commit b9c0ea6a6bc01c0034d00d685cab0de5953fdcc9 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Wed Dec 26 01:11:58 2018 -0800 Port message-checksum to bignums * lisp/gnus/message.el (message--rotate-fixnum-left): New function. (message-checksum): Use it instead of assuming fixnum-only arithmetic. This should fix Bug#33083. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 03f80616d9..dc15769a4f 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -5400,6 +5400,17 @@ Otherwise, generate and save a value for `canlock-password' first." (message "Denied posting -- only quoted text.") nil))))))) +(defun message--rotate-fixnum-left (n) + "Rotate the fixnum N left by one bit in a fixnum word. +The result is a fixnum." + (logior (if (natnump n) 0 1) + (ash (cond ((< (ash most-positive-fixnum -1) n) + (logior n most-negative-fixnum)) + ((< n (ash most-negative-fixnum -1)) + (logand n most-positive-fixnum)) + (n)) + 1))) + (defun message-checksum () "Return a \"checksum\" for the current buffer." (let ((sum 0)) @@ -5409,7 +5420,7 @@ Otherwise, generate and save a value for `canlock-password' first." (concat "^" (regexp-quote mail-header-separator) "$")) (while (not (eobp)) (when (not (looking-at "[ \t\n]")) - (setq sum (logxor (ash sum 1) (if (natnump sum) 0 1) + (setq sum (logxor (message--rotate-fixnum-left sum) (char-after)))) (forward-char 1))) sum)) commit bbc7015e7bcb7ed569ea4d75672fcaacbe291f06 Author: Martin Rudalics Date: Wed Dec 26 09:09:44 2018 +0100 Set up debugger buffer earlier and fit window to it (Bug#32825) * lisp/emacs-lisp/debug.el (debug): Set up debugger buffer before displaying it and advise 'display-buffer' to fit the window to it (Bug#32825). diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index b6b1f20675..5c186f7019 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -236,12 +236,33 @@ first will be printed into the backtrace buffer." ;; Place an extra debug-on-exit for macro's. (when (eq 'lambda (car-safe (cadr (backtrace-frame 4)))) (backtrace-debug 5 t))) + (with-current-buffer debugger-buffer + (unless (derived-mode-p 'debugger-mode) + (debugger-mode)) + (debugger-setup-buffer debugger-args)) + (when noninteractive + ;; If the backtrace is long, save the beginning + ;; and the end, but discard the middle. + (when (> (count-lines (point-min) (point-max)) + debugger-batch-max-lines) + (goto-char (point-min)) + (forward-line (/ 2 debugger-batch-max-lines)) + (let ((middlestart (point))) + (goto-char (point-max)) + (forward-line (- (/ 2 debugger-batch-max-lines) + debugger-batch-max-lines)) + (delete-region middlestart (point))) + (insert "...\n")) + (goto-char (point-min)) + (message "%s" (buffer-string)) + (kill-emacs -1)) (pop-to-buffer debugger-buffer `((display-buffer-reuse-window display-buffer-in-previous-window display-buffer-below-selected) . ((window-min-height . 10) + (window-height . fit-window-to-buffer) ,@(when (and (window-live-p debugger-previous-window) (frame-visible-p (window-frame debugger-previous-window))) @@ -258,25 +279,6 @@ first will be printed into the backtrace buffer." (window-total-height debugger-window))) (error nil))) (setq debugger-previous-window debugger-window)) - (unless (derived-mode-p 'debugger-mode) - (debugger-mode)) - (debugger-setup-buffer debugger-args) - (when noninteractive - ;; If the backtrace is long, save the beginning - ;; and the end, but discard the middle. - (when (> (count-lines (point-min) (point-max)) - debugger-batch-max-lines) - (goto-char (point-min)) - (forward-line (/ 2 debugger-batch-max-lines)) - (let ((middlestart (point))) - (goto-char (point-max)) - (forward-line (- (/ 2 debugger-batch-max-lines) - debugger-batch-max-lines)) - (delete-region middlestart (point))) - (insert "...\n")) - (goto-char (point-min)) - (message "%s" (buffer-string)) - (kill-emacs -1)) (message "") (let ((standard-output nil) (buffer-read-only t)) commit 092b36dbd65ce8ab8efb4562a79709b3244ca8a8 Author: Dmitry Gutov Date: Wed Dec 26 02:28:10 2018 +0200 Tone down diff-added and diff-removed in light themes * lisp/vc/diff-mode.el (diff-removed, diff-added): Tone down light background colors (bug#33567). diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 7b37bed7ae..a4c0618c67 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -302,7 +302,7 @@ well." '((default :inherit diff-changed) (((class color) (min-colors 88) (background light)) - :background "#ffdddd") + :background "#ffeeee") (((class color) (min-colors 88) (background dark)) :background "#553333") (((class color)) @@ -313,7 +313,7 @@ well." '((default :inherit diff-changed) (((class color) (min-colors 88) (background light)) - :background "#ddffdd") + :background "#eeffee") (((class color) (min-colors 88) (background dark)) :background "#335533") (((class color)) commit 4fd19c236f5647d586280b85e9606b3e5dbdff4f Author: Juri Linkov Date: Tue Dec 25 23:54:26 2018 +0200 * lisp/isearch.el (isearch-done): Reset isearch-lazy-highlight-last-string to nil (bug#33838). (isearch-lazy-highlight-new-loop) (isearch-lazy-highlight-buffer-update): Don't set arg ELLIPSIS of isearch-message to t to not reset the value of isearch-error. diff --git a/lisp/isearch.el b/lisp/isearch.el index dd0973d4ea..d2c1c150b5 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1357,6 +1357,7 @@ NOPUSH is t and EDIT is t." (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout) (isearch-dehighlight) (lazy-highlight-cleanup lazy-highlight-cleanup) + (setq isearch-lazy-highlight-last-string nil) (let ((found-start (window-group-start)) (found-point (point))) (when isearch-window-configuration @@ -3768,7 +3769,7 @@ by other Emacs features." (when isearch-lazy-count-current (setq isearch-lazy-count-current (gethash (point) isearch-lazy-count-hash 0)) - (isearch-message nil t)))) + (isearch-message)))) (defun isearch-lazy-highlight-search (string bound) "Search ahead for the next or previous match, for lazy highlighting. @@ -3971,7 +3972,7 @@ Attempt to do the search exactly the way the pending Isearch would." (setq isearch-lazy-count-total 0)) (setq isearch-lazy-count-current (gethash opoint isearch-lazy-count-hash 0)) - (isearch-message nil t)) + (isearch-message)) (setq isearch-lazy-highlight-timer (run-at-time lazy-highlight-interval nil 'isearch-lazy-highlight-buffer-update))))))))) commit f360cf9843fb56d1690cf94bdfe435ba740a992e Author: Juri Linkov Date: Tue Dec 25 23:49:13 2018 +0200 * lisp/vc/diff-mode.el (diff-syntax-fontify-hunk): Add `*' to names of ephemeral buffers like in " *org-src-fontification:%s*" from `org-src-font-lock-fontify-block'. (Bug#33567) (diff-header, diff-file-header): Tone down light background colors. diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index dd3a04b4e7..7b37bed7ae 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -272,7 +272,7 @@ well." (defface diff-header '((((class color) (min-colors 88) (background light)) - :background "grey80") + :background "grey85") (((class color) (min-colors 88) (background dark)) :background "grey45") (((class color)) @@ -282,7 +282,7 @@ well." (defface diff-file-header '((((class color) (min-colors 88) (background light)) - :background "grey70" :weight bold) + :background "grey75" :weight bold) (((class color) (min-colors 88) (background dark)) :background "grey60" :weight bold) (((class color)) @@ -2434,7 +2434,7 @@ When OLD is non-nil, highlight the hunk from the old source." (insert-file-contents file t) (setq props (diff-syntax-fontify-props file text line-nb))))) ;; Get properties from a cached revision - (let* ((buffer-name (format " diff-syntax:%s.~%s~" + (let* ((buffer-name (format " *diff-syntax:%s.~%s~*" (expand-file-name file) revision)) (buffer (gethash buffer-name diff-syntax-fontify-revisions))) (unless (and buffer (buffer-live-p buffer)) commit 9916410fa8bc765677e2d09384599aa85945967d Author: Dmitry Gutov Date: Tue Dec 25 18:23:01 2018 +0200 Prepend 'rubocop' with 'bundle exec' when appropriate diff --git a/etc/NEWS b/etc/NEWS index 34151d8caa..e427e84780 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -511,6 +511,8 @@ This enables more efficient backends. See the docstring of *** The Rubocop Flymake diagnostic function will only run Lint cops if it can't find the config file. +*** Rubocop is called with 'bundle exec' if Gemfile mentions it. + ** Package *** New function 'package-get-version' lets packages query their own version. diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 351dac2f85..d0ae9b4644 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2323,6 +2323,7 @@ If there is no Rubocop config file, Rubocop will be passed a flag (let ((command (list "rubocop" "--stdin" buffer-file-name "--format" "emacs" "--cache" "false" ; Work around a bug in old version. "--display-cop-names")) + (default-directory default-directory) config-dir) (when buffer-file-name (setq config-dir (locate-dominating-file buffer-file-name @@ -2331,7 +2332,12 @@ If there is no Rubocop config file, Rubocop will be passed a flag (setq command (append command '("--lint"))) (setq command (append command (list "--config" (expand-file-name ruby-rubocop-config - config-dir))))) + config-dir)))) + (when (ruby-flymake-rubocop--use-bundler-p config-dir) + (setq command (append '("bundle" "exec") command)) + ;; In case of a project with multiple nested subprojects, + ;; each one with a Gemfile. + (setq default-directory config-dir))) (ruby-flymake--helper "rubocop-flymake" @@ -2369,6 +2375,13 @@ If there is no Rubocop config file, Rubocop will be passed a flag into diags finally (funcall report-fn diags))))))) +(defun ruby-flymake-rubocop--use-bundler-p (dir) + (let ((file (expand-file-name "Gemfile" dir))) + (and (file-exists-p file) + (with-temp-buffer + (insert-file-contents file) + (re-search-forward "^ *gem ['\"]rubocop['\"]" nil t))))) + (defun ruby-flymake-auto (report-fn &rest args) (apply (if (and ruby-flymake-use-rubocop-if-available commit e533848dd35426f8328f3d6e290ee5c08a776553 Author: Dmitry Gutov Date: Tue Dec 25 17:32:10 2018 +0200 ; Documentation updates diff --git a/etc/NEWS b/etc/NEWS index a018bc3956..34151d8caa 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -506,6 +506,11 @@ Control whether Flymake starts checking the buffer on save. This enables more efficient backends. See the docstring of 'flymake-diagnostic-functions' or the Flymake manual for details. +** Ruby + +*** The Rubocop Flymake diagnostic function will only run Lint cops if +it can't find the config file. + ** Package *** New function 'package-get-version' lets packages query their own version. diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 2a50374765..351dac2f85 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2301,7 +2301,10 @@ It will be properly highlighted even when the call omits parens.") (defcustom ruby-flymake-use-rubocop-if-available t "Non-nil to use the RuboCop Flymake backend. -Only takes effect if RuboCop is installed." +Only takes effect if RuboCop is installed. + +If there is no Rubocop config file, Rubocop will be passed a flag +'--lint' to only show syntax errors and important problems." :version "26.1" :type 'boolean :safe 'booleanp) commit a361cc88a15e9c39f17145f9acd1ea4a8ca70461 Author: Dmitry Gutov Date: Tue Dec 25 17:08:58 2018 +0200 Use rubocop --lint when no .rubocop.yml * lisp/progmodes/ruby-mode.el (ruby-flymake-rubocop): When no config file found, only run lint cops (bug#31760). diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index d60899cf18..2a50374765 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2324,7 +2324,8 @@ Only takes effect if RuboCop is installed." (when buffer-file-name (setq config-dir (locate-dominating-file buffer-file-name ruby-rubocop-config)) - (when config-dir + (if (not config-dir) + (setq command (append command '("--lint"))) (setq command (append command (list "--config" (expand-file-name ruby-rubocop-config config-dir))))) commit 9fe788a1fa02c6b717c709773f3cca7bc8b2ebe6 Author: Michael Albinus Date: Tue Dec 25 11:08:30 2018 +0100 Provide tramp-adb-handle-make-process * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): Add `tramp-adb-handle-make-process' and `tramp-handle-start-file-process'. (tramp-adb-handle-make-process): New defun, derived from `tramp-adb-handle-start-file-process'. (Bug#28691) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 5f0b9dad31..e0bfee6839 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -144,7 +144,7 @@ It is used for TCP/IP devices." (make-directory . tramp-adb-handle-make-directory) (make-directory-internal . ignore) (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) - (make-process . ignore) + (make-process . tramp-adb-handle-make-process) (make-symbolic-link . tramp-handle-make-symbolic-link) (process-file . tramp-adb-handle-process-file) (rename-file . tramp-adb-handle-rename-file) @@ -154,7 +154,7 @@ It is used for TCP/IP devices." (set-file-times . tramp-adb-handle-set-file-times) (set-visited-file-modtime . tramp-handle-set-visited-file-modtime) (shell-command . tramp-adb-handle-shell-command) - (start-file-process . tramp-adb-handle-start-file-process) + (start-file-process . tramp-handle-start-file-process) (substitute-in-file-name . tramp-handle-substitute-in-file-name) (temporary-file-directory . tramp-handle-temporary-file-directory) (tramp-set-file-uid-gid . ignore) @@ -1017,83 +1017,120 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ;; We use BUFFER also as connection buffer during setup. Because of ;; this, its original contents must be saved, and restored once ;; connection has been setup. -(defun tramp-adb-handle-start-file-process (name buffer program &rest args) - "Like `start-file-process' for Tramp files." - (with-parsed-tramp-file-name default-directory nil - ;; When PROGRAM is nil, we should provide a tty. This is not - ;; possible here. - (unless (stringp program) - (tramp-error v 'file-error "PROGRAM must be a string")) - - (let* ((buffer - (if buffer - (get-buffer-create buffer) - ;; BUFFER can be nil. We use a temporary buffer. - (generate-new-buffer tramp-temp-buffer-name))) - (command - (format "cd %s; %s" - (tramp-shell-quote-argument localname) - (mapconcat 'tramp-shell-quote-argument - (cons program args) " "))) - (tramp-process-connection-type - (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) - - (while (get-process name1) - ;; NAME must be unique as process name. - (setq i (1+ i) - name1 (format "%s<%d>" name i))) - (setq name name1) - ;; Set the new process properties. - (tramp-set-connection-property v "process-name" name) - (tramp-set-connection-property v "process-buffer" buffer) - - (with-current-buffer (tramp-get-connection-buffer v) - (unwind-protect - ;; We catch this event. Otherwise, `start-process' could - ;; be called on the local host. - (save-excursion - (save-restriction - ;; Activate narrowing in order to save BUFFER - ;; contents. Clear also the modification time; - ;; otherwise we might be interrupted by - ;; `verify-visited-file-modtime'. - (let ((buffer-undo-list t) - (buffer-read-only nil) - (mark (point))) - (clear-visited-file-modtime) - (narrow-to-region (point-max) (point-max)) - ;; We call `tramp-adb-maybe-open-connection', in - ;; order to cleanup the prompt afterwards. - (tramp-adb-maybe-open-connection v) - (widen) - (delete-region mark (point)) - (narrow-to-region (point-max) (point-max)) - ;; Send the command. - (let ((tramp-adb-prompt (regexp-quote command))) - (tramp-adb-send-command v command)) - (let ((p (tramp-get-connection-process v))) - ;; Set query flag and process marker for this - ;; process. We ignore errors, because the process - ;; could have finished already. - (ignore-errors - (set-process-query-on-exit-flag p t) - (set-marker (process-mark p) (point))) - ;; Return process. - p)))) - - ;; Save exit. - (if (string-match-p tramp-temp-buffer-name (buffer-name)) - (ignore-errors - (set-process-buffer (tramp-get-connection-process v) nil) - (kill-buffer (current-buffer))) - (set-buffer-modified-p bmp)) - (tramp-flush-connection-property v "process-name") - (tramp-flush-connection-property v "process-buffer")))))) +(defun tramp-adb-handle-make-process (&rest args) + "Like `make-process' for Tramp files." + (when args + (with-parsed-tramp-file-name (expand-file-name default-directory) nil + (let ((name (plist-get args :name)) + (buffer (plist-get args :buffer)) + (command (plist-get args :command)) + (coding (plist-get args :coding)) + (noquery (plist-get args :noquery)) + (stop (plist-get args :stop)) + (connection-type (plist-get args :connection-type)) + (filter (plist-get args :filter)) + (sentinel (plist-get args :sentinel)) + (stderr (plist-get args :stderr))) + (unless (stringp name) + (signal 'wrong-type-argument (list 'stringp name))) + (unless (or (null buffer) (bufferp buffer) (stringp buffer)) + (signal 'wrong-type-argument (list 'stringp buffer))) + (unless (consp command) + (signal 'wrong-type-argument (list 'consp command))) + (unless (or (null coding) + (and (symbolp coding) (memq coding coding-system-list)) + (and (consp coding) + (memq (car coding) coding-system-list) + (memq (cdr coding) coding-system-list))) + (signal 'wrong-type-argument (list 'symbolp coding))) + (unless (or (null connection-type) (memq connection-type '(pipe pty))) + (signal 'wrong-type-argument (list 'symbolp connection-type))) + (unless (or (null filter) (functionp filter)) + (signal 'wrong-type-argument (list 'functionp filter))) + (unless (or (null sentinel) (functionp sentinel)) + (signal 'wrong-type-argument (list 'functionp sentinel))) + (unless (or (null stderr) (bufferp stderr) (stringp stderr)) + (signal 'wrong-type-argument (list 'stringp stderr))) + + (let* ((buffer + (if buffer + (get-buffer-create buffer) + ;; BUFFER can be nil. We use a temporary buffer. + (generate-new-buffer tramp-temp-buffer-name))) + (program (car command)) + (args (cdr command)) + (command + (format "cd %s; %s" + (tramp-shell-quote-argument localname) + (mapconcat 'tramp-shell-quote-argument + (cons program args) " "))) + (tramp-process-connection-type + (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) + + (while (get-process name1) + ;; NAME must be unique as process name. + (setq i (1+ i) + name1 (format "%s<%d>" name i))) + (setq name name1) + ;; Set the new process properties. + (tramp-set-connection-property v "process-name" name) + (tramp-set-connection-property v "process-buffer" buffer) + + (with-current-buffer (tramp-get-connection-buffer v) + (unwind-protect + ;; We catch this event. Otherwise, `make-process' + ;; could be called on the local host. + (save-excursion + (save-restriction + ;; Activate narrowing in order to save BUFFER + ;; contents. Clear also the modification time; + ;; otherwise we might be interrupted by + ;; `verify-visited-file-modtime'. + (let ((buffer-undo-list t) + (buffer-read-only nil) + (mark (point))) + (clear-visited-file-modtime) + (narrow-to-region (point-max) (point-max)) + ;; We call `tramp-adb-maybe-open-connection', in + ;; order to cleanup the prompt afterwards. + (tramp-adb-maybe-open-connection v) + (widen) + (delete-region mark (point)) + (narrow-to-region (point-max) (point-max)) + ;; Send the command. + (let ((tramp-adb-prompt (regexp-quote command))) + (tramp-adb-send-command v command)) + (let ((p (tramp-get-connection-process v))) + ;; Stop process if indicated. + (when stop + (stop-process p)) + ;; Set sentinel and filter. + (when sentinel + (set-process-sentinel p sentinel)) + (when filter + (set-process-filter p filter)) + ;; Set query flag and process marker for this + ;; process. We ignore errors, because the + ;; process could have finished already. + (ignore-errors + (set-process-query-on-exit-flag p (null noquery)) + (set-marker (process-mark p) (point))) + ;; Return process. + p)))) + + ;; Save exit. + (if (string-match-p tramp-temp-buffer-name (buffer-name)) + (ignore-errors + (set-process-buffer (tramp-get-connection-process v) nil) + (kill-buffer (current-buffer))) + (set-buffer-modified-p bmp)) + (tramp-flush-connection-property v "process-name") + (tramp-flush-connection-property v "process-buffer")))))))) (defun tramp-adb-handle-exec-path () "Like `exec-path' for Tramp files."