mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Add new command 'shortdoc-copy-function-as-kill'
* lisp/emacs-lisp/shortdoc.el (shortdoc-copy-function-as-kill): New command. (shortdoc-mode-map): Bind above new command to "w".
This commit is contained in:
parent
46ec36adfd
commit
e589690781
2 changed files with 20 additions and 1 deletions
|
|
@ -1515,7 +1515,8 @@ Example:
|
|||
"N" #'shortdoc-next-section
|
||||
"P" #'shortdoc-previous-section
|
||||
"C-c C-n" #'shortdoc-next-section
|
||||
"C-c C-p" #'shortdoc-previous-section)
|
||||
"C-c C-p" #'shortdoc-previous-section
|
||||
"w" #'shortdoc-copy-function-as-kill)
|
||||
|
||||
(define-derived-mode shortdoc-mode special-mode "shortdoc"
|
||||
"Mode for shortdoc."
|
||||
|
|
@ -1557,6 +1558,20 @@ With ARG, do it that many times."
|
|||
(shortdoc--goto-section arg 'shortdoc-section t)
|
||||
(forward-line -2))
|
||||
|
||||
(defun shortdoc-copy-function-as-kill ()
|
||||
"Copy name of the function near point into the kill ring."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (pos-bol))
|
||||
(when-let* ((re (rx bol "(" (group (+ (not (in " "))))))
|
||||
(string
|
||||
(and (or (looking-at re)
|
||||
(re-search-backward re nil t))
|
||||
(match-string 1))))
|
||||
(set-text-properties 0 (length string) nil string)
|
||||
(kill-new string)
|
||||
(message string))))
|
||||
|
||||
(provide 'shortdoc)
|
||||
|
||||
;;; shortdoc.el ends here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue