[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Suggestion to have highlight related bindings consistent between search-

From: Kaushal
Subject: Suggestion to have highlight related bindings consistent between search-map and hi-lock-map
Date: Fri, 10 Jul 2015 15:02:43 -0400


I was trying to using the binding for highlight-regexp and I got confused if the prefix was "C-x w r" or "M-s h r". I "grepping" (actually agging), I found that below are the ONLY bindings that begin with "C-x w .." and "M-s h .." (with the exact same number of bindings too).

Can we make the bindings consistent so that it doesn't matter is the user is using "C-x w" or "M-s h"?

km²~/downloads/:git/emacs/lisp> ag 'define.*C\-xw'
277:    (define-key map "\C-xwi" 'hi-lock-find-patterns)
278:    (define-key map "\C-xwl" 'highlight-lines-matching-regexp)
279:    (define-key map "\C-xwp" 'highlight-phrase)
280:    (define-key map "\C-xwh" 'highlight-regexp)
281:    (define-key map "\C-xw." 'highlight-symbol-at-point)
282:    (define-key map "\C-xwr" 'unhighlight-regexp)
283:    (define-key map "\C-xwb" 'hi-lock-write-interactive-patterns)

km²~/downloads/:git/emacs/lisp> ag 'define.*search-map\s+"h'
935:(define-key search-map "hf"   'hi-lock-find-patterns)
932:(define-key search-map "hl"   'highlight-lines-matching-regexp)
931:(define-key search-map "hp"   'highlight-phrase)
930:(define-key search-map "hr"   'highlight-regexp)
933:(define-key search-map "h."   'highlight-symbol-at-point)
934:(define-key search-map "hu"   'unhighlight-regexp)
936:(define-key search-map "hw"   'hi-lock-write-interactive-patterns)

​Some bindings are consistent but some are not. Here are the inconsistent ones:

hi-lock.el  277: (define-key map        "\C-xwi" 'hi-lock-find-patterns)
bindings.el 935: (define-key search-map     "hf" 'hi-lock-find-patterns)

hi-lock.el  282: (define-key map        "\C-xwr" 'unhighlight-regexp)
bindings.el 934: (define-key search-map     "hu" 'unhighlight-regexp)

hi-lock.el  280: (define-key map        "\C-xwh" 'highlight-regexp)
bindings.el 930: (define-key search-map     "hr" 'highlight-regexp)

hi-lock.el  283: (define-key map        "\C-xwb" 'hi-lock-write-interactive-patterns)
bindings.el 936: (define-key search-map     "hw" 'hi-lock-write-interactive-patterns)

*** Here are my suggested consistent bindings to fix the inconsistent ones: ***

- Currently "C-x w f" is undefined; "f" for find patterns
hi-lock.el  277: (define-key map        "\C-xwf" 'hi-lock-find-patterns) ; changed
bindings.el 935: (define-key search-map     "hf" 'hi-lock-find-patterns) ; no change

- Currently "C-x w u" is undefined; "u" for unhighlight
hi-lock.el  282: (define-key map        "\C-xwu" 'unhighlight-regexp) ; changed
bindings.el 934: (define-key search-map     "hu" 'unhighlight-regexp) ; no change

- "C-x w r" which was earlier bound to unhighlight-regexp should now be bound to highlight-regexp; "r" for regexp
hi-lock.el  280: (define-key map        "\C-xwr" 'highlight-regexp) ; changed
bindings.el 930: (define-key search-map     "hr" 'highlight-regexp) ; no change

- Currently "C-x w w" is undefined; "w" for write interactive patterns
hi-lock.el  283: (define-key map        "\C-xww" 'hi-lock-write-interactive-patterns) ; changed
bindings.el 936: (define-key search-map     "hw" 'hi-lock-write-interactive-patterns) ; no change

Well.. turns out only 4 bindings need to change in hi-lock.el to make these consistent.
| search-map | hi-lock-map | last key in binding | function                           |
| M-s h      | C-x w       | l                   | highlight-lines-matching-regexp    |
| M-s h      | C-x w       | p                   | highlight-phrase                   |
| M-s h      | C-x w       | .                   | highlight-symbol-at-point          |
| M-s h      | C-x w       | f                   | hi-lock-find-patterns              |
| M-s h      | C-x w       | u                   | unhighlight-regexp                 |
| M-s h      | C-x w       | r                   | highlight-regexp                   |
| M-s h      | C-x w       | w                   | hi-lock-write-interactive-patterns |

Kaushal Modi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]