aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-04-12 10:05:57 +0800
committerSean Whitton2025-04-12 10:05:57 +0800
commit3b841700a8bef1d5b16542679458ddfb588ea777 (patch)
tree3c8022883deec6cc9e448826d25dd5e2cd4b1b86
parentcc232bd7a19dcd8b5c77320615a5e93ea0f589b6 (diff)
downloademacs-3b841700a8bef1d5b16542679458ddfb588ea777.tar.gz
emacs-3b841700a8bef1d5b16542679458ddfb588ea777.zip
vc-do-async-command: Ellipse later lines in multiline arguments
* lisp/emacs-lisp/cl-print.el (cl-print-expand-ellipsis): Bind inhibit-read-only to t. * lisp/vc/vc-dispatcher.el (require): Require cl-print at compile time. (vc-do-async-command): When printing command arguments that contain multiple lines, use cl-prin1 with cl-print-string-length bound in order to ellipse lines other than the first. Switch the outer quotation marks to single quotation marks.
-rw-r--r--lisp/emacs-lisp/cl-print.el4
-rw-r--r--lisp/vc/vc-dispatcher.el22
2 files changed, 21 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index 62cda07ac73..ba699f75b71 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -518,7 +518,9 @@ BUTTON can also be a buffer position or nil (to mean point)."
518 (user-error "No ellipsis to expand here"))) 518 (user-error "No ellipsis to expand here")))
519 (let* ((end (next-single-property-change (point) 'cl-print-ellipsis)) 519 (let* ((end (next-single-property-change (point) 'cl-print-ellipsis))
520 (begin (previous-single-property-change end 'cl-print-ellipsis)) 520 (begin (previous-single-property-change end 'cl-print-ellipsis))
521 (value (get-text-property begin 'cl-print-ellipsis))) 521 (value (get-text-property begin 'cl-print-ellipsis))
522 ;; Ensure clicking the button works even in read only buffers.
523 (inhibit-read-only t))
522 ;; FIXME: Rather than `t' (i.e. reuse the print-length/level unchanged), 524 ;; FIXME: Rather than `t' (i.e. reuse the print-length/level unchanged),
523 ;; I think it would make sense to increase the level by 1 and to 525 ;; I think it would make sense to increase the level by 1 and to
524 ;; double the length at each expansion step. 526 ;; double the length at each expansion step.
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 090f5fff4a9..bd681b2c1cf 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -109,7 +109,9 @@
109;; TODO: 109;; TODO:
110;; - log buffers need font-locking. 110;; - log buffers need font-locking.
111 111
112(eval-when-compile (require 'cl-lib)) 112(eval-when-compile
113 (require 'cl-lib)
114 (require 'cl-print))
113 115
114;; General customization 116;; General customization
115 117
@@ -473,10 +475,22 @@ Display the buffer in some window, but don't select it."
473 (unless (eq (point) (point-min)) 475 (unless (eq (point) (point-min))
474 (insert " \n")) 476 (insert " \n"))
475 (setq new-window-start (point)) 477 (setq new-window-start (point))
476 (insert "Running \"" cmd) 478 (insert "Running '" cmd)
477 (dolist (flag flags) 479 (dolist (flag flags)
478 (insert " " flag)) 480 (let ((lines (string-lines flag)))
479 (insert "\"...\n") 481 (insert " ")
482 ;; If the argument has newlines in it (as a commit
483 ;; message commonly will) then ellipse it down so
484 ;; that the whole command is more readable.
485 (if (cdr lines)
486 (let ((flag (copy-sequence flag))
487 (cl-print-string-length (length
488 (car lines))))
489 (set-text-properties 0 (length flag) nil
490 flag)
491 (cl-prin1 flag buffer))
492 (insert flag))))
493 (insert "'...\n")
480 args)))) 494 args))))
481 (setq proc (apply #'vc-do-command t 'async command nil args)))) 495 (setq proc (apply #'vc-do-command t 'async command nil args))))
482 (unless vc--inhibit-async-window 496 (unless vc--inhibit-async-window