summaryrefslogtreecommitdiff
path: root/lisp/progmodes/prog-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/prog-mode.el')
-rw-r--r--lisp/progmodes/prog-mode.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 6c09dcf881d..4f15686dc87 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -68,6 +68,28 @@
`(menu-item "Find Definition" xref-find-definitions-at-mouse
:help ,(format "Find definition of `%s'" identifier))
'prog-separator)))
+
+ (when (thing-at-mouse click 'symbol)
+ (define-key-after menu [select-region mark-symbol]
+ `(menu-item "Symbol"
+ ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'symbol))
+ :help "Mark the symbol at click for a subsequent cut/copy")
+ 'mark-whole-buffer))
+ (define-key-after menu [select-region mark-list]
+ `(menu-item "List"
+ ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list))
+ :help "Mark the list at click for a subsequent cut/copy")
+ 'mark-whole-buffer)
+ (define-key-after menu [select-region mark-defun]
+ `(menu-item "Defun"
+ ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun))
+ :help "Mark the defun at click for a subsequent cut/copy")
+ 'mark-whole-buffer)
+
+ ;; Include text-mode select menu only in strings and comments.
+ (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click)))))
+ (text-mode-menu menu click))
+
menu)
(defvar prog-mode-map