commit 7b9a5c2a451781f674f0a7ebd71f1061a174f627 (HEAD, refs/remotes/origin/master) Author: Tao Fang Date: Tue Apr 26 01:24:44 2016 +0200 Fix: (void-variable url-http-response-status) * lisp/url/url-http.el (url-https-proxy-after-change-function): Display the error message before doing the callback to avoid a void variable situation (bug#23290). diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 23cd695..d0f8364 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -1379,8 +1379,8 @@ The return value of this function is the retrieval buffer." (error "error: %s" e))) (error "error: gnutls support needed!"))) (t - (url-http-activate-callback) - (message "error response: %d" url-http-response-status)))))) + (message "error response: %d" url-http-response-status) + (url-http-activate-callback)))))) (defun url-http-async-sentinel (proc why) ;; We are performing an asynchronous connection, and a status change commit fd8956d36abaaa90137cf9f9c4b4095e3a2ac7c1 Author: Lars Magne Ingebrigtsen Date: Tue Apr 26 00:59:50 2016 +0200 smtpmail would say it's done before it is * lisp/mail/smtpmail.el (smtpmail-via-smtp): Move the sending of the data end marker from here... (bug#23020). (smtpmail-send-data): ... to here, so that we don't get a "Sending done" before we've sent the final "." (which can make the SMPT server reject the email. diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 8e0bb3a..f21b847 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -858,8 +858,6 @@ Returns an error if the server cannot be contacted." ;; Send the contents. (smtpmail-command-or-throw process "DATA") (smtpmail-send-data process smtpmail-text-buffer) - ;; DATA end "." - (smtpmail-command-or-throw process ".") ;; Return success. nil)) (when (and process @@ -957,10 +955,11 @@ Returns an error if the server cannot be contacted." (process-send-string process "\r\n")) (defun smtpmail-send-data (process buffer) - (let ((data-continue t) sending-data + (let ((data-continue t) (pr (with-current-buffer buffer (make-progress-reporter "Sending email " - (point-min) (point-max))))) + (point-min) (point-max)))) + sending-data) (with-current-buffer buffer (goto-char (point-min))) (while data-continue @@ -970,6 +969,8 @@ Returns an error if the server cannot be contacted." (end-of-line 2) (setq data-continue (not (eobp)))) (smtpmail-send-data-1 process sending-data)) + ;; DATA end "." + (smtpmail-command-or-throw process ".") (progress-reporter-done pr))) (defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end) commit 77ba0f1c5a259615ec049e21d061c4646e29f1d6 Author: Lars Magne Ingebrigtsen Date: Tue Apr 26 00:47:51 2016 +0200 `url-retrieve-synchronously' now takes an optional timeout parameter * doc/misc/url.texi (Retrieving URLs): Document optional parameters. * lisp/url/url.el (url-retrieve-synchronously): Allow passing in a timeout parameter (bug#22940). diff --git a/doc/misc/url.texi b/doc/misc/url.texi index 62b1d74..fe03234 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi @@ -289,11 +289,16 @@ string or a parsed URL structure. If it is a string, that string is passed through @code{url-encode-url} before using it, to ensure that it is properly URI-encoded (@pxref{URI Encoding}). -@defun url-retrieve-synchronously url +@defun url-retrieve-synchronously url &optional silent no-cookies timeout This function synchronously retrieves the data specified by @var{url}, and returns a buffer containing the data. The return value is @code{nil} if there is no data associated with the URL (as is the case for @code{dired}, @code{info}, and @code{mailto} URLs). + +If @var{silent} is non-@code{nil}, don't do any messaging while +retrieving. If @var{inhibit-cookies} is non-@code{nil}, refuse to +store cookies. If @var{timeout} is passed, it should be a number that +says (in seconds) how long to wait for a response before giving up. @end defun @defun url-retrieve url callback &optional cbargs silent no-cookies diff --git a/etc/NEWS b/etc/NEWS index e401d2d..2aeee96 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -284,6 +284,10 @@ servers. programmatically delete all cookies, or cookies from a specific domain. ++++ +*** `url-retrieve-synchronously' now takes an optional timeout parameter. + +--- *** The URL package now support HTTPS over proxies supporting CONNECT. +++ diff --git a/lisp/url/url.el b/lisp/url/url.el index 4837ba0..6d710e0 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el @@ -221,14 +221,20 @@ URL-encoded before it's used." buffer)) ;;;###autoload -(defun url-retrieve-synchronously (url &optional silent inhibit-cookies) +(defun url-retrieve-synchronously (url &optional silent inhibit-cookies timeout) "Retrieve URL synchronously. Return the buffer containing the data, or nil if there are no data associated with it (the case for dired, info, or mailto URLs that need -no further processing). URL is either a string or a parsed URL." +no further processing). URL is either a string or a parsed URL. + +If SILENT is non-nil, don't do any messaging while retrieving. +If INHIBIT-COOKIES is non-nil, refuse to store cookies. If +TIMEOUT is passed, it should be a number that says (in seconds) +how long to wait for a response before giving up." (url-do-setup) (let ((retrieval-done nil) + (start-time (current-time)) (asynch-buffer nil)) (setq asynch-buffer (url-retrieve url (lambda (&rest ignored) @@ -250,7 +256,11 @@ no further processing). URL is either a string or a parsed URL." ;; buffer-local variable so we can find the exact process that we ;; should be waiting for. In the mean time, we'll just wait for any ;; process output. - (while (not retrieval-done) + (while (and (not retrieval-done) + (or (not timeout) + (< (float-time (time-subtract + (current-time) start-time)) + timeout))) (url-debug 'retrieval "Spinning in url-retrieve-synchronously: %S (%S)" retrieval-done asynch-buffer) @@ -281,7 +291,7 @@ no further processing). URL is either a string or a parsed URL." ;; `sleep-for' was tried but it lead to other forms of ;; hanging. --Stef (unless (or (with-local-quit - (accept-process-output proc)) + (accept-process-output proc 1)) (null proc)) ;; accept-process-output returned nil, maybe because the process ;; exited (and may have been replaced with another). If we got commit 4f25bef332264df2e4d096e529a63655fa03c5bc Author: Lars Magne Ingebrigtsen Date: Tue Apr 26 00:30:36 2016 +0200 Include "Retype" as a comint password prompt * lisp/comint.el (comint-password-prompt-regexp): Include "Retype" to catch "Retype password for [account]:" from the "pass" utility (bug#22942). diff --git a/lisp/comint.el b/lisp/comint.el index dcd4a5a..88fc0b2 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -345,14 +345,15 @@ This variable is buffer-local." (regexp-opt '("Enter" "enter" "Enter same" "enter same" "Enter the" "enter the" "Old" "old" "New" "new" "'s" "login" - "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "[sudo]" "Repeat" "Bad") t) + "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "[sudo]" "Repeat" "Bad" "Retype") + t) " +\\)" "\\(?:" (regexp-opt password-word-equivalents) "\\|Response\\)" "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?\ \\(?: for [^::៖]+\\)?[::៖]\\s *\\'") "Regexp matching prompts for passwords in the inferior process. This is used by `comint-watch-for-password-prompt'." - :version "24.4" + :version "25.2" :type 'regexp :group 'comint) commit 89d1776b81ab552192ee41f13ce84ff86bda4556 Author: Alan Mackenzie Date: Mon Apr 25 17:57:24 2016 +0000 Fix spurious fontification of "for (; a * b;)" in CC Mode. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Check for being inside the parens of a for statement and after a semicolon near the beginning of the lambda form. diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index e171b20..6c34851 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1205,8 +1205,20 @@ casts and declarations are fontified. Used on level 2 and higher." 'font-lock-keyword-face) (looking-at c-not-decl-init-keywords)) (and c-macro-with-semi-re - (looking-at c-macro-with-semi-re))) ; 2008-11-04 - ;; Don't do anything more if we're looking at a keyword that + (looking-at c-macro-with-semi-re)) ; 2008-11-04 + (save-excursion ; A construct after a ; in a `for' statement + ; can't be a declaration. + (and (c-go-up-list-backward) + (eq (char-after) ?\() + (progn (c-backward-syntactic-ws) + (c-simple-skip-symbol-backward)) + (looking-at c-paren-stmt-key) + (progn (goto-char match-pos) + (while (and (eq (char-before) ?\)) + (c-go-list-backward)) + (c-backward-syntactic-ws)) + (eq (char-before) ?\;))))) + ;; Don't do anything more if we're looking at something that ;; can't start a declaration. t commit 86d083438dba60dc00e9e96414bf7e832720c05a Author: Paul Eggert Date: Mon Apr 25 10:41:29 2016 -0700 New function ‘char-from-name’ This also fixes the mishandling of "\N{CJK COMPATIBILITY IDEOGRAPH-F900}", "\N{VARIATION SELECTOR-1}", etc. Problem reported by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2016-04/msg00614.html * doc/lispref/nonascii.texi (Character Codes), etc/NEWS: Document this. * lisp/international/mule-cmds.el (char-from-name): New function. (read-char-by-name): Use it. Document that "BED" is treated as a name, not as a hexadecimal number. Reject out-of-range integers, floating-point numbers, and strings with trailing junk. * src/lread.c (character_name_to_code): Call char-from-name instead of inspecting ucs-names directly, so that we handle computed names like "VARIATION SELECTOR-1". Do not use an auto string, since char-from-name might GC. * test/src/lread-tests.el: Add tests for new behavior, and fix some old tests that were wrong. diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index 0e4aa86..fd2ce32 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi @@ -420,6 +420,18 @@ codepoint can have. @end example @end defun +@defun char-from-name string &optional ignore-case +This function returns the character whose Unicode name is @var{string}. +If @var{ignore-case} is non-@code{nil}, case is ignored in @var{string}. +This function returns @code{nil} if @var{string} does not name a character. + +@example +;; U+03A3 +(= (char-from-name "GREEK CAPITAL LETTER SIGMA") #x03A3) + @result{} t +@end example +@end defun + @defun get-byte &optional pos string This function returns the byte at character position @var{pos} in the current buffer. If the current buffer is unibyte, this is literally diff --git a/etc/NEWS b/etc/NEWS index 6bdb648..e401d2d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -391,6 +391,10 @@ compares their numerical values. According to this predicate, "foo2.png" is smaller than "foo12.png". +++ +** The new function 'char-from-name' converts a Unicode name string +to the corresponding character code. + ++++ ** New functions 'sxhash-eq' and 'sxhash-eql' return hash codes of a Lisp object suitable for use with 'eq' and 'eql' correspondingly. If two objects are 'eq' ('eql'), then the result of 'sxhash-eq' diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 8eb320a..2ce21a8 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2978,6 +2978,27 @@ on encoding." (let ((char (assoc name ucs-names))) (when char (format " (%c)" (cdr char))))) +(defun char-from-name (string &optional ignore-case) + "Return a character as a number from its Unicode name STRING. +If optional IGNORE-CASE is non-nil, ignore case in STRING. +Return nil if STRING does not name a character." + (or (cdr (assoc-string string (ucs-names) ignore-case)) + (let ((minus (string-match-p "-[0-9A-F]+\\'" string))) + (when minus + ;; Parse names like "VARIATION SELECTOR-17" and "CJK + ;; COMPATIBILITY IDEOGRAPH-F900" that are not in ucs-names. + (ignore-errors + (let* ((case-fold-search ignore-case) + (vs (string-match-p "\\`VARIATION SELECTOR-" string)) + (minus-num (string-to-number (substring string minus) + (if vs 10 16))) + (vs-offset (if vs (if (< minus-num -16) #xE00EF #xFDFF) 0)) + (code (- vs-offset minus-num)) + (name (get-char-code-property code 'name))) + (when (eq t (compare-strings string nil nil name nil nil + ignore-case)) + code))))))) + (defun read-char-by-name (prompt) "Read a character by its Unicode name or hex number string. Display PROMPT and read a string that represents a character by its @@ -2991,9 +3012,11 @@ preceded by an asterisk `*' and use completion, it will show all the characters whose names include that substring, not necessarily at the beginning of the name. -This function also accepts a hexadecimal number of Unicode code -point or a number in hash notation, e.g. #o21430 for octal, -#x2318 for hex, or #10r8984 for decimal." +Accept a name like \"CIRCULATION FUNCTION\", a hexadecimal +number like \"2A10\", or a number in hash notation (e.g., +\"#x2a10\" for hex, \"10r10768\" for decimal, or \"#o25020\" for +octal). Treat otherwise-ambiguous strings like \"BED\" (U+1F6CF) +as names, not numbers." (let* ((enable-recursive-minibuffers t) (completion-ignore-case t) (input @@ -3006,13 +3029,13 @@ point or a number in hash notation, e.g. #o21430 for octal, (category . unicode-name)) (complete-with-action action (ucs-names) string pred))))) (char - (cond - ((string-match-p "\\`[0-9a-fA-F]+\\'" input) - (string-to-number input 16)) - ((string-match-p "\\`#" input) - (read input)) - (t - (cdr (assoc-string input (ucs-names) t)))))) + (cond + ((char-from-name input t)) + ((string-match-p "\\`[0-9a-fA-F]+\\'" input) + (ignore-errors (string-to-number input 16))) + ((string-match-p "\\`#\\([bBoOxX]\\|[0-9]+[rR]\\)[0-9a-zA-Z]+\\'" + input) + (ignore-errors (read input)))))) (unless (characterp char) (error "Invalid character")) char)) diff --git a/src/lread.c b/src/lread.c index a42c1f6..6e97e07 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2155,26 +2155,15 @@ grow_read_buffer (void) static int character_name_to_code (char const *name, ptrdiff_t name_len) { - Lisp_Object code; - - /* Code point as U+XXXX.... */ - if (name[0] == 'U' && name[1] == '+') - { - /* Pass the leading '+' to string_to_number, so that it - rejects monstrosities such as negative values. */ - code = string_to_number (name + 1, 16, false); - } - else - { - /* Look up the name in the table returned by 'ucs-names'. */ - AUTO_STRING_WITH_LEN (namestr, name, name_len); - Lisp_Object names = call0 (Qucs_names); - code = CDR (Fassoc (namestr, names)); - } - - if (! (INTEGERP (code) - && 0 <= XINT (code) && XINT (code) <= MAX_UNICODE_CHAR - && ! char_surrogate_p (XINT (code)))) + /* For "U+XXXX", pass the leading '+' to string_to_number to reject + monstrosities like "U+-0000". */ + Lisp_Object code + = (name[0] == 'U' && name[1] == '+' + ? string_to_number (name + 1, 16, false) + : call2 (Qchar_from_name, make_unibyte_string (name, name_len), Qt)); + + if (! RANGED_INTEGERP (0, code, MAX_UNICODE_CHAR) + || char_surrogate_p (XINT (code))) { AUTO_STRING (format, "\\N{%s}"); AUTO_STRING_WITH_LEN (namestr, name, name_len); @@ -4829,5 +4818,5 @@ that are loaded before your customizations are read! */); DEFSYM (Qrehash_size, "rehash-size"); DEFSYM (Qrehash_threshold, "rehash-threshold"); - DEFSYM (Qucs_names, "ucs-names"); + DEFSYM (Qchar_from_name, "char-from-name"); } diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 2ebaf49..1a82d13 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -28,15 +28,55 @@ (ert-deftest lread-char-number () (should (equal (read "?\\N{U+A817}") #xA817))) -(ert-deftest lread-char-name () +(ert-deftest lread-char-name-1 () (should (equal (read "?\\N{SYLOTI NAGRI LETTER \n DHO}") #xA817))) +(ert-deftest lread-char-name-2 () + (should (equal (read "?\\N{BED}") #x1F6CF))) +(ert-deftest lread-char-name-3 () + (should (equal (read "?\\N{U+BED}") #xBED))) +(ert-deftest lread-char-name-4 () + (should (equal (read "?\\N{VARIATION SELECTOR-1}") #xFE00))) +(ert-deftest lread-char-name-5 () + (should (equal (read "?\\N{VARIATION SELECTOR-16}") #xFE0F))) +(ert-deftest lread-char-name-6 () + (should (equal (read "?\\N{VARIATION SELECTOR-17}") #xE0100))) +(ert-deftest lread-char-name-7 () + (should (equal (read "?\\N{VARIATION SELECTOR-256}") #xE01EF))) +(ert-deftest lread-char-name-8 () + (should (equal (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-F900}") #xF900))) +(ert-deftest lread-char-name-9 () + (should (equal (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-FAD9}") #xFAD9))) +(ert-deftest lread-char-name-10 () + (should (equal (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-2F800}") #x2F800))) +(ert-deftest lread-char-name-11 () + (should (equal (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-2FA1D}") #x2FA1D))) (ert-deftest lread-char-invalid-number () (should-error (read "?\\N{U+110000}") :type 'invalid-read-syntax)) -(ert-deftest lread-char-invalid-name () +(ert-deftest lread-char-invalid-name-1 () (should-error (read "?\\N{DOES NOT EXIST}")) :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-2 () + (should-error (read "?\\N{VARIATION SELECTOR-0}")) :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-3 () + (should-error (read "?\\N{VARIATION SELECTOR-257}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-4 () + (should-error (read "?\\N{VARIATION SELECTOR--0}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-5 () + (should-error (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-F8FF}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-6 () + (should-error (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-FADA}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-7 () + (should-error (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-2F7FF}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-8 () + (should-error (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-2FA1E}")) + :type 'invalid-read-syntax) (ert-deftest lread-char-non-ascii-name () (should-error (read "?\\N{LATIN CAPITAL LETTER Ø}") @@ -55,13 +95,13 @@ (should-error (read "?\\N{U+DFFF}") :type 'invalid-read-syntax)) (ert-deftest lread-string-char-number-1 () - (should (equal (read "a\\N{U+A817}b") "a\uA817bx"))) + (should (equal (read "\"a\\N{U+A817}b\"") "a\uA817b"))) (ert-deftest lread-string-char-number-2 () (should-error (read "?\\N{0.5}") :type 'invalid-read-syntax)) (ert-deftest lread-string-char-number-3 () (should-error (read "?\\N{U+-0}") :type 'invalid-read-syntax)) (ert-deftest lread-string-char-name () - (should (equal (read "a\\N{SYLOTI NAGRI LETTER DHO}b") "a\uA817b"))) + (should (equal (read "\"a\\N{SYLOTI NAGRI LETTER DHO}b\"") "a\uA817b"))) ;;; lread-tests.el ends here commit f069d854508946bcc03e4c77ceb430748e3ab6d7 Author: Tino Calancha Date: Mon Apr 25 19:27:06 2016 +0200 ; Run find-function-after-hook after finding a symbol * lisp/emacs-lisp/find-func.el (find-library): * lisp/help-mode.el (help-function-def, help-variable-def): Run `find-function-after-hook' inside the help-function of the buttons (bug#22583). diff --git a/etc/NEWS b/etc/NEWS index eff5472..6bdb648 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -56,7 +56,10 @@ affected by this, as SGI stopped supporting IRIX in December 2013. * Changes in Emacs 25.2 --- +** `find-library', `help-function-def' and `help-variable-def' now run +`find-function-after-hook'. + +--- ** 'process-attributes' on Darwin systems now returns more information. +++ diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 0575ce4..b04a9d2 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -283,7 +283,11 @@ LIBRARY should be a string (the name of the library)." "Library name: ") table nil nil nil nil def)))) (let ((buf (find-file-noselect (find-library-name library)))) - (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf))))) + (condition-case nil + (prog1 + (switch-to-buffer buf) + (run-hooks 'find-function-after-hook)) + (error (pop-to-buffer buf))))) ;;;###autoload (defun find-function-search-for-symbol (symbol type library) diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 7b95e5f..e008698 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -202,6 +202,7 @@ The format is (FUNCTION ARGS...).") (let ((location (find-function-search-for-symbol fun type file))) (pop-to-buffer (car location)) + (run-hooks 'find-function-after-hook) (if (cdr location) (goto-char (cdr location)) (message "Unable to find location in file")))) @@ -231,6 +232,7 @@ The format is (FUNCTION ARGS...).") (setq file (help-C-file-name var 'var))) (let ((location (find-variable-noselect var file))) (pop-to-buffer (car location)) + (run-hooks 'find-function-after-hook) (if (cdr location) (goto-char (cdr location)) (message "Unable to find location in file")))) commit db2ee1cd63ebebbe52099a1442dbc47f74135e5b Author: Alan Mackenzie Date: Mon Apr 25 17:08:26 2016 +0000 c-forward-<>-arglist no longer directly applies face properties in Java Mode. This allows the calling of c-restore-<>-properties from c-common-init without the test suite giving spurious errors. * lisp/progmodes/cc-engine.el (c-forward-<>-arglist): Remove the form that sets face properties. (c-forward-<>-arglist-recur): Reformulate the bit that handles types inside template brackets using c-inside-<>-type-key. Don't bind c-record-type-identifiers or c-record-found-types around the recursive call, allowing positions of found types to flow back to the caller. * lisp/progmodes/cc-langs.el (c-inside-<>-type-kwds, c-inside-<>-type-key): new lang consts/var. * lisp/progmodes/cc-mode.el (c-common-init): Don't remove c-restore-<>-properties from the list of functions called at mode initialization. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index c38a3a3..f7a850f 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -6026,7 +6026,6 @@ comment at the start of cc-engine.el for more info." ;; `nconc' doesn't mind that the tail of ;; `c-record-found-types' is t. (nconc c-record-found-types c-record-type-identifiers))) - (if (c-major-mode-is 'java-mode) (c-fontify-recorded-types-and-refs)) t) (goto-char start) @@ -6072,28 +6071,31 @@ comment at the start of cc-engine.el for more info." (progn (c-forward-syntactic-ws) (when (or (and c-record-type-identifiers all-types) - (c-major-mode-is 'java-mode)) - ;; All encountered identifiers are types, so set the - ;; promote flag and parse the type. - (progn - (c-forward-syntactic-ws) - (if (looking-at "\\?") - (forward-char) - (when (looking-at c-identifier-start) + (not (equal c-inside-<>-type-key "\\(\\<\\>\\)"))) + (c-forward-syntactic-ws) + (cond + ((eq (char-after) ??) + (forward-char)) + ((and (looking-at c-identifier-start) + (not (looking-at c-keywords-regexp))) + (if (or (and all-types c-record-type-identifiers) + (c-major-mode-is 'java-mode)) + ;; All encountered identifiers are types, so set the + ;; promote flag and parse the type. (let ((c-promote-possible-types t) (c-record-found-types t)) - (c-forward-type)))) + (c-forward-type)) + (c-forward-token-2)))) - (c-forward-syntactic-ws) + (c-forward-syntactic-ws) - (when (or (looking-at "extends") - (looking-at "super")) - (forward-word-strictly) - (c-forward-syntactic-ws) - (let ((c-promote-possible-types t) - (c-record-found-types t)) - (c-forward-type) - (c-forward-syntactic-ws))))) + (when (looking-at c-inside-<>-type-key) + (goto-char (match-end 1)) + (c-forward-syntactic-ws) + (let ((c-promote-possible-types t) + (c-record-found-types t)) + (c-forward-type)) + (c-forward-syntactic-ws))) (setq pos (point)) ; e.g. first token inside the '<' @@ -6414,9 +6416,7 @@ comment at the start of cc-engine.el for more info." ((and c-recognize-<>-arglists (eq (char-after) ?<)) ;; Maybe an angle bracket arglist. - (when (let ((c-record-type-identifiers t) - (c-record-found-types t) - (c-last-identifier-range)) + (when (let (c-last-identifier-range) (c-forward-<>-arglist nil)) (c-forward-syntactic-ws) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 94005be..705f723 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -2310,6 +2310,15 @@ assumed to be set if this isn't nil." t (c-make-keywords-re t (c-lang-const c-<>-sexp-kwds))) (c-lang-defvar c-opt-<>-sexp-key (c-lang-const c-opt-<>-sexp-key)) +(c-lang-defconst c-inside-<>-type-kwds + "Keywords which, used inside a C++ style template arglist, introduce a type." + t nil + java '("extends" "super")) + +(c-lang-defconst c-inside-<>-type-key + t (c-make-keywords-re t (c-lang-const c-inside-<>-type-kwds))) +(c-lang-defvar c-inside-<>-type-key (c-lang-const c-inside-<>-type-key)) + (c-lang-defconst c-brace-id-list-kwds "Keywords that may be followed by a brace block containing a comma separated list of identifier definitions, i.e. like the list of diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index a53c86c..2ab1d6b 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -686,9 +686,8 @@ compatible with old code; callers should always specify it." (funcall fn (point-min) (point-max))) c-get-state-before-change-functions) (mapc (lambda (fn) - (if (not (eq fn 'c-restore-<>-properties)) - (funcall fn (point-min) (point-max) - (- (point-max) (point-min))))) + (funcall fn (point-min) (point-max) + (- (point-max) (point-min)))) c-before-font-lock-functions)))) (set (make-local-variable 'outline-regexp) "[^#\n\^M]") commit ff9de7b38a3a316529c73e36645182055e2addc4 Author: Jun Hao Date: Mon Apr 25 18:02:08 2016 +0200 Pass in port only if provided by caller in the OS X keychain * lisp/auth-source.el (auth-source-macos-keychain-search): Pass in port only if provided (bug#23374). diff --git a/lisp/auth-source.el b/lisp/auth-source.el index d691b54..fe28a02 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -1735,7 +1735,7 @@ entries for git.gnus.org: (items (catch 'match (dolist (host hosts) (dolist (port ports) - (let* ((port (format "%S" port)) + (let* ((port (if port (format "%S" port))) (items (apply #'auth-source-macos-keychain-search-items coll type commit fda715c6cb576502c987e599964b715687b05b15 Author: Alan Mackenzie Date: Mon Apr 25 15:19:58 2016 +0000 Add fontification for a C declaration which looks like a function call. For example, "t1 *fn (t2 *b);". * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Add new variable at-decl-start, setting it to whether the putative decl starts immediately after ; or { or }. Accept such a construct as a decl when at-decl-start is non-nil. * lisp/progmodes/cc-langs.el (c-pre-start-tokens): New language variable. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 4aff0dc..c38a3a3 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -7152,6 +7152,9 @@ comment at the start of cc-engine.el for more info." cast-end ;; Have we got a new-style C++11 "auto"? new-style-auto + ;; Set when the symbol before `preceding-token-end' is known to + ;; terminate the previous construct, or when we're at point-min. + at-decl-start ;; Save `c-record-type-identifiers' and ;; `c-record-ref-identifiers' since ranges are recorded ;; speculatively and should be thrown away if it turns out @@ -7159,6 +7162,15 @@ comment at the start of cc-engine.el for more info." (save-rec-type-ids c-record-type-identifiers) (save-rec-ref-ids c-record-ref-identifiers)) + (save-excursion + (goto-char preceding-token-end) + (setq at-decl-start + (or (bobp) + (let ((tok-end (point))) + (c-backward-token-2) + (member (buffer-substring-no-properties (point) tok-end) + c-pre-start-tokens))))) + (while (c-forward-annotation) (c-forward-syntactic-ws)) @@ -7771,12 +7783,15 @@ comment at the start of cc-engine.el for more info." at-type (or at-decl-end (looking-at "=[^=]")) (not context) - (not got-suffix)) - ;; Got something like "foo * bar;". Since we're not inside an - ;; arglist it would be a meaningless expression because the - ;; result isn't used. We therefore choose to recognize it as - ;; a declaration. Do not allow a suffix since it could then - ;; be a function call. + (or (not got-suffix) + at-decl-start)) + ;; Got something like "foo * bar;". Since we're not inside + ;; an arglist it would be a meaningless expression because + ;; the result isn't used. We therefore choose to recognize + ;; it as a declaration. We only allow a suffix (which makes + ;; the construct look like a function call) when + ;; `at-decl-start' provides additional evidence that we do + ;; have a declaration. (throw 'at-decl-or-cast t)) ;; CASE 17 diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 6489199..94005be 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1330,6 +1330,14 @@ operators." (c-lang-defconst c-haskell-op-re t (c-make-keywords-re nil (c-lang-const c-haskell-op))) (c-lang-defvar c-haskell-op-re (c-lang-const c-haskell-op-re)) + +(c-lang-defconst c-pre-start-tokens + "List of operators following which an apparent declaration \(e.g. +\"t1 *fn (t2 *b);\") is most likely to be an actual declaration +\(as opposed to an arithmetic expression)." + t '(";" "{" "}")) +(c-lang-defvar c-pre-start-tokens (c-lang-const c-pre-start-tokens)) + ;;; Syntactic whitespace. commit 438b98e5b70c55129453870b870a139c4a4a77fd Author: Eli Zaretskii Date: Mon Apr 25 11:50:37 2016 +0300 Don't mirror slashes in convert-standard-filename on MS-Windows * lisp/w32-fns.el (w32-convert-standard-filename): Don't mirror slashes into backslashes. This avoids producing ugly file names, and is deemed no longer necessary, and should certainly be unrelated to which shell is in use. diff --git a/etc/NEWS b/etc/NEWS index f964e71..eff5472 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -418,6 +418,10 @@ Windows NT and later you can now register any hotkey combination. (On Windows 9X, the previous limitations, spelled out in the Emacs manual, still apply.) +** `convert-standard-filename' no longer mirrors slashes on MS-Windows. +Previously, on MS-Windows this function converted slash characters in +file names into backslashes. It no longer does that. + * Installation Changes in Emacs 25.1 diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el index 4723557..690a990 100644 --- a/lisp/w32-fns.el +++ b/lisp/w32-fns.el @@ -200,8 +200,7 @@ certain patterns. This function is called by `convert-standard-filename'. Replace invalid characters and turn Cygwin names into native -names, and also turn slashes into backslashes if the shell -requires it (see `w32-shell-dos-semantics')." +names." (save-match-data (let ((name (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename) @@ -216,13 +215,6 @@ requires it (see `w32-shell-dos-semantics')." (while (string-match "[?*:<>|\"\000-\037]" name start) (aset name (match-beginning 0) ?!) (setq start (match-end 0))) - ;; convert directory separators to Windows format - ;; (but only if the shell in use requires it) - (when (w32-shell-dos-semantics) - (setq start 0) - (while (string-match "/" name start) - (aset name (match-beginning 0) ?\\) - (setq start (match-end 0)))) name))) (defun set-w32-system-coding-system (coding-system)