commit a8d17f35a29d9875e94e28c8405d350b57fd1e80 (HEAD, refs/remotes/origin/master) Author: Alan Mackenzie Date: Fri May 10 07:28:54 2019 +0000 Make uncomment-region remove obtrusive spaces before tabs. These spaces were typically inserted earlier by comment-region. This patch makes these two complementary functions closer to inverses. * lisp/newcomment.el (uncomment-region-default-1): Remove spaces before a tab where the comment opener has just been removed. diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 9d919ccbbe..ab2be080a3 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -1001,7 +1001,15 @@ This function is the default value of `uncomment-region-function'." (re-search-forward sre (line-end-position) t)) (replace-match "" t t nil (if (match-end 2) 2 1))))) ;; Go to the end for the next comment. - (goto-char (point-max)))))) + (goto-char (point-max))) + ;; Remove any obtrusive spaces left preceding a tab at `spt'. + (when (and (eq (char-after spt) ?\t) (eq (char-before spt) ? ) + (> tab-width 0)) + (save-excursion + (goto-char spt) + (let* ((fcol (current-column)) + (slim (- (point) (mod fcol tab-width)))) + (delete-char (- (skip-chars-backward " " slim))))))))) (set-marker end nil)) (defun uncomment-region-default (beg end &optional arg) commit eda8ea685802e4e07e28351f65b5e24661a384fe Author: Michael Heerdegen Date: Mon May 6 14:58:24 2019 +0200 Fix alist-get gv setter not returning VAL This fixes Bug#35546. * lisp/emacs-lisp/gv.el (alist-get): Make setter return the set value to preserve 'setf' semantics. diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index 4ea3ce84fc..bdd1574820 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -392,18 +392,20 @@ The return value is the last VAL in the list. ,(funcall setter `(cons (setq ,p (cons ,k ,v)) ,getter))))) - (cond - ((null remove) set-exp) - ((or (eql v default) - (and (eq (car-safe v) 'quote) - (eq (car-safe default) 'quote) - (eql (cadr v) (cadr default)))) - `(if ,p ,(funcall setter `(delq ,p ,getter)))) - (t - `(cond - ((not (eql ,default ,v)) ,set-exp) - (,p ,(funcall setter - `(delq ,p ,getter))))))))))))))) + `(progn + ,(cond + ((null remove) set-exp) + ((or (eql v default) + (and (eq (car-safe v) 'quote) + (eq (car-safe default) 'quote) + (eql (cadr v) (cadr default)))) + `(if ,p ,(funcall setter `(delq ,p ,getter)))) + (t + `(cond + ((not (eql ,default ,v)) ,set-exp) + (,p ,(funcall setter + `(delq ,p ,getter)))))) + ,v)))))))))) ;;; Some occasionally handy extensions. commit d2bd9958bd7cf7d0e8fd7e405173cd62e979d251 Author: Stefan Monnier Date: Thu May 9 10:32:25 2019 -0400 * lisp/mail/footnote.el: Avoid regexp-opt-charset, which is not autoloaded. (footnote-hebrew-numeric-regex): Use rx-to-string instead. diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el index 327eda11dc..a1bbf7369b 100644 --- a/lisp/mail/footnote.el +++ b/lisp/mail/footnote.el @@ -348,7 +348,7 @@ Use Unicode characters for footnoting." (defconst footnote-hebrew-numeric-regex (let ((numchars (string-to-list (apply #'concat (apply #'append footnote-hebrew-numeric))))) - (concat (regexp-opt-charset (cons ?' numchars)) "+"))) + (rx-to-string `(1+ (in ?' ,@numchars))))) ;; (defconst footnote-hebrew-numeric-regex "\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?") (defun footnote--hebrew-numeric (n) commit eb1698c54ab2e907d4912db46b8a3da9490d0482 Author: Michael Albinus Date: Thu May 9 14:24:22 2019 +0200 Fix an error in tramp-vc-file-name-handler * lisp/net/tramp.el (tramp-accept-process-output, tramp-send-string): * lisp/net/tramp-adb.el (tramp-adb-handle-make-process): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band) (tramp-sh-handle-make-process): * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory) (tramp-smb-handle-file-acl, tramp-smb-handle-process-file) (tramp-smb-handle-set-file-acl) (tramp-smb-handle-start-file-process): Do not suppress timers. * lisp/net/tramp-sh.el (tramp-vc-file-name-handler): Check, that `tramp-file-name-for-operation' returns a proper Tramp file. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index bd66ab4456..008a5cedd8 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -975,9 +975,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (or (null program) tramp-process-connection-type)) (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) (name1 name) - (i 0) - ;; We do not want to run timers. - timer-list timer-idle-list) + (i 0)) (while (get-process name1) ;; NAME must be unique as process name. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index c4c439885c..b9df403309 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2417,9 +2417,7 @@ The method used must be an out-of-band method." ;; The default directory must be remote. (let ((default-directory (file-name-directory (if t1 filename newname))) - (process-environment (copy-sequence process-environment)) - ;; We do not want to run timers. - timer-list timer-idle-list) + (process-environment (copy-sequence process-environment))) ;; Set the transfer process properties. (tramp-set-connection-property v "process-name" (buffer-name (current-buffer))) @@ -2878,8 +2876,6 @@ the result will be a local, non-Tramp, file name." ;; has been started several times in `eshell' and ;; friends. tramp-current-connection - ;; We do not want to run timers. - timer-list timer-idle-list p) (while (get-process name1) @@ -3550,24 +3546,29 @@ Fall back to normal file name handler if no Tramp handler exists." (tramp-replace-environment-variables (apply #'tramp-file-name-for-operation operation args))) (fn (assoc operation tramp-sh-file-name-handler-alist))) - (with-parsed-tramp-file-name filename nil - (cond - ;; That's what we want: file names, for which checks are - ;; applied. We assume that VC uses only `file-exists-p' and - ;; `file-readable-p' checks; otherwise we must extend the - ;; list. We do not perform any action, but return nil, in - ;; order to keep `vc-registered' running. - ((and fn (memq operation '(file-exists-p file-readable-p))) - (add-to-list 'tramp-vc-registered-file-names localname 'append) - nil) - ;; `process-file' and `start-file-process' shall be ignored. - ((and fn (eq operation 'process-file) 0)) - ((and fn (eq operation 'start-file-process) nil)) - ;; Tramp file name handlers like `expand-file-name'. They - ;; must still work. - (fn (save-match-data (apply (cdr fn) args))) - ;; Default file name handlers, we don't care. - (t (tramp-run-real-handler operation args))))))) + (if (tramp-tramp-file-p filename) + (with-parsed-tramp-file-name filename nil + (cond + ;; That's what we want: file names, for which checks are + ;; applied. We assume that VC uses only `file-exists-p' + ;; and `file-readable-p' checks; otherwise we must extend + ;; the list. We do not perform any action, but return + ;; nil, in order to keep `vc-registered' running. + ((and fn (memq operation '(file-exists-p file-readable-p))) + (add-to-list 'tramp-vc-registered-file-names localname 'append) + nil) + ;; `process-file' and `start-file-process' shall be ignored. + ((and fn (eq operation 'process-file) 0)) + ((and fn (eq operation 'start-file-process) nil)) + ;; Tramp file name handlers like `expand-file-name'. They + ;; must still work. + (fn (save-match-data (apply (cdr fn) args))) + ;; Default file name handlers, we don't care. + (t (tramp-run-real-handler operation args)))) + + ;; When `tramp-mode' is not enabled, or the file name is + ;; quoted, we don't do anything. + (tramp-run-real-handler operation args))))) (defun tramp-sh-handle-file-notify-add-watch (file-name flags _callback) "Like `file-notify-add-watch' for Tramp files." diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 66476305c2..9d15c0562b 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -452,9 +452,7 @@ pass to the OPERATION." (expand-file-name tramp-temp-name-prefix (tramp-compat-temporary-file-directory)))) - (args (list (concat "//" host "/" share) "-E")) - ;; We do not want to run timers. - timer-list timer-idle-list) + (args (list (concat "//" host "/" share) "-E"))) (if (not (zerop (length user))) (setq args (append args (list "-U" user))) @@ -742,9 +740,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (let* ((share (tramp-smb-get-share v)) (localname (replace-regexp-in-string "\\\\" "/" (tramp-smb-get-localname v))) - (args (list (concat "//" host "/" share) "-E")) - ;; We do not want to run timers. - timer-list timer-idle-list) + (args (list (concat "//" host "/" share) "-E"))) (if (not (zerop (length user))) (setq args (append args (list "-U" user))) @@ -1218,8 +1214,6 @@ component is used as the target of the symlink." (let* ((name (file-name-nondirectory program)) (name1 name) (i 0) - ;; We do not want to run timers. - timer-list timer-idle-list input tmpinput outbuf command ret) ;; Determine input. @@ -1395,9 +1389,7 @@ component is used as the target of the symlink." "\\\\" "/" (tramp-smb-get-localname v))) (args (list (concat "//" host "/" share) "-E" "-S" (replace-regexp-in-string - "\n" "," acl-string))) - ;; We do not want to run timers. - timer-list timer-idle-list) + "\n" "," acl-string)))) (if (not (zerop (length user))) (setq args (append args (list "-U" user))) @@ -1477,9 +1469,7 @@ component is used as the target of the symlink." (command (mapconcat #'identity (cons program args) " ")) (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) (name1 name) - (i 0) - ;; We do not want to run timers. - timer-list timer-idle-list) + (i 0)) (unwind-protect (save-excursion (save-restriction diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 1f83756c32..0a3129fd45 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3640,7 +3640,8 @@ support symbolic links." (if (and (not current-buffer-p) (integerp asynchronous)) (let ((tramp-remote-process-environment - ;; `async-shell-command-width' has been introduced with Emacs 27.1. + ;; `async-shell-command-width' has been introduced with + ;; Emacs 27.1. (if (natnump (bound-and-true-p async-shell-command-width)) (cons (format "COLUMNS=%d" (bound-and-true-p async-shell-command-width)) @@ -4087,15 +4088,7 @@ for process communication also." (with-current-buffer (process-buffer proc) (let ((inhibit-read-only t) last-coding-system-used - ;; We do not want to run timers. - (tl timer-list) - (stimers (with-timeout-suspend)) - timer-list timer-idle-list result) - ;; Enable our progress reporter. - (dolist (timer tl) - (if (eq (timer--function timer) #'tramp-progress-reporter-update) - (push timer timer-list))) ;; JUST-THIS-ONE is set due to Bug#12145. (tramp-message proc 10 "%s %s %s %s\n%s" @@ -4103,8 +4096,6 @@ for process communication also." (with-local-quit (setq result (accept-process-output proc timeout nil t))) (buffer-string)) - ;; Reenable the timers. - (with-timeout-unsuspend stimers) result))) (defun tramp-check-for-regexp (proc regexp) @@ -4185,20 +4176,12 @@ The STRING is expected to use Unix line-endings, but the lines sent to the remote host use line-endings as defined in the variable `tramp-rsh-end-of-line'. The communication buffer is erased before sending." (let* ((p (tramp-get-connection-process vec)) - (chunksize (tramp-get-connection-property p "chunksize" nil)) - ;; We do not want to run timers. - (tl timer-list) - (stimers (with-timeout-suspend)) - timer-list timer-idle-list) + (chunksize (tramp-get-connection-property p "chunksize" nil))) (unless p (tramp-error vec 'file-error "Can't send string to remote host -- not logged in")) (tramp-set-connection-property p "last-cmd-time" (current-time)) (tramp-message vec 10 "%s" string) - ;; Enable our progress reporter. - (dolist (timer tl) - (if (eq (timer--function timer) #'tramp-progress-reporter-update) - (push timer timer-list))) (with-current-buffer (tramp-get-connection-buffer vec) ;; Clean up the buffer. We cannot call `erase-buffer' because ;; narrowing might be in effect. @@ -4222,9 +4205,7 @@ the remote host use line-endings as defined in the variable (process-send-string p (substring string pos (min (+ pos chunksize) end))) (setq pos (+ pos chunksize)))) - (process-send-string p string))) - ;; Reenable the timers. - (with-timeout-unsuspend stimers)))) + (process-send-string p string)))))) (defun tramp-process-sentinel (proc event) "Flush file caches and remove shell prompt." commit 4255f0fcaeccf49c6aee8c05e878288b4980337b Author: Michael Albinus Date: Thu May 9 14:23:07 2019 +0200 * test/lisp/net/tramp-tests.el (cl-lib): Require instead of cl-seq. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index cce4d4e289..75c7ac6ca4 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -41,7 +41,7 @@ ;;; Code: -(require 'cl-seq) +(require 'cl-lib) (require 'dired) (require 'ert) (require 'ert-x)