* Re: key map entry for shift-return? [not found] <mailman.2050.1247045493.2239.help-gnu-emacs@gnu.org> @ 2009-07-09 12:34 ` Xah Lee 2009-07-09 13:51 ` Alan Mackenzie 0 siblings, 1 reply; 24+ messages in thread From: Xah Lee @ 2009-07-09 12:34 UTC (permalink / raw) To: help-gnu-emacs On Jul 8, 2:31 am, Chris Withers <ch...@simplistix.co.uk> wrote: > Hi All, > > What's the key map entry for shift-return? > (as in the one for just return is "\C-m") this is a weak point in emacs. For detail, see: • The Confusion of Emacs's Keystroke Representation http://xahlee.org/emacs/keystroke_rep.html several people have given you answer on how to represent shift-return. i wanted to add that, key combo like Shift Return is better avoided, because there's another complexity in emacs with the Enter/Return key, somewhat tied to Ctrl+m in complex ways. The upshot is that when trying to define keys with return, you migth run into all sort of problems or puzzles. Xah ∑ http://xahlee.org/ ☄ ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-09 12:34 ` key map entry for shift-return? Xah Lee @ 2009-07-09 13:51 ` Alan Mackenzie 2009-07-09 14:27 ` Miles Bader 0 siblings, 1 reply; 24+ messages in thread From: Alan Mackenzie @ 2009-07-09 13:51 UTC (permalink / raw) To: help-gnu-emacs Hi, Xah! In gnu.emacs.help Xah Lee <xahlee@gmail.com> wrote: > On Jul 8, 2:31?am, Chris Withers <ch...@simplistix.co.uk> wrote: >> Hi All, >> What's the key map entry for shift-return? >> (as in the one for just return is "\C-m") > this is a weak point in emacs. For detail, see: > ? The Confusion of Emacs's Keystroke Representation > http://xahlee.org/emacs/keystroke_rep.html > several people have given you answer on how to represent shift-return. > i wanted to add that, key combo like Shift Return is better avoided, > because there's another complexity in emacs with the Enter/Return key, > somewhat tied to Ctrl+m in complex ways. The upshot is that when > trying to define keys with return, you might run into all sort of > problems or puzzles. Hey, stop being so enigmatic! I think the OP only wants Shift Return for his own use, which should be OK. So please tell him (and me) what this other complexity is. Thanks! > Xah -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-09 13:51 ` Alan Mackenzie @ 2009-07-09 14:27 ` Miles Bader 2009-07-09 16:01 ` Xah Lee 0 siblings, 1 reply; 24+ messages in thread From: Miles Bader @ 2009-07-09 14:27 UTC (permalink / raw) To: help-gnu-emacs Alan Mackenzie <acm@muc.de> writes: > Hey, stop being so enigmatic! I think the OP only wants Shift Return > for his own use, which should be OK. So please tell him (and me) what > this other complexity is. He's just looking for an excuse to flog his screeds... -Miles -- Bore, n. A person who talks when you wish him to listen. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-09 14:27 ` Miles Bader @ 2009-07-09 16:01 ` Xah Lee 2009-07-09 17:21 ` despen 0 siblings, 1 reply; 24+ messages in thread From: Xah Lee @ 2009-07-09 16:01 UTC (permalink / raw) To: help-gnu-emacs On Jul 9, 7:27 am, Miles Bader <mi...@gnu.org> wrote: > Alan Mackenzie <a...@muc.de> writes: > > Hey, stop being so enigmatic! I think the OP only wants Shift Return > > for his own use, which should be OK. So please tell him (and me) what > > this other complexity is. > > He's just looking for an excuse to flog his screeds... Thanks Miles. ^_^ Well, perhaps just a sentence or two to answer Alan. Basically, for good or bad, emacs does not capture the key by itself, but goes thru ascii representation in its implementation... my phrasing here is not exactl but don't want to spend too much time writing this. Basically, the end result is that when people want to map keys like Tab, Return, or with modifiers, it has many complexities. Many threads asked or discussed these in the past year or two here.... another example comes to mind is that emacs is unable to capture Ctrl+Shift+key combos in terminal. Perhaps historically justifiable... but today's apps that goes thru network don't have this limitation... Xah ∑ http://xahlee.org/ ☄ ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-09 16:01 ` Xah Lee @ 2009-07-09 17:21 ` despen 2009-07-09 17:56 ` Xah Lee 2009-07-09 18:02 ` Alan Mackenzie 0 siblings, 2 replies; 24+ messages in thread From: despen @ 2009-07-09 17:21 UTC (permalink / raw) To: help-gnu-emacs Xah Lee <xahlee@gmail.com> writes: > On Jul 9, 7:27 am, Miles Bader <mi...@gnu.org> wrote: >> Alan Mackenzie <a...@muc.de> writes: >> > Hey, stop being so enigmatic! I think the OP only wants Shift Return >> > for his own use, which should be OK. So please tell him (and me) what >> > this other complexity is. >> >> He's just looking for an excuse to flog his screeds... > > Well, perhaps just a sentence or two to answer Alan. > > Basically, for good or bad, emacs does not capture the key by itself, > but goes thru ascii representation in its implementation... my > phrasing here is not exactl but don't want to spend too much time > writing this. Basically, the end result is that when people want to > map keys like Tab, Return, or with modifiers, it has many > complexities. Many threads asked or discussed these in the past year > or two here.... another example comes to mind is that emacs is unable > to capture Ctrl+Shift+key combos in terminal. Perhaps historically > justifiable... but today's apps that goes thru network don't have this > limitation... I'm not sure what this is all about, I never saw the original post. But binding something to shift return doesn't seem to be a big problem. Try evaling this: (define-key global-map [(S-return)] 'compile) It works for me. I don't expect it would work in a TTY, but that's an issue with the TTY not emacs. For some TTY programs even that can be fixed. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-09 17:21 ` despen @ 2009-07-09 17:56 ` Xah Lee 2009-07-09 20:48 ` despen 2009-07-09 18:02 ` Alan Mackenzie 1 sibling, 1 reply; 24+ messages in thread From: Xah Lee @ 2009-07-09 17:56 UTC (permalink / raw) To: help-gnu-emacs On Jul 9, 10:21 am, des...@verizon.net wrote: > Xah Lee <xah...@gmail.com> writes: > > On Jul 9, 7:27 am, Miles Bader <mi...@gnu.org> wrote: > >> Alan Mackenzie <a...@muc.de> writes: > >> > Hey, stop being so enigmatic! I think the OP only wants Shift Return > >> > for his own use, which should be OK. So please tell him (and me) what > >> > this other complexity is. > > >> He's just looking for an excuse to flog his screeds... > > > Well, perhaps just a sentence or two to answer Alan. > > > Basically, for good or bad, emacs does not capture the key by itself, > > but goes thru ascii representation in its implementation... my > > phrasing here is not exactl but don't want to spend too much time > > writing this. Basically, the end result is that when people want to > > map keys like Tab, Return, or with modifiers, it has many > > complexities. Many threads asked or discussed these in the past year > > or two here.... another example comes to mind is that emacs is unable > > to capture Ctrl+Shift+key combos in terminal. Perhaps historically > > justifiable... but today's apps that goes thru network don't have this > > limitation... > > I'm not sure what this is all about, I never saw the original post. > But binding something to shift return doesn't seem to be a big problem. > Try evaling this: > > (define-key global-map [(S-return)] 'compile) > > It works for me. > > I don't expect it would work in a TTY, but that's an issue with the TTY > not emacs. For some TTY programs even that can be fixed. Yes. That touches the point. here's a example to illustarte what i was saying: Try: (define-key global-map (kbd "RET") 'forward-word) now press Ctrl+m, you see that it also does forward-word. To a emacs geek, perhaps this is natural, however, to any average programer or logically, pressing Return key certainly is not the same as pressing Ctrl+m. This is what i was saying about keybindings involving Return, Tab (and few others) has some rather unexpected complexities in emacs, and, i was saying, these complexities has to do with how emacs implemented the key capture, and i was saying that in modern apps, usually they don't have this problem. emacs being a old app, is what it is. I'm trying to communicate a few facts here as mentioned by this thread. This emacs issue, certainly is not optimal. I don't know if it is worthy a fix. But i feel it should be known. Xah ∑ http://xahlee.org/ ☄ ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-09 17:56 ` Xah Lee @ 2009-07-09 20:48 ` despen 0 siblings, 0 replies; 24+ messages in thread From: despen @ 2009-07-09 20:48 UTC (permalink / raw) To: help-gnu-emacs Xah Lee <xahlee@gmail.com> writes: > On Jul 9, 10:21 am, des...@verizon.net wrote: >> Xah Lee <xah...@gmail.com> writes: >> > On Jul 9, 7:27 am, Miles Bader <mi...@gnu.org> wrote: >> >> Alan Mackenzie <a...@muc.de> writes: >> >> > Hey, stop being so enigmatic! I think the OP only wants Shift Return >> >> > for his own use, which should be OK. So please tell him (and me) what >> >> > this other complexity is. >> >> >> He's just looking for an excuse to flog his screeds... >> >> > Well, perhaps just a sentence or two to answer Alan. >> >> > Basically, for good or bad, emacs does not capture the key by itself, >> > but goes thru ascii representation in its implementation... my >> > phrasing here is not exactl but don't want to spend too much time >> > writing this. Basically, the end result is that when people want to >> > map keys like Tab, Return, or with modifiers, it has many >> > complexities. Many threads asked or discussed these in the past year >> > or two here.... another example comes to mind is that emacs is unable >> > to capture Ctrl+Shift+key combos in terminal. Perhaps historically >> > justifiable... but today's apps that goes thru network don't have this >> > limitation... >> >> I'm not sure what this is all about, I never saw the original post. >> But binding something to shift return doesn't seem to be a big problem. >> Try evaling this: >> >> (define-key global-map [(S-return)] 'compile) >> >> It works for me. >> >> I don't expect it would work in a TTY, but that's an issue with the TTY >> not emacs. For some TTY programs even that can be fixed. > > Yes. That touches the point. > > here's a example to illustarte what i was saying: > > Try: > (define-key global-map (kbd "RET") 'forward-word) I can't find anywhere in the documentation where emacs recommends using KBD to define keys: http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html#Init-Rebinding "When the key sequence includes function keys or mouse button events, or non-ASCII characters such as C-= or H-a, you must use the more general method of rebinding, which uses a vector to specify the key sequence. The way to write a vector in Emacs Lisp is with square brackets around the vector elements." Which is exactly what I did. I typed C-h k Shift Return and emacs told me I typed "S-return". The process seemed to work perfectly. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-09 17:21 ` despen 2009-07-09 17:56 ` Xah Lee @ 2009-07-09 18:02 ` Alan Mackenzie 2009-07-09 21:19 ` Peter Dyballa [not found] ` <mailman.2177.1247174372.2239.help-gnu-emacs@gnu.org> 1 sibling, 2 replies; 24+ messages in thread From: Alan Mackenzie @ 2009-07-09 18:02 UTC (permalink / raw) To: help-gnu-emacs Hi, Despen! In gnu.emacs.help despen@verizon.net wrote: > Xah Lee <xahlee@gmail.com> writes: >> On Jul 9, 7:27 am, Miles Bader <mi...@gnu.org> wrote: >>> Alan Mackenzie <a...@muc.de> writes: >>> > Hey, stop being so enigmatic! I think the OP only wants Shift Return >>> > for his own use, which should be OK. So please tell him (and me) what >>> > this other complexity is. >> Well, perhaps just a sentence or two to answer Alan. >> Basically, for good or bad, emacs does not capture the key by itself, >> but goes thru ascii representation in its implementation... It's not quite as simple as that, actually. ;-) >> my phrasing here is not exact but don't want to spend too much time >> writing this. Basically, the end result is that when people want to >> map keys like Tab, Return, or with modifiers, it has many >> complexities. Thanks for being so exact about this, Xah! ;-) >> Many threads asked or discussed these in the past year >> or two here.... another example comes to mind is that emacs is unable >> to capture Ctrl+Shift+key combos in terminal. It is on my terminal, a Linux tty with a suitable keyboard layout. I just wish the Linux guys would have the courage to make standard keyboard layouts with unique codes for every modified key combination. >> Perhaps historically justifiable... but today's apps that goes thru >> network don't have this limitation... > I'm not sure what this is all about, I never saw the original post. > But binding something to shift return doesn't seem to be a big problem. > Try evaling this: > (define-key global-map [(S-return)] 'compile) > It works for me. :-) Then feel free to use it. > I don't expect it would work in a TTY, but that's an issue with the TTY > not emacs. For some TTY programs even that can be fixed. It can be fixed for Emacs running on a tty, as indeed I have fixed mine. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-09 18:02 ` Alan Mackenzie @ 2009-07-09 21:19 ` Peter Dyballa [not found] ` <mailman.2177.1247174372.2239.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 24+ messages in thread From: Peter Dyballa @ 2009-07-09 21:19 UTC (permalink / raw) To: Alan Mackenzie; +Cc: help-gnu-emacs Am 09.07.2009 um 20:02 schrieb Alan Mackenzie: > It can be fixed for Emacs running on a tty, as indeed I have fixed > mine. Is this fix *very* specific? If it can be used in many terminal emulations on many operating systems by many users, then it's really worth to become part of GNU Emacs – or is it 'just' X resources? Then it's worth to become part of the documentation. -- Greetings Pete A blizzard is when it snows sideways. ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2177.1247174372.2239.help-gnu-emacs@gnu.org>]
* Re: key map entry for shift-return? [not found] ` <mailman.2177.1247174372.2239.help-gnu-emacs@gnu.org> @ 2009-07-09 22:14 ` Alan Mackenzie 2009-07-10 1:24 ` Miles Bader 0 siblings, 1 reply; 24+ messages in thread From: Alan Mackenzie @ 2009-07-09 22:14 UTC (permalink / raw) To: help-gnu-emacs Peter Dyballa <Peter_Dyballa@web.de> wrote: > Am 09.07.2009 um 20:02 schrieb Alan Mackenzie: >> It can be fixed for Emacs running on a tty, as indeed I have fixed >> mine. > Is this fix *very* specific? If it can be used in many terminal > emulations on many operating systems by many users, then it's really > worth to become part of GNU Emacs ? or is it 'just' X resources? Then > it's worth to become part of the documentation. The fix is specific to Linux virtual terminals, the things that use `loadkeys' and friends to setup the keyboard, and to which you get by pressing, e.g. C-A-<f1> from X-Windows. I don't know if it would work without modification in an X-Windows terminal window. The fix arranges for modifier keys to apply prefixes, so that where <right> is normally "ESC [ C", C-<right> becomes "ESC [ 1 } ESC [ C" and C-S-<right> would be "ESC [ 5 } ESC [ C". Additionally, there's some stuff in the function key map to handle the prefices. It works flawlessly. The guy who wrote it, Kalle Niemitalo, doesn't much like GPL-3, and doesn't want to assign it to the FSF, so it can't become part of Emacs. I keep meaning to put it up on the Emacs Wiki, though. > Pete -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-09 22:14 ` Alan Mackenzie @ 2009-07-10 1:24 ` Miles Bader 2009-07-10 8:01 ` Alan Mackenzie 0 siblings, 1 reply; 24+ messages in thread From: Miles Bader @ 2009-07-10 1:24 UTC (permalink / raw) To: help-gnu-emacs Alan Mackenzie <acm@muc.de> writes: > The guy who wrote it, Kalle Niemitalo, doesn't much like GPL-3, and > doesn't want to assign it to the FSF, so it can't become part of Emacs. Sounds worth rewriting to get around the ass-hattery... -Miles -- Cabbage, n. A familiar kitchen-garden vegetable about as large and wise as a man's head. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-10 1:24 ` Miles Bader @ 2009-07-10 8:01 ` Alan Mackenzie 2009-07-10 10:14 ` Miles Bader 0 siblings, 1 reply; 24+ messages in thread From: Alan Mackenzie @ 2009-07-10 8:01 UTC (permalink / raw) To: help-gnu-emacs Hi, Miles! Miles Bader <miles@gnu.org> wrote: > Alan Mackenzie <acm@muc.de> writes: >> The guy who wrote it, Kalle Niemitalo, doesn't much like GPL-3, and >> doesn't want to assign it to the FSF, so it can't become part of Emacs. > Sounds worth rewriting to get around the ass-hattery... The what? It sounds somewhat derogatory, whatever it means. I really can't bring myself to disparage Kalle, who supplied me what I needed at a time (over a decade ago) when I could barely even formulate the problem, never mind solve it. Dislike of the GPLs and aversion to assigning copyright to the FSF aren't exactly uncommon, though I personally disagree with these stances. Rewriting it would indeed be worth it, though I think I'd have to leave it to other people since I know KN's code too well. People ask about "control arrow keys on a tty" quite a lot. There's one problem in Emacs at the moment: the function `event-apply-modifier' strips out the upper-caseity from C-S-<letter>. I don't know why it does this, but my own personal fix hasn't caused me any problems: (defun acm-event-apply-modifier (event symbol lshiftby prefix) "Apply a modifier flag to event EVENT. Unlike the core Emacs function `event-apply-modifier', when both <control> and <shift> are modifying a\(n English\) letter in an event, b25 is set (for shift), and the LSB contains C-<letter>. SYMBOL is the name of this modifier, as a symbol. LSHIFTBY is the bit position of the modifier bit; e.g. 25 means 0x2000000. PREFIX is the string that represents this modifier in an event type symbol." (if (numberp event) (let ((letter (logand event 4194303))) ; 2^22 - 1 (if (eq symbol 'control) (cond ((and (>= letter ?A) (<= letter ?Z)) (- (logior (lsh 1 25) event) ?A -1)) ; add <shift> ((and (>= letter ?a) (<= letter ?z)) (- event ?a -1)) ((and (>= letter ?\C-a) (<= letter ?\C-z) (not (memq letter '(?\C-i ?\C-m))))) ; Can by typed without <ctrl> (t (logior (lsh 1 lshiftby) event))) (logior (lsh 1 lshiftby) event))) (if (memq symbol (event-modifiers event)) event (let ((event-type (if (symbolp event) event (car event)))) (setq event-type (intern (concat prefix (symbol-name event-type)))) (if (symbolp event) event-type (cons event-type (cdr event))))))) > -Miles -- Alan Mackenzie (Nuernberg). ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-10 8:01 ` Alan Mackenzie @ 2009-07-10 10:14 ` Miles Bader 2009-07-10 12:45 ` Alan Mackenzie 0 siblings, 1 reply; 24+ messages in thread From: Miles Bader @ 2009-07-10 10:14 UTC (permalink / raw) To: help-gnu-emacs Alan Mackenzie <acm@muc.de> writes: > There's one problem in Emacs at the moment: the function > `event-apply-modifier' strips out the upper-caseity from C-S-<letter>. > I don't know why it does this, but my own personal fix hasn't caused > me any problems: Hmm, maybe resend your function to emacs-devel? -Miles -- Bacchus, n. A convenient deity invented by the ancients as an excuse for getting drunk. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-10 10:14 ` Miles Bader @ 2009-07-10 12:45 ` Alan Mackenzie 0 siblings, 0 replies; 24+ messages in thread From: Alan Mackenzie @ 2009-07-10 12:45 UTC (permalink / raw) To: help-gnu-emacs Miles Bader <miles@gnu.org> wrote: > Alan Mackenzie <acm@muc.de> writes: >> There's one problem in Emacs at the moment: the function >> `event-apply-modifier' strips out the upper-caseity from C-S-<letter>. >> I don't know why it does this, but my own personal fix hasn't caused >> me any problems: > Hmm, maybe resend your function to emacs-devel? I did, actually, some time ago in a rather obscure thread: Subject: Re: Shift on console Date: Mon, 17 Mar 2008 23:31:05 +0000 Message-ID: <20080317233104.GA1824@muc.de> , but it didn't attract any interest. Until there're keyboards which distinguish C-S-a from C-a, and infrastructure to support them, there's not much to be gained by committing it. I use C-M-S-a to go to the start of the next defun, since I got tired of typing in M-- C-M-a all the time. > -Miles -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 24+ messages in thread
* key map entry for shift-return? @ 2009-07-08 9:31 Chris Withers 2009-07-08 9:51 ` Peter Dyballa 0 siblings, 1 reply; 24+ messages in thread From: Chris Withers @ 2009-07-08 9:31 UTC (permalink / raw) To: help-gnu-emacs Hi All, What's the key map entry for shift-return? (as in the one for just return is "\C-m") cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-08 9:31 Chris Withers @ 2009-07-08 9:51 ` Peter Dyballa 2009-07-08 9:53 ` Chris Withers [not found] ` <mailman.2052.1247046795.2239.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 24+ messages in thread From: Peter Dyballa @ 2009-07-08 9:51 UTC (permalink / raw) To: Chris Withers; +Cc: help-gnu-emacs Am 08.07.2009 um 11:31 schrieb Chris Withers: > What's the key map entry for shift-return? What is C-h k s-RET returning? Is your system able to distinguish between RET and s-RET? -- Greetings Pete A morning without coffee is like something without something else. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-08 9:51 ` Peter Dyballa @ 2009-07-08 9:53 ` Chris Withers 2009-07-08 11:08 ` Peter Dyballa [not found] ` <mailman.2052.1247046795.2239.help-gnu-emacs@gnu.org> 1 sibling, 1 reply; 24+ messages in thread From: Chris Withers @ 2009-07-08 9:53 UTC (permalink / raw) To: Peter Dyballa; +Cc: help-gnu-emacs Peter Dyballa wrote: > > Am 08.07.2009 um 11:31 schrieb Chris Withers: > >> What's the key map entry for shift-return? > > What is C-h k s-RET returning? """ RET (translated from <S-return>) runs the command newline-and-indent, which is an interactive compiled Lisp function in `simple.el'. It is bound to RET, C-j. """ > Is your system able to distinguish > between RET and s-RET? How can I tell? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-08 9:53 ` Chris Withers @ 2009-07-08 11:08 ` Peter Dyballa 2009-07-08 11:51 ` Chris Withers [not found] ` <mailman.2060.1247053882.2239.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 24+ messages in thread From: Peter Dyballa @ 2009-07-08 11:08 UTC (permalink / raw) To: Chris Withers; +Cc: help-gnu-emacs On 08.07.2009, at 11:53, Chris Withers wrote: >> Is your system able to distinguish between RET and s-RET? > > How can I tell? By interpreting the output! C-h k says translated, so it is able to distinguish in this environment. And it also tells you one possible syntax form: S- return. You can also try to interactively bind the key and then by executing C-x ESC ESC (repeat-complex-command) you can review what was executed. So you can use: (global-set-key [S-return] 'some-function) -- Greetings Pete Rain is saved up in cloud banks. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-08 11:08 ` Peter Dyballa @ 2009-07-08 11:51 ` Chris Withers 2009-07-08 12:42 ` Peter Dyballa [not found] ` <mailman.2060.1247053882.2239.help-gnu-emacs@gnu.org> 1 sibling, 1 reply; 24+ messages in thread From: Chris Withers @ 2009-07-08 11:51 UTC (permalink / raw) To: Peter Dyballa; +Cc: help-gnu-emacs Peter Dyballa wrote: > > C-h k says translated, so it is able to distinguish in this environment. > And it also tells you one possible syntax form: S-return. You can also > try to interactively bind the key and then by executing C-x ESC ESC > (repeat-complex-command) you can review what was executed. > > So you can use: > > (global-set-key [S-return] 'some-function) Well, I now have the following in my .emacs: (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "\C-m" 'newline-and-indent))) (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map "S-return" 'newline))) The first one works, the second one doesn't. What did I do wrong? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-08 11:51 ` Chris Withers @ 2009-07-08 12:42 ` Peter Dyballa 2009-07-08 13:39 ` Chris Withers 0 siblings, 1 reply; 24+ messages in thread From: Peter Dyballa @ 2009-07-08 12:42 UTC (permalink / raw) To: Chris Withers; +Cc: help-gnu-emacs Am 08.07.2009 um 13:51 schrieb Chris Withers: > (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map > "\C-m" 'newline-and-indent))) > > (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map > "S-return" 'newline))) > > The first one works, the second one doesn't. What did I do wrong? I think the syntax needs to use the vector form in this case: (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map [S-return] 'newline))) -- Greetings Pete (: _ / __ - - _/ \__/_/ - - (´`) (´`) - - `´ `´ ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-08 12:42 ` Peter Dyballa @ 2009-07-08 13:39 ` Chris Withers 2009-07-08 14:49 ` Peter Dyballa 0 siblings, 1 reply; 24+ messages in thread From: Chris Withers @ 2009-07-08 13:39 UTC (permalink / raw) To: Peter Dyballa; +Cc: help-gnu-emacs Peter Dyballa wrote: > >> (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map >> "S-return" 'newline))) >> >> The first one works, the second one doesn't. What did I do wrong? > > I think the syntax needs to use the vector form in this case: > > (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map > [S-return] 'newline))) Excellent, that was it, thanks. Chris - can you guess I don't speak lisp? ;-) -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: key map entry for shift-return? 2009-07-08 13:39 ` Chris Withers @ 2009-07-08 14:49 ` Peter Dyballa 0 siblings, 0 replies; 24+ messages in thread From: Peter Dyballa @ 2009-07-08 14:49 UTC (permalink / raw) To: Chris Withers; +Cc: help-gnu-emacs Am 08.07.2009 um 15:39 schrieb Chris Withers: > Chris - can you guess I don't speak lisp? ;-) Me too. I learn from copying and have of practical things a good idea and experience… -- Greetings Pete Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we. – Georges W. Bush ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2060.1247053882.2239.help-gnu-emacs@gnu.org>]
* Re: key map entry for shift-return? [not found] ` <mailman.2060.1247053882.2239.help-gnu-emacs@gnu.org> @ 2009-07-08 12:17 ` Teemu Likonen 0 siblings, 0 replies; 24+ messages in thread From: Teemu Likonen @ 2009-07-08 12:17 UTC (permalink / raw) To: help-gnu-emacs On 2009-07-08 12:51 (+0100), Chris Withers wrote: > Peter Dyballa wrote: >> So you can use: >> >> (global-set-key [S-return] 'some-function) > > Well, I now have the following in my .emacs: > > (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map > "\C-m" 'newline-and-indent))) > > (add-hook 'python-mode-hook '(lambda () (define-key python-mode-map > "S-return" 'newline))) That's not good practice. You should write your python-mode settings to a single hook function and add function's "name" to the python-mode-hook. For example, put these lines in your .emacs file: (add-hook 'python-mode-hook 'my-python-mode-hook) (defun my-python-mode-hook () (define-key python-mode-map "\C-m" 'newline-and-indent) (define-key python-mode-map [S-return] 'newline)) Now if you need to change the settings you can just edit the function and evaluate it with C-M-x. (Note that python-mode-hook is a variable which may contain your previous hook experiments "(lambda ...)" if you haven't restarted your Emacs session. You should set the variable to nil before evaluating the above code or you can just restart Emacs.) > The first one works, the second one doesn't. What did I do wrong? Note that I used [S-return], not "S-return". See Peter's message once again. ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <mailman.2052.1247046795.2239.help-gnu-emacs@gnu.org>]
* Re: key map entry for shift-return? [not found] ` <mailman.2052.1247046795.2239.help-gnu-emacs@gnu.org> @ 2009-07-09 7:28 ` Alan Mackenzie 0 siblings, 0 replies; 24+ messages in thread From: Alan Mackenzie @ 2009-07-09 7:28 UTC (permalink / raw) To: help-gnu-emacs Chris Withers <chris@simplistix.co.uk> wrote: > Peter Dyballa wrote: >> Am 08.07.2009 um 11:31 schrieb Chris Withers: >>> What's the key map entry for shift-return? >> What is C-h k s-RET returning? > """ > RET (translated from <S-return>) runs the command newline-and-indent, > which is an interactive compiled Lisp function in `simple.el'. > It is bound to RET, C-j. > """ >> Is your system able to distinguish >> between RET and s-RET? > How can I tell? Type the two key sequences, then do C-h l (`view-lossage'). Visually separate them in the display buffer (not always easy), and are they the same? > cheers, > Chris -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2009-07-10 12:45 UTC | newest] Thread overview: 24+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <mailman.2050.1247045493.2239.help-gnu-emacs@gnu.org> 2009-07-09 12:34 ` key map entry for shift-return? Xah Lee 2009-07-09 13:51 ` Alan Mackenzie 2009-07-09 14:27 ` Miles Bader 2009-07-09 16:01 ` Xah Lee 2009-07-09 17:21 ` despen 2009-07-09 17:56 ` Xah Lee 2009-07-09 20:48 ` despen 2009-07-09 18:02 ` Alan Mackenzie 2009-07-09 21:19 ` Peter Dyballa [not found] ` <mailman.2177.1247174372.2239.help-gnu-emacs@gnu.org> 2009-07-09 22:14 ` Alan Mackenzie 2009-07-10 1:24 ` Miles Bader 2009-07-10 8:01 ` Alan Mackenzie 2009-07-10 10:14 ` Miles Bader 2009-07-10 12:45 ` Alan Mackenzie 2009-07-08 9:31 Chris Withers 2009-07-08 9:51 ` Peter Dyballa 2009-07-08 9:53 ` Chris Withers 2009-07-08 11:08 ` Peter Dyballa 2009-07-08 11:51 ` Chris Withers 2009-07-08 12:42 ` Peter Dyballa 2009-07-08 13:39 ` Chris Withers 2009-07-08 14:49 ` Peter Dyballa [not found] ` <mailman.2060.1247053882.2239.help-gnu-emacs@gnu.org> 2009-07-08 12:17 ` Teemu Likonen [not found] ` <mailman.2052.1247046795.2239.help-gnu-emacs@gnu.org> 2009-07-09 7:28 ` Alan Mackenzie
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).