Note that there are some explanatory texts on larger screens.

plurals
  1. POEmacs/elisp: global-set-key bindings not taking effect for Meta-<down> or -<up>?
    text
    copied!<p>I am trying to bind <code>M-&lt;up&gt;</code> and <code>M-&lt;down&gt;</code> to <code>scroll-down-line</code> and <code>scroll-up-line</code> respectively as indicated here: <a href="https://stackoverflow.com/a/16229080/562139">https://stackoverflow.com/a/16229080/562139</a>.</p> <p>This is what I have in my <code>.emacs</code>:</p> <pre><code>;; Key bindings (global-set-key (kbd "M-g") 'goto-line) ;; Scroll line by line (global-set-key (kbd "M-&lt;down&gt;") 'scroll-up-line) (global-set-key (kbd "M-&lt;up&gt;") 'scroll-down-line) </code></pre> <p><strong>Problem:</strong> The scroll key bindings are not taking effect, while the one for <code>goto-line</code> does.</p> <p>When I run <code>M-x scroll-down-line</code> however, emacs prompts me and says </p> <blockquote> <p>"you can run the command with &lt;M-down&gt;"</p> </blockquote> <p><strong>Note:</strong> When I run <code>global-set-key (kbd "M-&lt;down&gt;") 'scroll-up-line)</code> or <code>(global-set-key (kbd "M-&lt;up&gt;") 'scroll-down-line)</code> directly in the mini-buffer, the bindings take effect! However, I seem to have noticed through the corner of my eye when I do the latter, that pressing <code>M-&lt;up&gt;</code> actually sends something like <code>ESC ESC-&lt;up&gt;</code>.</p> <p>I'm foxed. What gives?</p> <p>Note: I am running emacs 24.3 in a terminal (via iTerm on OSX with Option key mapped to ESC+) over SSH to a RHEL5 virtual machine.)</p> <hr> <p><strong>Update</strong></p> <p>I followed the suggestion in <a href="https://stackoverflow.com/a/4351584/562139">this answer</a> and found that pressing M-&lt;up&gt; results in something completely different:</p> <pre><code>ESC &lt;up&gt; (translated from ESC M-[ A) runs the command scroll-down-line, which is an interactive compiled Lisp function. It is bound to &lt;M-up&gt;, ESC &lt;up&gt;. (scroll-down-line &amp;optional ARG) </code></pre> <p>I'm going to try binding that key sequence to the function and check the result.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload