* Using punctuation in abbrev @ 2013-06-01 17:41 Aurélien Aptel 2013-06-01 18:42 ` Drew Adams 2013-06-02 14:24 ` Stefan Monnier 0 siblings, 2 replies; 25+ messages in thread From: Aurélien Aptel @ 2013-06-01 17:41 UTC (permalink / raw) To: help-gnu-emacs Hi, I want to substitute $-> with a unicode rightwards arrow (U+2192 →). Since abbrev defaults to backward-word to extract the word before point, I've used the :regexp property of an abbrev-table to define what to extract. From define-abbrev-table documentation: - `:regexp' is a regular expression that specifies how to extract the name of the abbrev before point. The submatch 1 is treated as the potential name of an abbrev. If :regexp is nil, the default behavior uses `backward-word' and `forward-word' to extract the name of the abbrev, which can therefore only be a single word. Here's what I put in my init file: (define-abbrev-table 'global-abbrev-table '( ("$->" "→") ("$=>" "⇒") ("$foo" "X") ) "custom abbrev table" :regexp (rx (or bos bol space) (group (+ (not space))))) (setq save-abbrevs nil) (setq-default abbrev-mode t) But only the $foo substitution works and I can't figure out why. The regex seems to be correct: (let ((rx (rx (or bos bol space) (group (+ (not space))))) (slist '(" $->" "\n$=>" " $foo"))) (mapcar (lambda (s) (string-match-p rx s)) slist)) => (0 0 0) ^ permalink raw reply [flat|nested] 25+ messages in thread
* RE: Using punctuation in abbrev 2013-06-01 17:41 Using punctuation in abbrev Aurélien Aptel @ 2013-06-01 18:42 ` Drew Adams 2013-06-01 22:49 ` Aurélien Aptel [not found] ` <mailman.841.1370126985.22516.help-gnu-emacs@gnu.org> 2013-06-02 14:24 ` Stefan Monnier 1 sibling, 2 replies; 25+ messages in thread From: Drew Adams @ 2013-06-01 18:42 UTC (permalink / raw) To: Aurélien Aptel, help-gnu-emacs > I want to substitute $-> with a unicode rightwards arrow (U+2192 →). 1. Does that mean that you want to type `$->' and use `expand-abbrev' each time to insert a Unicode right arrow? If so, and if you don't really care whether you use abbrev, consider binding insertion of a right arrow char to a key sequence instead. 2. On the other hand, if you already have lots of `$->' occurrences in your text and you want to change them to right arrows, consider using `query-replace' or `replace-string' instead. For #1, library ucs-cmds.el can help. http://www.emacswiki.org/emacs-en/download/ucs-cmds.el http://www.emacswiki.org/emacs/UnicodeEncoding Command `ucsc-insert' is a replacement for `insert-char'. You can remap the keys bound to `insert-char' to `uscs-insert', if you like: (define-key global-map [remap insert-char] 'ucsc-insert) Unless you give `ucsc-insert' a negative prefix arg it does the same thing as `insert-char'. With a negative prefix arg it creates a command that inserts the Unicode character you choose. You can provide the character by hex or by name (with completion). In this case, that means 2192 or "RIGHT ARROW". Create command `right-arrow', which inserts a right arrow char (U+2192): M-- M-x ucsc-insert 2192 RET Bind the command to a key (e.g., <f9>): (global-set-key [f9] 'right-arrow) You can use a numeric prefix arg to insert multiple right arrows: `M-8 <f9>' inserts eight right arrows. ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-01 18:42 ` Drew Adams @ 2013-06-01 22:49 ` Aurélien Aptel 2013-06-02 18:48 ` Drew Adams [not found] ` <mailman.841.1370126985.22516.help-gnu-emacs@gnu.org> 1 sibling, 1 reply; 25+ messages in thread From: Aurélien Aptel @ 2013-06-01 22:49 UTC (permalink / raw) To: Drew Adams; +Cc: help-gnu-emacs On Sat, Jun 1, 2013 at 8:42 PM, Drew Adams <drew.adams@oracle.com> wrote: >> I want to substitute $-> with a unicode rightwards arrow (U+2192 →). > > 1. Does that mean that you want to type `$->' and use `expand-abbrev' > each time to insert a Unicode right arrow? If so, and if you don't > really care whether you use abbrev, consider binding insertion of a > right arrow char to a key sequence instead. The abbrev minor mode is active in all my buffers and it doesn't have to be triggered by a specific key, it's automatically substituted as I type. I plan on having a lot of easy-to-remember abbreviations for unicode chars I regularly use, all prefixed by $ or some other less used character so that it only triggers when I want. Calling insert-char is too cumbersome and breaks the flow. The only thing that doesn't work is this word extraction regex... > 2. On the other hand, if you already have lots of `$->' occurrences in > your text and you want to change them to right arrows, consider using > `query-replace' or `replace-string' instead. That is not what I want. ^ permalink raw reply [flat|nested] 25+ messages in thread
* RE: Using punctuation in abbrev 2013-06-01 22:49 ` Aurélien Aptel @ 2013-06-02 18:48 ` Drew Adams 0 siblings, 0 replies; 25+ messages in thread From: Drew Adams @ 2013-06-02 18:48 UTC (permalink / raw) To: Aurélien Aptel; +Cc: help-gnu-emacs > >> I want to substitute $-> with a unicode rightwards arrow (U+2192 →). > > > > 1. Does that mean that you want to type `$->' and use `expand-abbrev' > > each time to insert a Unicode right arrow? If so, and if you don't > > really care whether you use abbrev, consider binding insertion of a > > right arrow char to a key sequence instead. > > The abbrev minor mode is active in all my buffers and it doesn't have > to be triggered by a specific key, it's automatically substituted as I > type. I plan on having a lot of easy-to-remember abbreviations for > unicode chars I regularly use, all prefixed by $ or some other less > used character so that it only triggers when I want. Calling > insert-char is too cumbersome and breaks the flow. You apparently really want to use abbrev here. OK. But to be clear, I did not suggest that you call `insert-char' each time. Not at all. I suggested that you bind a specific right-arrow inserting command to a key, and hit that key each time, instead of typing `$->' each time. IOW, in effect, add a Unicode right-arrow key to your keyboard. ^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.841.1370126985.22516.help-gnu-emacs@gnu.org>]
* Re: Using punctuation in abbrev [not found] ` <mailman.841.1370126985.22516.help-gnu-emacs@gnu.org> @ 2013-06-02 5:02 ` Emanuel Berg 2013-06-02 5:21 ` Emanuel Berg 1 sibling, 0 replies; 25+ messages in thread From: Emanuel Berg @ 2013-06-02 5:02 UTC (permalink / raw) To: help-gnu-emacs Aurélien Aptel <aurelien.aptel+emacs@gmail.com> writes: > I want to substitute $-> with a unicode rightwards arrow (U+2192 > →). I tried to do something similar, namely to replace "..." by "…", and "---" by "—", in HTML-mode. It didn't work, so I posted a question: http://unix.stackexchange.com/q/71101 The reply was, this has to do with abbrev following the Emacs definition of what is a word. Apparently, you can fiddle with that, which, for a local mode, perhaps is smart (in my case, the HTML mode), but I decided not to do it, because it might screw up my cursor movement finger habits, and I am very picky about those. -- Emanuel Berg - programmer (hire me! CV below) computer projects: http://user.it.uu.se/~embe8573 internet activity: http://home.student.uu.se/embe8573 ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev [not found] ` <mailman.841.1370126985.22516.help-gnu-emacs@gnu.org> 2013-06-02 5:02 ` Emanuel Berg @ 2013-06-02 5:21 ` Emanuel Berg 2013-06-02 17:17 ` Aurélien Aptel [not found] ` <mailman.880.1370193431.22516.help-gnu-emacs@gnu.org> 1 sibling, 2 replies; 25+ messages in thread From: Emanuel Berg @ 2013-06-02 5:21 UTC (permalink / raw) To: help-gnu-emacs Aurélien Aptel <aurelien.aptel+emacs@gmail.com> writes: > I plan on having a lot of easy-to-remember abbreviations for > unicode chars I regularly use, all prefixed by $ or some other > less used character ... Calling insert-char is too cumbersome > and breaks the flow. Just curious: what Unicode chars do you regularly use? Another thought: Pick a shortcut that is very "fast" (short, and without you having to move your hand), like M-; or C-o (it depends what is already wired into your hands, and what you already do useful stuff with - don't change that - but there are many shortcuts...). Then, write a defun that waits for a keystroke, then inserts the Unicode char depending on what was hit, So, say, M-; l is right arrow, M-; j is left arrow, M-; i is up arrow, etc. -- Emanuel Berg - programmer (hire me! CV below) computer projects: http://user.it.uu.se/~embe8573 internet activity: http://home.student.uu.se/embe8573 ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-02 5:21 ` Emanuel Berg @ 2013-06-02 17:17 ` Aurélien Aptel 2013-06-02 18:10 ` Jambunathan K ` (2 more replies) [not found] ` <mailman.880.1370193431.22516.help-gnu-emacs@gnu.org> 1 sibling, 3 replies; 25+ messages in thread From: Aurélien Aptel @ 2013-06-02 17:17 UTC (permalink / raw) To: Emanuel Berg; +Cc: help-gnu-emacs On Sun, Jun 2, 2013 at 7:21 AM, Emanuel Berg <embe8573@student.uu.se> wrote: > Just curious: what Unicode chars do you regularly use? mainly arrows, ×, ≠, ≈, ... > Another thought: Pick a shortcut that is very "fast" (short, and > without you having to move your hand), like M-; or C-o (it depends > what is already wired into your hands, and what you already do > useful stuff with - don't change that - but there are many > shortcuts...). > > Then, write a defun that waits for a keystroke, then inserts the > Unicode char depending on what was hit, So, say, M-; l is right > arrow, M-; j is left arrow, M-; i is up arrow, etc. That's not a bad alternative. I think I'll do this. ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-02 17:17 ` Aurélien Aptel @ 2013-06-02 18:10 ` Jambunathan K 2013-06-03 3:44 ` Yuri Khan [not found] ` <mailman.905.1370231076.22516.help-gnu-emacs@gnu.org> 2 siblings, 0 replies; 25+ messages in thread From: Jambunathan K @ 2013-06-02 18:10 UTC (permalink / raw) To: Aurélien Aptel; +Cc: help-gnu-emacs, Emanuel Berg Aurélien Aptel <aurelien.aptel+emacs@gmail.com> writes: > On Sun, Jun 2, 2013 at 7:21 AM, Emanuel Berg <embe8573@student.uu.se> wrote: >> Just curious: what Unicode chars do you regularly use? > > mainly arrows, ×, ≠, ≈, ... You can try this 1. C-x b *scratch* 2. M-x set-input-method RET TeX RET 3. C-\ (M-x toggle-input-method RET) 4. Type whatever in English 5. C-\ (M-x toggle-input-method RET) 6. \times \ne \approx 7. C-\ 8. Type whatever in English Step 6 should produce unicode chars for you. They are easier to remember. While in TeX input method, on a unicode "not equals" glyph if you do, C-u C-x = you will see this. Just focus on "to input" field to get the TeX encoding for that unicode character. ,---- | position: 64 of 64 (98%), column: 0 | character: ≠ (displayed as ≠) (codepoint 8800, #o21140, #x2260) | preferred charset: unicode (Unicode (ISO10646)) | code point in charset: 0x2260 | script: symbol | syntax: . which means: punctuation | category: .:Base, c:Chinese, h:Korean, j:Japanese | to input: type "\neq" or "\ne" with TeX input method ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | buffer code: #xE2 #x89 #xA0 | file code: #xE2 #x89 #xA0 (encoded by coding system utf-8) | display: by this font (glyph code) | xft:-unknown-DejaVu Sans Mono-normal-normal-normal-*-20-*-*-*-m-0-iso10646-1 (#x7F6) | | Character code properties: customize what to show | name: NOT EQUAL TO | general-category: Sm (Symbol, Math) | decomposition: (61 824) ('=' '̸') | | There are text properties here: | fontified t `---- ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-02 17:17 ` Aurélien Aptel 2013-06-02 18:10 ` Jambunathan K @ 2013-06-03 3:44 ` Yuri Khan [not found] ` <mailman.905.1370231076.22516.help-gnu-emacs@gnu.org> 2 siblings, 0 replies; 25+ messages in thread From: Yuri Khan @ 2013-06-03 3:44 UTC (permalink / raw) To: Aurélien Aptel; +Cc: help-gnu-emacs, Emanuel Berg On Mon, Jun 3, 2013 at 12:17 AM, Aurélien Aptel <aurelien.aptel+emacs@gmail.com> wrote: > On Sun, Jun 2, 2013 at 7:21 AM, Emanuel Berg <embe8573@student.uu.se> wrote: >> Just curious: what Unicode chars do you regularly use? > > mainly arrows, ×, ≠, ≈, ... This is an Emacs list and you are asking how to enter characters in Emacs, but I feel this is better solved at the system level (and I actually believe there is a system outside Emacs) so that you can enter these characters in other programs. * If you are running Emacs on X11, you can hack your XKB configuration to put frequently-needed characters on Level3 (which is an alternate shift state often configured to activate on right Alt or another modifier key of your choice). You might even find an existing symbols map that has characters you need. * On Windows, the equivalent is the MSKLC tool. * I believe there is an analogous tool on Mac, too. ^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.905.1370231076.22516.help-gnu-emacs@gnu.org>]
* Re: Using punctuation in abbrev [not found] ` <mailman.905.1370231076.22516.help-gnu-emacs@gnu.org> @ 2013-06-03 18:05 ` Emanuel Berg 2013-06-04 3:05 ` Yuri Khan ` (3 more replies) 0 siblings, 4 replies; 25+ messages in thread From: Emanuel Berg @ 2013-06-03 18:05 UTC (permalink / raw) To: help-gnu-emacs Yuri Khan <yuri.v.khan@gmail.com> writes: > * If you are running Emacs on X11, you can hack your XKB > configuration to put frequently-needed characters on Level3 > (which is an alternate shift state often configured to activate > on right Alt or another modifier key of your choice). You might > even find an existing symbols map that has characters you need. If you run Emacs in a Linux VT, you can do approximately the same with loadkeys (read the part on strings in the man page). However, I don't see why this should be done outside Emacs, if Emacs is the place, where the OP wants to use it? By the way - you have a cool name :) -- Emanuel Berg - programmer (hire me! CV below) computer projects: http://user.it.uu.se/~embe8573 internet activity: http://home.student.uu.se/embe8573 ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-03 18:05 ` Emanuel Berg @ 2013-06-04 3:05 ` Yuri Khan 2013-06-04 9:14 ` Aurélien Aptel [not found] ` <mailman.968.1370315124.22516.help-gnu-emacs@gnu.org> ` (2 subsequent siblings) 3 siblings, 1 reply; 25+ messages in thread From: Yuri Khan @ 2013-06-04 3:05 UTC (permalink / raw) To: Emanuel Berg; +Cc: help-gnu-emacs On Tue, Jun 4, 2013 at 1:05 AM, Emanuel Berg <embe8573@student.uu.se> wrote: >> * If you are running Emacs on X11, you can hack your XKB >> configuration […] > > […]I don't see why this should be done outside Emacs, if > Emacs is the place, where the OP wants to use it? Because if I were OP I would want to have access to special characters all over the system, not just Emacs. ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-04 3:05 ` Yuri Khan @ 2013-06-04 9:14 ` Aurélien Aptel 0 siblings, 0 replies; 25+ messages in thread From: Aurélien Aptel @ 2013-06-04 9:14 UTC (permalink / raw) To: Yuri Khan; +Cc: help-gnu-emacs, Emanuel Berg On Tue, Jun 4, 2013 at 5:05 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote: > Because if I were OP I would want to have access to special characters > all over the system, not just Emacs. > It's a good idea but x, => or -> is more natural and easier to remember for me. ^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.968.1370315124.22516.help-gnu-emacs@gnu.org>]
* Re: Using punctuation in abbrev [not found] ` <mailman.968.1370315124.22516.help-gnu-emacs@gnu.org> @ 2013-06-04 17:27 ` Emanuel Berg 2013-06-05 6:59 ` Yuri Khan [not found] ` <mailman.1022.1370415567.22516.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 25+ messages in thread From: Emanuel Berg @ 2013-06-04 17:27 UTC (permalink / raw) To: help-gnu-emacs Yuri Khan <yuri.v.khan@gmail.com> writes: >>> * If you are running Emacs on X11, you can hack your XKB >>> configuration […] >> >> ... I don't see why this should be done outside Emacs, if Emacs >> is the place, where the OP wants to use it? > > Because if I were OP I would want to have access to special > characters all over the system, not just Emacs. Why? There is no reason to do programming and/or tech writing outside Emacs, if Emacs is the place you normally do it. Also, Emacs - with Elisp - gives you the tools to setup the execution of such tasks. The shell CLI should be used for the batch tools - sed, units, those things - all typing, and editing, should be done in the editor. -- Emanuel Berg - programmer (hire me! CV below) computer projects: http://user.it.uu.se/~embe8573 internet activity: http://home.student.uu.se/embe8573 ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-04 17:27 ` Emanuel Berg @ 2013-06-05 6:59 ` Yuri Khan [not found] ` <mailman.1022.1370415567.22516.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 25+ messages in thread From: Yuri Khan @ 2013-06-05 6:59 UTC (permalink / raw) To: Emanuel Berg; +Cc: help-gnu-emacs On Wed, Jun 5, 2013 at 12:27 AM, Emanuel Berg <embe8573@student.uu.se> wrote: > Yuri Khan <yuri.v.khan@gmail.com> writes: >> Because if I were OP I would want to have access to special >> characters all over the system, not just Emacs. > > Why? There is no reason to do programming and/or tech writing > outside Emacs, if Emacs is the place you normally do it. Also, > Emacs - with Elisp - gives you the tools to setup the execution of > such tasks. Because such things may need to be discussed with other people, and this involves an email client, a web browser, an instant messenger, or any combination of the above. Yes, I’m aware Emacs has solutions for each of those, and no, I do not want to give up Firefox, Thunderbird and Gajim. That’s what I meant when I said I believe in an operating system/environment outside Emacs. ^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.1022.1370415567.22516.help-gnu-emacs@gnu.org>]
* Re: Using punctuation in abbrev [not found] ` <mailman.1022.1370415567.22516.help-gnu-emacs@gnu.org> @ 2013-06-05 21:12 ` Emanuel Berg 0 siblings, 0 replies; 25+ messages in thread From: Emanuel Berg @ 2013-06-05 21:12 UTC (permalink / raw) To: help-gnu-emacs Yuri Khan <yuri.v.khan@gmail.com> writes: >>> Because if I were OP I would want to have access to special >>> characters all over the system, not just Emacs. >> >> Why? There is no reason to do programming and/or tech writing >> outside Emacs, if Emacs is the place you normally do it. Also, >> Emacs - with Elisp - gives you the tools to setup the execution >> of such tasks. > > Because such things may need to be discussed with other people, > and this involves an email client, a web browser, an instant > messenger, or any combination of the above. Yes, I’m aware Emacs > has solutions for each of those, and no, I do not want to give > up Firefox, Thunderbird and Gajim. That’s what I meant when I > said I believe in an operating system/environment outside Emacs. Well, if you use all those applications, a lot of things will be different in a lot of ways. If you have no problem with that, you might say that input is unique in the sense that with everything else not so, at least input should be consistent, always and everywhere. In that sense, I agree. -- Emanuel Berg - programmer (hire me! CV below) computer projects: http://user.it.uu.se/~embe8573 internet activity: http://home.student.uu.se/embe8573 ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-03 18:05 ` Emanuel Berg 2013-06-04 3:05 ` Yuri Khan [not found] ` <mailman.968.1370315124.22516.help-gnu-emacs@gnu.org> @ 2013-06-04 21:39 ` Stefan Monnier [not found] ` <mailman.1002.1370382007.22516.help-gnu-emacs@gnu.org> 3 siblings, 0 replies; 25+ messages in thread From: Stefan Monnier @ 2013-06-04 21:39 UTC (permalink / raw) To: help-gnu-emacs > However, I don't see why this should be done outside Emacs, if > Emacs is the place, where the OP wants to use it? To each his own, but FWIW, I do prefer input methods that work everywhere. For this reason I don't use the latin-N input methods and prefer to use "compose + ' + e" to enter é. But it's often easier to add such special-purpose tricks to Emacs, especially if you want them to be custom-tailored to the specific mode in which you use it. And in the case of the OP, since he wants it to work in all Emacs modes, it's likely he'd also want it to work outside Emacs. Stefan ^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.1002.1370382007.22516.help-gnu-emacs@gnu.org>]
* Re: Using punctuation in abbrev [not found] ` <mailman.1002.1370382007.22516.help-gnu-emacs@gnu.org> @ 2013-06-04 22:47 ` Emanuel Berg 0 siblings, 0 replies; 25+ messages in thread From: Emanuel Berg @ 2013-06-04 22:47 UTC (permalink / raw) To: help-gnu-emacs Stefan Monnier <monnier@iro.umontreal.ca> writes: >> However, I don't see why this should be done outside Emacs, if >> Emacs is the place, where the OP wants to use it? > > To each his own Yes. (Those are my opinions. I'm not telling anyone what to do.) > but FWIW, I do prefer input methods that work everywhere. Yes. I *prefer* that as well. In much the same way as I prefer the dired colors to match the ls dircolors. The colors in the Linux VT and the colors in urxvt. The cursor movements in those terminals, and in Emacs. And so on, forever (almost). But, because I've spent so much time on such "unification" issues, I have come to the conclusion that sometimes, although preferable, it is not worth a huge effort just for the sake of it. And I think this is such a case. > For this reason I don't use the latin-N input methods and prefer > to use "compose + ' + e" to enter é. Here, I agree without reservation. I use the US layout and for the special chars of my native language I, as well, rely on the compose key. You don't have to type that much to "learn anew". It is like people loosing one hand in an accident. Say they are right handed, and they lose that hand. Before long, they are as good with their lefts, as they ever were with their rights. Adaptability - perhaps the most human, of all humans things... > But it's often easier to add such special-purpose tricks to > Emacs, especially if you want them to be custom-tailored to the > specific mode in which you use it. Yes, I said this to (almost). A lot of stuff that you do almost routinely in Emacs and Elisp - when faced with the same problem, say, at shell level, I am always surprised how difficult everything is. Scripts, functions, the PATH, where to put documentation - I don't know if I am just worse at it, or if Emacs is actually better (if that could be quantified somehow). Anyway, that's always the case for me. -- Emanuel Berg - programmer (hire me! CV below) computer projects: http://user.it.uu.se/~embe8573 internet activity: http://home.student.uu.se/embe8573 ^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.880.1370193431.22516.help-gnu-emacs@gnu.org>]
* Re: Using punctuation in abbrev [not found] ` <mailman.880.1370193431.22516.help-gnu-emacs@gnu.org> @ 2013-06-02 19:48 ` Emanuel Berg 2013-06-02 21:06 ` Stefan Monnier ` (2 more replies) 0 siblings, 3 replies; 25+ messages in thread From: Emanuel Berg @ 2013-06-02 19:48 UTC (permalink / raw) To: help-gnu-emacs Aurélien Aptel <aurelien.aptel+emacs@gmail.com> writes: >> Just curious: what Unicode chars do you regularly use? > > mainly arrows, ×, ≠, ≈, ... Aha, so you are writing scientific stuff, or perhaps documentation with flow charts etc.? Or is there actually some new super programming language which take advantage of all that notation? (That would be... scary and impressive, at the same time.) >> Another thought: Pick a shortcut that is very "fast" (short, >> and without you having to move your hand), like M-; or C-o (it >> depends what is already wired into your hands, and what you >> already do useful stuff with - don't change that - but there >> are many shortcuts...). Then, write a defun that waits for a >> keystroke, then inserts the Unicode char depending on what was >> hit, So, say, M-; l is right arrow, M-; j is left arrow, M-; i >> is up arrow, etc. > > That's not a bad alternative. I think I'll do this. I'm happy you think so. Whatever solution you come up with, be sure to post it here so all can learn from it :) -- Emanuel Berg - programmer (hire me! CV below) computer projects: http://user.it.uu.se/~embe8573 internet activity: http://home.student.uu.se/embe8573 ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-02 19:48 ` Emanuel Berg @ 2013-06-02 21:06 ` Stefan Monnier 2013-06-02 22:36 ` Aurélien Aptel [not found] ` <mailman.901.1370212579.22516.help-gnu-emacs@gnu.org> 2 siblings, 0 replies; 25+ messages in thread From: Stefan Monnier @ 2013-06-02 21:06 UTC (permalink / raw) To: help-gnu-emacs > with flow charts etc.? Or is there actually some new super > programming language which take advantage of all that notation? > (That would be... scary and impressive, at the same time.) If you're into that kind of thing, you might like Agda (note that it's a proof assistant, so not useful if you want to do Octave/Mathematica kind of things). Stefan ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-02 19:48 ` Emanuel Berg 2013-06-02 21:06 ` Stefan Monnier @ 2013-06-02 22:36 ` Aurélien Aptel [not found] ` <mailman.901.1370212579.22516.help-gnu-emacs@gnu.org> 2 siblings, 0 replies; 25+ messages in thread From: Aurélien Aptel @ 2013-06-02 22:36 UTC (permalink / raw) To: Emanuel Berg; +Cc: help-gnu-emacs On Sun, Jun 2, 2013 at 9:48 PM, Emanuel Berg <embe8573@student.uu.se> wrote: > Aurélien Aptel <aurelien.aptel+emacs@gmail.com> writes: > >>> Just curious: what Unicode chars do you regularly use? >> >> mainly arrows, ×, ≠, ≈, ... > > Aha, so you are writing scientific stuff, or perhaps documentation > with flow charts etc.? Or is there actually some new super > programming language which take advantage of all that notation? > (That would be... scary and impressive, at the same time.) Scientific or programming related stuff yes. And about the programming language, it has already been done 60 years ago with APL [1] which is actually scary and impressive :) 1: https://en.wikipedia.org/wiki/APL_%28programming_language%29 ^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <mailman.901.1370212579.22516.help-gnu-emacs@gnu.org>]
* Re: Using punctuation in abbrev [not found] ` <mailman.901.1370212579.22516.help-gnu-emacs@gnu.org> @ 2013-06-03 0:10 ` Emanuel Berg 0 siblings, 0 replies; 25+ messages in thread From: Emanuel Berg @ 2013-06-03 0:10 UTC (permalink / raw) To: help-gnu-emacs Aurélien Aptel <aurelien.aptel+emacs@gmail.com> writes: > Scientific or programming related stuff yes. And about the > programming language, it has already been done 60 years ago with > APL [1] which is actually scary and impressive :) Stefan Monnier <monnier@iro.umontreal.ca> writes: > If you're into that kind of thing, you might like Agda (note > that it's a proof assistant, so not useful if you want to do > Octave/Mathematica kind of things). Thanks for cool facts, but no, I'm not into that at all. I have a degree in CS so I'm done with math and formal stuff (with the exception of teaching it to school kids to get food money) - I want to do Lisp and C, steady, everyday stuff. (And I don't consider Lisp "functional" but rather "do whatever you want".) But I can se some perks with such a "Unicode language" - for example, how many ways have you seen "not equal" been syntaxed in PLs? !=, <>, ne, =/= (Erlang), ... - what a mess, and one of the most annoying things to have to stop and look up. Unicode notation would help in such cases, for sure. And, the code would be more pleasant to read (and more readable to non-programmers with a background in math and/or natural sciences). -- Emanuel Berg - programmer (hire me! CV below) computer projects: http://user.it.uu.se/~embe8573 internet activity: http://home.student.uu.se/embe8573 ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-01 17:41 Using punctuation in abbrev Aurélien Aptel 2013-06-01 18:42 ` Drew Adams @ 2013-06-02 14:24 ` Stefan Monnier 2013-06-02 17:00 ` Aurélien Aptel 1 sibling, 1 reply; 25+ messages in thread From: Stefan Monnier @ 2013-06-02 14:24 UTC (permalink / raw) To: help-gnu-emacs > Here's what I put in my init file: > (define-abbrev-table 'global-abbrev-table '( > ("$->" "→") > ("$=>" "⇒") > ("$foo" "X") > ) > "custom abbrev table" > :regexp (rx (or bos bol space) (group (+ (not space))))) > (setq save-abbrevs nil) > (setq-default abbrev-mode t) > But only the $foo substitution works and I can't figure out why. Actually, if you call M-x expand-abbrev RET explicitly, you'll see they all work. What doesn't work for the first two is the "press space after it to cause expansion", because this is only performed right after a word char (hence it works for "$foo" because the last char is a word char). Stefan ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-02 14:24 ` Stefan Monnier @ 2013-06-02 17:00 ` Aurélien Aptel 2013-06-02 17:54 ` Andreas Röhler 2013-06-02 17:56 ` Stefan Monnier 0 siblings, 2 replies; 25+ messages in thread From: Aurélien Aptel @ 2013-06-02 17:00 UTC (permalink / raw) To: Stefan Monnier; +Cc: help-gnu-emacs On Sun, Jun 2, 2013 at 4:24 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote: > Actually, if you call M-x expand-abbrev RET explicitly, you'll see they > all work. What doesn't work for the first two is the "press space after > it to cause expansion", because this is only performed right after > a word char (hence it works for "$foo" because the last char is a word > char). I see, thanks. I've just looked at it: it's done in src/cmds.c:434 so behavior can't be changed from Lisp, too bad. ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-02 17:00 ` Aurélien Aptel @ 2013-06-02 17:54 ` Andreas Röhler 2013-06-02 17:56 ` Stefan Monnier 1 sibling, 0 replies; 25+ messages in thread From: Andreas Röhler @ 2013-06-02 17:54 UTC (permalink / raw) To: help-gnu-emacs Am 02.06.2013 19:00, schrieb Aurélien Aptel: > On Sun, Jun 2, 2013 at 4:24 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote: >> Actually, if you call M-x expand-abbrev RET explicitly, you'll see they >> all work. What doesn't work for the first two is the "press space after >> it to cause expansion", because this is only performed right after >> a word char (hence it works for "$foo" because the last char is a word >> char). > > I see, thanks. > I've just looked at it: it's done in src/cmds.c:434 so behavior can't > be changed from Lisp, too bad. > > AFAICS the restriction is in abbrev--before-point for example, which fetches the abbrev using (backward-word 1). Don't see a reason why not permit any printable char being part of an abbrev. Replace backward-word by (skip-chars-backward "^ \t\r\n\f") etc. Andreas ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: Using punctuation in abbrev 2013-06-02 17:00 ` Aurélien Aptel 2013-06-02 17:54 ` Andreas Röhler @ 2013-06-02 17:56 ` Stefan Monnier 1 sibling, 0 replies; 25+ messages in thread From: Stefan Monnier @ 2013-06-02 17:56 UTC (permalink / raw) To: Aurélien Aptel; +Cc: help-gnu-emacs >> Actually, if you call M-x expand-abbrev RET explicitly, you'll see they >> all work. What doesn't work for the first two is the "press space after >> it to cause expansion", because this is only performed right after >> a word char (hence it works for "$foo" because the last char is a word >> char). > I see, thanks. > I've just looked at it: it's done in src/cmds.c:434 so behavior can't > be changed from Lisp, too bad. The code that calls expand-abbrev from self-insert-command is indeed in C, so you can't change it from Elisp, but that code also runs post-self-insert-hook, so you can add a function to that hook which will call expand-abbrev for the missing case. Stefan ^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2013-06-05 21:12 UTC | newest] Thread overview: 25+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-06-01 17:41 Using punctuation in abbrev Aurélien Aptel 2013-06-01 18:42 ` Drew Adams 2013-06-01 22:49 ` Aurélien Aptel 2013-06-02 18:48 ` Drew Adams [not found] ` <mailman.841.1370126985.22516.help-gnu-emacs@gnu.org> 2013-06-02 5:02 ` Emanuel Berg 2013-06-02 5:21 ` Emanuel Berg 2013-06-02 17:17 ` Aurélien Aptel 2013-06-02 18:10 ` Jambunathan K 2013-06-03 3:44 ` Yuri Khan [not found] ` <mailman.905.1370231076.22516.help-gnu-emacs@gnu.org> 2013-06-03 18:05 ` Emanuel Berg 2013-06-04 3:05 ` Yuri Khan 2013-06-04 9:14 ` Aurélien Aptel [not found] ` <mailman.968.1370315124.22516.help-gnu-emacs@gnu.org> 2013-06-04 17:27 ` Emanuel Berg 2013-06-05 6:59 ` Yuri Khan [not found] ` <mailman.1022.1370415567.22516.help-gnu-emacs@gnu.org> 2013-06-05 21:12 ` Emanuel Berg 2013-06-04 21:39 ` Stefan Monnier [not found] ` <mailman.1002.1370382007.22516.help-gnu-emacs@gnu.org> 2013-06-04 22:47 ` Emanuel Berg [not found] ` <mailman.880.1370193431.22516.help-gnu-emacs@gnu.org> 2013-06-02 19:48 ` Emanuel Berg 2013-06-02 21:06 ` Stefan Monnier 2013-06-02 22:36 ` Aurélien Aptel [not found] ` <mailman.901.1370212579.22516.help-gnu-emacs@gnu.org> 2013-06-03 0:10 ` Emanuel Berg 2013-06-02 14:24 ` Stefan Monnier 2013-06-02 17:00 ` Aurélien Aptel 2013-06-02 17:54 ` Andreas Röhler 2013-06-02 17:56 ` Stefan Monnier
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).