mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-23 21:17:11 -05:00
emacs: Add "c" key binding to copy a button link.
* emacs/guix-info.el (guix-info-button-map): New variable. (guix-info-button-copy-label): New procedure. * doc/emacs.texi (Emacs Info buffer): Mention a "c" key binding. (Emacs Keymaps): Add 'guix-info-button-map'.
This commit is contained in:
parent
054a3921f0
commit
5614921754
2 changed files with 22 additions and 0 deletions
|
@ -290,6 +290,9 @@ emacs, The GNU Emacs Manual}) which can be used to:
|
|||
|
||||
@end itemize
|
||||
|
||||
It is also possible to copy a button label (a link to an URL or a file)
|
||||
by pressing @kbd{c} on a button.
|
||||
|
||||
|
||||
@node Emacs Configuration
|
||||
@subsection Configuration
|
||||
|
@ -397,6 +400,9 @@ Keymap with specific keys for ``output-info'' buffers.
|
|||
@item guix-generation-info-mode-map
|
||||
Keymap with specific keys for ``generation-info'' buffers.
|
||||
|
||||
@item guix-info-button-map
|
||||
Keymap with keys available when a point is placed on a button.
|
||||
|
||||
@end table
|
||||
|
||||
@node Emacs Appearance
|
||||
|
|
|
@ -313,7 +313,15 @@ VAL is a list, call the function on each element of this list."
|
|||
|
||||
;;; Buttons
|
||||
|
||||
(defvar guix-info-button-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map button-map)
|
||||
(define-key map (kbd "c") 'guix-info-button-copy-label)
|
||||
map)
|
||||
"Keymap for buttons in info buffers.")
|
||||
|
||||
(define-button-type 'guix
|
||||
'keymap guix-info-button-map
|
||||
'follow-link t)
|
||||
|
||||
(define-button-type 'guix-action
|
||||
|
@ -350,6 +358,14 @@ VAL is a list, call the function on each element of this list."
|
|||
(guix-get-show-entries guix-profile 'info guix-package-info-type
|
||||
'name (button-label btn))))
|
||||
|
||||
(defun guix-info-button-copy-label (&optional pos)
|
||||
"Copy a label of the button at POS into kill ring.
|
||||
If POS is nil, use the current point position."
|
||||
(interactive)
|
||||
(let ((button (button-at (or pos (point)))))
|
||||
(when button
|
||||
(kill-new (button-label button)))))
|
||||
|
||||
(defun guix-info-insert-action-button (label action &optional message
|
||||
&rest properties)
|
||||
"Make action button with LABEL and insert it at point.
|
||||
|
|
Loading…
Reference in a new issue