commit 7575ba254c884c89a3ed9b1b2c2bd73c079d98ee (HEAD, refs/remotes/origin/master) Author: Michael Albinus Date: Sun Apr 3 10:18:40 2016 +0200 Fix Bug#23186 * lisp/net/tramp.el (tramp-encoding-command-switch) (tramp-encoding-command-interactive): * lisp/net/tramp-sh.el (tramp-maybe-open-connection): `tramp-encoding-shell' could be nil. (Bug#23186) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index dbaa73f..2667aaf 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4783,6 +4783,8 @@ connection if a previous connection has died for some reason." (setenv "HISTSIZE" "0")))) (setenv "PROMPT_COMMAND") (setenv "PS1" tramp-initial-end-of-output) + (unless (stringp tramp-encoding-shell) + (tramp-error vec 'file-error "`tramp-encoding-shell' not set")) (let* ((target-alist (tramp-compute-multi-hops vec)) ;; We will apply `tramp-ssh-controlmaster-options' ;; only for the first hop. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index f03ec55..fc194fa 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -146,7 +146,7 @@ use for the remote host." :type '(file :must-match t)) (defcustom tramp-encoding-command-switch - (if (string-match "cmd\\.exe" tramp-encoding-shell) + (if (string-match "cmd\\.exe" (or tramp-encoding-shell "")) "/c" "-c") "Use this switch together with `tramp-encoding-shell' for local commands. @@ -155,7 +155,7 @@ See the variable `tramp-encoding-shell' for more information." :type 'string) (defcustom tramp-encoding-command-interactive - (unless (string-match "cmd\\.exe" tramp-encoding-shell) "-i") + (unless (string-match "cmd\\.exe" (or tramp-encoding-shell "")) "-i") "Use this switch together with `tramp-encoding-shell' for interactive shells. See the variable `tramp-encoding-shell' for more information." :version "24.1" commit 7032e03d60a0e3a6e1466d8c55baa00c4bfc5fea Author: Michael Albinus Date: Sun Apr 3 10:14:56 2016 +0200 Fix Bug#22145 * lisp/net/tramp-cache.el (tramp-get-connection-property) (tramp-set-connection-property, tramp-connection-property-p) (tramp-flush-connection-property): Improve docstring. * lisp/net/tramp-sh.el (tramp-maybe-open-connection): Use it. * lisp/net/tramp.el (tramp-get-local-locale): New defun. * test/automated/tramp-tests.el (tramp--test-utf8): Improve settings of coding systems. (Bug#22145) diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 92f66f4..158cfb5 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -223,8 +223,10 @@ This is suppressed for temporary buffers." ;;;###tramp-autoload (defun tramp-get-connection-property (key property default) "Get the named PROPERTY for the connection. -KEY identifies the connection, it is either a process or a vector. -If the value is not set for the connection, returns DEFAULT." +KEY identifies the connection, it is either a process or a +vector. A special case is nil, which is used to cache connection +properties of the local machine. If the value is not set for the +connection, returns DEFAULT." ;; Unify key by removing localname and hop from vector. Work with a ;; copy in order to avoid side effects. (when (vectorp key) @@ -241,8 +243,10 @@ If the value is not set for the connection, returns DEFAULT." ;;;###tramp-autoload (defun tramp-set-connection-property (key property value) "Set the named PROPERTY of a connection to VALUE. -KEY identifies the connection, it is either a process or a vector. -PROPERTY is set persistent when KEY is a vector." +KEY identifies the connection, it is either a process or a +vector. A special case is nil, which is used to cache connection +properties of the local machine. PROPERTY is set persistent when +KEY is a vector." ;; Unify key by removing localname and hop from vector. Work with a ;; copy in order to avoid side effects. (when (vectorp key) @@ -258,13 +262,17 @@ PROPERTY is set persistent when KEY is a vector." ;;;###tramp-autoload (defun tramp-connection-property-p (key property) "Check whether named PROPERTY of a connection is defined. -KEY identifies the connection, it is either a process or a vector." +KEY identifies the connection, it is either a process or a +vector. A special case is nil, which is used to cache connection +properties of the local machine." (not (eq (tramp-get-connection-property key property 'undef) 'undef))) ;;;###tramp-autoload (defun tramp-flush-connection-property (key) "Remove all properties identified by KEY. -KEY identifies the connection, it is either a process or a vector." +KEY identifies the connection, it is either a process or a +vector. A special case is nil, which is used to cache connection +properties of the local machine." ;; Unify key by removing localname and hop from vector. Work with a ;; copy in order to avoid side effects. (when (vectorp key) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 7260107..dbaa73f 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4773,7 +4773,7 @@ connection if a previous connection has died for some reason." (when (and p (processp p)) (delete-process p)) (setenv "TERM" tramp-terminal-type) - (setenv "LC_ALL" "en_US.utf8") + (setenv "LC_ALL" (tramp-get-local-locale vec)) (if (stringp tramp-histfile-override) (setenv "HISTFILE" tramp-histfile-override) (if tramp-histfile-override diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 3b8510e..f03ec55 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3747,6 +3747,26 @@ This is used internally by `tramp-file-mode-from-int'." (tramp-compat-funcall 'group-gid) (nth 3 (file-attributes "~/" id-format)))) +(defun tramp-get-local-locale (&optional vec) + ;; We use key nil for local connection properties. + (with-tramp-connection-property nil "locale" + (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8")) + locale) + (with-temp-buffer + (unless (or (memq system-type '(windows-nt)) + (not (zerop (tramp-call-process + nil "locale" nil t nil "-a")))) + (while candidates + (goto-char (point-min)) + (if (string-match (format "^%s\r?$" (regexp-quote (car candidates))) + (buffer-string)) + (setq locale (car candidates) + candidates nil) + (setq candidates (cdr candidates)))))) + ;; Return value. + (when vec (tramp-message vec 7 "locale %s" (or locale "C"))) + (or locale "C")))) + ;;;###tramp-autoload (defun tramp-check-cached-permissions (vec access) "Check `file-attributes' caches for VEC. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index a29e42e..a12ee38 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -2033,9 +2033,12 @@ Use the `ls' command." (defun tramp--test-utf8 () "Perform the test in `tramp-test32-utf8*'." - (let ((coding-system-for-read 'utf-8) - (coding-system-for-write 'utf-8) - (file-name-coding-system 'utf-8)) + (let* ((utf8 (if (and (eq system-type 'darwin) + (memq 'utf-8-hfs (coding-system-list))) + 'utf-8-hfs 'utf-8)) + (coding-system-for-read utf8) + (coding-system-for-write utf8) + (file-name-coding-system utf8)) (tramp--test-check-files (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ") (unless (tramp--test-hpux-p) commit d6e164af0211eb18fad654d777549a019776e9ba Merge: 3d88977 ed19f20 Author: John Wiegley Date: Sat Apr 2 14:51:34 2016 -0700 ; Merge from origin/emacs-25 The following commit was skipped: ed19f20 Merge branch 'emacs-25' of /home/acm/emacs/emacs.git/emacs-25... commit 3d889773617a882fbee5992960cfe18866cddc34 Merge: f822480 7c1802f Author: John Wiegley Date: Sat Apr 2 14:51:33 2016 -0700 Merge from origin/emacs-25 7c1802f * doc/lispref/text.texi (Columns): Remove a nonexistent refer... 9034c50 * doc/man/emacsclient.1: Document +line:column option. 06495c9 Fix rare problems with echo-area display and multiple frames f99b512 In M-%, avoid making buffer-local binding of text-property-de... commit f82248004d0f5ef84bbe03d83467bb3c43afa765 Merge: c558890 124c486 Author: John Wiegley Date: Sat Apr 2 14:51:33 2016 -0700 ; Merge from origin/emacs-25 The following commit was skipped: 124c486 Remove prog-indentation-context commit c558890bde00f4b5079edd2c1d0d51086af3b13b Merge: 52c7b77 e65c307 Author: John Wiegley Date: Sat Apr 2 14:51:33 2016 -0700 Merge from origin/emacs-25 e65c307 * src/font.c (QCuser_spec): Add missing colon to :user-spec. c8b868b Don't start the 'midnight' timer twice 278c8a7 * src/xwidget.c (Fxwidget_resize): Fix inappropriate use of X... e5c17f4 Fix todo-mode category movement bc70fda * lisp/xt-mouse.el (xterm-mouse-utf-8): Add :version. cf40f38 Ignore non-nil. non-cons values of unread-command-events 8ee4c52 Improve documentatuon of 'truncate-partial-width-windows' fb9a62c * src/ftfont.c (ftfont_shape_by_flt): Parenthesize as per GNU... 1e1ea22 Fix 'dired-goto-file' in Dired buffers produced by find-dired 3a13472 Fix map-put and map-delete for alists (Bug#23105) 422c3da Minor copyedits of documentation for temporary displays 90fb9b3 Add customization option for using UTF-8 coordinates in xt-mouse f14d463 Minor doc string fixes in replace.el e70ee9d Fix scrolling upwards with 'xwidget-webkit-browse-url' 44782de Fix display of Indic scripts 326c64f Fix splash screen display at startup 7ab2a97 ; In NEWS mention new display of minibuffer completions window a1cd84c Describe temporary displays in Emacs manual 5ec1056 Avoid stray As next to IDLW icons 45577d5 Avoid GTK 3 crash with icons and masks e99ff6e * lisp/minibuffer.el (minibuffer-completion-help): Use fit-wi... 077b78c Define make_save_ptr_ptr unconditionally 20a1003 Preserve current buffer when popping up TTY menus 7eba90c Improve font selection by family on MS-Windows 73d213f Comint, term, and compile now set EMACS 9524ec5 Ignore more merges when generating ChangeLog ad250f2 Sync with gnulib c0165ea Resurrect GNUS-NEWS autogeneration 1e5327c ; Backport ChangeLog.2 fixes from master e643977 Make `toggle-frame-maximized' respect the dock on OS X (bug#2... 38a43f1 Fix bug in displaying header line with a box face 91e6676 Fix an Isearch var to be a string (Bug#23038) 76ef522 Fix (args-out-of-range 1) error in cursor-sensor--detect 8a35f83 Render empty
    • correctly d8b2ce5 Ignore invalid base64 encoded embedded images 52ba24b Fix

      and

      newlines with or without
    • in shr b8ea08b Avoid errors in 'newline' fc3cd53 Fix Bug#23032 dd2737b Adjudicate review comments in abbrevs.texi 26f9c50 Fixup the "normal" matcher; highlight global var symbols, too 413e73b ; Small theme additions cd950da Honor prefix arg in doc-view-next-line-or-next-page ed909c0 ; Spelling fixes 6da3a6d Port to strict C99 offsetof de7601f Port to GTK with strict C11 compiler 658aa2d Port to GTK with strict C99 compiler 1df7173 Avoid screen artifacts with new OS X visible bell after scrol... 7a2edd3 Merge branch 'emacs-25' of git.sv.gnu.org:/srv/git/emacs into... dca240a Suppress some Tramp tests for OSX, do not merge with master 9094304 * lisp/progmodes/xref.el (xref-buffer-name, xref--window): Mo... cbedfc2 * lisp/gnus/mm-decode.el (gnus-format-message): Autoload it. 005ac7c * lisp/mail/rmail.el (rmail-mime-entity-truncated): Declare. 9ab03f2 ; Auto-commit of loaddefs files. 56df617 Address compilation warnings due to 2016-01-03 mml refactoring. a1ef911 * lisp/emacs-lisp/smie.el (smie-indent-keyword): Don't burp i... 79ae7fb * lisp/dired-x.el (dired-omit-here-always): Correct error mes... 253929f * lisp/dired-x.el (dired-omit-here-always): Replace undefined... ce53389 * lisp/xml.el (xml-parse-tag-1): Replace undefined function. d6d164f Avoid segfaults due to frame image cache being absent bc7f6f6 Improve documentation of glyphless-character display 6b6916e ; * src/xdisp.c (with_echo_area_buffer): Fix typos in comments. ee9a1f7 Support safe navigation operator in non-SMIE indentation code c3ed95b Move xsd:base64Binary decoding fix to debbugs.el 0.9.1 2036be4 Fix Ruby's operator precedence 1d686c2 (ruby-interpolation-inside-another-interpolation): New failin... 7950e1d Port to clang 3.7.0 on x86-64 218ae59 * test/automated/package-test.el (package-test-signed): Tweak... ba33b7c Sync with gnulib 38b276d Fix startup of "emacs -nw" on systems that CANNOT_DUMP dbfbedd Do not tokenize a comment before continuation as ';' 0403620 Don't misindent arguments of a method call inside continuation e6776f8 * src/keyboard.c (echo_keystrokes_p): Don't test cursor_in_ec... 8475f3d ASCII-only etc/NEWS etc. 5cc6919 Fix a cacheing bug, which led to inordinately slow c-beginnin... 0ce37ea Fix Isearch prompt when invoked with an argument f3033d4 Fix a typo in the Emacs manual 4235d2d Curved quotes in etc/NEWS etc. 26b56dc Fix some single quotes in documentation 80ec484 Make lisp-completion-at-point's argument optional 9d463ae Tweak the left precedence of '=>' 5b705bc Indent '.' relative to the first sibling expression 04f5525 Make '.' associative, for easier sexp navigation ba24c99 Revert "Simplify "Visit New File" to "New File"" commit 52c7b770d5f3d9deedf47fec4a23190d48bd62a1 Author: Stefan Monnier Date: Sat Apr 2 15:38:54 2016 -0400 * lisp/erc/erc-backend.el: Use lexical-binding. Silence byte-compiler Use #' to quote functions. (erc-server-delayed-reconnect): Remove unused arg `event'. (erc-process-sentinel-2): Adjust accordingly. Don't pass `err' to condition-case if we don't use it. (define-erc-response-handler): Use add-hook rather than add-to-list. (NICK): Use cl-pushnew rather than add-to-list. (331): Remove unused var `topic'. (352): Remove unused var `hopcount'. diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 46e6d89..bbb7ccb 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -1,4 +1,4 @@ -;;; erc-backend.el --- Backend network communication for ERC +;;; erc-backend.el --- Backend network communication for ERC -*- lexical-binding:t -*- ;; Copyright (C) 2004-2016 Free Software Foundation, Inc. @@ -376,7 +376,7 @@ alist." :type '(repeat (cons (string :tag "Target") coding-system))) -(defcustom erc-server-connect-function 'erc-open-network-stream +(defcustom erc-server-connect-function #'erc-open-network-stream "Function used to initiate a connection. It should take same arguments as `open-network-stream' does." :group 'erc-server @@ -574,8 +574,8 @@ We will store server variables in the buffer given by BUFFER." (when (fboundp 'set-process-coding-system) (set-process-coding-system process 'raw-text)) ;; process handlers - (set-process-sentinel process 'erc-process-sentinel) - (set-process-filter process 'erc-server-filter-function) + (set-process-sentinel process #'erc-process-sentinel) + (set-process-filter process #'erc-server-filter-function) (set-process-buffer process buffer) (erc-log "\n\n\n********************************************\n") (message "%s" (erc-format-message @@ -603,11 +603,11 @@ Make sure you are in an ERC buffer when running this." (setq erc-server-last-sent-time 0) (setq erc-server-lines-sent 0) (let ((erc-server-connect-function (or erc-session-connector - 'erc-open-network-stream))) + #'erc-open-network-stream))) (erc-open erc-session-server erc-session-port erc-server-current-nick erc-session-user-full-name t erc-session-password))))) -(defun erc-server-delayed-reconnect (event buffer) +(defun erc-server-delayed-reconnect (buffer) (if (buffer-live-p buffer) (with-current-buffer buffer (erc-server-reconnect)))) @@ -676,18 +676,18 @@ EVENT is the message received from the closed connection process." (erc-update-mode-line) (set-buffer-modified-p nil)) ;; reconnect - (condition-case err + (condition-case nil (progn (setq erc-server-reconnecting nil erc-server-reconnect-count (1+ erc-server-reconnect-count)) (setq delay erc-server-reconnect-timeout) (run-at-time delay nil - #'erc-server-delayed-reconnect event buffer)) + #'erc-server-delayed-reconnect buffer)) (error (unless (integerp erc-server-reconnect-attempts) (message "%s ... %s" "Reconnecting until we succeed" "kill the ERC server buffer to stop")) - (erc-server-delayed-reconnect event buffer)))))))) + (erc-server-delayed-reconnect buffer)))))))) (defun erc-process-sentinel-1 (event buffer) "Called when `erc-process-sentinel' has decided that we're disconnecting. @@ -810,7 +810,7 @@ protection algorithm." (+ erc-server-flood-penalty erc-server-flood-last-message)) (erc-log-irc-protocol str 'outbound) - (condition-case err + (condition-case nil (progn ;; Set encoding just before sending the string (when (fboundp 'set-process-coding-system) @@ -877,7 +877,7 @@ protection algorithm." (erc-log (concat "erc-server-send-queue: " msg "(" (buffer-name buffer) ")")) (when (erc-server-process-alive) - (condition-case err + (condition-case nil ;; Set encoding just before sending the string (progn (when (fboundp 'set-process-coding-system) @@ -1068,7 +1068,7 @@ Finds hooks by looking in the `erc-server-responses' hashtable." (erc-with-server-buffer (run-hook-with-args 'erc-timer-hook (erc-current-time))))) -(add-hook 'erc-default-server-functions 'erc-handle-unknown-server-response) +(add-hook 'erc-default-server-functions #'erc-handle-unknown-server-response) (defun erc-handle-unknown-server-response (proc parsed) "Display unknown server response's message." @@ -1076,7 +1076,7 @@ Finds hooks by looking in the `erc-server-responses' hashtable." " " (erc-response.command parsed) " " - (mapconcat 'identity (erc-response.command-args parsed) + (mapconcat #'identity (erc-response.command-args parsed) " ")))) (erc-display-message parsed 'notice proc line))) @@ -1207,10 +1207,11 @@ add things to `%s' instead." ;; value at this point, so I default to nil, and (add-hook) ;; unconditionally (defvar ,hook-name nil ,(format hook-doc name)) - (add-to-list ',hook-name ',fn-name) + (add-hook ',hook-name #',fn-name) ;; Handler function (defun ,fn-name (proc parsed) ,fn-doc + (ignore proc parsed) ,@fn-body) ;; Make find-function and find-variable find them @@ -1323,7 +1324,7 @@ add things to `%s' instead." (define-erc-response-handler (MODE) "Handle server mode changes." nil (let ((tgt (car (erc-response.command-args parsed))) - (mode (mapconcat 'identity (cdr (erc-response.command-args parsed)) + (mode (mapconcat #'identity (cdr (erc-response.command-args parsed)) " "))) (pcase-let ((`(,nick ,login ,host) (erc-parse-user (erc-response.sender parsed)))) @@ -1365,11 +1366,11 @@ add things to `%s' instead." (cons nn (cdr erc-default-recipients))) (rename-buffer nn t) ; bug#12002 (erc-update-mode-line) - (add-to-list 'bufs (current-buffer))))) + (cl-pushnew (current-buffer) bufs)))) (erc-update-user-nick nick nn host nil nil login) (cond ((string= nick (erc-current-nick)) - (add-to-list 'bufs (erc-server-buffer)) + (cl-pushnew (erc-server-buffer) bufs) (erc-set-current-nick nn) (erc-update-mode-line) (setq erc-nick-change-attempt-count 0) @@ -1490,7 +1491,7 @@ add things to `%s' instead." ;; FIXME: need clean way of specifying extra hooks in ;; define-erc-response-handler. -(add-hook 'erc-server-PRIVMSG-functions 'erc-auto-query) +(add-hook 'erc-server-PRIVMSG-functions #'erc-auto-query) (define-erc-response-handler (QUIT) "Another user has quit IRC." nil @@ -1521,7 +1522,7 @@ add things to `%s' instead." (define-erc-response-handler (WALLOPS) "Display a WALLOPS message." nil (let ((message (erc-response.contents parsed))) - (pcase-let ((`(,nick ,login ,host) + (pcase-let ((`(,nick ,_login ,_host) (erc-parse-user (erc-response.sender parsed)))) (erc-display-message parsed 'notice nil @@ -1573,7 +1574,7 @@ certain commands are accepted and more. See documentation for A server may send more than one 005 message." nil - (let ((line (mapconcat 'identity + (let ((line (mapconcat #'identity (setf (erc-response.command-args parsed) (cdr (erc-response.command-args parsed))) " "))) @@ -1592,7 +1593,7 @@ A server may send more than one 005 message." (define-erc-response-handler (221) "Display the current user modes." nil (let* ((nick (car (erc-response.command-args parsed))) - (modes (mapconcat 'identity + (modes (mapconcat #'identity (cdr (erc-response.command-args parsed)) " "))) (erc-set-modes nick modes) (erc-display-message parsed 'notice 'active 's221 ?n nick ?m modes))) @@ -1620,12 +1621,12 @@ See `erc-display-server-message'." nil (define-erc-response-handler (275) "Display secure connection message." nil - (pcase-let ((`(,nick ,user ,message) + (pcase-let ((`(,nick ,_user ,_message) (cdr (erc-response.command-args parsed)))) (erc-display-message parsed 'notice 'active 's275 ?n nick - ?m (mapconcat 'identity (cddr (erc-response.command-args parsed)) + ?m (mapconcat #'identity (cddr (erc-response.command-args parsed)) " ")))) (define-erc-response-handler (290) @@ -1656,12 +1657,12 @@ See `erc-display-server-message'." nil (define-erc-response-handler (307) "Display nick-identified message." nil - (pcase-let ((`(,nick ,user ,message) + (pcase-let ((`(,nick ,_user ,_message) (cdr (erc-response.command-args parsed)))) (erc-display-message parsed 'notice 'active 's307 ?n nick - ?m (mapconcat 'identity (cddr (erc-response.command-args parsed)) + ?m (mapconcat #'identity (cddr (erc-response.command-args parsed)) " ")))) (define-erc-response-handler (311 314) @@ -1735,12 +1736,12 @@ See `erc-display-server-message'." nil "Display a message for the 321 event." (erc-display-message parsed 'notice proc 's321) nil) -(add-hook 'erc-server-321-functions 'erc-server-321-message t) +(add-hook 'erc-server-321-functions #'erc-server-321-message t) (define-erc-response-handler (322) "LIST notice." nil (let ((topic (erc-response.contents parsed))) - (pcase-let ((`(,channel ,num-users) + (pcase-let ((`(,channel ,_num-users) (cdr (erc-response.command-args parsed)))) (add-to-list 'erc-channel-list (list channel)) (erc-update-channel-topic channel topic)))) @@ -1753,12 +1754,12 @@ See `erc-display-server-message'." nil (erc-display-message parsed 'notice proc 's322 ?c channel ?u num-users ?t (or topic ""))))) -(add-hook 'erc-server-322-functions 'erc-server-322-message t) +(add-hook 'erc-server-322-functions #'erc-server-322-message t) (define-erc-response-handler (324) "Channel or nick modes." nil (let ((channel (cadr (erc-response.command-args parsed))) - (modes (mapconcat 'identity (cddr (erc-response.command-args parsed)) + (modes (mapconcat #'identity (cddr (erc-response.command-args parsed)) " "))) (erc-set-modes channel modes) (erc-display-message @@ -1800,8 +1801,7 @@ See `erc-display-server-message'." nil (define-erc-response-handler (331) "No topic set for channel." nil - (let ((channel (cadr (erc-response.command-args parsed))) - (topic (erc-response.contents parsed))) + (let ((channel (cadr (erc-response.command-args parsed)))) (erc-display-message parsed 'notice (erc-get-buffer channel proc) 's331 ?c channel))) @@ -1835,12 +1835,10 @@ See `erc-display-server-message'." nil (define-erc-response-handler (352) "WHO notice." nil - (pcase-let ((`(,channel ,user ,host ,server ,nick ,away-flag) + (pcase-let ((`(,channel ,user ,host ,_server ,nick ,away-flag) (cdr (erc-response.command-args parsed)))) - (let ((full-name (erc-response.contents parsed)) - hopcount) + (let ((full-name (erc-response.contents parsed))) (when (string-match "\\(^[0-9]+ \\)\\(.*\\)$" full-name) - (setq hopcount (match-string 1 full-name)) (setq full-name (match-string 2 full-name))) (erc-update-channel-member channel nick nick nil nil nil nil nil nil host user full-name) (erc-display-message parsed 'notice 'active 's352 commit 7aa94d60560c0f1ba15b7fd2fd5d5a5bf114795a Author: Paul Pogonyshev Date: Sat Apr 2 12:47:46 2016 +0300 Support macros in 'func-arity' * src/eval.c (Ffunc_arity): Support Lisp macros as well. diff --git a/src/eval.c b/src/eval.c index e90b077..72facd5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2960,6 +2960,9 @@ function with `&rest' args, or `unevalled' for a special form. */) function = indirect_function (function); } + if (CONSP (function) && EQ (XCAR (function), Qmacro)) + function = XCDR (function); + if (SUBRP (function)) result = Fsubr_arity (function); else if (COMPILEDP (function)) commit 294b788009564e2692afb27a8205593da05c344c Author: Andy Moreton Date: Sat Apr 2 12:39:44 2016 +0300 Fix compilation of Cygwin w32 port * src/w32xfns.c (init_crit, delete_crit) [HAVE_W32NOTIFY]: Only initialize and free the notification set if compiling with w32notify feature. diff --git a/src/w32xfns.c b/src/w32xfns.c index 9b633c4..b5b22c9 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -48,6 +48,7 @@ init_crit (void) when the input queue is empty, so make it a manual reset event. */ input_available = CreateEvent (NULL, TRUE, FALSE, NULL); +#if HAVE_W32NOTIFY /* Initialize the linked list of notifications sets that will be used to communicate between the watching worker threads and the main thread. */ @@ -60,6 +61,7 @@ init_crit (void) } else DebPrint(("Out of memory: can't initialize notifications sets.")); +#endif #ifdef WINDOWSNT keyboard_handle = input_available; @@ -90,6 +92,7 @@ delete_crit (void) interrupt_handle = NULL; } +#if HAVE_W32NOTIFY if (notifications_set_head) { /* Free any remaining notifications set that could be left over. */ @@ -104,6 +107,7 @@ delete_crit (void) } } free (notifications_set_head); +#endif } void commit ed19f207449c43f7f08285ada87ae7a46c61c8d1 Merge: eabd667 7c1802f Author: Alan Mackenzie Date: Wed Mar 30 16:53:36 2016 +0000 Merge branch 'emacs-25' of /home/acm/emacs/emacs.git/emacs-25 into emacs-25 commit 7c1802f6ffc2704ba8042c7c1c6faa73dfa210d1 Author: Xue Fuqiao Date: Wed Mar 30 08:01:16 2016 +0800 * doc/lispref/text.texi (Columns): Remove a nonexistent reference. The example was removed by Chong Yidong on Mar 5, 2012. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 6b93e51..3749292 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -2191,9 +2191,6 @@ This function returns the horizontal position of point, measured in columns, counting from 0 at the left margin. The column position is the sum of the widths of all the displayed representations of the characters between the start of the current line and point. - -For an example of using @code{current-column}, see the description of -@code{count-lines} in @ref{Text Lines}. @end defun @deffn Command move-to-column column &optional force commit 9034c50ae6b04a0d1c443901fc115d09bb61f5a3 Author: Paul Eggert Date: Tue Mar 29 14:19:46 2016 -0700 * doc/man/emacsclient.1: Document +line:column option. diff --git a/doc/man/emacsclient.1 b/doc/man/emacsclient.1 index e62fe93..010eeba 100644 --- a/doc/man/emacsclient.1 +++ b/doc/man/emacsclient.1 @@ -49,9 +49,19 @@ If you set the variable "server-window" to a window or a frame, "C-x #" displays the server buffer in that window or in that frame. .SH OPTIONS -The programs follow the usual GNU command line syntax, with long +Most options follow the usual GNU command line syntax, with long options starting with two dashes ("\-"). .TP +.BI + line\fR[\fP\fB:\fPcolumn\fR]\fP +Go to the specified +.I line +and +.IR column . +A missing +.I column +is treated as column 1. +This option applies only to the next file specified. +.TP .B \-a, \-\-alternate-editor=EDITOR if the Emacs server is not running, run the specified editor instead. This can also be specified via the ALTERNATE_EDITOR environment variable. commit 06495c96ae0f5a0fa1d56f47750624138f80cb94 Author: Eli Zaretskii Date: Tue Mar 29 20:38:54 2016 +0300 Fix rare problems with echo-area display and multiple frames * src/xdisp.c (redisplay_window): Bind inhibit-redisplay non-nil around the call to x_consider_frame_title, to prevent resize_mini_window from undoing echo-area display. (Bug#23124) diff --git a/src/xdisp.c b/src/xdisp.c index d701306..5be94f0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -17082,7 +17082,16 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) ignore_mouse_drag_p = true; #endif } + ptrdiff_t count1 = SPECPDL_INDEX (); + /* x_consider_frame_title calls select-frame, which calls + resize_mini_window, which could resize the mini-window and by + that undo the effect of this redisplay cycle wrt minibuffer + and echo-area display. Binding inhibit-redisplay to t makes + the call to resize_mini_window a no-op, thus avoiding the + adverse side effects. */ + specbind (Qinhibit_redisplay, Qt); x_consider_frame_title (w->frame); + unbind_to (count1, Qnil); #endif } commit f99b51295b86770e4b16d4717c0e73049191c4c5 Author: Alan Mackenzie Date: Tue Mar 29 09:53:12 2016 +0000 In M-%, avoid making buffer-local binding of text-property-default-nonsticky This would happen when that variable already has a buffer local binding. Such a binding would not be seen by read-from-minibuffer. This fixes bug #23127. * lisp/replace.el (query-replace-read-from): Move the binding of text-property-default-nonsticky to inside of a new with-current-buffer buffer form with the minibuffer as argument. diff --git a/lisp/replace.el b/lisp/replace.el index 428be3c..a2344d9 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -167,8 +167,6 @@ wants to replace FROM with TO." ;; unavailable while preparing to dump. (custom-reevaluate-setting 'query-replace-from-to-separator) (let* ((history-add-new-input nil) - (text-property-default-nonsticky - (cons '(separator . t) text-property-default-nonsticky)) (separator (when query-replace-from-to-separator (propertize "\0" @@ -193,11 +191,18 @@ wants to replace FROM with TO." ;; a region in order to specify the minibuffer input. ;; That should not clobber the region for the query-replace itself. (save-excursion - (if regexp-flag - (read-regexp prompt nil 'query-replace-from-to-history) - (read-from-minibuffer - prompt nil nil nil 'query-replace-from-to-history - (car (if regexp-flag regexp-search-ring search-ring)) t)))) + ;; The `with-current-buffer' ensures that the binding + ;; for `text-property-default-nonsticky' isn't a buffer + ;; local binding in the current buffer, which + ;; `read-from-minibuffer' wouldn't see. + (with-current-buffer (window-buffer (minibuffer-window)) + (let ((text-property-default-nonsticky + (cons '(separator . t) text-property-default-nonsticky))) + (if regexp-flag + (read-regexp prompt nil 'query-replace-from-to-history) + (read-from-minibuffer + prompt nil nil nil 'query-replace-from-to-history + (car (if regexp-flag regexp-search-ring search-ring)) t)))))) (to)) (if (and (zerop (length from)) query-replace-defaults) (cons (caar query-replace-defaults) commit 124c48619e2c68c497d9075e6e940142c174c77b (refs/remotes/origin/remove-prog-indentation-context) Author: Dmitry Gutov Date: Mon Mar 28 03:51:21 2016 +0300 Remove prog-indentation-context * lisp/progmodes/prog-mode.el: (prog-indentation-context) (prog-first-column, prog-widen): Remove, as discussed in http://lists.gnu.org/archive/html/emacs-devel/2016-03/msg01425.html. * doc/lispref/text.texi (Mode-Specific Indent): Remove references to them. * etc/NEWS: Ditto. * lisp/progmodes/python.el: (prog-widen, prog-first-column): Remove the compatibility aliases and all uses. Do not merge to master. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 4c3a1a0..6b93e51 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -2365,83 +2365,6 @@ already indented, it calls @code{completion-at-point} to complete the text at point (@pxref{Completion in Buffers}). @end defopt -@cindex literate programming -@cindex multi-mode indentation - Some major modes need to support embedded regions of text whose -syntax belongs to a different major mode. Examples include -@dfn{literate programming} source files that combine documentation and -snippets of source code, Yacc/Bison programs that include snippets of -plain C code, etc. To correctly indent the embedded chunks, the major -mode needs to delegate the indentation to another mode's indentation -engine (e.g., call @code{c-indent-defun} for C code or -@code{python-indent-line} for Python), while providing it with some -context to guide the indentation. The following facilities support -such multi-mode indentation. - -@defvar prog-indentation-context -This variable, when non-@code{nil}, holds the indentation context for -the sub-mode's indentation engine provided by the superior major mode. -The value should be a list of the form @code{(@var{first-column} -@w{(@var{start} . @var{end})} @code{prev-chunk})}. The members of the -list have the following meaning: - -@table @var -@item first-column -The column to be used for top-level constructs. This replaces the -default value of the top-level column used by the sub-mode, usually -zero. -@item start -@itemx end -The region of the code chunk to be indented by the sub-mode. The -value of @var{end} can be @code{nil}, which stands for the value of -@code{point-max}. -@item prev-chunk -If this is non-@code{nil}, it should provide the sub-mode's -indentation engine with a virtual context of the code chunk. Valid -values include: - -@itemize @minus -@item -A string whose contents is the text the sub-mode's indentation engine -should consider to precede the code chunk. The sub-mode's indentation -engine can add text properties to that string, to be reused in -repeated calls with the same string, thus using it as a cache. An -example where this is useful is code chunks that need to be indented -as function bodies, but lack the function's preamble---the string -could then include that missing preamble. -@item -A function. It is expected to be called with the start position of -the current chunk, and should return a cons cell -@w{@code{(@var{prev-start} . @var{prev-end})}} that specifies the -region of the previous code chunk, or @code{nil} if there is no previous -chunk. This is useful in literate-programming sources, where code is -split into chunks, and correct indentation needs to access previous -chunks. -@end itemize -@end table -@end defvar - -The following convenience functions should be used by major mode's -indentation engine in support of invocations as sub-modes of another -major mode. - -@defun prog-first-column -Call this function instead of using a literal value (usually, zero) of -the column number for indenting top-level program constructs. The -function's value is the column number to use for top-level constructs. -When no superior mode is in effect, this function returns zero. -@end defun - -@defun prog-widen -Call this function instead of @code{widen} to remove any restrictions -imposed by the mode's indentation engine and restore the restrictions -recorded in @code{prog-indentation-context}. This prevents the -indentation engine of a sub-mode from inadvertently operating on text -outside of the chunk it was supposed to indent, and preserves the -restriction imposed by the superior mode. When no superior mode is in -effect, this function just calls @code{widen}. -@end defun - @node Region Indent @subsection Indenting an Entire Region diff --git a/etc/NEWS b/etc/NEWS index 96ec1f1..5599bd9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -396,18 +396,6 @@ the ordering of object keys by default. 'json-pretty-print-buffer-ordered' pretty prints JSON objects with object keys sorted alphabetically. -+++ -** Prog mode has some support for multi-mode indentation. -This allows better indentation support in modes that support multiple -programming languages in the same buffer, like literate programming -environments or ANTLR programs with embedded Python code. - -A major mode can provide indentation context for a sub-mode through -the 'prog-indentation-context' variable. To support this, modes that -provide indentation should use 'prog-widen' instead of 'widen' and -'prog-first-column' instead of a literal zero. See the node -"Mode-Specific Indent" in the ELisp manual for more details. - ** Prettify Symbols mode +++ diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 718b339..3f25a0c 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -49,53 +49,6 @@ map) "Keymap used for programming modes.") -(defvar prog-indentation-context nil - "When non-nil, provides context for indenting embedded code chunks. - -There are languages where part of the code is actually written in -a sub language, e.g., a Yacc/Bison or ANTLR grammar also consists -of plain C code. This variable enables the major mode of the -main language to use the indentation engine of the sub-mode for -lines in code chunks written in the sub-mode's language. - -When a major mode of such a main language decides to delegate the -indentation of a line/region to the indentation engine of the sub -mode, it should bind this variable to non-nil around the call. - -The non-nil value should be a list of the form: - - (FIRST-COLUMN (START . END) PREVIOUS-CHUNKS) - -FIRST-COLUMN is the column the indentation engine of the sub-mode -should use for top-level language constructs inside the code -chunk (instead of 0). - -START and END specify the region of the code chunk. END can be -nil, which stands for the value of `point-max'. The function -`prog-widen' uses this to restore restrictions imposed by the -sub-mode's indentation engine. - -PREVIOUS-CHUNKS, if non-nil, provides the indentation engine of -the sub-mode with the virtual context of the code chunk. Valid -values are: - - - A string containing text which the indentation engine can - consider as standing in front of the code chunk. To cache the - string's calculated syntactic information for repeated calls - with the same string, the sub-mode can add text-properties to - the string. - - A typical use case is for grammars with code chunks which are - to be indented like function bodies -- the string would contain - the corresponding function preamble. - - - A function, to be called with the start position of the current - chunk. It should return either the region of the previous chunk - as (PREV-START . PREV-END), or nil if there is no previous chunk. - - A typical use case are literate programming sources -- the - function would successively return the previous code chunks.") - (defun prog-indent-sexp (&optional defun) "Indent the expression after point. When interactively called with prefix, indent the enclosing defun @@ -109,27 +62,6 @@ instead." (end (progn (forward-sexp 1) (point)))) (indent-region start end nil)))) -(defun prog-first-column () - "Return the indentation column normally used for top-level constructs." - (or (car prog-indentation-context) 0)) - -(defun prog-widen () - "Remove restrictions (narrowing) from current code chunk or buffer. -This function should be used instead of `widen' in any function used -by the indentation engine to make it respect the value of -`prog-indentation-context'. - -This function (like `widen') is useful inside a -`save-restriction' to make the indentation correctly work when -narrowing is in effect." - (let ((chunk (cadr prog-indentation-context))) - (if chunk - ;; No call to `widen' is necessary here, as narrow-to-region - ;; changes (not just narrows) the existing restrictions - (narrow-to-region (car chunk) (or (cdr chunk) (point-max))) - (widen)))) - - (defvar-local prettify-symbols-alist nil "Alist of symbol prettifications. Each element looks like (SYMBOL . CHARACTER), where the symbol diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5aeefe4..90097df 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -283,18 +283,6 @@ :version "24.3" :link '(emacs-commentary-link "python")) - -;;; 24.x Compat - - -(unless (fboundp 'prog-widen) - (defun prog-widen () - (widen))) - -(unless (fboundp 'prog-first-column) - (defun prog-first-column () - 0)) - ;;; Bindings @@ -761,7 +749,7 @@ work on `python-indent-calculate-indentation' instead." (interactive) (save-excursion (save-restriction - (prog-widen) + (widen) (goto-char (point-min)) (let ((block-end)) (while (and (not block-end) @@ -860,7 +848,7 @@ keyword - Point is on a line starting a dedenter block. - START is the position where the dedenter block starts." (save-restriction - (prog-widen) + (widen) (let ((ppss (save-excursion (beginning-of-line) (syntax-ppss)))) @@ -1007,10 +995,10 @@ current context or a list of integers. The latter case is only happening for :at-dedenter-block-start context since the possibilities can be narrowed to specific indentation points." (save-restriction - (prog-widen) + (widen) (save-excursion (pcase (python-indent-context) - (`(:no-indent . ,_) (prog-first-column)) ; usually 0 + (`(:no-indent . ,_) 0) (`(,(or :after-line :after-comment :inside-string @@ -1048,7 +1036,7 @@ possibilities can be narrowed to specific indentation points." (let ((opening-block-start-points (python-info-dedenter-opening-block-positions))) (if (not opening-block-start-points) - (prog-first-column) ; if not found default to first column + 0 ; if not found default to first column (mapcar (lambda (pos) (save-excursion (goto-char pos) @@ -1066,7 +1054,7 @@ integers. Levels are returned in ascending order, and in the case INDENTATION is a list, this order is enforced." (if (listp indentation) (sort (copy-sequence indentation) #'<) - (nconc (number-sequence (prog-first-column) (1- indentation) + (nconc (number-sequence 0 (1- indentation) python-indent-offset) (list indentation)))) @@ -1091,7 +1079,7 @@ minimum." (python-indent--previous-level levels (current-indentation)) (if levels (apply #'max levels) - (prog-first-column))))) + 0)))) (defun python-indent-line (&optional previous) "Internal implementation of `python-indent-line-function'. @@ -4479,7 +4467,7 @@ Optional argument INCLUDE-TYPE indicates to include the type of the defun. This function can be used as the value of `add-log-current-defun-function' since it returns nil if point is not inside a defun." (save-restriction - (prog-widen) + (widen) (save-excursion (end-of-line 1) (let ((names) @@ -4662,7 +4650,7 @@ likely an invalid python file." (let ((point (python-info-dedenter-opening-block-position))) (when point (save-restriction - (prog-widen) + (widen) (message "Closes %s" (save-excursion (goto-char point) (buffer-substring @@ -4683,7 +4671,7 @@ statement." With optional argument LINE-NUMBER, check that line instead." (save-excursion (save-restriction - (prog-widen) + (widen) (when line-number (python-util-goto-line line-number)) (while (and (not (eobp)) @@ -4699,7 +4687,7 @@ With optional argument LINE-NUMBER, check that line instead." Optional argument LINE-NUMBER forces the line number to check against." (save-excursion (save-restriction - (prog-widen) + (widen) (when line-number (python-util-goto-line line-number)) (when (python-info-line-ends-backslash-p) @@ -4716,7 +4704,7 @@ When current line is continuation of another return the point where the continued line ends." (save-excursion (save-restriction - (prog-widen) + (widen) (let* ((context-type (progn (back-to-indentation) (python-syntax-context-type))) commit e65c3079c65595d95749348366af9811fafff062 Author: Paul Eggert Date: Sun Mar 27 15:02:37 2016 -0700 * src/font.c (QCuser_spec): Add missing colon to :user-spec. diff --git a/src/font.c b/src/font.c index 5ab3b3e..2519599 100644 --- a/src/font.c +++ b/src/font.c @@ -5317,7 +5317,7 @@ syms_of_font (void) DEFSYM (Qja, "ja"); DEFSYM (Qko, "ko"); - DEFSYM (QCuser_spec, "user-spec"); + DEFSYM (QCuser_spec, ":user-spec"); staticpro (&scratch_font_spec); scratch_font_spec = Ffont_spec (0, NULL); commit c8b868b1e2532aa07dbf4959798dbdc52ea9b5d5 Author: Eli Zaretskii Date: Sun Mar 27 18:15:06 2016 +0300 Don't start the 'midnight' timer twice * lisp/midnight.el (midnight-mode): Avoid starting the midnight timer twice when activating the mode the first time. (Bug#23123) diff --git a/lisp/midnight.el b/lisp/midnight.el index 0e68eb9..878c5a7 100644 --- a/lisp/midnight.el +++ b/lisp/midnight.el @@ -53,8 +53,12 @@ the time when it is run.") "Non-nil means run `midnight-hook' at midnight." :global t :initialize #'custom-initialize-default - (if midnight-mode (timer-activate midnight-timer) - (cancel-timer midnight-timer))) + ;; Disable first, since the ':initialize' function above already + ;; starts the timer when the mode is turned on for the first time, + ;; via setting 'midnight-delay', which calls 'midnight-delay-set', + ;; which starts the timer. + (when (timerp midnight-timer) (cancel-timer midnight-timer)) + (if midnight-mode (timer-activate midnight-timer))) ;;; time conversion commit 278c8a7ef7baec2ffbfba211366ff3586a05f1e6 Author: YAMAMOTO Mitsuharu Date: Sun Mar 27 18:00:08 2016 +0900 * src/xwidget.c (Fxwidget_resize): Fix inappropriate use of XFASTINT. diff --git a/src/xwidget.c b/src/xwidget.c index 54b8004..c24475f 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -774,7 +774,7 @@ VALUE is the amount to scroll, either relatively or absolutely. */) ? gtk_scrolled_window_get_hadjustment : gtk_scrolled_window_get_vadjustment) (GTK_SCROLLED_WINDOW (xw->widgetscrolledwindow_osr))); - double final_value = XFASTINT (value); + double final_value = XINT (value); if (EQ (Qt, relative)) final_value += gtk_adjustment_get_value (adjustment); gtk_adjustment_set_value (adjustment, final_value); commit e5c17f46785e2eca165ccd5aa890f212c6a61ca1 Author: Stephen Berman Date: Sat Mar 26 23:14:50 2016 +0100 Fix todo-mode category movement * lisp/calendar/todo-mode.el (todo-move-category): Use moved category's existing categories sexp instead of invoking todo-update-categories-sexp in file moved to, in order to take archived items into account. If the moved category has archived items, handle the source archive buffer properly. Remove superfluous code. diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 94cd08e..9574c03 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -1414,7 +1414,12 @@ the archive of the file moved to, creating it if it does not exist." (setq todo-files (funcall todo-files-function)) (todo-reevaluate-filelist-defcustoms)) (dolist (buf buffers) + ;; Make sure archive file is in Todo Archive mode so that + ;; todo-categories has correct value. (with-current-buffer (find-file-noselect buf) + (when (equal (file-name-extension (buffer-file-name)) "toda") + (unless (derived-mode-p 'todo-archive-mode) + (todo-archive-mode))) (widen) (goto-char (point-max)) (let* ((beg (re-search-backward @@ -1466,10 +1471,18 @@ the archive of the file moved to, creating it if it does not exist." (re-search-backward (concat "^" (regexp-quote todo-category-beg) "\\(" (regexp-quote cat) "\\)$") nil t) - (replace-match new nil nil nil 1))) - (setq todo-categories - (append todo-categories (list (cons (or new cat) counts)))) - (todo-update-categories-sexp) + (replace-match new nil nil nil 1)) + (setq todo-categories + (append todo-categories (list (cons (or new cat) counts)))) + (goto-char (point-min)) + (if (looking-at "((\"") + ;; Delete existing sexp. + (delete-region (line-beginning-position) (line-end-position)) + ;; Otherwise, file is new, so make space for categories sexp. + (insert "\n") + (goto-char (point-min))) + ;; Insert (new or updated) sexp. + (prin1 todo-categories (current-buffer))) ;; If archive was just created, save it to avoid "File ;; no longer exists!" message on invoking ;; `todo-view-archived-items'. @@ -1500,9 +1513,7 @@ the archive of the file moved to, creating it if it does not exist." (setq todo-category-number 1)) (todo-category-select))))) (set-window-buffer (selected-window) - (set-buffer (find-file-noselect nfile))) - (todo-category-number (or new cat)) - (todo-category-select)))) + (set-buffer (find-file-noselect nfile)))))) (defun todo-merge-category (&optional file) "Merge current category into another existing category. commit bc70fda2c9f93a30351c7c79a2b5763bbbd7bbc6 Author: Glenn Morris Date: Sat Mar 26 16:45:51 2016 -0400 * lisp/xt-mouse.el (xterm-mouse-utf-8): Add :version. diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index b6738b2..e520957 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -138,6 +138,7 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)." "Non-nil if UTF-8 coordinates should be used to read mouse coordinates. Set this to non-nil if you are sure that your terminal understands UTF-8 coordinates, but not SGR coordinates." + :version "25.1" :type 'boolean :risky t :group 'xterm) commit cf40f389cfbcb8dc4f2a880aa2a5aa38b394293c Author: Eli Zaretskii Date: Sat Mar 26 11:52:12 2016 +0300 Ignore non-nil. non-cons values of unread-command-events * src/keyboard.c (requeued_events_pending_p, read_char) (Finput_pending_p): Use CONSP instead of !NILP to see if there are unread command events to be processed. (Bug#22976) diff --git a/src/keyboard.c b/src/keyboard.c index 53030e2..9618e38 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2529,7 +2529,7 @@ read_char (int commandflag, Lisp_Object map, if (KEYMAPP (map) && INTERACTIVE && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event) /* Don't bring up a menu if we already have another event. */ - && NILP (Vunread_command_events) + && !CONSP (Vunread_command_events) && !detect_input_pending_run_timers (0)) { c = read_char_minibuf_menu_prompt (commandflag, map); @@ -2660,7 +2660,7 @@ read_char (int commandflag, Lisp_Object map, && !EQ (XCAR (prev_event), Qmenu_bar) && !EQ (XCAR (prev_event), Qtool_bar) /* Don't bring up a menu if we already have another event. */ - && NILP (Vunread_command_events)) + && !CONSP (Vunread_command_events)) { c = read_char_x_menu_prompt (map, prev_event, used_mouse_menu); @@ -9878,7 +9878,7 @@ clear_input_pending (void) bool requeued_events_pending_p (void) { - return (!NILP (Vunread_command_events)); + return (CONSP (Vunread_command_events)); } DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 1, 0, @@ -9889,7 +9889,7 @@ if there is a doubt, the value is t. If CHECK-TIMERS is non-nil, timers that are ready to run will do so. */) (Lisp_Object check_timers) { - if (!NILP (Vunread_command_events) + if (CONSP (Vunread_command_events) || !NILP (Vunread_post_input_method_events) || !NILP (Vunread_input_method_events)) return (Qt); commit 8ee4c52abc98e6522d812a29cfe57ffbdeb98144 Author: Eli Zaretskii Date: Sat Mar 26 10:17:12 2016 +0300 Improve documentatuon of 'truncate-partial-width-windows' * src/xdisp.c (syms_of_xdisp) : Clarify in the doc string how the width of partial-width windows is computed for the purposes of truncation decision. (Bug#4338) * doc/emacs/windows.texi (Split Window): Clarify how the width of windows is calculated for the purposes of truncation decision. * doc/emacs/display.texi (Line Truncation): Remove a redundant index entry. diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index c8987c2..01f899f 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1601,7 +1601,6 @@ screen lines. Setting the variable @code{truncate-lines} in any way makes it local to the current buffer; until that time, the default value, which is normally @code{nil}, is in effect. -@vindex truncate-partial-width-windows If a split window becomes too narrow, Emacs may automatically enable line truncation. @xref{Split Window}, for the variable @code{truncate-partial-width-windows} which controls this. diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index 7587f88..702963f 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi @@ -117,10 +117,14 @@ variable @code{truncate-lines} (@pxref{Line Truncation}); it is instead controlled by the variable @code{truncate-partial-width-windows}. If the value of this variable is a positive integer (the default is 50), that specifies the minimum -width for a partial-width window before automatic line truncation -occurs; if the value is @code{nil}, automatic line truncation is -disabled; and for any other non-@code{nil} value, Emacs truncates -lines in every partial-width window regardless of its width. +total width for a partial-width window before automatic line +truncation occurs; if the value is @code{nil}, automatic line +truncation is disabled; and for any other non-@code{nil} value, Emacs +truncates lines in every partial-width window regardless of its width. +The total width of a window is in column units as reported by +@code{window-total-width} (@pxref{Window Sizes,,, elisp, The Emacs +Lisp Reference Manual}), it includes the fringes, the continuation and +truncation glyphs, the margins, and the scroll bar. On text terminals, side-by-side windows are separated by a vertical divider which is drawn using the @code{vertical-border} face. diff --git a/src/xdisp.c b/src/xdisp.c index d6ee2de..d701306 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -31422,8 +31422,11 @@ Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */); Vtruncate_partial_width_windows, doc: /* Non-nil means truncate lines in windows narrower than the frame. For an integer value, truncate lines in each window narrower than the -full frame width, provided the window width is less than that integer; -otherwise, respect the value of `truncate-lines'. +full frame width, provided the total window width in column units is less +than that integer; otherwise, respect the value of `truncate-lines'. +The total width of the window is as returned by `window-total-width', it +includes the fringes, the continuation and truncation glyphs, the +display margins (if any), and the scroll bar For any other non-nil value, truncate lines in all windows that do not span the full frame width. commit fb9a62c9c454df1a5c24b76b5d17ac13721f04d2 Author: Paul Eggert Date: Fri Mar 25 10:58:52 2016 -0700 * src/ftfont.c (ftfont_shape_by_flt): Parenthesize as per GNU style. diff --git a/src/ftfont.c b/src/ftfont.c index b0b5320..7285aee 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -2600,8 +2600,8 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, "combining" is the sole FLT provided by the m17n-lib. In addition, it is the sole FLT that can handle the other combining characters with non-OTF fonts. */ - if (0x300 <= c1 && c1 <= 0x36F - || (! otf && CHAR_HAS_CATEGORY (c1, '^'))) + if ((0x300 <= c1 && c1 <= 0x36F) + || (! otf && CHAR_HAS_CATEGORY (c1, '^'))) flt = mflt_get (msymbol ("combining")); } if (! flt && ! otf) commit 1e1ea22e91b8312c76eb8768bf995ae6129ac16a Author: Eli Zaretskii Date: Fri Mar 25 17:18:21 2016 +0300 Fix 'dired-goto-file' in Dired buffers produced by find-dired * lisp/dired.el (dired-goto-file): Try looking for the file as a relative name with leading sub-directories, before looking for the basename alone. (Bug#23089) diff --git a/lisp/dired.el b/lisp/dired.el index ef22d45..5741872 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2736,9 +2736,18 @@ instead of `dired-actual-switches'." (save-excursion (goto-char (point-min)) (dired-goto-file-1 file file (point-max))) - ;; Otherwise, look for it as a relative name. The - ;; hair is to get the result of `dired-goto-subdir' - ;; without calling it if we don't have any subdirs. + ;; Next, look for it as a relative name with leading + ;; subdirectories. (This happens in Dired buffers + ;; created by find-dired, for example.) + (save-excursion + (goto-char (point-min)) + (dired-goto-file-1 (file-relative-name file + default-directory) + file (point-max))) + ;; Otherwise, look for it as a relative name, a base + ;; name only. The hair is to get the result of + ;; `dired-goto-subdir' without calling it if we don't + ;; have any subdirs. (save-excursion (when (if (string= dir (expand-file-name default-directory)) (goto-char (point-min)) commit 3a13472adee7117e5af1249e41f6e8db9c473603 Author: Nicolas Petton Date: Fri Mar 25 15:09:04 2016 +0100 Fix map-put and map-delete for alists (Bug#23105) * lisp/emacs-lisp/map.el (map-put): Do not bind the evaluated place expression to a new symbol. * test/lisp/emacs-lisp/map-tests.el: Add a regression test. diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index ec8d3d7..ba15a65 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -123,33 +123,26 @@ MAP can be a list, hash-table or array." default))) (defmacro map-put (map key value) - "Associate KEY with VALUE in MAP and return MAP. + "Associate KEY with VALUE in MAP and return VALUE. If KEY is already present in MAP, replace the associated value with VALUE. MAP can be a list, hash-table or array." - (macroexp-let2 nil map map - `(progn - (setf (map-elt ,map ,key) ,value) - ,map))) + `(setf (map-elt ,map ,key) ,value)) -(defmacro map-delete (map key) +(defun map-delete (map key) "Delete KEY from MAP and return MAP. No error is signaled if KEY is not a key of MAP. If MAP is an array, store nil at the index KEY. MAP can be a list, hash-table or array." - (declare (debug t)) - (gv-letplace (mgetter msetter) `(gv-delay-error ,map) - (macroexp-let2 nil key key - `(if (not (listp ,mgetter)) - (map--delete ,mgetter ,key) - ;; The alist case is special, since it can't be handled by the - ;; map--delete function. - (setf (alist-get ,key (gv-synthetic-place ,mgetter ,msetter) - nil t) - nil) - ,mgetter)))) + (map--dispatch map + :list (setf (alist-get key map nil t) nil) + :hash-table (remhash key map) + :array (and (>= key 0) + (<= key (seq-length map)) + (aset map key nil))) + map) (defun map-nested-elt (map keys &optional default) "Traverse MAP using KEYS and return the looked up value or DEFAULT if nil. @@ -337,15 +330,6 @@ MAP can be a list, hash-table or array." (cdr pair))) map)) -(defun map--delete (map key) - (map--dispatch map - :list (error "No place to remove the mapping for %S" key) - :hash-table (remhash key map) - :array (and (>= key 0) - (<= key (seq-length map)) - (aset map key nil))) - map) - (defun map--apply-hash-table (function map) "Private function used to apply FUNCTION over MAP, MAP being a hash-table." (let (result) diff --git a/test/automated/map-tests.el b/test/automated/map-tests.el index d145c19..20cb0f6 100644 --- a/test/automated/map-tests.el +++ b/test/automated/map-tests.el @@ -87,9 +87,16 @@ Evaluate BODY for each created map. (let ((vec [3 4 5])) (should-error (setf (map-elt vec 3) 6)))) +(ert-deftest test-map-put-alist-new-key () + "Regression test for Bug#23105." + (let ((alist '((0 . a)))) + (map-put alist 2 'b) + (should (eq (map-elt alist 2) + 'b)))) + (ert-deftest test-map-put-return-value () (let ((ht (make-hash-table))) - (should (eq (map-put ht 'a 'hello) ht)))) + (should (eq (map-put ht 'a 'hello) 'hello)))) (ert-deftest test-map-delete () (with-maps-do map commit 422c3dadce6dbd33ced2024782438af68c5756de Author: Eli Zaretskii Date: Fri Mar 25 13:37:58 2016 +0300 Minor copyedits of documentation for temporary displays * doc/emacs/windows.texi (Temporary Displays): Improve indexing. Minor changes in wording. (Window Choice, Displaying Buffers, Pop Up Window): Disambiguate index entries for 'display-buffer'. * etc/NEWS: Minor rewording of the entry about temporary displays. diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index e401620..7587f88 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi @@ -206,7 +206,7 @@ Choice}, for how Emacs picks or creates the window to use. Select buffer @var{bufname} in another window (@code{switch-to-buffer-other-window}). -@findex display-buffer +@findex display-buffer @r{(command)} @item C-x 4 C-o @var{bufname} @key{RET} @kindex C-x 4 C-o Display buffer @var{bufname} in some window, without trying to select @@ -345,7 +345,6 @@ user's attention will be diverted to that buffer. These commands usually work by calling @code{switch-to-buffer} internally (@pxref{Select Buffer}). -@findex display-buffer Some commands try to display intelligently, trying not to take over the selected window, e.g., by splitting off a new window and displaying the desired buffer there. Such commands, which include the @@ -379,7 +378,7 @@ Several of these commands are bound in the @kbd{C-x 5} prefix key. @node Window Choice @subsection How @code{display-buffer} works -@findex display-buffer +@findex display-buffer, detailed description The @code{display-buffer} command (as well as commands that call it internally) chooses a window to display by following the steps given @@ -449,6 +448,8 @@ mentioned in the next section. @node Temporary Displays @subsection Displaying non-editable buffers. +@cindex pop-up windows +@cindex temporary windows Some buffers are shown in windows for perusal rather than for editing. Help commands (@pxref{Help}) typically use a buffer called @file{*Help*} @@ -456,19 +457,19 @@ for that purpose, minibuffer completion (@pxref{Completion}) uses a buffer called @file{*Completions*} instead. Such buffers are usually displayed only for a short period of time. - Normally, Emacs chooses the window for such temporary displays via + Normally, Emacs chooses the window for such temporary displays via @code{display-buffer} as described above. The @file{*Completions*} -buffer, on the other hand, is preferably displayed in a window at the +buffer, on the other hand, is normally displayed in a window at the bottom of the selected frame, regardless of the number of windows already shown on that frame. - If you prefer Emacs to display a temporary buffer in a different -fashion, the recommended approach is to customize the variable + If you prefer Emacs to display a temporary buffer in a different +fashion, we recommend to customize the variable @code{display-buffer-alist} (@pxref{Choosing Window,,Choosing a Window -for Display, elisp, The Emacs Lisp Reference Manual}). For example, to -display @file{*Completions*} by splitting a window as described in the -previous section, use the following form in your initialization file -(@pxref{Init File}): +for Display, elisp, The Emacs Lisp Reference Manual}). For example, +to display @file{*Completions*} by splitting a window as described in +the previous section, use the following form in your initialization +file (@pxref{Init File}): @example @group @@ -478,15 +479,18 @@ previous section, use the following form in your initialization file @end group @end example - The @file{*Completions*} buffer is also special in the sense that -Emacs usually tries to make its window just as large as to display all -of its contents. To resize windows showing other temporary displays -like, for example, the @file{*Help*} buffer accordingly, you have to -explicitly invoke the minor mode (@pxref{Minor Modes}) +@findex temp-buffer-resize-mode + The @file{*Completions*} buffer is also special in the sense that +Emacs usually tries to make its window just as large as necessary to +display all of its contents. To resize windows showing other +temporary displays like, for example, the @file{*Help*} buffer +accordingly, turn on the minor mode (@pxref{Minor Modes}) @code{temp-buffer-resize-mode} (@pxref{Temporary Displays,,Temporary Displays, elisp, The Emacs Lisp Reference Manual}). - The maximum size of windows resized by @code{temp-buffer-resize-mode} +@vindex temp-buffer-max-height +@vindex temp-buffer-max-width + The maximum size of windows resized by @code{temp-buffer-resize-mode} can be controlled by customizing the options @code{temp-buffer-max-height} and @code{temp-buffer-max-width} (@pxref{Temporary Displays,,Temporary Displays, elisp, The Emacs Lisp diff --git a/etc/NEWS b/etc/NEWS index 35f9341..96ec1f1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1927,10 +1927,14 @@ frames. and 'window-divider-default-right-width'. +++ -*** The minibuffer completions window is now displayad at the bottom of -the selected frame and always fit to its buffer. The Emacs manual +*** The window displaying the '*Completions*' buffer with minibuffer +completion candidates is now shown at the bottom of the selected +frame. The size of that window is always as large as required to +display all the candidates, except when limited by the minimum size +of the other windows on that frame; those other windows are resized +to provide space for the '*Completions*' display. The Emacs manual describes how to customize 'display-buffer-alist' to get back the old -behavior. +behavior, see the node "Temporary Displays" there. --- ** Tearoff menus and detachable toolbars for Gtk+ have been removed. commit 90fb9b38dd4a386a71cdf7c3bf6b42292db43c42 Author: Philipp Stephani Date: Fri Mar 25 13:17:38 2016 +0300 Add customization option for using UTF-8 coordinates in xt-mouse * lisp/xt-mouse.el (xterm-mouse-utf-8): New customization option. (xterm-mouse--read-coordinate): New function to replace `xterm-mouse--read-utf8-char'; uses UTF-8 only if enabled. (xterm-mouse--read-number-from-terminal): Adapt to new name. (xterm-mouse-tracking-enable-sequence) (xterm-mouse-tracking-disable-sequence): Replace constants with functions, mark constants as obsolete. (xterm-mouse--tracking-sequence): New helper function. (turn-on-xterm-mouse-tracking-on-terminal): Use new functions; enable UTF-8 only if customization option says so; store UTF-8 flag in terminal parameter. (Bug#23009) * test/automated/xt-mouse-tests.el: Add tests for xt-mouse.el. diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 5975e60..b6738b2 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -134,23 +134,34 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)." (fdiff (- f (* 1.0 maxwrap dbig)))) (+ (truncate fdiff) (* maxwrap dbig)))))) -(defun xterm-mouse--read-utf8-char (&optional prompt seconds) - "Read an utf-8 encoded character from the current terminal. -This function reads and returns an utf-8 encoded character of -command input. If the user generates an event which is not a -character (i.e., a mouse click or function key event), read-char -signals an error. - -The returned event may come directly from the user, or from a -keyboard macro. It is not decoded by the keyboard's input coding -system and always treated with an utf-8 input encoding. - -The optional arguments PROMPT and SECONDS work like in -`read-event'." - (let ((tmp (keyboard-coding-system))) - (set-keyboard-coding-system 'utf-8) - (prog1 (read-event prompt t seconds) - (set-keyboard-coding-system tmp)))) +(defcustom xterm-mouse-utf-8 nil + "Non-nil if UTF-8 coordinates should be used to read mouse coordinates. +Set this to non-nil if you are sure that your terminal +understands UTF-8 coordinates, but not SGR coordinates." + :type 'boolean + :risky t + :group 'xterm) + +(defun xterm-mouse--read-coordinate () + "Read a mouse coordinate from the current terminal. +If `xterm-mouse-utf-8' was non-nil when +`turn-on-xterm-mouse-tracking-on-terminal' was called, reads the +coordinate as an UTF-8 code unit sequence; otherwise, reads a +single byte." + (let ((previous-keyboard-coding-system (keyboard-coding-system))) + (unwind-protect + (progn + (set-keyboard-coding-system + (if (terminal-parameter nil 'xterm-mouse-utf-8) + 'utf-8-unix + ;; Use Latin-1 instead of no-conversion to avoid flicker + ;; due to `set-keyboard-coding-system' changing the meta + ;; mode. + 'latin-1)) + ;; Wait only a little; we assume that the entire escape sequence + ;; has already been sent when this function is called. + (read-char nil nil 0.1)) + (set-keyboard-coding-system previous-keyboard-coding-system)))) ;; In default mode, each numeric parameter of XTerm's mouse report is ;; a single char, possibly encoded as utf-8. The actual numeric @@ -170,7 +181,7 @@ The optional arguments PROMPT and SECONDS work like in (<= ?0 c ?9)) (setq n (+ (* 10 n) c (- ?0)))) (cons n c)) - (cons (- (setq c (xterm-mouse--read-utf8-char)) 32) c)))) + (cons (- (setq c (xterm-mouse--read-coordinate)) 32) c)))) ;; XTerm reports mouse events as ;; in default mode, and @@ -314,6 +325,38 @@ down the SHIFT key while pressing the mouse button." (mapc #'turn-off-xterm-mouse-tracking-on-terminal (terminal-list)) (setq mouse-position-function nil))) +(defun xterm-mouse-tracking-enable-sequence () + "Return a control sequence to enable XTerm mouse tracking. +The returned control sequence enables basic mouse tracking, mouse +motion events and finally extended tracking on terminals that +support it. The following escape sequences are understood by +modern xterms: + +\"\\e[?1000h\" \"Basic mouse mode\": Enables reports for mouse + clicks. There is a limit to the maximum row/column + position (<= 223), which can be reported in this + basic mode. + +\"\\e[?1002h\" \"Mouse motion mode\": Enables reports for mouse + motion events during dragging operations. + +\"\\e[?1005h\" \"UTF-8 coordinate extension\": Enables an + extension to the basic mouse mode, which uses UTF-8 + characters to overcome the 223 row/column limit. + This extension may conflict with non UTF-8 + applications or non UTF-8 locales. It is only + enabled when the option `xterm-mouse-utf-8' is + non-nil. + +\"\\e[?1006h\" \"SGR coordinate extension\": Enables a newer + alternative extension to the basic mouse mode, which + overcomes the 223 row/column limit without the + drawbacks of the UTF-8 coordinate extension. + +The two extension modes are mutually exclusive, where the last +given escape sequence takes precedence over the former." + (apply #'concat (xterm-mouse--tracking-sequence ?h))) + (defconst xterm-mouse-tracking-enable-sequence "\e[?1000h\e[?1002h\e[?1005h\e[?1006h" "Control sequence to enable xterm mouse tracking. @@ -343,10 +386,34 @@ escape sequences are understood by modern xterms: The two extension modes are mutually exclusive, where the last given escape sequence takes precedence over the former.") +(make-obsolete-variable + 'xterm-mouse-tracking-enable-sequence + "use the function `xterm-mouse-tracking-enable-sequence' instead." + "25.1") + +(defun xterm-mouse-tracking-disable-sequence () + "Return a control sequence to disable XTerm mouse tracking. +The control sequence resets the modes set by +`xterm-mouse-tracking-enable-sequence'." + (apply #'concat (nreverse (xterm-mouse--tracking-sequence ?l)))) + (defconst xterm-mouse-tracking-disable-sequence "\e[?1006l\e[?1005l\e[?1002l\e[?1000l" "Reset the modes set by `xterm-mouse-tracking-enable-sequence'.") +(make-obsolete-variable + 'xterm-mouse-tracking-disable-sequence + "use the function `xterm-mouse-tracking-disable-sequence' instead." + "25.1") + +(defun xterm-mouse--tracking-sequence (suffix) + "Return a control sequence to enable or disable mouse tracking. +SUFFIX is the last character of each escape sequence (?h to +enable, ?l to disable)." + (mapcar + (lambda (code) (format "\e[?%d%c" code suffix)) + `(1000 1002 ,@(when xterm-mouse-utf-8 '(1005)) 1006))) + (defun turn-on-xterm-mouse-tracking-on-terminal (&optional terminal) "Enable xterm mouse tracking on TERMINAL." (when (and xterm-mouse-mode (eq t (terminal-live-p terminal)) @@ -360,18 +427,19 @@ given escape sequence takes precedence over the former.") (with-selected-frame (car (frames-on-display-list terminal)) (define-key input-decode-map "\e[M" 'xterm-mouse-translate) (define-key input-decode-map "\e[<" 'xterm-mouse-translate-extended)) - (condition-case err - (send-string-to-terminal xterm-mouse-tracking-enable-sequence - terminal) - ;; FIXME: This should use a dedicated error signal. - (error (if (equal (cadr err) "Terminal is currently suspended") - nil ;The sequence will be sent upon resume. - (signal (car err) (cdr err))))) - (push xterm-mouse-tracking-enable-sequence - (terminal-parameter nil 'tty-mode-set-strings)) - (push xterm-mouse-tracking-disable-sequence - (terminal-parameter nil 'tty-mode-reset-strings)) - (set-terminal-parameter terminal 'xterm-mouse-mode t)))) + (let ((enable (xterm-mouse-tracking-enable-sequence)) + (disable (xterm-mouse-tracking-disable-sequence))) + (condition-case err + (send-string-to-terminal enable terminal) + ;; FIXME: This should use a dedicated error signal. + (error (if (equal (cadr err) "Terminal is currently suspended") + nil ; The sequence will be sent upon resume. + (signal (car err) (cdr err))))) + (push enable (terminal-parameter nil 'tty-mode-set-strings)) + (push disable (terminal-parameter nil 'tty-mode-reset-strings)) + (set-terminal-parameter terminal 'xterm-mouse-mode t) + (set-terminal-parameter terminal 'xterm-mouse-utf-8 + xterm-mouse-utf-8))))) (defun turn-off-xterm-mouse-tracking-on-terminal (terminal) "Disable xterm mouse tracking on TERMINAL." diff --git a/test/automated/xt-mouse-tests.el b/test/automated/xt-mouse-tests.el new file mode 100644 index 0000000..c7e835c --- /dev/null +++ b/test/automated/xt-mouse-tests.el @@ -0,0 +1,110 @@ +;;; xt-mouse-tests.el --- Test suite for xt-mouse. -*- lexical-binding: t; -*- + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Philipp Stephani + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;;; Code: + +(require 'xt-mouse) + +(defmacro with-xterm-mouse-mode (&rest body) + "Run BODY with `xterm-mouse-mode' temporarily enabled." + (declare (indent 0)) + ;; Make the frame huge so that the test input events below don't hit + ;; the menu bar. + `(cl-letf (((frame-width nil) 2000) + ((frame-height nil) 2000) + ;; Reset XTerm parameters so that the tests don't get + ;; confused. + ((terminal-parameter nil 'xterm-mouse-x) nil) + ((terminal-parameter nil 'xterm-mouse-y) nil) + ((terminal-parameter nil 'xterm-mouse-last-down) nil) + ((terminal-parameter nil 'xterm-mouse-last-click) nil)) + (if xterm-mouse-mode + (progn ,@body) + (unwind-protect + (progn + ;; `xterm-mouse-mode' doesn't work in the initial + ;; terminal. Since we can't create a second terminal in + ;; batch mode, fake it temporarily. + (cl-letf (((symbol-function 'terminal-name) + (lambda (&optional _terminal) "fake-terminal"))) + (xterm-mouse-mode)) + ,@body) + (xterm-mouse-mode 0))))) + +(ert-deftest xt-mouse-tracking-basic () + (should (equal (xterm-mouse-tracking-enable-sequence) + "\e[?1000h\e[?1002h\e[?1006h")) + (should (equal (xterm-mouse-tracking-disable-sequence) + "\e[?1006l\e[?1002l\e[?1000l")) + (with-xterm-mouse-mode + (should xterm-mouse-mode) + (should (terminal-parameter nil 'xterm-mouse-mode)) + (should-not (terminal-parameter nil 'xterm-mouse-utf-8)) + (let* ((unread-command-events (append "\e[M%\xD9\x81" + "\e[M'\xD9\x81" nil)) + (key (read-key))) + (should (consp key)) + (cl-destructuring-bind (event-type position . rest) key + (should (equal event-type 'S-mouse-2)) + (should (consp position)) + (cl-destructuring-bind (_ _ xy . rest) position + (should (equal xy '(184 . 95)))))))) + +(ert-deftest xt-mouse-tracking-utf-8 () + (let ((xterm-mouse-utf-8 t)) + (should (equal (xterm-mouse-tracking-enable-sequence) + "\e[?1000h\e[?1002h\e[?1005h\e[?1006h")) + (should (equal (xterm-mouse-tracking-disable-sequence) + "\e[?1006l\e[?1005l\e[?1002l\e[?1000l")) + (with-xterm-mouse-mode + (should xterm-mouse-mode) + (should (terminal-parameter nil 'xterm-mouse-mode)) + (should (terminal-parameter nil 'xterm-mouse-utf-8)) + ;; The keyboard driver doesn't decode bytes in + ;; `unread-command-events'. + (let* ((unread-command-events (append "\e[M%\u0640\u0131" + "\e[M'\u0640\u0131" nil)) + (key (read-key))) + (should (consp key)) + (cl-destructuring-bind (event-type position . rest) key + (should (equal event-type 'S-mouse-2)) + (should (consp position)) + (cl-destructuring-bind (_ _ xy . rest) position + (should (equal xy '(1567 . 271))))))))) + +(ert-deftest xt-mouse-tracking-sgr () + (with-xterm-mouse-mode + (should xterm-mouse-mode) + (should (terminal-parameter nil 'xterm-mouse-mode)) + (should-not (terminal-parameter nil 'xterm-mouse-utf-8)) + (let* ((unread-command-events (append "\e[<5;1569;273;M" + "\e[<5;1569;273;m" nil)) + (key (read-key))) + (should (consp key)) + (cl-destructuring-bind (event-type position . rest) key + (should (equal event-type 'S-mouse-2)) + (should (consp position)) + (cl-destructuring-bind (_ _ xy . rest) position + (should (equal xy '(1568 . 271)))))))) + +;;; xt-mouse-tests.el ends here commit f14d463661f46f614125f88b56d73106fab9ece6 Author: Eli Zaretskii Date: Fri Mar 25 13:02:20 2016 +0300 Minor doc string fixes in replace.el * lisp/replace.el (query-replace, query-replace-regexp) (query-replace-regexp-eval, map-query-replace-regexp) (replace-string, replace-regexp): Clarify in doc strings that these commands operate from point to the end of the buffer's accessible portion. (Bug#23067) diff --git a/lisp/replace.el b/lisp/replace.el index 2c3aa9b..428be3c 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -293,7 +293,8 @@ As each match is found, the user must type a character saying what to do with it. For directions, type \\[help-command] at that time. In Transient Mark mode, if the mark is active, operate on the contents -of the region. Otherwise, operate from point to the end of the buffer. +of the region. Otherwise, operate from point to the end of the buffer's +accessible portion. Use \\\\[next-history-element] \ to pull the last incremental search string to the minibuffer @@ -355,7 +356,8 @@ As each match is found, the user must type a character saying what to do with it. For directions, type \\[help-command] at that time. In Transient Mark mode, if the mark is active, operate on the contents -of the region. Otherwise, operate from point to the end of the buffer. +of the region. Otherwise, operate from point to the end of the buffer's +accessible portion. Use \\\\[next-history-element] \ to pull the last incremental search regexp to the minibuffer @@ -452,7 +454,8 @@ Use `\\#&' or `\\#N' if you want a number instead of a string. In interactive use, `\\#' in itself stands for `replace-count'. In Transient Mark mode, if the mark is active, operate on the contents -of the region. Otherwise, operate from point to the end of the buffer. +of the region. Otherwise, operate from point to the end of the buffer's +accessible portion. Use \\\\[next-history-element] \ to pull the last incremental search regexp to the minibuffer @@ -507,7 +510,8 @@ each successive replacement uses the next successive replacement string, wrapping around from the last such string to the first. In Transient Mark mode, if the mark is active, operate on the contents -of the region. Otherwise, operate from point to the end of the buffer. +of the region. Otherwise, operate from point to the end of the buffer's +accessible portion. Non-interactively, TO-STRINGS may be a list of replacement strings. @@ -573,7 +577,7 @@ replace backward. Operates on the region between START and END (if both are nil, from point to the end of the buffer). Interactively, if Transient Mark mode is enabled and the mark is active, operates on the contents of the region; -otherwise from point to the end of the buffer. +otherwise from point to the end of the buffer's accessible portion. Use \\\\[next-history-element] \ to pull the last incremental search string to the minibuffer @@ -620,7 +624,8 @@ regexp in `search-whitespace-regexp'. This function is not affected by `replace-character-fold' In Transient Mark mode, if the mark is active, operate on the contents -of the region. Otherwise, operate from point to the end of the buffer. +of the region. Otherwise, operate from point to the end of the buffer's +accessible portion. Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. A negative prefix arg means commit e70ee9d6804510ac1b1929df92fa5b6cd897e7e4 Author: Eli Zaretskii Date: Fri Mar 25 12:51:57 2016 +0300 Fix scrolling upwards with 'xwidget-webkit-browse-url' * src/xwidget.c (Fxwidget_set_adjustment): Use CHECK_NUMBER instead of CHECK_NATNUM. Suggested by Shayan Pirani . (Bug#22918) diff --git a/src/xwidget.c b/src/xwidget.c index d438d87..54b8004 100644 --- a/src/xwidget.c +++ b/src/xwidget.c @@ -767,7 +767,7 @@ VALUE is the amount to scroll, either relatively or absolutely. */) Lisp_Object value) { CHECK_XWIDGET (xwidget); - CHECK_NATNUM (value); + CHECK_NUMBER (value); struct xwidget *xw = XXWIDGET (xwidget); GtkAdjustment *adjustment = ((EQ (Qhorizontal, axis) commit 44782dea433ce567bf69612a74b62432d68cd4b3 Author: K. Handa Date: Fri Mar 25 12:40:25 2016 +0300 Fix display of Indic scripts * ftfont.c (ftfont_shape_by_flt): For combining characters out of the range U+300...U+36F, use the "combining" FLT only with non-OTF fonts. diff --git a/src/ftfont.c b/src/ftfont.c index a402245..b0b5320 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -2596,7 +2596,12 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, language information, and select a proper flt for them here. */ int c1 = LGLYPH_CHAR (LGSTRING_GLYPH (lgstring, 1)); - if (CHAR_HAS_CATEGORY (c1, '^')) + /* For the combining characters in the range U+300..U+36F, + "combining" is the sole FLT provided by the m17n-lib. In + addition, it is the sole FLT that can handle the other + combining characters with non-OTF fonts. */ + if (0x300 <= c1 && c1 <= 0x36F + || (! otf && CHAR_HAS_CATEGORY (c1, '^'))) flt = mflt_get (msymbol ("combining")); } if (! flt && ! otf) commit 326c64fcc37cdb31183ec62d5535ec0a52c4738e Author: Eli Zaretskii Date: Fri Mar 25 10:45:39 2016 +0300 Fix splash screen display at startup * src/frame.c (DEFAULT_ROWS): Enlarge to 36, so that the initial window displayed by "emacs -q" has enough space to show the whole text even if it includes 2 lines talking about recovering crashes sessions. (Bug#23074) * lisp/startup.el (use-fancy-splash-screens-p): Fix off-by-one error when computing the window-height from frame-height. * etc/NEWS: Mention the change. diff --git a/etc/NEWS b/etc/NEWS index 3defc19..35f9341 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -123,6 +123,12 @@ command line when 'initial-buffer-choice' is non-nil. ** The value of 'initial-scratch-message' is now treated as a doc string and can contain escape sequences for command keys, quotes, and the like. +--- +** The default height of GUI frames was enlarged. +This is so there's enough space in the initial window to display the +optional text about recovering crashes sessions, without losing the +splash image display. + * Changes in Emacs 25.1 diff --git a/lisp/startup.el b/lisp/startup.el index 15a79f6..536289c 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1890,10 +1890,12 @@ we put it on this frame." (when frame (let* ((img (create-image (fancy-splash-image-file))) (image-height (and img (cdr (image-size img nil frame)))) - ;; We test frame-height so that, if the frame is split - ;; by displaying a warning, that doesn't cause the normal - ;; splash screen to be used. - (frame-height (1- (frame-height frame)))) + ;; We test frame-height and not window-height so that, + ;; if the frame is split by displaying a warning, that + ;; doesn't cause the normal splash screen to be used. + ;; We subtract 2 from frame-height to account for the + ;; echo area and the mode line. + (frame-height (- (frame-height frame) 2))) (> frame-height (+ image-height 19))))))) diff --git a/src/frame.c b/src/frame.c index 7511d53..53ff059 100644 --- a/src/frame.c +++ b/src/frame.c @@ -4565,7 +4565,7 @@ On Nextstep, this just calls `ns-parse-geometry'. */) This function does not make the coordinates positive. */ -#define DEFAULT_ROWS 35 +#define DEFAULT_ROWS 36 #define DEFAULT_COLS 80 long commit 7ab2a9743faca2ddde04ea2e6127badac9ce1bb1 Author: Martin Rudalics Date: Fri Mar 25 08:38:34 2016 +0100 ; In NEWS mention new display of minibuffer completions window diff --git a/etc/NEWS b/etc/NEWS index f952a14..3defc19 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1920,6 +1920,12 @@ frames. 'window-divider-default-places', 'window-divider-default-bottom-width' and 'window-divider-default-right-width'. ++++ +*** The minibuffer completions window is now displayad at the bottom of +the selected frame and always fit to its buffer. The Emacs manual +describes how to customize 'display-buffer-alist' to get back the old +behavior. + --- ** Tearoff menus and detachable toolbars for Gtk+ have been removed. Those features have been deprecated in Gtk+ for a long time. commit a1cd84cffcca020e8cff88c7a5633e8d5a2d417e Author: Martin Rudalics Date: Fri Mar 25 08:30:23 2016 +0100 Describe temporary displays in Emacs manual * doc/emacs/emacs.texi (Temporary Displays): New subsubsection. * doc/emacs/windows.texi (Window Choice): Minor fixes. (Temporary Displays): New subsubsection describing display of temporary buffers and `temp-buffer-resize-mode'. diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index dc99d49..c23c96f 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -519,6 +519,7 @@ Multiple Windows * Pop Up Window:: Finding a file or buffer in another window. * Change Window:: Deleting windows and changing their sizes. * Displaying Buffers:: How Emacs picks a window for displaying a buffer. +* Temporary Displays:: Displaying non-editable buffers. * Window Convenience:: Convenience functions for window handling. Displaying a Buffer in a Window diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index f99234b..e401620 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi @@ -374,6 +374,7 @@ Several of these commands are bound in the @kbd{C-x 5} prefix key. @menu * Window Choice:: How @code{display-buffer} works. +* Temporary Displays:: Displaying non-editable buffers. @end menu @node Window Choice @@ -411,15 +412,15 @@ By default, this step is skipped. To enable it, change the variable @code{graphic-only} means to do this only on graphical displays. @item -Otherwise, try to create a new window by splitting the selected -window, and display the buffer in that new window. +Otherwise, try to create a new window by splitting a window on the +selected frame, and display the buffer in that new window. @vindex split-height-threshold @vindex split-width-threshold The split can be either vertical or horizontal, depending on the variables @code{split-height-threshold} and @code{split-width-threshold}. These variables should have integer -values. If @code{split-height-threshold} is smaller than the selected +values. If @code{split-height-threshold} is smaller than the chosen window's height, the split puts the new window below. Otherwise, if @code{split-width-threshold} is smaller than the window's width, the split puts the new window on the right. If neither condition holds, @@ -427,6 +428,12 @@ Emacs tries to split so that the new window is below---but only if the window was not split before (to avoid excessive splitting). @item +Otherwise, display the buffer in a window previously showing it. +Normally, only windows on the selected frame are considered, but if +@code{pop-up-frames} is non-@code{nil} the window may be also on another +frame. + +@item Otherwise, display the buffer in an existing window on the selected frame. @@ -435,6 +442,57 @@ If all the above methods fail for whatever reason, create a new frame and display the buffer there. @end itemize +A more advanced and flexible way to customize the behavior of +@code{display-buffer} is by using the option @code{display-buffer-alist} +mentioned in the next section. + + +@node Temporary Displays +@subsection Displaying non-editable buffers. + +Some buffers are shown in windows for perusal rather than for editing. +Help commands (@pxref{Help}) typically use a buffer called @file{*Help*} +for that purpose, minibuffer completion (@pxref{Completion}) uses a +buffer called @file{*Completions*} instead. Such buffers are usually +displayed only for a short period of time. + + Normally, Emacs chooses the window for such temporary displays via +@code{display-buffer} as described above. The @file{*Completions*} +buffer, on the other hand, is preferably displayed in a window at the +bottom of the selected frame, regardless of the number of windows +already shown on that frame. + + If you prefer Emacs to display a temporary buffer in a different +fashion, the recommended approach is to customize the variable +@code{display-buffer-alist} (@pxref{Choosing Window,,Choosing a Window +for Display, elisp, The Emacs Lisp Reference Manual}). For example, to +display @file{*Completions*} by splitting a window as described in the +previous section, use the following form in your initialization file +(@pxref{Init File}): + +@example +@group +(customize-set-variable + 'display-buffer-alist + '(("\\*Completions\\*" display-buffer-pop-up-window))) +@end group +@end example + + The @file{*Completions*} buffer is also special in the sense that +Emacs usually tries to make its window just as large as to display all +of its contents. To resize windows showing other temporary displays +like, for example, the @file{*Help*} buffer accordingly, you have to +explicitly invoke the minor mode (@pxref{Minor Modes}) +@code{temp-buffer-resize-mode} (@pxref{Temporary Displays,,Temporary +Displays, elisp, The Emacs Lisp Reference Manual}). + + The maximum size of windows resized by @code{temp-buffer-resize-mode} +can be controlled by customizing the options +@code{temp-buffer-max-height} and @code{temp-buffer-max-width} +(@pxref{Temporary Displays,,Temporary Displays, elisp, The Emacs Lisp +Reference Manual}) and cannot exceed the size of the containing frame. + + @node Window Convenience @section Convenience Features for Window Handling commit 5ec105648b4695ef3fa159cad2fedcd31e62337a Author: Paul Eggert Date: Thu Mar 24 16:48:46 2016 -0700 Avoid stray As next to IDLW icons * lisp/progmodes/idlw-toolbar.el (idlwave-toolbar-add-everywhere): Use "" for empty labels, not "a", as the latter now displays stray "A"s (Bug#18997). diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el index 0e0714e..d857bfd 100644 --- a/lisp/progmodes/idlw-toolbar.el +++ b/lisp/progmodes/idlw-toolbar.el @@ -439,7 +439,7 @@ static char * file[] = { \" \", \" \", \" \"};") - "The Cont icon.") + "The Cont icon.") (defvar idlwave-toolbar-to-here-icon (idlwave-toolbar-make-button @@ -918,7 +918,7 @@ static char * file[] = { (help (aref x 3)) (key (vector 'tool-bar func)) (def (list 'menu-item - "a" + "" func :image (symbol-value icon) :visible show commit 45577d548d3abfe504d3f936b3c9b997d0cf7f9c Author: Paul Eggert Date: Thu Mar 24 16:46:28 2016 -0700 Avoid GTK 3 crash with icons and masks Problem reported by Mosè Giordano (Bug#18997). * src/gtkutil.c (xg_get_pixbuf_from_pixmap): Remove. (xg_get_pixbuf_from_pix_and_mask): Do not use xg_get_pixbuf_from_pixmap, as it is poorly documented. Instead, invoke XGetPixel directly. This is slow but speed is not important here. Also, fail for unusual situations (not TrueColor, or images that are not 8 bits per sample) instead of displaying junk or crashing. diff --git a/src/gtkutil.c b/src/gtkutil.c index ba059b7..e791e6a 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -252,35 +252,6 @@ xg_create_default_cursor (Display *dpy) return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); } -static GdkPixbuf * -xg_get_pixbuf_from_pixmap (struct frame *f, Pixmap pix) -{ - int iunused; - GdkPixbuf *tmp_buf; - Window wunused; - unsigned int width, height, uunused; - XImage *xim; - - XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused, - &width, &height, &uunused, &uunused); - - xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height, - ~0, XYPixmap); - if (!xim) return 0; - - tmp_buf = gdk_pixbuf_new_from_data ((guchar *) xim->data, - GDK_COLORSPACE_RGB, - FALSE, - xim->bitmap_unit, - width, - height, - xim->bytes_per_line, - NULL, - NULL); - XDestroyImage (xim); - return tmp_buf; -} - /* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ static GdkPixbuf * @@ -288,46 +259,43 @@ xg_get_pixbuf_from_pix_and_mask (struct frame *f, Pixmap pix, Pixmap mask) { - int width, height; - GdkPixbuf *icon_buf, *tmp_buf; - - tmp_buf = xg_get_pixbuf_from_pixmap (f, pix); - icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0); - g_object_unref (G_OBJECT (tmp_buf)); - - width = gdk_pixbuf_get_width (icon_buf); - height = gdk_pixbuf_get_height (icon_buf); + GdkPixbuf *icon_buf = 0; + int iunused; + Window wunused; + unsigned int width, height, depth, uunused; - if (mask) + if (FRAME_DISPLAY_INFO (f)->red_bits != 8) + return 0; + XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused, + &width, &height, &uunused, &depth); + if (depth != 24) + return 0; + XImage *xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height, + ~0, XYPixmap); + if (xim) { - GdkPixbuf *mask_buf = xg_get_pixbuf_from_pixmap (f, mask); - guchar *pixels = gdk_pixbuf_get_pixels (icon_buf); - guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf); - int rowstride = gdk_pixbuf_get_rowstride (icon_buf); - int mask_rowstride = gdk_pixbuf_get_rowstride (mask_buf); - int y; - - for (y = 0; y < height; ++y) - { - guchar *iconptr, *maskptr; - int x; - - iconptr = pixels + y * rowstride; - maskptr = mask_pixels + y * mask_rowstride; - - for (x = 0; x < width; ++x) - { - /* In a bitmap, RGB is either 255/255/255 or 0/0/0. Checking - just R is sufficient. */ - if (maskptr[0] == 0) - iconptr[3] = 0; /* 0, 1, 2 is R, G, B. 3 is alpha. */ - - iconptr += rowstride/width; - maskptr += mask_rowstride/width; - } - } + XImage *xmm = (! mask ? 0 + : XGetImage (FRAME_X_DISPLAY (f), mask, 0, 0, + width, height, ~0, XYPixmap)); + icon_buf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height); + if (icon_buf) + { + guchar *pixels = gdk_pixbuf_get_pixels (icon_buf); + int rowjunkwidth = gdk_pixbuf_get_rowstride (icon_buf) - width * 4; + for (int y = 0; y < height; y++, pixels += rowjunkwidth) + for (int x = 0; x < width; x++) + { + unsigned long rgb = XGetPixel (xim, x, y); + *pixels++ = (rgb >> 16) & 255; + *pixels++ = (rgb >> 8) & 255; + *pixels++ = rgb & 255; + *pixels++ = xmm && !XGetPixel (xmm, x, y) ? 0 : 255; + } + } - g_object_unref (G_OBJECT (mask_buf)); + if (xmm) + XDestroyImage (xmm); + XDestroyImage (xim); } return icon_buf; commit e99ff6e85ae30d94150e5c67dff2dd81077a6692 Author: Juri Linkov Date: Fri Mar 25 00:14:24 2016 +0200 * lisp/minibuffer.el (minibuffer-completion-help): Use fit-window-to-buffer instead of shrink-window-if-larger-than-buffer. (Bug#23092) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index ecac0ae..6540059 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1835,7 +1835,7 @@ variables.") 'display-buffer-below-selected)) ,(if temp-buffer-resize-mode '(window-height . resize-temp-buffer-window) - '(window-height . shrink-window-if-larger-than-buffer)) + '(window-height . fit-window-to-buffer)) ,(when temp-buffer-resize-mode '(preserve-size . (nil . t)))) nil commit 077b78cffc0711717ae8976ef302b788e88d27a8 Author: Eli Zaretskii Date: Thu Mar 24 20:52:45 2016 +0200 Define make_save_ptr_ptr unconditionally * src/alloc.c (make_save_ptr_ptr): Remove the !(defined USE_X_TOOLKIT || defined USE_GTK) conditional. Reported by Philipp Stephani . (Bug#23101) diff --git a/src/alloc.c b/src/alloc.c index b5be0f6..4c9cbf1 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3730,7 +3730,6 @@ make_save_ptr_int (void *a, ptrdiff_t b) return val; } -#if ! (defined USE_X_TOOLKIT || defined USE_GTK) Lisp_Object make_save_ptr_ptr (void *a, void *b) { @@ -3741,7 +3740,6 @@ make_save_ptr_ptr (void *a, void *b) p->data[1].pointer = b; return val; } -#endif Lisp_Object make_save_funcptr_ptr_obj (void (*a) (void), void *b, Lisp_Object c) commit 20a1003f6de52d574ea12e72ac5070a3d5e181ab Author: Eli Zaretskii Date: Thu Mar 24 20:05:49 2016 +0200 Preserve current buffer when popping up TTY menus * src/term.c (tty_menu_show): Be sure to save and restore the current buffer around TTY menu pop-ups. (Bug#23101) diff --git a/src/term.c b/src/term.c index 17f3679..a77e572 100644 --- a/src/term.c +++ b/src/term.c @@ -3402,9 +3402,11 @@ static void tty_pop_down_menu (Lisp_Object arg) { tty_menu *menu = XSAVE_POINTER (arg, 0); + struct buffer *orig_buffer = XSAVE_POINTER (arg, 1); block_input (); tty_menu_destroy (menu); + set_buffer_internal (orig_buffer); unblock_input (); } @@ -3683,7 +3685,10 @@ tty_menu_show (struct frame *f, int x, int y, int menuflags, pane = selidx = 0; - record_unwind_protect (tty_pop_down_menu, make_save_ptr (menu)); + /* We save and restore the current buffer because tty_menu_activate + triggers redisplay, which switches buffers at will. */ + record_unwind_protect (tty_pop_down_menu, + make_save_ptr_ptr (menu, current_buffer)); specbind (Qoverriding_terminal_local_map, Fsymbol_value (Qtty_menu_navigation_map)); commit 7eba90c12227d86636aaa3da8d68b0c213fb3910 Author: Eli Zaretskii Date: Thu Mar 24 18:30:41 2016 +0200 Improve font selection by family on MS-Windows * src/w32font.c (w32font_list_internal): Allow 'ascii-0' charset, in addition to 'iso10646-1', 'unicode-bmp', and 'unicode-sip'. This avoids rejecting many font families whose members are shown by 'font-family-list', in particular 'courier' requested by info.el. Without this change, many values of ':family' attribute of a face have no effect on MS-Windows, because they are rejected due to bogus mismatch of the charset. diff --git a/src/w32font.c b/src/w32font.c index a1878ad..018e657 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -796,7 +796,8 @@ w32font_list_internal (struct frame *f, Lisp_Object font_spec, && !EQ (spec_charset, Qiso10646_1) && !EQ (spec_charset, Qunicode_bmp) && !EQ (spec_charset, Qunicode_sip) - && !EQ (spec_charset, Qunknown)) + && !EQ (spec_charset, Qunknown) + && !EQ (spec_charset, Qascii_0)) return Qnil; } commit 73d213f2816876fe9c6c429e75a3be5454a42b34 Author: Paul Eggert Date: Wed Mar 23 15:07:56 2016 -0700 Comint, term, and compile now set EMACS This fixes directory tracking in ansi-term, at the expense of breaking some usages of 'configure'. Setting EMACS is meant to be a somewhat temporary measure, until Bash 4.4 comes out and is common. (Bug#20484). * etc/NEWS: Document this. * lisp/comint.el (comint-exec-1): * lisp/net/tramp-sh.el (tramp-remote-process-environment): * lisp/progmodes/compile.el (compilation-start): * lisp/term.el (term-exec-1): Go back to setting the EMACS environment variable, for backward compatibility to Bash 4.3 and earlier. diff --git a/etc/NEWS b/etc/NEWS index 8ce194a..f952a14 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1404,7 +1404,8 @@ symbol-function was changed not to signal 'void-function' any more. *** As a consequence, the second arg of 'indirect-function' is now obsolete. +++ -** Comint, term, and compile do not set the EMACS env var any more. +** Although comint, term, and compile still set the EMACS variable, +this is now considered deprecated and will be removed in a future release. Use the INSIDE_EMACS environment variable instead. +++ diff --git a/lisp/comint.el b/lisp/comint.el index dcd4a5a..cb79c17 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -816,6 +816,13 @@ series of processes in the same Comint buffer. The hook (format "COLUMNS=%d" (window-width))) (list "TERM=emacs" (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))) + + ;; This hack is for backward compatibility with Bash 4.3 and + ;; earlier. It can break common uses of 'configure', so + ;; remove it once Bash 4.4 or later is common. + (unless (getenv "EMACS") + (list "EMACS=t")) + (list (format "INSIDE_EMACS=%s,comint" emacs-version)) process-environment)) (default-directory diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 1f43747..9fa4610 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -520,6 +520,7 @@ as given in your `~/.profile'." (defcustom tramp-remote-process-environment `("TMOUT=0" "LC_CTYPE=''" ,(format "TERM=%s" tramp-terminal-type) + "EMACS=t" ;; Deprecated; remove this line once Bash 4.4-or-later is common. ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version) "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat" "autocorrect=" "correct=") diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index b7ab408..0b15a28 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1702,6 +1702,14 @@ Returns the compilation buffer created." (list "TERM=emacs" (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))) + + ;; Set the EMACS variable, but + ;; don't override users' setting of $EMACS. + ;; Remove this hack once Bash 4.4-or-later is common, + ;; since it can break 'configure'. + (unless (getenv "EMACS") + (list "EMACS=t")) + (list (format "INSIDE_EMACS=%s,compile" emacs-version)) (copy-sequence process-environment)))) (set (make-local-variable 'compilation-arguments) diff --git a/lisp/term.el b/lisp/term.el index a2e01ed..6fd3a5e 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1454,6 +1454,13 @@ Using \"emacs\" loses, because bash disables editing if $TERM == emacs.") (format "TERMINFO=%s" data-directory) (format term-termcap-format "TERMCAP=" term-term-name term-height term-width) + + ;; This is for backwards compatibility with Bash 4.3 and earlier. + ;; Remove this hack once Bash 4.4-or-later is common, because + ;; it breaks './configure' of some packages that expect it to + ;; say where to find EMACS. + (format "EMACS=%s (term:%s)" emacs-version term-protocol-version) + (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version) (format "LINES=%d" term-height) (format "COLUMNS=%d" term-width)) commit 9524ec5e4e3c7c3036f2640b2595d3755894c1b3 Author: Paul Eggert Date: Wed Mar 23 14:49:26 2016 -0700 Ignore more merges when generating ChangeLog * build-aux/gitlog-to-emacslog: Ignore all merges from gnu.org, not merely those from master and emacs-NN. The ChangeLog entries they generate are not that useful. diff --git a/build-aux/gitlog-to-emacslog b/build-aux/gitlog-to-emacslog index bcc47b1..5c187f5 100755 --- a/build-aux/gitlog-to-emacslog +++ b/build-aux/gitlog-to-emacslog @@ -77,7 +77,7 @@ test -d .git || { # Maybe we should skip all "Merge branch 'master'" messages. # See eg the cairo-related ones. ./build-aux/gitlog-to-changelog \ - --ignore-matching="^; |^Merge branch '(master|emacs-[0-9][0-9])' of git\.(savannah|sv)\.gnu\.org:/srv/git/emacs$|^Merge remote-tracking branch '.*'$" \ + --ignore-matching="^; |^Merge branch '[^']*' of git\.(savannah|sv)\.gnu\.org:/srv/git/emacs|^Merge remote-tracking branch '.*'$" \ --ignore-line='^; ' --format='%B' \ "$gen_origin..$new_origin" >"ChangeLog.tmp" || exit commit eabd667a9584fe5bd2422e296d256dceea67debf Author: Alan Mackenzie Date: Mon Mar 14 21:44:11 2016 +0000 Fix a cacheing bug, which led to inordinately slow c-beginning-of-defun. * lisp/progmodes/cc-defs.el (c-self-bind-state-cache): New macro. * lisp/progmodes/cc-engine.el (c-ssb-lit-begin): Always call c-parse-state rather than just using the cache variable c-state-cache. (c-syntactic-skip-backward): Invoke c-self-bind-state-cache to isolate calls to c-parse-state from other uses of the parse state cache. * lisp/progmodes/cc-cmds.el (c-beginning-of-defun, c-end-of-defun): Invoke c-self-bind-state-cache around the processing, replacing flawed bindings of c-state-cache. diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 6761de1..764f44a 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -1594,69 +1594,70 @@ defun." (c-region-is-active-p) (push-mark)) - (c-save-buffer-state - (beginning-of-defun-function end-of-defun-function - (start (point)) - (paren-state (copy-tree (c-parse-state))) ; This must not share list - ; structure with other users of c-state-cache. - (orig-point-min (point-min)) (orig-point-max (point-max)) - lim ; Position of { which has been widened to. - where pos case-fold-search) - - (save-restriction - (if (eq c-defun-tactic 'go-outward) - (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace. - paren-state orig-point-min orig-point-max))) - - ;; Move back out of any macro/comment/string we happen to be in. - (c-beginning-of-macro) - (setq pos (c-literal-limits)) - (if pos (goto-char (car pos))) - - (setq where (c-where-wrt-brace-construct)) - - (if (< arg 0) - ;; Move forward to the closing brace of a function. - (progn - (if (memq where '(at-function-end outwith-function)) - (setq arg (1+ arg))) - (if (< arg 0) - (c-while-widening-to-decl-block - (< (setq arg (- (c-forward-to-nth-EOF-} (- arg) where))) 0))) - ;; Move forward to the next opening brace.... - (when (and (= arg 0) - (progn - (c-while-widening-to-decl-block - (not (c-syntactic-re-search-forward "{" nil 'eob))) - (eq (char-before) ?{))) - (backward-char) - ;; ... and backward to the function header. - (c-beginning-of-decl-1) - t)) - - ;; Move backward to the opening brace of a function, making successively - ;; larger portions of the buffer visible as necessary. - (when (> arg 0) - (c-while-widening-to-decl-block - (> (setq arg (c-backward-to-nth-BOF-{ arg where)) 0))) - - (when (eq arg 0) - ;; Go backward to this function's header. - (c-beginning-of-decl-1) - - (setq pos (point)) - ;; We're now there, modulo comments and whitespace. - ;; Try to be line oriented; position point at the closest - ;; preceding boi that isn't inside a comment, but if we hit - ;; the previous declaration then we use the current point - ;; instead. - (while (and (/= (point) (c-point 'boi)) - (c-backward-single-comment))) - (if (/= (point) (c-point 'boi)) - (goto-char pos))) - - (c-keep-region-active) - (= arg 0))))) + (c-self-bind-state-cache ; We must not share with other users of c-state-cache. + (c-save-buffer-state + (beginning-of-defun-function + end-of-defun-function + (start (point)) + (paren-state (c-parse-state)) + (orig-point-min (point-min)) (orig-point-max (point-max)) + lim ; Position of { which has been widened to. + where pos case-fold-search) + + (save-restriction + (if (eq c-defun-tactic 'go-outward) + (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace. + paren-state orig-point-min orig-point-max))) + + ;; Move back out of any macro/comment/string we happen to be in. + (c-beginning-of-macro) + (setq pos (c-literal-limits)) + (if pos (goto-char (car pos))) + + (setq where (c-where-wrt-brace-construct)) + + (if (< arg 0) + ;; Move forward to the closing brace of a function. + (progn + (if (memq where '(at-function-end outwith-function)) + (setq arg (1+ arg))) + (if (< arg 0) + (c-while-widening-to-decl-block + (< (setq arg (- (c-forward-to-nth-EOF-} (- arg) where))) 0))) + ;; Move forward to the next opening brace.... + (when (and (= arg 0) + (progn + (c-while-widening-to-decl-block + (not (c-syntactic-re-search-forward "{" nil 'eob))) + (eq (char-before) ?{))) + (backward-char) + ;; ... and backward to the function header. + (c-beginning-of-decl-1) + t)) + + ;; Move backward to the opening brace of a function, making successively + ;; larger portions of the buffer visible as necessary. + (when (> arg 0) + (c-while-widening-to-decl-block + (> (setq arg (c-backward-to-nth-BOF-{ arg where)) 0))) + + (when (eq arg 0) + ;; Go backward to this function's header. + (c-beginning-of-decl-1) + + (setq pos (point)) + ;; We're now there, modulo comments and whitespace. + ;; Try to be line oriented; position point at the closest + ;; preceding boi that isn't inside a comment, but if we hit + ;; the previous declaration then we use the current point + ;; instead. + (while (and (/= (point) (c-point 'boi)) + (c-backward-single-comment))) + (if (/= (point) (c-point 'boi)) + (goto-char pos))) + + (c-keep-region-active) + (= arg 0)))))) (defun c-forward-to-nth-EOF-} (n where) ;; Skip to the closing brace of the Nth function after point. If @@ -1718,66 +1719,68 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'." (c-region-is-active-p) (push-mark)) - (c-save-buffer-state - (beginning-of-defun-function end-of-defun-function - (start (point)) - (paren-state (copy-tree (c-parse-state))) ; This must not share list - ; structure with other users of c-state-cache. - (orig-point-min (point-min)) (orig-point-max (point-max)) - lim - where pos case-fold-search) - - (save-restriction - (if (eq c-defun-tactic 'go-outward) - (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace - paren-state orig-point-min orig-point-max))) - - ;; Move back out of any macro/comment/string we happen to be in. - (c-beginning-of-macro) - (setq pos (c-literal-limits)) - (if pos (goto-char (car pos))) - - (setq where (c-where-wrt-brace-construct)) + (c-self-bind-state-cache ; c-state-cache's list structure must not be shared + ; with other users. + (c-save-buffer-state + (beginning-of-defun-function + end-of-defun-function + (start (point)) + (paren-state (c-parse-state)) + (orig-point-min (point-min)) (orig-point-max (point-max)) + lim + where pos case-fold-search) + + (save-restriction + (if (eq c-defun-tactic 'go-outward) + (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace + paren-state orig-point-min orig-point-max))) + + ;; Move back out of any macro/comment/string we happen to be in. + (c-beginning-of-macro) + (setq pos (c-literal-limits)) + (if pos (goto-char (car pos))) + + (setq where (c-where-wrt-brace-construct)) + + (if (< arg 0) + ;; Move backwards to the } of a function + (progn + (if (memq where '(at-header outwith-function)) + (setq arg (1+ arg))) + (if (< arg 0) + (c-while-widening-to-decl-block + (< (setq arg (- (c-backward-to-nth-BOF-{ (- arg) where))) 0))) + (if (= arg 0) + (c-while-widening-to-decl-block + (progn (c-syntactic-skip-backward "^}") + (not (eq (char-before) ?})))))) + + ;; Move forward to the } of a function + (if (> arg 0) + (c-while-widening-to-decl-block + (> (setq arg (c-forward-to-nth-EOF-} arg where)) 0)))) + + ;; Do we need to move forward from the brace to the semicolon? + (when (eq arg 0) + (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc. + (c-syntactic-re-search-forward ";")) - (if (< arg 0) - ;; Move backwards to the } of a function - (progn - (if (memq where '(at-header outwith-function)) - (setq arg (1+ arg))) - (if (< arg 0) - (c-while-widening-to-decl-block - (< (setq arg (- (c-backward-to-nth-BOF-{ (- arg) where))) 0))) - (if (= arg 0) - (c-while-widening-to-decl-block - (progn (c-syntactic-skip-backward "^}") - (not (eq (char-before) ?})))))) - - ;; Move forward to the } of a function - (if (> arg 0) - (c-while-widening-to-decl-block - (> (setq arg (c-forward-to-nth-EOF-} arg where)) 0)))) - - ;; Do we need to move forward from the brace to the semicolon? - (when (eq arg 0) - (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc. - (c-syntactic-re-search-forward ";")) + (setq pos (point)) + ;; We're there now, modulo comments and whitespace. + ;; Try to be line oriented; position point after the next + ;; newline that isn't inside a comment, but if we hit the + ;; next declaration then we use the current point instead. + (while (and (not (bolp)) + (not (looking-at "\\s *$")) + (c-forward-single-comment))) + (cond ((bolp)) + ((looking-at "\\s *$") + (forward-line 1)) + (t + (goto-char pos)))) - (setq pos (point)) - ;; We're there now, modulo comments and whitespace. - ;; Try to be line oriented; position point after the next - ;; newline that isn't inside a comment, but if we hit the - ;; next declaration then we use the current point instead. - (while (and (not (bolp)) - (not (looking-at "\\s *$")) - (c-forward-single-comment))) - (cond ((bolp)) - ((looking-at "\\s *$") - (forward-line 1)) - (t - (goto-char pos)))) - - (c-keep-region-active) - (= arg 0)))) + (c-keep-region-active) + (= arg 0))))) (defun c-defun-name () "Return the name of the current defun, or NIL if there isn't one. diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 000995c..3b9f44e 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -1258,7 +1258,8 @@ been put there by c-put-char-property. POINT remains unchanged." (def-edebug-spec c-clear-char-property t) (def-edebug-spec c-clear-char-properties t) (def-edebug-spec c-put-overlay t) -(def-edebug-spec c-delete-overlay t) ;)) +(def-edebug-spec c-delete-overlay t) +(def-edebug-spec c-self-bind-state-cache t);)) ;;; Functions. @@ -1397,6 +1398,26 @@ been put there by c-put-char-property. POINT remains unchanged." (save-restriction (widen) (c-set-cpp-delimiters ,beg ,end))))) + +(defmacro c-self-bind-state-cache (&rest forms) + ;; Bind the state cache to itself and execute the FORMS. It is assumed that no + ;; buffer changes will happen in FORMS, and no hidden buffer changes which could + ;; affect the parsing will be made by FORMS. + `(let ((c-state-cache (copy-tree c-state-cache)) + (c-state-cache-good-pos c-state-cache-good-pos) + ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache)) + ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit) + ;(c-state-semi-nonlit-pos-cache (copy-treec c-state-semi-nonlit-pos-cache)) + ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache) + (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert)) + (c-state-point-min c-state-point-min) + (c-state-point-min-lit-type c-state-point-min-lit-type) + (c-state-point-min-lit-start c-state-point-min-lit-start) + (c-state-min-scan-pos c-state-min-scan-pos) + (c-state-old-cpp-beg c-state-old-cpp-beg) + (c-state-old-cpp-end c-state-old-cpp-end)) + ,@forms)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The following macros are to be used only in `c-parse-state' and its diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 69a2a53..afe87c5 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -4259,8 +4259,7 @@ comment at the start of cc-engine.el for more info." (setq safe-pos-list (cdr safe-pos-list))) (unless (setq safe-pos (car-safe safe-pos-list)) (setq safe-pos (max (or (c-safe-position - (point) (or c-state-cache - (c-parse-state))) + (point) (c-parse-state)) 0) (point-min)) safe-pos-list (list safe-pos))) @@ -4308,107 +4307,108 @@ Non-nil is returned if the point moved, nil otherwise. Note that this function might do hidden buffer changes. See the comment at the start of cc-engine.el for more info." - (let ((start (point)) - state-2 - ;; A list of syntactically relevant positions in descending - ;; order. It's used to avoid scanning repeatedly over - ;; potentially large regions with `parse-partial-sexp' to verify - ;; each position. Used in `c-ssb-lit-begin' - safe-pos-list - ;; The result from `c-beginning-of-macro' at the start position or the - ;; start position itself if it isn't within a macro. Evaluated on - ;; demand. - start-macro-beg - ;; The earliest position after the current one with the same paren - ;; level. Used only when `paren-level' is set. - lit-beg - (paren-level-pos (point))) - - (while - (progn - ;; The next loop "tries" to find the end point each time round, - ;; loops when it hasn't succeeded. - (while - (and - (let ((pos (point))) - (while (and - (< (skip-chars-backward skip-chars limit) 0) - ;; Don't stop inside a literal. - (when (setq lit-beg (c-ssb-lit-begin)) - (goto-char lit-beg) - t))) - (< (point) pos)) + (c-self-bind-state-cache + (let ((start (point)) + state-2 + ;; A list of syntactically relevant positions in descending + ;; order. It's used to avoid scanning repeatedly over + ;; potentially large regions with `parse-partial-sexp' to verify + ;; each position. Used in `c-ssb-lit-begin' + safe-pos-list + ;; The result from `c-beginning-of-macro' at the start position or the + ;; start position itself if it isn't within a macro. Evaluated on + ;; demand. + start-macro-beg + ;; The earliest position after the current one with the same paren + ;; level. Used only when `paren-level' is set. + lit-beg + (paren-level-pos (point))) + + (while + (progn + ;; The next loop "tries" to find the end point each time round, + ;; loops when it hasn't succeeded. + (while + (and + (let ((pos (point))) + (while (and + (< (skip-chars-backward skip-chars limit) 0) + ;; Don't stop inside a literal. + (when (setq lit-beg (c-ssb-lit-begin)) + (goto-char lit-beg) + t))) + (< (point) pos)) + + (let ((pos (point)) state-2 pps-end-pos) - (let ((pos (point)) state-2 pps-end-pos) + (cond + ((and paren-level + (save-excursion + (setq state-2 (parse-partial-sexp + pos paren-level-pos -1) + pps-end-pos (point)) + (/= (car state-2) 0))) + ;; Not at the right level. + + (if (and (< (car state-2) 0) + ;; We stop above if we go out of a paren. + ;; Now check whether it precedes or is + ;; nested in the starting sexp. + (save-excursion + (setq state-2 + (parse-partial-sexp + pps-end-pos paren-level-pos + nil nil state-2)) + (< (car state-2) 0))) + + ;; We've stopped short of the starting position + ;; so the hit was inside a nested list. Go up + ;; until we are at the right level. + (condition-case nil + (progn + (goto-char (scan-lists pos -1 + (- (car state-2)))) + (setq paren-level-pos (point)) + (if (and limit (>= limit paren-level-pos)) + (progn + (goto-char limit) + nil) + t)) + (error + (goto-char (or limit (point-min))) + nil)) + + ;; The hit was outside the list at the start + ;; position. Go to the start of the list and exit. + (goto-char (1+ (elt state-2 1))) + nil)) + + ((c-beginning-of-macro limit) + ;; Inside a macro. + (if (< (point) + (or start-macro-beg + (setq start-macro-beg + (save-excursion + (goto-char start) + (c-beginning-of-macro limit) + (point))))) + t + + ;; It's inside the same macro we started in so it's + ;; a relevant match. + (goto-char pos) + nil)))))) - (cond - ((and paren-level - (save-excursion - (setq state-2 (parse-partial-sexp - pos paren-level-pos -1) - pps-end-pos (point)) - (/= (car state-2) 0))) - ;; Not at the right level. - - (if (and (< (car state-2) 0) - ;; We stop above if we go out of a paren. - ;; Now check whether it precedes or is - ;; nested in the starting sexp. - (save-excursion - (setq state-2 - (parse-partial-sexp - pps-end-pos paren-level-pos - nil nil state-2)) - (< (car state-2) 0))) - - ;; We've stopped short of the starting position - ;; so the hit was inside a nested list. Go up - ;; until we are at the right level. - (condition-case nil - (progn - (goto-char (scan-lists pos -1 - (- (car state-2)))) - (setq paren-level-pos (point)) - (if (and limit (>= limit paren-level-pos)) - (progn - (goto-char limit) - nil) - t)) - (error - (goto-char (or limit (point-min))) - nil)) - - ;; The hit was outside the list at the start - ;; position. Go to the start of the list and exit. - (goto-char (1+ (elt state-2 1))) - nil)) - - ((c-beginning-of-macro limit) - ;; Inside a macro. - (if (< (point) - (or start-macro-beg - (setq start-macro-beg - (save-excursion - (goto-char start) - (c-beginning-of-macro limit) - (point))))) - t - - ;; It's inside the same macro we started in so it's - ;; a relevant match. - (goto-char pos) - nil)))))) - - (> (point) - (progn - ;; Skip syntactic ws afterwards so that we don't stop at the - ;; end of a comment if `skip-chars' is something like "^/". - (c-backward-syntactic-ws) - (point))))) + (> (point) + (progn + ;; Skip syntactic ws afterwards so that we don't stop at the + ;; end of a comment if `skip-chars' is something like "^/". + (c-backward-syntactic-ws) + (point))))) - ;; We might want to extend this with more useful return values in - ;; the future. - (/= (point) start))) + ;; We might want to extend this with more useful return values in + ;; the future. + (/= (point) start)))) ;; The following is an alternative implementation of ;; `c-syntactic-skip-backward' that uses backward movement to keep