diff options
| author | Juri Linkov | 2018-02-21 22:37:33 +0200 |
|---|---|---|
| committer | Juri Linkov | 2018-02-21 22:37:33 +0200 |
| commit | 465207221d44e4774b2df3db8fa570de92daf456 (patch) | |
| tree | 11f197600dfe096ebf7e08040a8e42fd9dbe24e2 | |
| parent | 5209e9b45b72eb8f02aade19d75792e16e4c638d (diff) | |
| download | emacs-465207221d44e4774b2df3db8fa570de92daf456.tar.gz emacs-465207221d44e4774b2df3db8fa570de92daf456.zip | |
* lisp/vc/vc-dispatcher.el (vc-do-command): Bind message-truncate-lines to t
to keep entire commands in *Messages* but avoid resizing the echo area.
Rephrase messages in a such way that the important parts are
at the beginning. (Bug#19045)
| -rw-r--r-- | lisp/vc/vc-dispatcher.el | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index b0d2221b255..da9d34644cd 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el | |||
| @@ -290,16 +290,16 @@ case, and the process object in the asynchronous case." | |||
| 290 | (let* ((files | 290 | (let* ((files |
| 291 | (mapcar (lambda (f) (file-relative-name (expand-file-name f))) | 291 | (mapcar (lambda (f) (file-relative-name (expand-file-name f))) |
| 292 | (if (listp file-or-list) file-or-list (list file-or-list)))) | 292 | (if (listp file-or-list) file-or-list (list file-or-list)))) |
| 293 | ;; Keep entire commands in *Messages* but avoid resizing the | ||
| 294 | ;; echo area. Messages in this function are formatted in | ||
| 295 | ;; a such way that the important parts are at the beginning, | ||
| 296 | ;; due to potential truncation of long messages. | ||
| 297 | (message-truncate-lines t) | ||
| 293 | (full-command | 298 | (full-command |
| 294 | ;; What we're doing here is preparing a version of the command | ||
| 295 | ;; for display in a debug-progress message. If it's fewer than | ||
| 296 | ;; 20 characters display the entire command (without trailing | ||
| 297 | ;; newline). Otherwise display the first 20 followed by an ellipsis. | ||
| 298 | (concat (if (string= (substring command -1) "\n") | 299 | (concat (if (string= (substring command -1) "\n") |
| 299 | (substring command 0 -1) | 300 | (substring command 0 -1) |
| 300 | command) | 301 | command) |
| 301 | " " | 302 | " " (vc-delistify flags) |
| 302 | (vc-delistify (mapcar (lambda (s) (if (> (length s) 20) (concat (substring s 0 2) "...") s)) flags)) | ||
| 303 | " " (vc-delistify files)))) | 303 | " " (vc-delistify files)))) |
| 304 | (save-current-buffer | 304 | (save-current-buffer |
| 305 | (unless (or (eq buffer t) | 305 | (unless (or (eq buffer t) |
| @@ -324,7 +324,7 @@ case, and the process object in the asynchronous case." | |||
| 324 | (apply 'start-file-process command (current-buffer) | 324 | (apply 'start-file-process command (current-buffer) |
| 325 | command squeezed)))) | 325 | command squeezed)))) |
| 326 | (when vc-command-messages | 326 | (when vc-command-messages |
| 327 | (message "Running %s in background..." full-command)) | 327 | (message "Running in background: %s" full-command)) |
| 328 | ;; Get rid of the default message insertion, in case we don't | 328 | ;; Get rid of the default message insertion, in case we don't |
| 329 | ;; set a sentinel explicitly. | 329 | ;; set a sentinel explicitly. |
| 330 | (set-process-sentinel proc #'ignore) | 330 | (set-process-sentinel proc #'ignore) |
| @@ -332,10 +332,11 @@ case, and the process object in the asynchronous case." | |||
| 332 | (setq status proc) | 332 | (setq status proc) |
| 333 | (when vc-command-messages | 333 | (when vc-command-messages |
| 334 | (vc-run-delayed | 334 | (vc-run-delayed |
| 335 | (message "Running %s in background... done" full-command)))) | 335 | (let ((message-truncate-lines t)) |
| 336 | (message "Done in background: %s" full-command))))) | ||
| 336 | ;; Run synchronously | 337 | ;; Run synchronously |
| 337 | (when vc-command-messages | 338 | (when vc-command-messages |
| 338 | (message "Running %s in foreground..." full-command)) | 339 | (message "Running in foreground: %s" full-command)) |
| 339 | (let ((buffer-undo-list t)) | 340 | (let ((buffer-undo-list t)) |
| 340 | (setq status (apply 'process-file command nil t nil squeezed))) | 341 | (setq status (apply 'process-file command nil t nil squeezed))) |
| 341 | (when (and (not (eq t okstatus)) | 342 | (when (and (not (eq t okstatus)) |
| @@ -345,13 +346,14 @@ case, and the process object in the asynchronous case." | |||
| 345 | (pop-to-buffer (current-buffer)) | 346 | (pop-to-buffer (current-buffer)) |
| 346 | (goto-char (point-min)) | 347 | (goto-char (point-min)) |
| 347 | (shrink-window-if-larger-than-buffer)) | 348 | (shrink-window-if-larger-than-buffer)) |
| 348 | (error "Running %s...FAILED (%s)" full-command | 349 | (error "Failed (%s): %s" |
| 349 | (if (integerp status) (format "status %d" status) status))) | 350 | (if (integerp status) (format "status %d" status) status) |
| 351 | full-command)) | ||
| 350 | (when vc-command-messages | 352 | (when vc-command-messages |
| 351 | (message "Running %s...OK = %d" full-command status)))) | 353 | (message "Done (status=%d): %s" status full-command)))) |
| 352 | (vc-run-delayed | 354 | (vc-run-delayed |
| 353 | (run-hook-with-args 'vc-post-command-functions | 355 | (run-hook-with-args 'vc-post-command-functions |
| 354 | command file-or-list flags)) | 356 | command file-or-list flags)) |
| 355 | status)))) | 357 | status)))) |
| 356 | 358 | ||
| 357 | (defun vc-do-async-command (buffer root command &rest args) | 359 | (defun vc-do-async-command (buffer root command &rest args) |