mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
(read-only-keymap-*): Be more careful with the namespace
* lisp/keymap.el (keymap-read-only-bind): Rename from `read-only-keymap-bind`. Improve docstring. (keymap--read-only-filter): Rename from `read-only-keymap-filter`. * lisp/net/goto-addr.el (goto-address-highlight-keymap): * lisp/progmodes/bug-reference.el (bug-reference-map): * lisp/net/browse-url.el (browse-url-button-map): * lisp/ansi-osc.el (ansi-osc-hyperlink-map): Adjust accordingly.
This commit is contained in:
parent
06639a6b9b
commit
b1f924e12f
5 changed files with 11 additions and 8 deletions
|
|
@ -146,7 +146,7 @@ and `shell-dirtrack-mode'."
|
|||
|
||||
(defvar-keymap ansi-osc-hyperlink-map
|
||||
:doc "Keymap used by OSC 8 hyperlink buttons."
|
||||
"RET" (read-only-keymap-bind #'browse-url-button-open)
|
||||
"RET" (keymap-read-only-bind #'browse-url-button-open)
|
||||
"C-c RET" #'browse-url-button-open
|
||||
"<mouse-2>" #'browse-url-button-open
|
||||
"<follow-link>" 'mouse-face)
|
||||
|
|
|
|||
|
|
@ -801,16 +801,19 @@ in the echo area.
|
|||
|
||||
|
||||
|
||||
(defun read-only-keymap-filter (cmd)
|
||||
(defun keymap--read-only-filter (cmd)
|
||||
"Return CMD if `browse-url' and similar button bindings should be active.
|
||||
They are considered active only in read-only buffers."
|
||||
(when buffer-read-only cmd))
|
||||
|
||||
(defun read-only-keymap-bind (binding)
|
||||
"Use BINDING according to `read-only-keymap-filter'."
|
||||
(defun keymap-read-only-bind (binding)
|
||||
"Behave like BINDING, but only when the buffer is read-only.
|
||||
BINDING should be a command to pput in a keymap.
|
||||
Return an element that can be added in a keymap with `keymap-set', such that
|
||||
it is active only when the current buffer is read-only."
|
||||
`(menu-item
|
||||
"" ,binding
|
||||
:filter ,#'read-only-keymap-filter))
|
||||
:filter ,#'keymap--read-only-filter))
|
||||
|
||||
(provide 'keymap)
|
||||
|
||||
|
|
|
|||
|
|
@ -1761,7 +1761,7 @@ from `browse-url-elinks-wrapper'."
|
|||
|
||||
(defvar-keymap browse-url-button-map
|
||||
:doc "The keymap used for `browse-url' buttons."
|
||||
"RET" (read-only-keymap-bind #'browse-url-button-open)
|
||||
"RET" (keymap-read-only-bind #'browse-url-button-open)
|
||||
"C-c RET" #'browse-url-button-open
|
||||
"<mouse-2>" #'browse-url-button-open
|
||||
"w" #'browse-url-button-copy)
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ will have no effect.")
|
|||
(defvar-keymap goto-address-highlight-keymap
|
||||
:doc "Keymap to hold goto-addr's mouse key defs under highlighted URLs."
|
||||
"<mouse-2>" #'goto-address-at-point
|
||||
"RET" (read-only-keymap-bind #'goto-address-at-point)
|
||||
"RET" (keymap-read-only-bind #'goto-address-at-point)
|
||||
"C-c RET" #'goto-address-at-point)
|
||||
|
||||
(defun goto-address-context-menu (menu click)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
(defvar-keymap bug-reference-map
|
||||
:doc "Keymap used by bug reference buttons."
|
||||
"<mouse-2>" #'bug-reference-push-button
|
||||
"RET" (read-only-keymap-bind #'bug-reference-push-button)
|
||||
"RET" (keymap-read-only-bind #'bug-reference-push-button)
|
||||
"C-c RET" #'bug-reference-push-button)
|
||||
|
||||
;; E.g., "https://gcc.gnu.org/PR%s"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue