commit d9fd1d32632816aa7833bcfcc116a0a01a53a4b7 (HEAD, refs/remotes/origin/master) Author: Tino Calancha Date: Thu Feb 9 18:14:10 2017 +0900 Ibuffer: Erase output buffer before shell commands * lisp/ibuf-macs.el (define-ibuffer-op): Add keyword arguments BEFORE and AFTER; they are forms to run before/after the operation. * lisp/ibuf-ext.el (ibuffer--maybe-erase-shell-cmd-output): New defun; if shell-command-dont-erase-buffer is nil, then erase shell command output buffer. (ibuffer-do-shell-command-pipe, ibuffer-do-shell-command-file): Use it. diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 00cbf051d2..2a68f777d9 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -506,11 +506,19 @@ the mode if ARG is omitted or nil." (ibuffer-backward-filter-group 1)) (ibuffer-forward-line 0)) +(defun ibuffer--maybe-erase-shell-cmd-output () + (let ((buf (get-buffer "*Shell Command Output*"))) + (when (and (buffer-live-p buf) + (not shell-command-dont-erase-buffer) + (not (zerop (buffer-size buf)))) + (with-current-buffer buf (erase-buffer))))) + ;;;###autoload (autoload 'ibuffer-do-shell-command-pipe "ibuf-ext") (define-ibuffer-op shell-command-pipe (command) "Pipe the contents of each marked buffer to shell command COMMAND." (:interactive "sPipe to shell command: " :opstring "Shell command executed on" + :before (ibuffer--maybe-erase-shell-cmd-output) :modifier-p nil) (let ((out-buf (get-buffer-create "*Shell Command Output*"))) (with-current-buffer out-buf (goto-char (point-max))) @@ -533,6 +541,7 @@ the mode if ARG is omitted or nil." "Run shell command COMMAND separately on files of marked buffers." (:interactive "sShell command on buffer's file: " :opstring "Shell command executed on" + :before (ibuffer--maybe-erase-shell-cmd-output) :modifier-p nil) (let ((file (and (not (buffer-modified-p)) buffer-file-name)) @@ -551,7 +560,6 @@ the mode if ARG is omitted or nil." (shell-quote-argument file)) nil out-buf nil))) - ;;;###autoload (autoload 'ibuffer-do-eval "ibuf-ext") (define-ibuffer-op eval (form) "Evaluate FORM in each of the buffers. diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el index 05e568efeb..2e751cebd6 100644 --- a/lisp/ibuf-macs.el +++ b/lisp/ibuf-macs.el @@ -169,6 +169,8 @@ value if and only if `a' is \"less than\" `b'. dangerous (opstring "operated on") (active-opstring "Operate on") + before + after complex) &rest body) "Generate a function which operates on a buffer. @@ -198,6 +200,8 @@ operation is complete, in the form: ACTIVE-OPSTRING is a string which will be displayed to the user in a confirmation message, in the form: \"Really ACTIVE-OPSTRING x buffers?\" +BEFORE is a form to evaluate before start the operation. +AFTER is a form to evaluate once the operation is complete. COMPLEX means this function is special; if COMPLEX is nil BODY evaluates once for each marked buffer, MBUF, with MBUF current and saving the point. If COMPLEX is non-nil, BODY evaluates @@ -206,7 +210,7 @@ BODY define the operation; they are forms to evaluate per each marked buffer. BODY is evaluated with `buf' bound to the buffer object. -\(fn OP ARGS DOCUMENTATION (&key INTERACTIVE MARK MODIFIER-P DANGEROUS OPSTRING ACTIVE-OPSTRING COMPLEX) &rest BODY)" +\(fn OP ARGS DOCUMENTATION (&key INTERACTIVE MARK MODIFIER-P DANGEROUS OPSTRING ACTIVE-OPSTRING BEFORE AFTER COMPLEX) &rest BODY)" (declare (indent 2) (doc-string 3)) `(progn (defun ,(intern (concat (if (string-match "^ibuffer-do" (symbol-name op)) @@ -238,6 +242,7 @@ buffer object. (if (eq modifier-p t) '((setq ibuffer-did-modification t)) ()) + (and after `(,after)) ; post-operation form. `((ibuffer-redisplay t) (message ,(concat "Operation finished; " opstring " %s buffers") count)))) (inner-body (if complex @@ -247,7 +252,8 @@ buffer object. (save-excursion ,@body)) t))) - (body `(let ((count + (body `(let ((_ ,before) ; pre-operation form. + (count (,(pcase mark (:deletion 'ibuffer-map-deletion-lines) commit 1e23bf5c513fafb9d14a8e07232101515386a912 Author: Tino Calancha Date: Thu Feb 9 18:13:59 2017 +0900 Ibuffer: Don't truncate shell command output * lisp/ibuf-ext.el (ibuffer-do-shell-command-pipe) (ibuffer-do-shell-command-pipe-replace) Use 'call-shell-region' (Bug#22679). (ibuffer-do-shell-command-file): Use call-process-shell-command. If FILE, the file that the buffer object is visiting, exists and the buffer is up-to-date, then use FILE instead of creating a temporary file (Bug#22679). diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 058eaecb36..00cbf051d2 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -512,8 +512,10 @@ the mode if ARG is omitted or nil." (:interactive "sPipe to shell command: " :opstring "Shell command executed on" :modifier-p nil) - (shell-command-on-region - (point-min) (point-max) command)) + (let ((out-buf (get-buffer-create "*Shell Command Output*"))) + (with-current-buffer out-buf (goto-char (point-max))) + (call-shell-region (point-min) (point-max) + command nil out-buf))) ;;;###autoload (autoload 'ibuffer-do-shell-command-pipe-replace "ibuf-ext") (define-ibuffer-op shell-command-pipe-replace (command) @@ -523,9 +525,8 @@ the mode if ARG is omitted or nil." :active-opstring "replace buffer contents in" :dangerous t :modifier-p t) - (with-current-buffer buf - (shell-command-on-region (point-min) (point-max) - command nil t))) + (call-shell-region (point-min) (point-max) + command 'delete buf)) ;;;###autoload (autoload 'ibuffer-do-shell-command-file "ibuf-ext") (define-ibuffer-op shell-command-file (command) @@ -533,16 +534,23 @@ the mode if ARG is omitted or nil." (:interactive "sShell command on buffer's file: " :opstring "Shell command executed on" :modifier-p nil) - (shell-command (concat command " " - (shell-quote-argument - (or buffer-file-name - (let ((file - (make-temp-file - (substring - (buffer-name) 0 - (min 10 (length (buffer-name))))))) - (write-region nil nil file nil 0) - file)))))) + (let ((file (and (not (buffer-modified-p)) + buffer-file-name)) + (out-buf (get-buffer-create "*Shell Command Output*"))) + (unless (and file (file-exists-p file)) + (setq file + (make-temp-file + (substring + (buffer-name) 0 + (min 10 (length (buffer-name)))))) + (write-region nil nil file nil 0)) + (with-current-buffer out-buf (goto-char (point-max))) + (call-process-shell-command + (format "%s %s" + command + (shell-quote-argument file)) + nil out-buf nil))) + ;;;###autoload (autoload 'ibuffer-do-eval "ibuf-ext") (define-ibuffer-op eval (form) commit 2bfe83fcd3575d03f371a7d0e6b8c5d661bc5ac7 Author: Noam Postavsky Date: Thu Feb 2 09:19:43 2017 -0500 Make sure eshell pipelines don't drop data * lisp/eshell/esh-proc.el (eshell-sentinel): If called while still handling output of the process, make sure to close the pipes only later, so that the next process in the pipeline recieves EOF only after getting all its input (Bug#25549). diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index b0dbb22915..ba5cb5c2db 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el @@ -393,8 +393,20 @@ PROC is the process that's exiting. STRING is the exit message." (unless (string= string "run") (unless (string-match "^\\(finished\\|exited\\)" string) (eshell-insertion-filter proc string)) - (eshell-close-handles (process-exit-status proc) 'nil - (cadr entry)))) + (let ((handles (nth 1 entry)) + (str (prog1 (nth 3 entry) + (setf (nth 3 entry) nil))) + (status (process-exit-status proc))) + ;; If we're in the middle of handling output + ;; from this process then schedule the EOF for + ;; later. + (letrec ((finish-io + (lambda () + (if (nth 4 entry) + (run-at-time 0 nil finish-io) + (when str (eshell-output-object str nil handles)) + (eshell-close-handles status 'nil handles))))) + (funcall finish-io))))) (eshell-remove-process-entry entry)))) (eshell-kill-process-function proc string))))) commit 41de25c1134e201235ac7f6e19ecb2925a7df635 Author: Katsumi Yamaoka Date: Thu Feb 9 00:41:19 2017 +0000 Make mm-shr use mail-parse-charset by default * lisp/gnus/mm-decode.el (mm-shr): Use mail-parse-charset by default. This helps an html message with no charset spec to be decoded. diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 579222f0f6..989d4b8ea1 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1793,22 +1793,23 @@ If RECURSIVE, search recursively." (buffer-string)))))) (shr-inhibit-images mm-html-inhibit-images) (shr-blocked-images mm-html-blocked-images) - charset char) + charset coding char) (unless handle (setq handle (mm-dissect-buffer t))) - (setq charset (mail-content-type-get (mm-handle-type handle) 'charset)) + (and (setq charset + (or (mail-content-type-get (mm-handle-type handle) 'charset) + mail-parse-charset)) + (setq coding (mm-charset-to-coding-system charset nil t)) + (eq coding 'ascii) + (setq coding nil)) (save-restriction (narrow-to-region (point) (point)) (shr-insert-document (mm-with-part handle (insert (prog1 - (if (and charset - (setq charset - (mm-charset-to-coding-system charset - nil t)) - (not (eq charset 'ascii))) - (decode-coding-string (buffer-string) charset) - (string-as-multibyte (buffer-string))) + (if coding + (decode-coding-string (buffer-string) coding) + (buffer-string)) (erase-buffer) (mm-enable-multibyte))) (goto-char (point-min)) commit 90f76eb3584ef1fda727bcd0dd74c5324a11a59d Author: Stephen Berman Date: Wed Feb 8 22:38:39 2017 +0100 describe-char: unambiguous name for inserting ASCII 7 * lisp/descr-text.el (describe-char): Make the input suggestion for inserting ASCII character 7 by name use the unambiguous name "BELL (BEL)" (bug#25641). diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 3971dbb86b..6a6a8ea447 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -616,10 +616,18 @@ relevant to POS." 'help-args '(,current-input-method)) "input method") (list - (let ((name - (or (get-char-code-property char 'name) - (get-char-code-property char 'old-name)))) - (if (and name (assoc-string name (ucs-names))) + (let* ((names (ucs-names)) + (name + (or (when (= char 7) + ;; Special case for "BELL" which is + ;; apparently the only char which + ;; doesn't have a new name and whose + ;; old-name is shadowed by a newer char + ;; with that name (bug#25641). + (car (rassoc char names))) + (get-char-code-property char 'name) + (get-char-code-property char 'old-name)))) + (if (and name (assoc-string name names)) (format "type \"C-x 8 RET %x\" or \"C-x 8 RET %s\"" char name) commit e3b659630843de7e459bce483c278af765c644f7 Author: Michael Albinus Date: Wed Feb 8 19:33:52 2017 +0100 Modify suppressing `vc-refresh-state' in filenotify-tests.el * test/lisp/filenotify-tests.el (file-notify-test03-autorevert): Use an advice rather than an alias for suppressing `vc-refresh-state'. diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index c024c51ce2..dcd83a3ef3 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -665,9 +665,6 @@ delivered." (setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded" auto-revert-remote-files t auto-revert-stop-on-user-input nil) -;; In the remote case, `vc-refresh-state' returns undesired error -;; messages. Let's suppress them. -(defalias 'vc-refresh-state 'ignore) (ert-deftest file-notify-test03-autorevert () "Check autorevert via file notification." @@ -679,6 +676,9 @@ delivered." buf) (unwind-protect (progn + ;; In the remote case, `vc-refresh-state' returns undesired + ;; error messages. Let's suppress them. + (advice-add 'vc-refresh-state :around 'ignore) (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) @@ -748,6 +748,7 @@ delivered." (file-notify--test-cleanup-p)) ;; Cleanup. + (advice-remove 'vc-refresh-state 'ignore) (ignore-errors (kill-buffer buf)) (file-notify--test-cleanup))))