aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVisuwesh2022-07-23 09:15:24 +0200
committerLars Ingebrigtsen2022-07-23 09:15:24 +0200
commite5de76b72e75aaa04d83331ebc4d72dadd7eed77 (patch)
treedf4aefd780e606e5301473de9ef0765c337f9554
parent97abe8511a829861f6efb865209ac2dd0e7ae129 (diff)
downloademacs-e5de76b72e75aaa04d83331ebc4d72dadd7eed77.tar.gz
emacs-e5de76b72e75aaa04d83331ebc4d72dadd7eed77.zip
New user option to disable deleting current input in comint mouse-2
* etc/NEWS: Announce the user option (bug#56646). * lisp/comint.el (comint-delete-old-input): New user option to disable deleting current input when insert an old input using mouse-2. (comint-insert-input): Use it.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/comint.el15
2 files changed, 16 insertions, 4 deletions
diff --git a/etc/NEWS b/etc/NEWS
index a143550f036..666699e8c66 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -996,6 +996,11 @@ The user option 'comint-terminfo-terminal' and the variable
996'system-uses-terminfo' can now be set as connection-local variables to 996'system-uses-terminfo' can now be set as connection-local variables to
997change the terminal used on a remote host. 997change the terminal used on a remote host.
998 998
999---
1000*** New user option 'comint-delete-old-input'
1001When set to nil, this prevents comint from deleting the current input
1002when inserting previous input using '<mouse-2>'.
1003
999** Mwheel 1004** Mwheel
1000 1005
1001--- 1006---
diff --git a/lisp/comint.el b/lisp/comint.el
index d52623c00ae..3ed04f098c7 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -905,6 +905,12 @@ series of processes in the same Comint buffer. The hook
905 "Return non-nil if STR contains non-whitespace syntax." 905 "Return non-nil if STR contains non-whitespace syntax."
906 (not (string-match "\\`\\s *\\'" str))) 906 (not (string-match "\\`\\s *\\'" str)))
907 907
908(defcustom comint-delete-old-input t
909 "When non-nil, delete old input on inserting previous input with \\<comint-mode-map>\\[comint-insert-input]."
910 :type 'boolean
911 :group 'comint
912 :version "29.1")
913
908(defun comint-insert-input (event) 914(defun comint-insert-input (event)
909 "In a Comint buffer, set the current input to the previous input at point. 915 "In a Comint buffer, set the current input to the previous input at point.
910If there is no previous input at point, run the command specified 916If there is no previous input at point, run the command specified
@@ -936,10 +942,11 @@ by the global keymap (usually `mouse-yank-at-click')."
936 ;; Otherwise, insert the previous input. 942 ;; Otherwise, insert the previous input.
937 (goto-char (point-max)) 943 (goto-char (point-max))
938 ;; First delete any old unsent input at the end 944 ;; First delete any old unsent input at the end
939 (delete-region 945 (when comint-delete-old-input
940 (or (marker-position comint-accum-marker) 946 (delete-region
941 (process-mark (get-buffer-process (current-buffer)))) 947 (or (marker-position comint-accum-marker)
942 (point)) 948 (process-mark (get-buffer-process (current-buffer))))
949 (point)))
943 ;; Insert the input at point 950 ;; Insert the input at point
944 (insert input))))) 951 (insert input)))))
945 952