summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-09-24 09:29:52 +0300
committerJuri Linkov <juri@linkov.net>2021-09-24 09:29:52 +0300
commit2abf143f8185fced544c4f8d144ea710142d7a59 (patch)
tree40074cf2a1642ad8cb494a3fa0cd9dd8ee797b5b /lisp/mouse.el
parent4c891b2a05748c7a16ac6ac94f01e017187c4949 (diff)
downloademacs-2abf143f8185fced544c4f8d144ea710142d7a59.tar.gz
emacs-2abf143f8185fced544c4f8d144ea710142d7a59.tar.bz2
emacs-2abf143f8185fced544c4f8d144ea710142d7a59.zip
New thing-at-point target 'string' used in context-menu-region
* lisp/mouse.el (context-menu-region): Use separate "List" and "String". * lisp/thingatpt.el (string): New target 'string'. (thing-at-point-bounds-of-string-at-point): New function. (thing-at-point-bounds-of-list-at-point): Revert previous commit by removing optional args 'escape-strings' and 'no-syntax-crossing'. (list-or-string): Remove recently added target 'list-or-string'. (thing-at-point-bounds-of-list-or-string-at-point): Remove function. https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01737.html
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 8ad3f7664a2..9f1417f420d 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -482,12 +482,17 @@ Some context functions add menu items below the separator."
`(menu-item "Defun"
,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'defun))
:help "Mark the defun at click for a subsequent cut/copy"))
- (define-key-after submenu [mark-list-or-string]
- `(menu-item ,(if (nth 8 (save-excursion
- (syntax-ppss (posn-point (event-end click)))))
- "String" "List")
- ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'list-or-string))
- :help "Mark list or string at click for a subsequent cut/copy"))
+ (define-key-after submenu [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"))
+ (when (let ((pos (posn-point (event-end click))))
+ (or (eq (char-syntax (char-after pos)) ?\")
+ (nth 3 (save-excursion (syntax-ppss pos)))))
+ (define-key-after submenu [mark-string]
+ `(menu-item "String"
+ ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'string))
+ :help "Mark the string at click for a subsequent cut/copy")))
(define-key-after submenu [mark-line]
`(menu-item "Line"
,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line))