commit 8ca70e402ecab5d7e71e418af6866c8b02d4f757 (HEAD, refs/remotes/origin/master) Author: Michael Albinus Date: Sun Oct 23 13:28:33 2016 +0200 ; Apply whitespace conventions of Tramp upstream diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index e907719..0e21a81 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4092,32 +4092,32 @@ process to set up. VEC specifies the connection." ;; CCC this can't be the right way to do it. Hm. (tramp-message vec 5 "Determining coding system") (with-current-buffer (process-buffer proc) - ;; Use MULE to select the right EOL convention for - ;; communicating with the process. + ;; Use MULE to select the right EOL convention for communicating + ;; with the process. (let ((cs (or (and (memq 'utf-8 (coding-system-list)) - (string-match "utf-?8" (tramp-get-remote-locale vec)) - (cons 'utf-8 'utf-8)) - (process-coding-system proc) - (cons 'undecided 'undecided))) - cs-decode cs-encode) - (when (symbolp cs) (setq cs (cons cs cs))) - (setq cs-decode (or (car cs) 'undecided) - cs-encode (or (cdr cs) 'undecided) - cs-encode - (coding-system-change-eol-conversion - cs-encode (if (string-match "^Darwin" uname) 'mac 'unix))) - (tramp-send-command vec "echo foo ; echo bar" t) - (goto-char (point-min)) - (when (search-forward "\r" nil t) - (setq cs-decode (coding-system-change-eol-conversion cs-decode 'dos))) - ;; Special setting for Mac OS X. - (when (and (string-match "^Darwin" uname) - (memq 'utf-8-hfs (coding-system-list))) - (setq cs-decode 'utf-8-hfs - cs-encode 'utf-8-hfs)) - (set-buffer-process-coding-system cs-decode cs-encode) - (tramp-message - vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))) + (string-match "utf-?8" (tramp-get-remote-locale vec)) + (cons 'utf-8 'utf-8)) + (process-coding-system proc) + (cons 'undecided 'undecided))) + cs-decode cs-encode) + (when (symbolp cs) (setq cs (cons cs cs))) + (setq cs-decode (or (car cs) 'undecided) + cs-encode (or (cdr cs) 'undecided) + cs-encode + (coding-system-change-eol-conversion + cs-encode (if (string-match "^Darwin" uname) 'mac 'unix))) + (tramp-send-command vec "echo foo ; echo bar" t) + (goto-char (point-min)) + (when (search-forward "\r" nil t) + (setq cs-decode (coding-system-change-eol-conversion cs-decode 'dos))) + ;; Special setting for Mac OS X. + (when (and (string-match "^Darwin" uname) + (memq 'utf-8-hfs (coding-system-list))) + (setq cs-decode 'utf-8-hfs + cs-encode 'utf-8-hfs)) + (set-buffer-process-coding-system cs-decode cs-encode) + (tramp-message + vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))) (tramp-send-command vec "set +o vi +o emacs" t) @@ -4172,7 +4172,7 @@ process to set up. VEC specifies the connection." ;; Set `remote-tty' process property. (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"" 'noerror))) (unless (zerop (length tty)) - (process-put proc 'remote-tty tty))) + (process-put proc 'remote-tty tty))) ;; Dump stty settings in the traces. (when (>= tramp-verbose 9) @@ -4183,13 +4183,13 @@ process to set up. VEC specifies the connection." (let (unset vars) (dolist (item (reverse - (append `(,(tramp-get-remote-locale vec)) - (copy-sequence tramp-remote-process-environment)))) - (setq item (split-string item "=" 'omit)) - (setcdr item (mapconcat 'identity (cdr item) "=")) - (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) - (push (format "%s %s" (car item) (cdr item)) vars) - (push (car item) unset))) + (append `(,(tramp-get-remote-locale vec)) + (copy-sequence tramp-remote-process-environment)))) + (setq item (split-string item "=" 'omit)) + (setcdr item (mapconcat 'identity (cdr item) "=")) + (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) + (push (format "%s %s" (car item) (cdr item)) vars) + (push (car item) unset))) (when vars (tramp-send-command vec commit a0d1e4c66296f76635f405427f55dbcc62a4fd68 Author: Paul Eggert Date: Sun Oct 23 02:58:07 2016 -0700 * src/regex.c (re_search_2): Use UNINIT, not IF_LINT. This finishes the merge of the recent emacs-25 regex changes into master. diff --git a/src/regex.c b/src/regex.c index 8bc8303..8d769cc 100644 --- a/src/regex.c +++ b/src/regex.c @@ -4346,7 +4346,8 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, /* Loop through the string, looking for a place to start matching. */ for (;;) { - ptrdiff_t offset1, offset2; + ptrdiff_t offset1; + ptrdiff_t offset2 UNINIT; /* The UNINIT works around GCC bug 78081. */ re_char *orig_base; bool might_relocate; @@ -4468,7 +4469,6 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, /* re_match_2_internal may allocate, relocating the Lisp text object that we're searching. */ - IF_LINT (offset2 = 0); /* Work around GCC bug 78081. */ orig_base = STR_BASE_PTR (re_match_object); might_relocate = orig_base != NULL; if (might_relocate) commit 394bdb8f2317e312d39e071b588581802dd3027a Merge: 46288dd 50fa7d6 Author: Paul Eggert Date: Sun Oct 23 02:50:48 2016 -0700 Merge from origin/emacs-25 50fa7d6 ;* src/w32heap.c: Fix typo and wording of the comments. 6f1325e electric-quote mode no longer worries about coding c2a1792 * src/regex.c (re_search_2): Make new code safe for -Wjump-mi... f6134bb Port to GCC 6.2.1 + --enable-gcc-warnings b2ba630 Explain how to debug emacsclient lisp errors 9da53e2 Let describe-function work for lambda again 5c2da93 Fix kill-line's docstring ad66b3f Fix handling of allocation in regex matching 5a26c9b * lisp/electric.el (electric-quote-mode): Improve doc (Bug#24... 3877c91 vc-region-history: Search just on lines intersecting the region 8988327 Fix documentation of 'alist-get' b6998ea * src/regex.h (re_match_object): Improve commentary. # Conflicts: # etc/NEWS # lisp/help-fns.el commit 46288dd6321e2ff4028781383660786050933304 Merge: 6df147c dfd0476 Author: Paul Eggert Date: Sun Oct 23 02:48:50 2016 -0700 ; Merge from origin/emacs-25 The following commit was skipped: dfd0476 Fix cursor at bottom left of rectangle (bug#24364) commit 6df147c61a2f3fbabe6e47349d4e826cc7414ea2 Merge: e892e11 8ad0d7d Author: Paul Eggert Date: Sun Oct 23 02:48:50 2016 -0700 Merge from origin/emacs-25 8ad0d7d ; Fix quoting in etc/NEWS 6b9dee1 Change Tramp version to "2.2.13.25.2" 62f2684 * lisp/emacs-lisp/autoload.el (update-directory-autoloads): F... b2f32e4 Don't scan compiled module files for autoloads 9a758b4 Fix Bug#24698 baa8ba4 * lisp/subr.el (start-process): Doc fix. (Bug#24693) e535ca4 Fix display of vc-dir CVS file statuses in subdirectories 12da149 Update URL of MS-Windows optional DLLs 2331056 Merge branch 'emacs-25' of git.savannah.gnu.org:/srv/git/emac... a4285bc * lisp/simple.el (process-menu-mode, list-processes--refresh)... b0c447e * lisp/ibuf-ext.el (ibuffer-do-shell-command-file): Fix non-f... cf3c19b * lisp/ibuffer.el (ibuffer): Improve 'other-window' case. (B... # Conflicts: # doc/misc/trampver.texi # etc/NEWS # lisp/net/tramp-sh.el # lisp/net/trampver.el commit e892e1158619f546182e990f927abea02cdf5db3 Merge: 6129cd0 d70ed8a Author: Paul Eggert Date: Sun Oct 23 02:43:18 2016 -0700 ; Merge from origin/emacs-25 The following commits were skipped: d70ed8a Fix time-related data types in 2 editfns.c functions 99892ee Port to Ubuntu 16.10, which needs gcc -nopie commit 6129cd03e20a0aaee46ceb742a9ed1ae2904eab3 Merge: 16d126d b73f466 Author: Paul Eggert Date: Sun Oct 23 02:43:17 2016 -0700 Merge from origin/emacs-25 b73f466 * lisp/cus-start.el (exec-path): Handle nil elements. (Bug#2... 55ebb70 Catch the imenu-unavailable error in sh-mode completion table 993acb5 ; Minor fix for last change in characters.el 30c4bb5 More char-width fixes 4eb4463 Fix char-width-table values for some Emoji 528997d Keep point when switching from and to *terminal* buffer 2130005 * INSTALL: Use correct Emacs release number 25. 10835b1 Avoid crashes due to objects read with the #n=object form 4de671d Improve doc string of 'completion-at-point-functions' ceb46f0 Fix crash in evaluating functions d8374c4 * src/filelock.c (current_lock_owner): Update comment. commit 16d126d7559c2f58c8af6cf86c9f54b6e21cceb4 Merge: f39141b eb17d6f Author: Paul Eggert Date: Sun Oct 23 02:43:17 2016 -0700 ; Merge from origin/emacs-25 The following commits were skipped: eb17d6f Port --enable-gcc-warnings to GCC 6.2.1 40c426a Work around Samba bug with ':' in symlink contents commit f39141b786525700c2619e5731c166e294265888 Merge: 241ae7a 2deb20c Author: Paul Eggert Date: Sun Oct 23 02:43:16 2016 -0700 Merge from origin/emacs-25 2deb20c Port last_marked change to full-program optimizers 27eb668 Adapt GDB scripts to '--enable-check-lisp-object-type' builds dac64e3 Avoid optimizing out the last_marked[] array commit 50fa7d64d36c3f2d6ab11e7136575fbca7012cae Author: Eli Zaretskii Date: Sun Oct 23 12:14:05 2016 +0300 ;* src/w32heap.c: Fix typo and wording of the comments. diff --git a/src/w32heap.c b/src/w32heap.c index 6643b43..3e628d5 100644 --- a/src/w32heap.c +++ b/src/w32heap.c @@ -129,18 +129,18 @@ static DWORD_PTR committed = 0; /* The maximum block size that can be handled by a non-growable w32 heap is limited by the MaxBlockSize value below. - This point deserves and explanation. + This point deserves an explanation. - The W32 heap allocator can be used for a growable - heap or a non-growable one. + The W32 heap allocator can be used for a growable heap or a + non-growable one. A growable heap is not compatible with a fixed base address for the heap. Only a non-growable one is. One drawback of non-growable heaps is that they can hold only objects smaller than a certain - size (the one defined below). Most of the largest blocks are GC'ed - before dumping. In any case and to be safe, we implement a simple + size (the one defined below). Most of the larger blocks are GC'ed + before dumping. In any case, and to be safe, we implement a simple first-fit allocation algorithm starting at the end of the - dumped_data[] array like depicted below: + dumped_data[] array as depicted below: ---------------------------------------------- | | | | @@ -273,7 +273,7 @@ init_heap (void) else { /* Find the RtlCreateHeap function. Headers for this function - are provided with the w32 ddk, but the function is available + are provided with the w32 DDK, but the function is available in ntdll.dll since XP. */ HMODULE hm_ntdll = LoadLibrary ("ntdll.dll"); RtlCreateHeap_Proc s_pfn_Rtl_Create_Heap commit 6f1325ed926ed455398021377a10160ac695c0d6 Author: Paul Eggert Date: Sun Oct 23 01:14:23 2016 -0700 electric-quote mode no longer worries about coding * doc/emacs/text.texi (Quotation Marks), etc/NEWS: Document this. * lisp/electric.el (electric--insertable-p): Remove. All uses removed (Bug#24759). diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 579f788..7fa0804 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -422,9 +422,7 @@ portable; curved quotes are less ambiguous and typically look nicer. Electric Quote mode makes it easier to type curved quotes. As you type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’}, -@t{``} to @t{“}, and @t{''} to @t{”}. These conversions are -suppressed in buffers whose coding systems cannot represent curved -quote characters. +@t{``} to @t{“}, and @t{''} to @t{”}. @vindex electric-quote-paragraph @vindex electric-quote-comment diff --git a/etc/NEWS b/etc/NEWS index 5b89639..a5bcb8d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -38,6 +38,12 @@ fontsets if the default font supports these characters. Set this variable to nil to disable the new behavior and get back the old behavior. ++++ +** 'electric-quote-mode' is no longer suppressed in a buffer whose +whose coding system cannot represent curved quote characters. +Instead, users can deal with the unrepresentable characters in the +usual way when they save the buffer. + --- ** New variable 'inhibit-compacting-font-caches'. Set this variable to a non-nil value to speed up display of characters diff --git a/lisp/electric.el b/lisp/electric.el index b6697e0..ab9770b 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -430,12 +430,6 @@ The variable `electric-layout-rules' says when and how to insert newlines." :version "25.1" :type 'boolean :safe 'booleanp :group 'electricity) -(defun electric--insertable-p (string) - (or (not buffer-file-coding-system) - (eq (coding-system-base buffer-file-coding-system) 'undecided) - (not (unencodable-char-position nil nil buffer-file-coding-system - nil string)))) - (defun electric-quote-post-self-insert-function () "Function that `electric-quote-mode' adds to `post-self-insert-hook'. This requotes when a quoting key is typed." @@ -460,8 +454,7 @@ This requotes when a quoting key is typed." (when start (save-excursion (if (eq last-command-event ?\`) - (cond ((and (electric--insertable-p "“") - (search-backward "‘`" (- (point) 2) t)) + (cond ((search-backward "‘`" (- (point) 2) t) (replace-match "“") (when (and electric-pair-mode (eq (cdr-safe @@ -469,16 +462,13 @@ This requotes when a quoting key is typed." (char-after))) (delete-char 1)) (setq last-command-event ?“)) - ((and (electric--insertable-p "‘") - (search-backward "`" (1- (point)) t)) + ((search-backward "`" (1- (point)) t) (replace-match "‘") (setq last-command-event ?‘))) - (cond ((and (electric--insertable-p "”") - (search-backward "’'" (- (point) 2) t)) + (cond ((search-backward "’'" (- (point) 2) t) (replace-match "”") (setq last-command-event ?”)) - ((and (electric--insertable-p "’") - (search-backward "'" (1- (point)) t)) + ((search-backward "'" (1- (point)) t) (replace-match "’") (setq last-command-event ?’))))))))) @@ -497,9 +487,6 @@ and text paragraphs, and these are selectively controlled with `electric-quote-comment', `electric-quote-string', and `electric-quote-paragraph'. -Electric quoting is suppressed in a buffer whose coding system -cannot represent the replacement characters. - This is a global minor mode. To toggle the mode in a single buffer, use `electric-quote-local-mode'." :global t :group 'electricity commit c2a17924a57483d14692c8913edbe8ad24b5ffbb Author: Paul Eggert Date: Sun Oct 23 01:00:27 2016 -0700 * src/regex.c (re_search_2): Make new code safe for -Wjump-misses-init. diff --git a/src/regex.c b/src/regex.c index daa15ec..b12e95b 100644 --- a/src/regex.c +++ b/src/regex.c @@ -4380,6 +4380,10 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, /* Loop through the string, looking for a place to start matching. */ for (;;) { + ptrdiff_t offset1, offset2; + re_char *orig_base; + bool might_relocate; + /* If the pattern is anchored, skip quickly past places we cannot match. We don't bother to treat startpos == 0 specially @@ -4498,10 +4502,9 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, /* re_match_2_internal may allocate, relocating the Lisp text object that we're searching. */ - ptrdiff_t offset1, offset2; IF_LINT (offset2 = 0); /* Work around GCC bug 78081. */ - re_char *orig_base = STR_BASE_PTR (re_match_object); - bool might_relocate = orig_base != NULL; + orig_base = STR_BASE_PTR (re_match_object); + might_relocate = orig_base != NULL; if (might_relocate) { if (string1) offset1 = string1 - orig_base; commit f6134bbda259c115c06d4a9a3ab5c39340a15949 Author: Paul Eggert Date: Sat Oct 22 21:12:54 2016 -0700 Port to GCC 6.2.1 + --enable-gcc-warnings * src/regex.c (ENSURE_FAIL_STACK, re_search_2): Redo recent regex changes to avoid complaints from GCC 6.2.1 when Emacs is configured with --enable-gcc-warnings. Also, work around GCC bug 78081, which was uncovered by this new code. diff --git a/src/regex.c b/src/regex.c index 1346ef4..daa15ec 100644 --- a/src/regex.c +++ b/src/regex.c @@ -1439,21 +1439,22 @@ typedef struct #define TOP_FAILURE_HANDLE() fail_stack.frame #ifdef emacs -#define STR_BASE_PTR(obj) \ - (NILP (obj) ? current_buffer->text->beg : \ - STRINGP (obj) ? SDATA (obj) : \ - NULL) +# define STR_BASE_PTR(obj) \ + (NILP (obj) ? current_buffer->text->beg \ + : STRINGP (obj) ? SDATA (obj) \ + : NULL) #else -#define STR_BASE_PTR(obj) NULL +# define STR_BASE_PTR(obj) NULL #endif #define ENSURE_FAIL_STACK(space) \ while (REMAINING_AVAIL_SLOTS <= space) { \ - re_char* orig_base = STR_BASE_PTR (re_match_object); \ + re_char *orig_base = STR_BASE_PTR (re_match_object); \ + bool might_relocate = orig_base != NULL; \ ptrdiff_t string1_off, end1_off, end_match_1_off; \ ptrdiff_t string2_off, end2_off, end_match_2_off; \ ptrdiff_t d_off, dend_off, dfail_off; \ - if (orig_base) \ + if (might_relocate) \ { \ if (string1) \ { \ @@ -1472,12 +1473,11 @@ while (REMAINING_AVAIL_SLOTS <= space) { \ dfail_off = dfail - orig_base; \ } \ if (!GROW_FAIL_STACK (fail_stack)) \ - return -2; \ - /* GROW_FAIL_STACK may call malloc and relocate the string */ \ - /* pointers. */ \ - re_char* new_base = STR_BASE_PTR (re_match_object); \ - if (new_base && new_base != orig_base) \ + return -2; \ + /* In Emacs, GROW_FAIL_STACK might relocate string pointers. */ \ + if (might_relocate) \ { \ + re_char *new_base = STR_BASE_PTR (re_match_object); \ if (string1) \ { \ string1 = new_base + string1_off; \ @@ -4496,11 +4496,13 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, && !bufp->can_be_null) return -1; - /* re_match_2_internal may allocate, causing a relocation of the - lisp text object that we're searching. */ + /* re_match_2_internal may allocate, relocating the Lisp text + object that we're searching. */ ptrdiff_t offset1, offset2; + IF_LINT (offset2 = 0); /* Work around GCC bug 78081. */ re_char *orig_base = STR_BASE_PTR (re_match_object); - if (orig_base) + bool might_relocate = orig_base != NULL; + if (might_relocate) { if (string1) offset1 = string1 - orig_base; if (string2) offset2 = string2 - orig_base; @@ -4515,9 +4517,9 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, if (val == -2) return -2; - re_char *new_base = STR_BASE_PTR (re_match_object); - if (new_base && new_base != orig_base) + if (might_relocate) { + re_char *new_base = STR_BASE_PTR (re_match_object); if (string1) string1 = offset1 + new_base; if (string2) string2 = offset2 + new_base; } commit b2ba630739cf12db939cdcfe9cd19b6a7fdfbf97 Author: Noam Postavsky Date: Sat Oct 22 11:52:14 2016 -0400 Explain how to debug emacsclient lisp errors * doc/lispref/debugging.texi (Error Debugging): Mention that debug-on-signal is useful for getting backtraces from emacsclient (Bug#24616). diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index c88a2fa..3719343 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -152,6 +152,13 @@ presence of @code{condition-case}. (To invoke the debugger, the error must still fulfill the criteria specified by @code{debug-on-error} and @code{debug-ignored-errors}.) +@cindex emacsclient, getting a backtrace +@cindex backtrace from emacsclient's @option{--eval} +For example, setting this variable is useful to get a backtrace from +code evaluated by emacsclient's @option{--eval} option. If Lisp code +evaluated by emacsclient signals an error while this variable is +non-@code{nil}, the backtrace will popup in the running Emacs. + @strong{Warning:} Setting this variable to non-@code{nil} may have annoying effects. Various parts of Emacs catch errors in the normal course of affairs, and you may not even realize that errors happen commit 9da53e2d353c97ab955fe8c35482b5eb335316c1 Author: Noam Postavsky Date: Mon Oct 3 18:49:56 2016 -0400 Let describe-function work for lambda again Since commit "* lisp/help-fns.el (describe-function): More type checking[...]", `describe-function' throws a user-error when given a non-symbol. This prevents the [back] button in a *Help* buffer from working when the page it goes back to describes an anonymous function (e.g., the result of `describe-key' on a key which is bound to a lambda form). * lisp/help-fns.el (describe-function): Move the checks on FUNCTION being an fbound symbol into the `interactive' form. This allows non-interactive calls to pass an anonymous function (Bug #24221). Note that passing a non-bound symbol non-interactively will still trigger a `void-function' error from `describe-function-1'. diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 26d8839..7dfa670 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -50,23 +50,24 @@ to get buffer-local values.") ;;;###autoload (defun describe-function (function) - "Display the full documentation of FUNCTION (a symbol)." + "Display the full documentation of FUNCTION (a symbol). +When called from lisp, FUNCTION may also be a function object." (interactive - (let ((fn (function-called-at-point)) - (enable-recursive-minibuffers t) - val) - (setq val (completing-read (if fn - (format "Describe function (default %s): " fn) - "Describe function: ") - obarray 'fboundp t nil nil - (and fn (symbol-name fn)))) - (list (if (equal val "") - fn (intern val))))) - (or (and function (symbolp function)) - (user-error "You didn't specify a function symbol")) - (or (fboundp function) - (user-error "Symbol's function definition is void: %s" function)) - + (let* ((fn (function-called-at-point)) + (enable-recursive-minibuffers t) + (val (completing-read + (if fn + (format "Describe function (default %s): " fn) + "Describe function: ") + obarray 'fboundp t nil nil + (and fn (symbol-name fn))))) + (unless (equal val "") + (setq fn (intern val))) + (unless (and fn (symbolp fn)) + (user-error "You didn't specify a function symbol")) + (unless (fboundp fn) + (user-error "Symbol's function definition is void: %s" fn)) + (list fn))) ;; We save describe-function-orig-buffer on the help xref stack, so ;; it is restored by the back/forward buttons. 'help-buffer' ;; expects (current-buffer) to be a help buffer when processing commit 5c2da93015abb2e6746d54e5946dfaa5ede4e685 Author: Noam Postavsky Date: Sat Sep 17 13:30:24 2016 -0400 Fix kill-line's docstring * lisp/simple.el (kill-line): The effect of show-trailing-whitespace is important lines with *no* nonblanks (Bug #16654). diff --git a/lisp/simple.el b/lisp/simple.el index 67c0266..6d36a88 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4846,8 +4846,8 @@ To kill a whole line, when point is not at the beginning, type \ \\[move-beginning-of-line] \\[kill-line] \\[kill-line]. If `show-trailing-whitespace' is non-nil, this command will just -kill the rest of the current line, even if there are only -nonblanks there. +kill the rest of the current line, even if there are no nonblanks +there. If option `kill-whole-line' is non-nil, then this command kills the whole line including its terminating newline, when used at the beginning of a line commit ad66b3fadb7ae22a4cbb82bb1507c39ceadf3897 Author: Noam Postavsky Date: Wed Oct 19 20:23:50 2016 -0400 Fix handling of allocation in regex matching `re_match_2_internal' uses pointers to the lisp objects that it searches. Since it may call malloc when growing the "fail stack", these pointers may be invalidated while searching, resulting in memory curruption (Bug #24358). To fix this, we check the pointer that the lisp object (as specified by re_match_object) points to before and after growing the stack, and update existing pointers accordingly. * src/regex.c (STR_BASE_PTR): New macro. (ENSURE_FAIL_STACK, re_search_2): Use it to convert pointers into offsets before possible malloc call, and back into pointers again afterwards. (POS_AS_IN_BUFFER): Add explanatory comment about punning trick. * src/search.c (search_buffer): Instead of storing search location as pointers, store them as pointers and recompute the corresponding address for each call to `re_search_2'. (string_match_1, fast_string_match_internal, fast_looking_at): * src/dired.c (directory_files_internal): Set `re_match_object' to Qnil after calling `re_search' or `re_match_2'. * src/regex.h (re_match_object): Mention new usage in commentary. diff --git a/src/dired.c b/src/dired.c index dba575c..006f74c 100644 --- a/src/dired.c +++ b/src/dired.c @@ -259,9 +259,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, QUIT; bool wanted = (NILP (match) - || re_search (bufp, SSDATA (name), len, 0, len, 0) >= 0); + || (re_match_object = name, + re_search (bufp, SSDATA (name), len, 0, len, 0) >= 0)); immediate_quit = 0; + re_match_object = Qnil; /* Stop protecting name from GC. */ if (wanted) { diff --git a/src/regex.c b/src/regex.c index 164eb46..1346ef4 100644 --- a/src/regex.c +++ b/src/regex.c @@ -152,6 +152,8 @@ /* Converts the pointer to the char to BEG-based offset from the start. */ # define PTR_TO_OFFSET(d) POS_AS_IN_BUFFER (POINTER_TO_OFFSET (d)) +/* Strings are 0-indexed, buffers are 1-indexed; we pun on the boolean + result to get the right base index. */ # define POS_AS_IN_BUFFER(p) ((p) + (NILP (re_match_object) || BUFFERP (re_match_object))) # define RE_MULTIBYTE_P(bufp) ((bufp)->multibyte) @@ -1436,11 +1438,62 @@ typedef struct #define NEXT_FAILURE_HANDLE(h) fail_stack.stack[(h) - 3].integer #define TOP_FAILURE_HANDLE() fail_stack.frame +#ifdef emacs +#define STR_BASE_PTR(obj) \ + (NILP (obj) ? current_buffer->text->beg : \ + STRINGP (obj) ? SDATA (obj) : \ + NULL) +#else +#define STR_BASE_PTR(obj) NULL +#endif #define ENSURE_FAIL_STACK(space) \ while (REMAINING_AVAIL_SLOTS <= space) { \ + re_char* orig_base = STR_BASE_PTR (re_match_object); \ + ptrdiff_t string1_off, end1_off, end_match_1_off; \ + ptrdiff_t string2_off, end2_off, end_match_2_off; \ + ptrdiff_t d_off, dend_off, dfail_off; \ + if (orig_base) \ + { \ + if (string1) \ + { \ + string1_off = string1 - orig_base; \ + end1_off = end1 - orig_base; \ + end_match_1_off = end_match_1 - orig_base; \ + } \ + if (string2) \ + { \ + string2_off = string2 - orig_base; \ + end2_off = end2 - orig_base; \ + end_match_2_off = end_match_2 - orig_base; \ + } \ + d_off = d - orig_base; \ + dend_off = dend - orig_base; \ + dfail_off = dfail - orig_base; \ + } \ if (!GROW_FAIL_STACK (fail_stack)) \ - return -2; \ + return -2; \ + /* GROW_FAIL_STACK may call malloc and relocate the string */ \ + /* pointers. */ \ + re_char* new_base = STR_BASE_PTR (re_match_object); \ + if (new_base && new_base != orig_base) \ + { \ + if (string1) \ + { \ + string1 = new_base + string1_off; \ + end1 = new_base + end1_off; \ + end_match_1 = new_base + end_match_1_off; \ + } \ + if (string2) \ + { \ + string2 = new_base + string2_off; \ + end2 = new_base + end2_off; \ + end_match_2 = new_base + end_match_2_off; \ + } \ + d = new_base + d_off; \ + dend = new_base + dend_off; \ + dfail = new_base + dfail_off; \ + } \ DEBUG_PRINT ("\n Doubled stack; size now: %zd\n", (fail_stack).size);\ DEBUG_PRINT (" slots available: %zd\n", REMAINING_AVAIL_SLOTS);\ } @@ -4443,6 +4496,16 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, && !bufp->can_be_null) return -1; + /* re_match_2_internal may allocate, causing a relocation of the + lisp text object that we're searching. */ + ptrdiff_t offset1, offset2; + re_char *orig_base = STR_BASE_PTR (re_match_object); + if (orig_base) + { + if (string1) offset1 = string1 - orig_base; + if (string2) offset2 = string2 - orig_base; + } + val = re_match_2_internal (bufp, string1, size1, string2, size2, startpos, regs, stop); @@ -4452,6 +4515,13 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, if (val == -2) return -2; + re_char *new_base = STR_BASE_PTR (re_match_object); + if (new_base && new_base != orig_base) + { + if (string1) string1 = offset1 + new_base; + if (string2) string2 = offset2 + new_base; + } + advance: if (!range) break; @@ -4887,8 +4957,8 @@ WEAK_ALIAS (__re_match, re_match) #endif /* not emacs */ #ifdef emacs -/* In Emacs, this is the string or buffer in which we - are matching. It is used for looking up syntax properties. */ +/* In Emacs, this is the string or buffer in which we are matching. + See the declaration in regex.h for details. */ Lisp_Object re_match_object; #endif diff --git a/src/regex.h b/src/regex.h index 51f4424..61c771c 100644 --- a/src/regex.h +++ b/src/regex.h @@ -169,7 +169,9 @@ extern reg_syntax_t re_syntax_options; #ifdef emacs # include "lisp.h" /* In Emacs, this is the string or buffer in which we are matching. - It is used for looking up syntax properties. + It is used for looking up syntax properties, and also to recompute + pointers in case the object is relocated as a side effect of + calling malloc (if it calls r_alloc_sbrk in ralloc.c). If the value is a Lisp string object, we are matching text in that string; if it's nil, we are matching text in the current buffer; if diff --git a/src/search.c b/src/search.c index dc7e2d8..ec5a1d7 100644 --- a/src/search.c +++ b/src/search.c @@ -287,8 +287,10 @@ looking_at_1 (Lisp_Object string, bool posix) immediate_quit = 1; QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */ - /* Get pointers and sizes of the two strings - that make up the visible portion of the buffer. */ + /* Get pointers and sizes of the two strings that make up the + visible portion of the buffer. Note that we can use pointers + here, unlike in search_buffer, because we only call re_match_2 + once, after which we never use the pointers again. */ p1 = BEGV_ADDR; s1 = GPT_BYTE - BEGV_BYTE; @@ -407,6 +409,7 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, (NILP (Vinhibit_changing_match_data) ? &search_regs : NULL)); immediate_quit = 0; + re_match_object = Qnil; /* Stop protecting string from GC. */ /* Set last_thing_searched only when match data is changed. */ if (NILP (Vinhibit_changing_match_data)) @@ -477,6 +480,7 @@ fast_string_match_internal (Lisp_Object regexp, Lisp_Object string, SBYTES (string), 0, SBYTES (string), 0); immediate_quit = 0; + re_match_object = Qnil; /* Stop protecting string from GC. */ return val; } @@ -564,6 +568,7 @@ fast_looking_at (Lisp_Object regexp, ptrdiff_t pos, ptrdiff_t pos_byte, len = re_match_2 (buf, (char *) p1, s1, (char *) p2, s2, pos_byte, NULL, limit_byte); immediate_quit = 0; + re_match_object = Qnil; /* Stop protecting string from GC. */ return len; } @@ -1178,8 +1183,8 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, if (RE && !(trivial_regexp_p (string) && NILP (Vsearch_spaces_regexp))) { - unsigned char *p1, *p2; - ptrdiff_t s1, s2; + unsigned char *base; + ptrdiff_t off1, off2, s1, s2; struct re_pattern_buffer *bufp; bufp = compile_pattern (string, @@ -1193,16 +1198,19 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, can take too long. */ QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */ - /* Get pointers and sizes of the two strings - that make up the visible portion of the buffer. */ + /* Get offsets and sizes of the two strings that make up the + visible portion of the buffer. We compute offsets instead of + pointers because re_search_2 may call malloc and therefore + change the buffer text address. */ - p1 = BEGV_ADDR; + base = current_buffer->text->beg; + off1 = BEGV_ADDR - base; s1 = GPT_BYTE - BEGV_BYTE; - p2 = GAP_END_ADDR; + off2 = GAP_END_ADDR - base; s2 = ZV_BYTE - GPT_BYTE; if (s1 < 0) { - p2 = p1; + off2 = off1; s2 = ZV_BYTE - BEGV_BYTE; s1 = 0; } @@ -1217,7 +1225,9 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, { ptrdiff_t val; - val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, + val = re_search_2 (bufp, + (char*) (base + off1), s1, + (char*) (base + off2), s2, pos_byte - BEGV_BYTE, lim_byte - pos_byte, (NILP (Vinhibit_changing_match_data) ? &search_regs : &search_regs_1), @@ -1262,8 +1272,10 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, { ptrdiff_t val; - val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, - pos_byte - BEGV_BYTE, lim_byte - pos_byte, + val = re_search_2 (bufp, + (char*) (base + off1), s1, + (char*) (base + off2), s2, + pos_byte - BEGV_BYTE, lim_byte - pos_byte, (NILP (Vinhibit_changing_match_data) ? &search_regs : &search_regs_1), lim_byte - BEGV_BYTE); commit 5a26c9b0e1b0d9a2de35e0a8b0a803017e70def0 Author: Paul Eggert Date: Fri Oct 21 14:00:09 2016 -0700 * lisp/electric.el (electric-quote-mode): Improve doc (Bug#24759). diff --git a/lisp/electric.el b/lisp/electric.el index e289601..b6697e0 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -497,6 +497,9 @@ and text paragraphs, and these are selectively controlled with `electric-quote-comment', `electric-quote-string', and `electric-quote-paragraph'. +Electric quoting is suppressed in a buffer whose coding system +cannot represent the replacement characters. + This is a global minor mode. To toggle the mode in a single buffer, use `electric-quote-local-mode'." :global t :group 'electricity commit 3877c911b7bd4ca7def18932615b10dc7b1fc6d3 Author: Tino Calancha Date: Thu Oct 20 19:39:59 2016 +0900 vc-region-history: Search just on lines intersecting the region * lisp/vc/vc.el (vc-region-history): If region ends in the beginning of a line, then exclude that line from the search (Bug#24725). diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index af875e8..ac020d0 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2393,7 +2393,7 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION." "Show the history of the region FROM..TO." (interactive "r") (let* ((lfrom (line-number-at-pos from)) - (lto (line-number-at-pos to)) + (lto (line-number-at-pos (1- to))) (file buffer-file-name) (backend (vc-backend file)) (buf (get-buffer-create "*VC-history*"))) commit 8988327d548db7b69f30ea15496ccb0726fa4502 Author: Eli Zaretskii Date: Wed Oct 19 21:10:31 2016 +0300 Fix documentation of 'alist-get' * doc/lispref/lists.texi (Association Lists): Fix the signature of 'alist-get'. Fix the markup, the wording, and the punctuation in the description. (Bug#24740) diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index e7a739f..dc4075d 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1556,15 +1556,15 @@ keys may not be symbols: @end smallexample @end defun -@defun alist-get key value &optional default remove +@defun alist-get key alist &optional default remove This function is like @code{assq}, but instead of returning the entire -association for @var{key}, @code{(@var{key} . @var{value})}, it -returns just the @var{value}. If @var{key} is not found in -@var{alist} it returns @var{default}. +association for @var{key} in @var{alist}, +@w{@code{(@var{key} . @var{value})}}, it returns just the @var{value}. +If @var{key} is not found in @var{alist}, it returns @var{default}. This is a generalized variable (@pxref{Generalized Variables}) that can be used to change a value with @code{setf}. When using it to set -a value, optional argument @var{remove} non-nil means to remove +a value, optional argument @var{remove} non-@code{nil} means to remove @var{key} from @var{alist} if the new value is @code{eql} to @var{default}. @end defun commit b6998eab37962357fda49a6a3b013c73228af187 Author: Eli Zaretskii Date: Wed Oct 19 17:31:47 2016 +0300 * src/regex.h (re_match_object): Improve commentary. diff --git a/src/regex.h b/src/regex.h index 817167a..51f4424 100644 --- a/src/regex.h +++ b/src/regex.h @@ -168,8 +168,12 @@ extern reg_syntax_t re_syntax_options; #ifdef emacs # include "lisp.h" -/* In Emacs, this is the string or buffer in which we - are matching. It is used for looking up syntax properties. */ +/* In Emacs, this is the string or buffer in which we are matching. + It is used for looking up syntax properties. + + If the value is a Lisp string object, we are matching text in that + string; if it's nil, we are matching text in the current buffer; if + it's t, we are matching text in a C string. */ extern Lisp_Object re_match_object; #endif commit dfd047666bcb2179652aee80248471a6efec06fc Author: Alan Third Date: Sun Sep 4 22:58:37 2016 +0100 Fix cursor at bottom left of rectangle (bug#24364) * lisp/rect.el (rectangle--col-pos): Don't assume point at EOL doesn't require rectangle--point-crutches to be set. diff --git a/lisp/rect.el b/lisp/rect.el index 70a542d..c003164 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -108,7 +108,7 @@ Point is at the end of the segment of this line within the rectangle." (defun rectangle--col-pos (col kind) (let ((c (move-to-column col))) - (if (= c col) + (if (and (= c col) (not (eolp))) (if (eq kind 'point) (if (window-parameter nil 'rectangle--point-crutches) (setf (window-parameter nil 'rectangle--point-crutches) nil)) commit 8ad0d7da0a84750e1884a89a212963f81ae26816 Author: Michael Albinus Date: Wed Oct 19 10:49:13 2016 +0200 ; Fix quoting in etc/NEWS diff --git a/etc/NEWS b/etc/NEWS index 3e686f9..5b89639 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -20,13 +20,13 @@ with a prefix argument or by typing C-u C-h C-n. This is a bug-fix release with (almost) no new features. --- -** `find-library', `help-function-def' and `help-variable-def' now run -`find-function-after-hook'. +** 'find-library', 'help-function-def' and 'help-variable-def' now run +'find-function-after-hook'. +++ ** New basic face 'fixed-pitch-serif', for a fixed-width font with serifs. -The Info-quoted and tex-verbatim faces now default to inheriting from -it. +The 'Info-quoted' and 'tex-verbatim' faces now default to inheriting +from it. --- ** New variable 'use-default-font-for-symbols' for backward compatibility. commit 6b9dee1ae6bc8717ccabad5d5f9bb33ebad4c69f Author: Michael Albinus Date: Wed Oct 19 10:35:52 2016 +0200 Change Tramp version to "2.2.13.25.2" * doc/misc/trampver.texi: * lisp/net/trampver.el: Change version to "2.2.13.25.2". diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi index 0cdf08d..b12614b 100644 --- a/doc/misc/trampver.texi +++ b/doc/misc/trampver.texi @@ -8,7 +8,7 @@ @c In the Tramp GIT, the version number is auto-frobbed from @c configure.ac, so you should edit that file and run @c "autoconf && ./configure" to change the version number. -@set trampver 2.2.13.25.1 +@set trampver 2.2.13.25.2 @c Other flags from configuration @set instprefix /usr/local diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index fc65c0a..25e8b22 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el @@ -6,7 +6,7 @@ ;; Author: Kai Großjohann ;; Keywords: comm, processes ;; Package: tramp -;; Version: 2.2.13.25.1 +;; Version: 2.2.13.25.2 ;; This file is part of GNU Emacs. @@ -32,7 +32,7 @@ ;; should be changed only there. ;;;###tramp-autoload -(defconst tramp-version "2.2.13.25.1" +(defconst tramp-version "2.2.13.25.2" "This version of Tramp.") ;;;###tramp-autoload @@ -63,7 +63,7 @@ (= emacs-major-version 21) (>= emacs-minor-version 4))) "ok" - (format "Tramp 2.2.13.25.1 is not fit for %s" + (format "Tramp 2.2.13.25.2 is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version))))))) (unless (string-match "\\`ok\\'" x) (error "%s" x))) commit 62f268414c1a04235b34befe3ad103cecec72382 Author: Eli Zaretskii Date: Wed Oct 19 10:59:05 2016 +0300 * lisp/emacs-lisp/autoload.el (update-directory-autoloads): Fix last change. diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index d4b9479..883a38a 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -770,8 +770,7 @@ write its autoloads into the specified file instead." ;; we don't want to depend on whether Emacs was ;; built with or without modules support, nor ;; what is the suffix for the underlying OS. - (unless (string-match "\\.\\(elc\\|\\so\\|dll\\)\\'" - suf) + (unless (string-match "\\.\\(elc\\|\\so\\|dll\\)" suf) (push suf tmp))) (concat "^[^=.].*" (regexp-opt tmp t) "\\'"))) (files (apply 'nconc commit b2f32e4c9a06234019f07f448b53b76e62aebbba Author: Eli Zaretskii Date: Wed Oct 19 10:42:45 2016 +0300 Don't scan compiled module files for autoloads * lisp/emacs-lisp/autoload.el (update-directory-autoloads): Ignore compiled module files. Make sure the extension really ends the file name. diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index eb6b746..d4b9479 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -766,7 +766,13 @@ write its autoloads into the specified file instead." (interactive "DUpdate autoloads from directory: ") (let* ((files-re (let ((tmp nil)) (dolist (suf (get-load-suffixes)) - (unless (string-match "\\.elc" suf) (push suf tmp))) + ;; We don't use module-file-suffix below because + ;; we don't want to depend on whether Emacs was + ;; built with or without modules support, nor + ;; what is the suffix for the underlying OS. + (unless (string-match "\\.\\(elc\\|\\so\\|dll\\)\\'" + suf) + (push suf tmp))) (concat "^[^=.].*" (regexp-opt tmp t) "\\'"))) (files (apply 'nconc (mapcar (lambda (dir) commit 9a758b4ccc9543ce0e74b4d71e5cd3a1443583e1 Author: Michael Albinus Date: Tue Oct 18 20:41:19 2016 +0200 Fix Bug#24698 * lisp/net/tramp-sh.el (tramp-open-connection-setup-interactive-shell): Don't send "stty tab0" to *BSD and Darwin machines. (Bug#24698) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 85712cc..166bc88 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4186,10 +4186,10 @@ process to set up. VEC specifies the connection." (case-fold-search t)) (tramp-open-shell vec (tramp-get-method-parameter vec 'tramp-remote-shell)) - ;; Disable tab and echo expansion. + ;; Disable echo expansion. (tramp-message vec 5 "Setting up remote shell environment") (tramp-send-command - vec "stty tab0 -inlcr -onlcr -echo kill '^U' erase '^H'" t) + vec "stty -inlcr -onlcr -echo kill '^U' erase '^H'" t) ;; Check whether the echo has really been disabled. Some ;; implementations, like busybox of embedded GNU/Linux, don't ;; support disabling. @@ -4206,7 +4206,8 @@ process to set up. VEC specifies the connection." (tramp-message vec 5 "Setting shell prompt") (tramp-send-command vec (format "PS1=%s PS2='' PS3='' PROMPT_COMMAND=''" - (tramp-shell-quote-argument tramp-end-of-output)) t) + (tramp-shell-quote-argument tramp-end-of-output)) + t) ;; Check whether the output of "uname -sr" has been changed. If ;; yes, this is a strong indication that we must expire all @@ -4214,148 +4215,142 @@ process to set up. VEC specifies the connection." ;; `tramp-maybe-open-connection', it will be caught there. (tramp-message vec 5 "Checking system information") (let ((old-uname (tramp-get-connection-property vec "uname" nil)) - (new-uname + (uname (tramp-set-connection-property vec "uname" (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) - (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) + (when (and (stringp old-uname) (not (string-equal old-uname uname))) (tramp-message vec 3 "Connection reset, because remote host changed from `%s' to `%s'" - old-uname new-uname) + old-uname uname) ;; We want to keep the password. (tramp-cleanup-connection vec t t) - (throw 'uname-changed (tramp-maybe-open-connection vec)))) + (throw 'uname-changed (tramp-maybe-open-connection vec))) - ;; Try to set up the coding system correctly. - ;; CCC this can't be the right way to do it. Hm. - (tramp-message vec 5 "Determining coding system") - (with-current-buffer (process-buffer proc) - (if (featurep 'mule) - ;; Use MULE to select the right EOL convention for communicating - ;; with the process. - (let ((cs (or (and (memq 'utf-8 (coding-system-list)) - (string-match "utf-?8" (tramp-get-remote-locale vec)) - (cons 'utf-8 'utf-8)) - (tramp-compat-funcall 'process-coding-system proc) - (cons 'undecided 'undecided))) - cs-decode cs-encode) - (when (symbolp cs) (setq cs (cons cs cs))) - (setq cs-decode (or (car cs) 'undecided) - cs-encode (or (cdr cs) 'undecided)) - (setq cs-encode - (tramp-compat-coding-system-change-eol-conversion - cs-encode - (if (string-match - "^Darwin" (tramp-get-connection-property vec "uname" "")) - 'mac 'unix))) - (tramp-send-command vec "echo foo ; echo bar" t) - (goto-char (point-min)) - (when (search-forward "\r" nil t) - (setq cs-decode (tramp-compat-coding-system-change-eol-conversion - cs-decode 'dos))) - ;; Special setting for Mac OS X. - (when (and (string-match - "^Darwin" (tramp-get-connection-property vec "uname" "")) - (memq 'utf-8-hfs (coding-system-list))) - (setq cs-decode 'utf-8-hfs - cs-encode 'utf-8-hfs)) - (tramp-compat-funcall - 'set-buffer-process-coding-system cs-decode cs-encode) - (tramp-message - vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)) - ;; Look for ^M and do something useful if found. - (when (search-forward "\r" nil t) - ;; We have found a ^M but cannot frob the process coding system - ;; because we're running on a non-MULE Emacs. Let's try - ;; stty, instead. - (tramp-send-command vec "stty -onlcr" t)))) - - (tramp-send-command vec "set +o vi +o emacs" t) - - ;; Check whether the remote host suffers from buggy - ;; `send-process-string'. This is known for FreeBSD (see comment in - ;; `send_process', file process.c). I've tested sending 624 bytes - ;; successfully, sending 625 bytes failed. Emacs makes a hack when - ;; this host type is detected locally. It cannot handle remote - ;; hosts, though. - (with-tramp-connection-property proc "chunksize" - (cond - ((and (integerp tramp-chunksize) (> tramp-chunksize 0)) - tramp-chunksize) - (t - (tramp-message - vec 5 "Checking remote host type for `send-process-string' bug") - (if (string-match - "^FreeBSD" (tramp-get-connection-property vec "uname" "")) - 500 0)))) - - ;; Set remote PATH variable. - (tramp-set-remote-path vec) - - ;; Search for a good shell before searching for a command which - ;; checks if a file exists. This is done because Tramp wants to use - ;; "test foo; echo $?" to check if various conditions hold, and - ;; there are buggy /bin/sh implementations which don't execute the - ;; "echo $?" part if the "test" part has an error. In particular, - ;; the OpenSolaris /bin/sh is a problem. There are also other - ;; problems with /bin/sh of OpenSolaris, like redirection of stderr - ;; in function declarations, or changing HISTFILE in place. - ;; Therefore, OpenSolaris' /bin/sh is replaced by bash, when - ;; detected. - (tramp-find-shell vec) - - ;; Disable unexpected output. - (tramp-send-command vec "mesg n 2>/dev/null; biff n 2>/dev/null" t) - - ;; IRIX64 bash expands "!" even when in single quotes. This - ;; destroys our shell functions, we must disable it. See - ;; . - (when (string-match "^IRIX64" (tramp-get-connection-property vec "uname" "")) - (tramp-send-command vec "set +H" t)) - - ;; On BSD-like systems, ?\t is expanded to spaces. Suppress this. - (when (string-match "BSD\\|Darwin" - (tramp-get-connection-property vec "uname" "")) - (tramp-send-command vec "stty -oxtabs" t)) - - ;; Set utf8 encoding. Needed for Mac OS X, for example. This is - ;; non-POSIX, so we must expect errors on some systems. - (tramp-send-command vec "stty iutf8 2>/dev/null" t) - - ;; Set `remote-tty' process property. - (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"" 'noerror))) - (unless (zerop (length tty)) - (tramp-compat-process-put proc 'remote-tty tty))) - - ;; Dump stty settings in the traces. - (when (>= tramp-verbose 9) - (tramp-send-command vec "stty -a" t)) - - ;; Set the environment. - (tramp-message vec 5 "Setting default environment") - - (let ((env (append `(,(tramp-get-remote-locale vec)) - (copy-sequence tramp-remote-process-environment))) - unset vars item) - (while env - (setq item (tramp-compat-split-string (car env) "=")) - (setcdr item (mapconcat 'identity (cdr item) "=")) - (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) - (push (format "%s %s" (car item) (cdr item)) vars) - (push (car item) unset)) - (setq env (cdr env))) - (when vars - (tramp-send-command - vec - (format "while read var val; do export $var=$val; done <<'%s'\n%s\n%s" - tramp-end-of-heredoc - (mapconcat 'identity vars "\n") - tramp-end-of-heredoc) - t)) - (when unset - (tramp-send-command - vec (format "unset %s" (mapconcat 'identity unset " ")) t)))) + ;; Try to set up the coding system correctly. + ;; CCC this can't be the right way to do it. Hm. + (tramp-message vec 5 "Determining coding system") + (with-current-buffer (process-buffer proc) + (if (featurep 'mule) + ;; Use MULE to select the right EOL convention for + ;; communicating with the process. + (let ((cs (or (and (memq 'utf-8 (coding-system-list)) + (string-match "utf-?8" (tramp-get-remote-locale vec)) + (cons 'utf-8 'utf-8)) + (tramp-compat-funcall 'process-coding-system proc) + (cons 'undecided 'undecided))) + cs-decode cs-encode) + (when (symbolp cs) (setq cs (cons cs cs))) + (setq cs-decode (or (car cs) 'undecided) + cs-encode (or (cdr cs) 'undecided)) + (setq cs-encode + (tramp-compat-coding-system-change-eol-conversion + cs-encode (if (string-match "^Darwin" uname) 'mac 'unix))) + (tramp-send-command vec "echo foo ; echo bar" t) + (goto-char (point-min)) + (when (search-forward "\r" nil t) + (setq cs-decode (tramp-compat-coding-system-change-eol-conversion + cs-decode 'dos))) + ;; Special setting for Mac OS X. + (when (and (string-match "^Darwin" uname) + (memq 'utf-8-hfs (coding-system-list))) + (setq cs-decode 'utf-8-hfs + cs-encode 'utf-8-hfs)) + (tramp-compat-funcall + 'set-buffer-process-coding-system cs-decode cs-encode) + (tramp-message + vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode)) + ;; Look for ^M and do something useful if found. + (when (search-forward "\r" nil t) + ;; We have found a ^M but cannot frob the process coding + ;; system because we're running on a non-MULE Emacs. Let's + ;; try stty, instead. + (tramp-send-command vec "stty -onlcr" t)))) + + (tramp-send-command vec "set +o vi +o emacs" t) + + ;; Check whether the remote host suffers from buggy + ;; `send-process-string'. This is known for FreeBSD (see comment + ;; in `send_process', file process.c). I've tested sending 624 + ;; bytes successfully, sending 625 bytes failed. Emacs makes a + ;; hack when this host type is detected locally. It cannot handle + ;; remote hosts, though. + (with-tramp-connection-property proc "chunksize" + (cond + ((and (integerp tramp-chunksize) (> tramp-chunksize 0)) + tramp-chunksize) + (t + (tramp-message + vec 5 "Checking remote host type for `send-process-string' bug") + (if (string-match "^FreeBSD" uname) 500 0)))) + + ;; Set remote PATH variable. + (tramp-set-remote-path vec) + + ;; Search for a good shell before searching for a command which + ;; checks if a file exists. This is done because Tramp wants to + ;; use "test foo; echo $?" to check if various conditions hold, + ;; and there are buggy /bin/sh implementations which don't execute + ;; the "echo $?" part if the "test" part has an error. In + ;; particular, the OpenSolaris /bin/sh is a problem. There are + ;; also other problems with /bin/sh of OpenSolaris, like + ;; redirection of stderr in function declarations, or changing + ;; HISTFILE in place. Therefore, OpenSolaris' /bin/sh is replaced + ;; by bash, when detected. + (tramp-find-shell vec) + + ;; Disable unexpected output. + (tramp-send-command vec "mesg n 2>/dev/null; biff n 2>/dev/null" t) + + ;; IRIX64 bash expands "!" even when in single quotes. This + ;; destroys our shell functions, we must disable it. See + ;; . + (when (string-match "^IRIX64" uname) + (tramp-send-command vec "set +H" t)) + + ;; Disable tab expansion. + (if (string-match "BSD\\|Darwin" uname) + (tramp-send-command vec "stty tabs" t) + (tramp-send-command vec "stty tab0" t)) + + ;; Set utf8 encoding. Needed for Mac OS X, for example. This is + ;; non-POSIX, so we must expect errors on some systems. + (tramp-send-command vec "stty iutf8 2>/dev/null" t) + + ;; Set `remote-tty' process property. + (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"" 'noerror))) + (unless (zerop (length tty)) + (tramp-compat-process-put proc 'remote-tty tty))) + + ;; Dump stty settings in the traces. + (when (>= tramp-verbose 9) + (tramp-send-command vec "stty -a" t)) + + ;; Set the environment. + (tramp-message vec 5 "Setting default environment") + + (let ((env (append `(,(tramp-get-remote-locale vec)) + (copy-sequence tramp-remote-process-environment))) + unset vars item) + (while env + (setq item (tramp-compat-split-string (car env) "=")) + (setcdr item (mapconcat 'identity (cdr item) "=")) + (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) + (push (format "%s %s" (car item) (cdr item)) vars) + (push (car item) unset)) + (setq env (cdr env))) + (when vars + (tramp-send-command + vec + (format "while read var val; do export $var=$val; done <<'%s'\n%s\n%s" + tramp-end-of-heredoc + (mapconcat 'identity vars "\n") + tramp-end-of-heredoc) + t)) + (when unset + (tramp-send-command + vec (format "unset %s" (mapconcat 'identity unset " ")) t))))) ;; Old text from documentation of tramp-methods: ;; Using a uuencode/uudecode inline method is discouraged, please use one commit baa8ba4ed471d7fe4bb07c80a9dd16c4712525b4 Author: Eli Zaretskii Date: Tue Oct 18 09:24:05 2016 +0300 * lisp/subr.el (start-process): Doc fix. (Bug#24693) diff --git a/lisp/subr.el b/lisp/subr.el index a3aef2e..573f238 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1966,7 +1966,7 @@ this process is not associated with any buffer. PROGRAM is the program file name. It is searched for in `exec-path' \(which see). If nil, just associate a pty with the buffer. Remaining -arguments are strings to give program as arguments. +arguments PROGRAM-ARGS are strings to give program as arguments. If you want to separate standard output from standard error, use `make-process' or invoke the command through a shell and redirect commit e535ca4522222e68c9405a51c2abba83f9f2cd69 Author: Göktuğ Kayaalp Date: Tue Oct 18 03:01:58 2016 +0300 Fix display of vc-dir CVS file statuses in subdirectories * lisp/vc/vc-cvs.el (vc-cvs-dir-status-files): Use 'cvs update' instead of 'cvs status'. It's faster, easier to parse, and relieves us of the need to use vc-expand-dirs. (Bug#24082) (vc-cvs-after-dir-status): Parse its output. diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index a2499a2..3cfe8ee 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -938,103 +938,32 @@ state." (t 'edited)))))))) (defun vc-cvs-after-dir-status (update-function) - ;; Heavily inspired by vc-cvs-parse-status. AKA a quick hack. - ;; This needs a lot of testing. - (let ((status nil) - (status-str nil) - (file nil) - (result nil) - (missing nil) - (ignore-next nil) - (subdir default-directory)) + (let ((result nil) + (translation '((?? . unregistered) + (?A . added) + (?C . conflict) + (?M . edited) + (?P . needs-merge) + (?R . removed) + (?U . needs-update)))) (goto-char (point-min)) - (while - ;; Look for either a file entry, an unregistered file, or a - ;; directory change. - (re-search-forward - "\\(^=+\n\\([^=c?\n].*\n\\|\n\\)+\\)\\|\\(\\(^?? .*\n\\)+\\)\\|\\(^cvs status: \\(Examining\\|nothing\\) .*\n\\)" - nil t) - ;; FIXME: get rid of narrowing here. - (narrow-to-region (match-beginning 0) (match-end 0)) - (goto-char (point-min)) - ;; The subdir - (when (looking-at "cvs status: Examining \\(.+\\)") - (setq subdir (expand-file-name (match-string 1)))) - ;; Unregistered files - (while (looking-at "? \\(.*\\)") - (setq file (file-relative-name - (expand-file-name (match-string 1) subdir))) - (push (list file 'unregistered) result) - (forward-line 1)) - (when (looking-at "cvs status: nothing known about") - ;; We asked about a non existent file. The output looks like this: - - ;; cvs status: nothing known about `lisp/v.diff' - ;; =================================================================== - ;; File: no file v.diff Status: Unknown - ;; - ;; Working revision: No entry for v.diff - ;; Repository revision: No revision control file - ;; - - ;; Due to narrowing in this iteration we only see the "cvs - ;; status:" line, so just set a flag so that we can ignore the - ;; file in the next iteration. - (setq ignore-next t)) - ;; A file entry. - (when (re-search-forward "^File: \\(no file \\)?\\(.*[^ \t]\\)[ \t]+Status: \\(.*\\)" nil t) - (setq missing (match-string 1)) - (setq file (file-relative-name - (expand-file-name (match-string 2) subdir))) - (setq status-str (match-string 3)) - (setq status - (cond - ((string-match "Up-to-date" status-str) 'up-to-date) - ((string-match "Locally Modified" status-str) 'edited) - ((string-match "Needs Merge" status-str) 'needs-merge) - ((string-match "Needs \\(Checkout\\|Patch\\)" status-str) - (if missing 'missing 'needs-update)) - ((string-match "Locally Added" status-str) 'added) - ((string-match "Locally Removed" status-str) 'removed) - ((string-match "File had conflicts " status-str) 'conflict) - ((string-match "Unknown" status-str) 'unregistered) - (t 'edited))) - (if ignore-next - (setq ignore-next nil) - (unless (eq status 'up-to-date) - (push (list file status) result)))) - (goto-char (point-max)) - (widen)) - (funcall update-function result)) - ;; Alternative implementation: use the "update" command instead of - ;; the "status" command. - ;; (let ((result nil) - ;; (translation '((?? . unregistered) - ;; (?A . added) - ;; (?C . conflict) - ;; (?M . edited) - ;; (?P . needs-merge) - ;; (?R . removed) - ;; (?U . needs-update)))) - ;; (goto-char (point-min)) - ;; (while (not (eobp)) - ;; (if (looking-at "^[ACMPRU?] \\(.*\\)$") - ;; (push (list (match-string 1) - ;; (cdr (assoc (char-after) translation))) - ;; result) - ;; (cond - ;; ((looking-at "cvs update: warning: \\(.*\\) was lost") - ;; ;; Format is: - ;; ;; cvs update: warning: FILENAME was lost - ;; ;; U FILENAME - ;; (push (list (match-string 1) 'missing) result) - ;; ;; Skip the "U" line - ;; (forward-line 1)) - ;; ((looking-at "cvs update: New directory `\\(.*\\)' -- ignored") - ;; (push (list (match-string 1) 'unregistered) result)))) - ;; (forward-line 1)) - ;; (funcall update-function result))) - ) + (while (not (eobp)) + (if (looking-at "^[ACMPRU?] \\(.*\\)$") + (push (list (match-string 1) + (cdr (assoc (char-after) translation))) + result) + (cond + ((looking-at "cvs update: warning: \\(.*\\) was lost") + ;; Format is: + ;; cvs update: warning: FILENAME was lost + ;; U FILENAME + (push (list (match-string 1) 'missing) result) + ;; Skip the "U" line + (forward-line 1)) + ((looking-at "cvs update: New directory `\\(.*\\)' -- ignored") + (push (list (match-string 1) 'unregistered) result)))) + (forward-line 1)) + (funcall update-function result))) ;; Based on vc-cvs-dir-state-heuristic from Emacs 22. ;; FIXME does not mention unregistered files. @@ -1071,16 +1000,12 @@ state." Query all files in DIR if files is nil." (let ((local (vc-cvs-stay-local-p dir))) (if (and (not files) local (not (eq local 'only-file))) - (vc-cvs-dir-status-heuristic dir update-function) - (if (not files) (setq files (vc-expand-dirs (list dir) 'CVS))) - (vc-cvs-command (current-buffer) 'async files "-f" "status") - ;; Alternative implementation: use the "update" command instead of - ;; the "status" command. - ;; (vc-cvs-command (current-buffer) 'async - ;; (file-relative-name dir) - ;; "-f" "-n" "update" "-d" "-P") - (vc-run-delayed - (vc-cvs-after-dir-status update-function))))) + (vc-cvs-dir-status-heuristic dir update-function)) + (vc-cvs-command (current-buffer) 'async + files + "-f" "-n" "-q" "update") + (vc-run-delayed + (vc-cvs-after-dir-status update-function)))) (defun vc-cvs-file-to-string (file) "Read the content of FILE and return it as a string." commit 12da149670a40c6d6c1bc107e8c29d7fcdcf7824 Author: Eli Zaretskii Date: Mon Oct 17 12:12:25 2016 +0300 Update URL of MS-Windows optional DLLs * nt/README.W32: * nt/INSTALL: Update the URL of the MS-Windows binaries of the optional libraries built with MSYS2/MinGW64 project tools. diff --git a/nt/INSTALL b/nt/INSTALL index cd726cb..7bf544c 100644 --- a/nt/INSTALL +++ b/nt/INSTALL @@ -634,12 +634,12 @@ build will run on Windows 9X and newer systems). To support XPM images (required for color tool-bar icons), you will need the libXpm library. It is available from the ezwinports site, http://sourceforge.net/projects/ezwinports/files/ and from - http://alpha.gnu.org/gnu/emacs/pretest/windows/. + http://ftp.gnu.org/gnu/emacs/windows/. For PNG images, we recommend to use versions 1.4.x and later of libpng, because previous versions had security issues. You can find precompiled libraries and headers on the ezwinports site and on - alpha.gnu. + ftp.gnu.org. Versions 1.4.0 and later of libpng are binary incompatible with earlier versions, so Emacs will only look for libpng libraries which @@ -657,7 +657,7 @@ build will run on Windows 9X and newer systems). giflib, as it is much enhanced wrt previous versions. You can find precompiled binaries and headers for giflib on the ezwinports site, http://sourceforge.net/projects/ezwinports/files/ and on - http://alpha.gnu.org/gnu/emacs/pretest/windows/. + http://ftp.gnu.org/gnu/emacs/windows/. Version 5.0.0 and later of giflib are binary incompatible with previous versions (the signatures of several functions have @@ -671,7 +671,7 @@ build will run on Windows 9X and newer systems). For JPEG images, you will need libjpeg 6b or later, which will be called libjpeg-N.dll, jpeg62.dll, libjpeg.dll, or jpeg.dll. You can - find these on the ezwinports site and on alpha.gnu. + find these on the ezwinports site and on ftp.gnu.org. TIFF images require libTIFF 3.0 or later, which will be called libtiffN.dll or libtiff-N.dll or libtiff.dll. These can be found on @@ -698,7 +698,7 @@ build will run on Windows 9X and newer systems). because the compiler needs to see their header files when building Emacs. - http://alpha.gnu.org/gnu/emacs/pretest/windows/ + http://ftp.gnu.org/gnu/emacs/windows/ More fat ports, from the MSYS2 project. @@ -759,7 +759,7 @@ build will run on Windows 9X and newer systems). You can get pre-built binaries (including any required DLL and the header files) at http://sourceforge.net/projects/ezwinports/files/ - and on http://alpha.gnu.org/gnu/emacs/pretest/windows/. + and on http://ftp.gnu.org/gnu/emacs/windows/. * Optional libxml2 support @@ -781,7 +781,7 @@ build will run on Windows 9X and newer systems). (including any required DLL and the header files) is here: http://sourceforge.net/projects/ezwinports/files/ - http://alpha.gnu.org/gnu/emacs/pretest/windows/ + http://ftp.gnu.org/gnu/emacs/windows/ For runtime support of libxml2, you will also need to install the libiconv "development" tarball, because the libiconv headers need to @@ -797,7 +797,7 @@ build will run on Windows 9X and newer systems). Emacs can decompress text if compiled with the zlib library. Prebuilt binaries of zlib DLL (for 32-bit builds of Emacs) are - available from the ezwinports site and on alpha.gnu; see above for + available from the ezwinports site and on ftp.gnu.org; see above for the URLs. (This library is also a prerequisite for several image libraries, so diff --git a/nt/README.W32 b/nt/README.W32 index e3f6094..5bd8796 100644 --- a/nt/README.W32 +++ b/nt/README.W32 @@ -140,8 +140,10 @@ See the end of the file for license conditions. 1. http://sourceforge.net/projects/ezwinports/files/ -- up-to-date builds, self-contained archives, only for 32-bit Emacs - 2. Libraries from the MSYS2 project on alpha.gnu.org: - http://alpha.gnu.org/gnu/emacs/pretest/windows/. + 2. Libraries from the MSYS2 project on ftp.gnu.org: + http://ftp.gnu.org/gnu/emacs/windows/emacs-NN-i686-deps.zip (32-bit) + http://ftp.gnu.org/gnu/emacs/windows/emacs-NN-x86_64-deps.zip (64-bit) + where NN is the Emacs version to which the libraries correspond. 3. The MSYS2 project -- for 64-bit Emacs: http://msys2.github.io/ https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/ @@ -200,7 +202,7 @@ See the end of the file for license conditions. You can get pre-built binaries (including any dependency DLLs) at http://sourceforge.net/projects/ezwinports/files/ and on - http://alpha.gnu.org/gnu/emacs/pretest/windows/. + http://ftp.gnu.org/gnu/emacs/windows/ * libxml2 support @@ -214,8 +216,7 @@ See the end of the file for license conditions. You can get pre-built binaries (including any required DLL and the header files) at http://sourceforge.net/projects/ezwinports/files/ and - http://alpha.gnu.org/gnu/emacs/pretest/windows/. - + http://ftp.gnu.org/gnu/emacs/windows/ * zlib support @@ -223,7 +224,7 @@ See the end of the file for license conditions. the zlib-decompress-region primitive. Prebuilt binaries of zlib DLL (for 32-bit builds of Emacs) are - available from the ezwinports site and on alpha.gnu; see above for + available from the ezwinports site and on ftp.gnu.org; see above for the URLs. For the 64-bit DLL, see the instructions below for installing from MSYS2 site. commit 2331056cfd8928e596fdd86f9dffd46547283d2f Merge: d70ed8a a4285bc Author: Eli Zaretskii Date: Mon Oct 17 10:26:55 2016 +0300 Merge branch 'emacs-25' of git.savannah.gnu.org:/srv/git/emacs into emacs-25 commit d70ed8aaeae8529813f591ce548631e424d853a2 Author: Eli Zaretskii Date: Mon Oct 17 10:25:58 2016 +0300 Fix time-related data types in 2 editfns.c functions * src/editfns.c (format_time_string, Fcurrent_time_zone): Pass a pointer to time_t value to emacs_localtime_rz and gmtime_r, instead of relying on struct timespec's tv_sec member to be of compatible type. diff --git a/src/editfns.c b/src/editfns.c index 4e90dad..403569f 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2054,7 +2054,11 @@ format_time_string (char const *format, ptrdiff_t formatlen, USE_SAFE_ALLOCA; timezone_t tz = tzlookup (zone, false); - tmp = emacs_localtime_rz (tz, &t.tv_sec, tmp); + /* On some systems, like 32-bit MinGW, tv_sec of struct timespec is + a 64-bit type, but time_t is a 32-bit type. emacs_localtime_rz + expects a pointer to time_t value. */ + time_t tsec = t.tv_sec; + tmp = emacs_localtime_rz (tz, &tsec, tmp); if (! tmp) { xtzfree (tz); @@ -2313,7 +2317,10 @@ the data it can't find. */) zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, zone, &local_tm); - if (HAVE_TM_GMTOFF || gmtime_r (&value.tv_sec, &gmt_tm)) + /* gmtime_r expects a pointer to time_t, but tv_sec of struct + timespec on some systems (MinGW) is a 64-bit field. */ + time_t tsec = value.tv_sec; + if (HAVE_TM_GMTOFF || gmtime_r (&tsec, &gmt_tm)) { long int offset = (HAVE_TM_GMTOFF ? tm_gmtoff (&local_tm) commit a4285bcb1114e29200001f33af9b4802167d6140 Author: Tino Calancha Date: Tue Jun 7 15:06:38 2016 -0400 * lisp/simple.el (process-menu-mode, list-processes--refresh): Include PID. (Bug#21725) (cherry picked from commit b7adc2f23787eb72015cd705b873e229db6a5049) diff --git a/lisp/simple.el b/lisp/simple.el index c43fe54..67c0266 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3749,6 +3749,7 @@ support pty association, if PROGRAM is nil." (define-derived-mode process-menu-mode tabulated-list-mode "Process Menu" "Major mode for listing the processes called by Emacs." (setq tabulated-list-format [("Process" 15 t) + ("PID" 7 t) ("Status" 7 t) ("Buffer" 15 t) ("TTY" 12 t) @@ -3775,6 +3776,7 @@ Also, delete any process that is exited or signaled." (process-query-on-exit-flag p)) (let* ((buf (process-buffer p)) (type (process-type p)) + (pid (if (process-id p) (format "%d" (process-id p)) "--")) (name (process-name p)) (status (symbol-name (process-status p))) (buf-label (if (buffer-live-p buf) @@ -3810,7 +3812,7 @@ Also, delete any process that is exited or signaled." (format " at %s b/s" speed) ""))))) (mapconcat 'identity (process-command p) " ")))) - (push (list p (vector name status buf-label tty cmd)) + (push (list p (vector name pid status buf-label tty cmd)) tabulated-list-entries)))))) (defun process-menu-visit-buffer (button) commit b0c447e4668116cecfda91d0203cb7cac2486d92 Author: Tino Calancha Date: Tue Jun 7 19:24:51 2016 -0400 * lisp/ibuf-ext.el (ibuffer-do-shell-command-file): Fix non-file-visiting-buffer case. (Bug#22678) (cherry picked from commit 738738259ba77fe17e433c64e0758ea59ab5bc75) diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index f537561..4443383 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -347,10 +347,14 @@ the mode if ARG is omitted or nil." :modifier-p nil) (shell-command (concat command " " (shell-quote-argument - (if buffer-file-name - buffer-file-name - (make-temp-file - (substring (buffer-name) 0 (min 10 (length (buffer-name)))))))))) + (or buffer-file-name + (let ((file + (make-temp-file + (substring + (buffer-name) 0 + (min 10 (length (buffer-name))))))) + (write-region nil nil file nil 0) + file)))))) ;;;###autoload (autoload 'ibuffer-do-eval "ibuf-ext") (define-ibuffer-op eval (form) commit cf3c19b0298236293d9c56d5ba425af4f42c1f8e Author: Tino Calancha Date: Tue Jun 7 20:35:24 2016 -0400 * lisp/ibuffer.el (ibuffer): Improve 'other-window' case. (Bug#23617) (cherry picked from commit f4ef1a1fea15aa58fbb5e7a59bff260720658e49) diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 9d23e64..1295ed7 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -2336,7 +2336,8 @@ FORMATS is the value to use for `ibuffer-formats'. (setq other-window-p t)) (let ((buf (get-buffer-create (or name "*Ibuffer*")))) (if other-window-p - (funcall (if noselect (lambda (buf) (display-buffer buf t)) #'pop-to-buffer) buf) + (or (and noselect (display-buffer buf t)) + (pop-to-buffer buf t)) (funcall (if noselect #'display-buffer #'switch-to-buffer) buf)) (with-current-buffer buf (save-selected-window commit 99892eeec8990884ef38601f14038ec6dc227741 Author: Paul Eggert Date: Sun Oct 16 16:25:47 2016 -0700 Port to Ubuntu 16.10, which needs gcc -nopie * configure.ac (emacs_cv_prog_cc_no_pie): Rename from emacs_cv_prog_cc_nopie. All usages changed. Check for -no-pie in preference to -nopie (Bug#24682). Backport from master. diff --git a/configure.ac b/configure.ac index 7a697ec..7c115a0 100644 --- a/configure.ac +++ b/configure.ac @@ -5159,25 +5159,29 @@ case "$opsys" in *) LD_SWITCH_SYSTEM_TEMACS= ;; esac -# -nopie fixes a temacs segfault on Gentoo, OpenBSD, and other systems -# with "hardened" GCC configurations for some reason (Bug#18784). -# We don't know why -nopie works, but not segfaulting is better than -# segfaulting. Use ac_c_werror_flag=yes when trying -nopie, otherwise -# clang keeps warning that it does not understand -nopie, and pre-4.6 -# GCC has a similar problem (Bug#20338). -AC_CACHE_CHECK([whether $CC accepts -nopie], - [emacs_cv_prog_cc_nopie], +# -no-pie or -nopie fixes a temacs segfault on Gentoo, OpenBSD, +# Ubuntu, and other systems with "hardened" GCC configurations for +# some reason (Bug#18784). We don't know why this works, but not +# segfaulting is better than segfaulting. Use ac_c_werror_flag=yes +# when trying the option, otherwise clang keeps warning that it does +# not understand it, and pre-4.6 GCC has a similar problem +# (Bug#20338). Prefer -no-pie to -nopie, as -no-pie is the +# spelling used by GCC 6.1.0 and later (Bug#24682). +AC_CACHE_CHECK( + [for $CC option to disable position independent executables], + [emacs_cv_prog_cc_no_pie], [emacs_save_c_werror_flag=$ac_c_werror_flag emacs_save_LDFLAGS=$LDFLAGS ac_c_werror_flag=yes - LDFLAGS="$LDFLAGS -nopie" - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], - [emacs_cv_prog_cc_nopie=yes], - [emacs_cv_prog_cc_nopie=no]) + for emacs_cv_prog_cc_no_pie in -no-pie -nopie no; do + test $emacs_cv_prog_cc_no_pie = no && break + LDFLAGS="$emacs_save_LDFLAGS $emacs_cv_prog_cc_no_pie" + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [break]) + done ac_c_werror_flag=$emacs_save_c_werror_flag LDFLAGS=$emacs_save_LDFLAGS]) -if test "$emacs_cv_prog_cc_nopie" = yes; then - LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -nopie" +if test "$emacs_cv_prog_cc_no_pie" != no; then + LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS $emacs_cv_prog_cc_no_pie" fi if test x$ac_enable_profiling != x ; then commit b73f4668ab685dfb690eced15b20ed47f90efccb Author: Glenn Morris Date: Sun Oct 16 18:56:06 2016 -0700 * lisp/cus-start.el (exec-path): Handle nil elements. (Bug#24471) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 001d638..a8bcc45 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -173,7 +173,9 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of (directory :format "%v"))) nil :standard - (mapcar 'directory-file-name + (mapcar (lambda (f) + (if f (directory-file-name f) + ".")) (append (parse-colon-path (getenv "PATH")) (list exec-directory)))) (exec-suffixes execute (repeat string)) commit 55ebb708cf65156085003ea0e5cd08a06353be05 Author: Andreas Politz Date: Sun Oct 16 16:56:25 2016 +0300 Catch the imenu-unavailable error in sh-mode completion table * lisp/progmodes/sh-script.el (sh--cmd-completion-table): Catch the imenu-unavailable error (bug#24238). diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index f089c81..0040adc 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1741,7 +1741,10 @@ This adds rules for comments and assignments." (defun sh--cmd-completion-table (string pred action) (let ((cmds (append (when (fboundp 'imenu--make-index-alist) - (mapcar #'car (imenu--make-index-alist))) + (mapcar #'car + (condition-case nil + (imenu--make-index-alist) + (imenu-unavailable nil)))) (mapcar (lambda (v) (concat v "=")) (sh--vars-before-point)) (locate-file-completion-table commit 993acb5088a9766f3af240edcb9c6ffb93530034 Author: Eli Zaretskii Date: Sun Oct 16 14:22:24 2016 +0300 ; Minor fix for last change in characters.el diff --git a/lisp/international/characters.el b/lisp/international/characters.el index c9f8beb..e7f2ce0 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -1248,8 +1248,6 @@ with L, LRE, or LRO Unicode bidi character type.") (#x17000 . #x187EC) (#x18800 . #x18AF2) (#x1B000 . #x1B001) - (#x1F004 . #x1F004) - (#x1F0CF . #x1F0CF) (#x1F18E . #x1F18E) (#x1F191 . #x1F19A) (#x1F200 . #x1F2FF) commit 30c4bb58ca14d4dcd9037553ba5782a8f68394d4 Author: Eli Zaretskii Date: Sun Oct 16 14:19:32 2016 +0300 More char-width fixes * lisp/international/characters.el (char-width-table): More fixes according to the latest EastAsianWidth.txt. (Bug#24705) diff --git a/lisp/international/characters.el b/lisp/international/characters.el index bd0e415..c9f8beb 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -1235,38 +1235,25 @@ with L, LRE, or LRO Unicode bidi character type.") (#x2B50 . #x2B50) (#x2B55 . #x2B55) (#x2E80 . #x303E) - (#x3040 . #xA4CF) + (#x3040 . #x4DBF) + (#x4E00 . #xA4CF) + (#xA960 . #xA97F) (#xAC00 . #xD7A3) (#xF900 . #xFAFF) + (#xFE10 . #xFE19) (#xFE30 . #xFE6F) (#xFF01 . #xFF60) (#xFFE0 . #xFFE6) (#x16FE0 . #x16FE0) (#x17000 . #x187EC) (#x18800 . #x18AF2) + (#x1B000 . #x1B001) + (#x1F004 . #x1F004) + (#x1F0CF . #x1F0CF) (#x1F18E . #x1F18E) (#x1F191 . #x1F19A) - (#x1F200 . #x1F202) - (#x1F210 . #x1F23B) - (#x1F300 . #x1F320) - (#x1F32D . #x1F335) - (#x1F337 . #x1F37C) - (#x1F37E . #x1F393) - (#x1F3A0 . #x1F3CA) - (#x1F3CF . #x1F3D3) - (#x1F3E0 . #x1F3F0) - (#x1F3F4 . #x1F3F4) - (#x1F3F8 . #x1F3FA) - (#x1F3FB . #x1F43E) - (#x1F440 . #x1F440) - (#x1F442 . #x1F4FC) - (#x1F4FF . #x1F53D) - (#x1F54B . #x1F54E) - (#x1F550 . #x1F567) - (#x1F57A . #x1F57A) - (#x1F595 . #x1F596) - (#x1F5A4 . #x1F5A4) - (#x1F5FB . #x1F5FF) + (#x1F200 . #x1F2FF) + (#x1F300 . #x1F5FF) (#x1F600 . #x1F64F) (#x1F680 . #x1F6C5) (#x1F6CC . #x1F6CC) commit 4eb4463abf1db904f9e8cdc35156a66f8a10125c Author: Eli Zaretskii Date: Sat Oct 15 17:58:57 2016 +0300 Fix char-width-table values for some Emoji * lisp/international/characters.el (char-width-table): Add missing range U+1F400..U+1F43E. (Bug#24699) * admin/notes/unicode: Mention the need to verify char-width-table setting against data in EastAsianWidth.txt. diff --git a/admin/notes/unicode b/admin/notes/unicode index 76479d4..d149459 100644 --- a/admin/notes/unicode +++ b/admin/notes/unicode @@ -36,6 +36,10 @@ and char-width-table. The additional scripts should cause automatic updates in charscript.el, but it is a good idea to look at the results and see if any changes in admin/unidata/blocks.awk are required. +The setting of char-width-table around line 1200 of characters.el +should be checked against the latest version of the Unicode file +EastAsianWidth.txt, and any discrepancies fixed. + Any new scripts added by UnicodeData.txt will also need updates to script-representative-chars defined in fontset.el, and also the list of OTF script tags in otf-script-alist, whose source is on this page: diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 00f68f0..bd0e415 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -1257,7 +1257,7 @@ with L, LRE, or LRO Unicode bidi character type.") (#x1F3E0 . #x1F3F0) (#x1F3F4 . #x1F3F4) (#x1F3F8 . #x1F3FA) - (#x1F3FB . #x1F3FF) + (#x1F3FB . #x1F43E) (#x1F440 . #x1F440) (#x1F442 . #x1F4FC) (#x1F4FF . #x1F53D) commit 528997daa15d6e864f4f7119fe073fe37ab4c685 Author: Eli Zaretskii Date: Sat Oct 15 16:53:36 2016 +0300 Keep point when switching from and to *terminal* buffer * lisp/term.el (term-reset-size): Don't reset the size if it didn't change. If the size did change, restore point after adjusting the size. (Bug#24465) diff --git a/lisp/term.el b/lisp/term.el index f477bcc..993e580 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1116,12 +1116,16 @@ Entry to this mode runs the hooks on `term-mode-hook'." (term-update-mode-line)) (defun term-reset-size (height width) - (setq term-height height) - (setq term-width width) - (setq term-start-line-column nil) - (setq term-current-row nil) - (setq term-current-column nil) - (term-set-scroll-region 0 height)) + (when (or (/= height term-height) + (/= width term-width)) + (let ((point (point))) + (setq term-height height) + (setq term-width width) + (setq term-start-line-column nil) + (setq term-current-row nil) + (setq term-current-column nil) + (term-set-scroll-region 0 height) + (goto-char point)))) ;; Recursive routine used to check if any string in term-kill-echo-list ;; matches part of the buffer before point. commit 21300051eb28b87703745dd0979d322da68d9ed5 Author: Michael Albinus Date: Sat Oct 15 12:40:45 2016 +0200 * INSTALL: Use correct Emacs release number 25. diff --git a/INSTALL b/INSTALL index 6f516bd..119b4d4 100644 --- a/INSTALL +++ b/INSTALL @@ -34,7 +34,7 @@ some of the steps manually. The more detailed description in the other sections of this guide will help you do that, so please refer to those sections if you need to. - 1. Unpacking the Emacs 24 release requires about 200 MB of free + 1. Unpacking the Emacs 25 release requires about 200 MB of free disk space. Building Emacs uses about another 200 MB of space. The final installed Emacs uses about 150 MB of disk space. This includes the space-saving that comes from automatically commit 10835b18cdfd93442e6fae093ffd130587006fcf Author: Eli Zaretskii Date: Fri Oct 14 22:52:46 2016 +0300 Avoid crashes due to objects read with the #n=object form * src/lread.c (read1): Use Fcons for 'placeholder', not AUTO_CONS, because elements of the list in 'read_objects' cannot be allocated off the stack. (Bug#24640) diff --git a/src/lread.c b/src/lread.c index ef58b20..8a36880 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2845,7 +2845,18 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) if (c == '=') { /* Make a placeholder for #n# to use temporarily. */ - AUTO_CONS (placeholder, Qnil, Qnil); + /* Note: We used to use AUTO_CONS to allocate + placeholder, but that is a bad idea, since it + will place a stack-allocated cons cell into + the list in read_objects, which is a + staticpro'd global variable, and thus each of + its elements is marked during each GC. A + stack-allocated object will become garbled + when its stack slot goes out of scope, and + some other function reuses it for entirely + different purposes, which will cause crashes + in GC. */ + Lisp_Object placeholder = Fcons (Qnil, Qnil); Lisp_Object cell = Fcons (make_number (n), placeholder); read_objects = Fcons (cell, read_objects); commit 4de671d844c56d70e747366657664c8d293fe2bf Author: Eli Zaretskii Date: Thu Oct 13 20:15:21 2016 +0300 Improve doc string of 'completion-at-point-functions' * lisp/minibuffer.el (completion-at-point-functions): Doc fix. (Bug#24663) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index c7f7c41..56454d5 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2052,22 +2052,22 @@ Also respects the obsolete wrapper hook `completion-in-region-functions'. minor-mode-map-alist)) (defvar completion-at-point-functions '(tags-completion-at-point-function) - "Special hook to find the completion table for the thing at point. -Each function on this hook is called in turn without any argument and should -return either nil to mean that it is not applicable at point, -or a function of no argument to perform completion (discouraged), -or a list of the form (START END COLLECTION . PROPS) where + "Special hook to find the completion table for the entity at point. +Each function on this hook is called in turn without any argument and +should return either nil, meaning it is not applicable at point, +or a function of no arguments to perform completion (discouraged), +or a list of the form (START END COLLECTION . PROPS), where: START and END delimit the entity to complete and should include point, - COLLECTION is the completion table to use to complete it, and + COLLECTION is the completion table to use to complete the entity, and PROPS is a property list for additional information. Currently supported properties are all the properties that can appear in `completion-extra-properties' plus: `:predicate' a predicate that completion candidates need to satisfy. - `:exclusive' If `no', means that if the completion table fails to + `:exclusive' value of `no' means that if the completion table fails to match the text at point, then instead of reporting a completion failure, the completion should try the next completion function. -As is the case with most hooks, the functions are responsible to preserve -things like point and current buffer.") +As is the case with most hooks, the functions are responsible for +preserving things like point and current buffer.") (defvar completion--capf-misbehave-funs nil "List of functions found on `completion-at-point-functions' that misbehave. commit ceb46f002145e986c944b2423404535019b7e62b Author: Philipp Stephani Date: Wed Oct 12 22:48:32 2016 +0200 Fix crash in evaluating functions See Bug#24673 * src/eval.c (funcall_lambda): Fix crash for bogus functions such as (closure). diff --git a/src/eval.c b/src/eval.c index 13a41a2..b94712d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2825,9 +2825,11 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, { if (EQ (XCAR (fun), Qclosure)) { - fun = XCDR (fun); /* Drop `closure'. */ + Lisp_Object cdr = XCDR (fun); /* Drop `closure'. */ + if (! CONSP (cdr)) + xsignal1 (Qinvalid_function, fun); + fun = cdr; lexenv = XCAR (fun); - CHECK_LIST_CONS (fun, fun); } else lexenv = Qnil; commit d8374c4e95d6b2a0e839b3b49b12225222e8c721 Author: Paul Eggert Date: Wed Oct 12 17:48:04 2016 -0700 * src/filelock.c (current_lock_owner): Update comment. diff --git a/src/filelock.c b/src/filelock.c index 23bb4b8..6c60c3e 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -574,10 +574,10 @@ current_lock_owner (lock_info_type *owner, char *lfname) break; case '\357': - /* Treat "\357\200\242" (U+F022 in UTF-8) as if it were ":". - This works around a bug in Samba, which can mistakenly - transliterate ':' to U+F022 in symlink contents (Bug#24656). - See . */ + /* Treat "\357\200\242" (U+F022 in UTF-8) as if it were ":" (Bug#24656). + This works around a bug in the Linux CIFS kernel client, which can + mistakenly transliterate ':' to U+F022 in symlink contents. + See . */ if (! (boot[0] == '\200' && boot[1] == '\242')) return -1; boot += 2; commit eb17d6f575de81dbbc113e474d28db0396c12714 Author: Paul Eggert Date: Wed Oct 12 09:16:31 2016 -0700 Port --enable-gcc-warnings to GCC 6.2.1 Backport from master. * src/conf_post.h (GNUC_PREREQ): New macro. * src/keyboard.c: Use it to work around GCC bug 54561. * src/process.c (would_block): New function. (server_accept_connection, wait_reading_process_output, send_process): Use it. diff --git a/src/conf_post.h b/src/conf_post.h index 209f607..f83965b 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -34,6 +34,17 @@ along with GNU Emacs. If not, see . */ #include +/* GNUC_PREREQ (V, W, X) is true if this is GNU C version V.W.X or later. + It can be used in a preprocessor expression. */ +#ifndef __GNUC_MINOR__ +# define GNUC_PREREQ(v, w, x) false +#elif ! defined __GNUC_PATCHLEVEL__ +# define GNUC_PREREQ(v, w, x) ((v) < __GNUC__ + ((w) <= __GNUC_MINOR__)) +#else +# define GNUC_PREREQ(v, w, x) \ + ((v) < __GNUC__ + ((w) <= __GNUC_MINOR__ + ((x) <= __GNUC_PATCHLEVEL__))) +#endif + /* The type of bool bitfields. Needed to compile Objective-C with standard GCC. It was also needed to port to pre-C99 compilers, although we don't care about that any more. */ diff --git a/src/keyboard.c b/src/keyboard.c index 9184246..f24d86e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -70,6 +70,11 @@ along with GNU Emacs. If not, see . */ #include TERM_HEADER #endif /* HAVE_WINDOW_SYSTEM */ +/* Work around GCC bug 54561. */ +#if GNUC_PREREQ (4, 3, 0) +# pragma GCC diagnostic ignored "-Wclobbered" +#endif + /* Variables for blockinput.h: */ /* Positive if interrupt input is blocked right now. */ diff --git a/src/process.c b/src/process.c index 7ab92b0..e6ea2fb 100644 --- a/src/process.c +++ b/src/process.c @@ -151,6 +151,18 @@ bool inhibit_sentinels; # define SOCK_CLOEXEC 0 #endif +/* True if ERRNUM represents an error where the system call would + block if a blocking variant were used. */ +static bool +would_block (int errnum) +{ +#ifdef EWOULDBLOCK + if (EWOULDBLOCK != EAGAIN && errnum == EWOULDBLOCK) + return true; +#endif + return errnum == EAGAIN; +} + #ifndef HAVE_ACCEPT4 /* Emulate GNU/Linux accept4 and socket well enough for this module. */ @@ -4262,15 +4274,7 @@ server_accept_connection (Lisp_Object server, int channel) if (s < 0) { int code = errno; - - if (code == EAGAIN) - return; -#ifdef EWOULDBLOCK - if (code == EWOULDBLOCK) - return; -#endif - - if (!NILP (ps->log)) + if (!would_block (code) && !NILP (ps->log)) call3 (ps->log, server, Qnil, concat3 (build_string ("accept failed with code"), Fnumber_to_string (make_number (code)), @@ -4687,12 +4691,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, int nread = read_process_output (proc, wait_proc->infd); if (nread < 0) { - if (errno == EIO || errno == EAGAIN) - break; -#ifdef EWOULDBLOCK - if (errno == EWOULDBLOCK) - break; -#endif + if (errno == EIO || would_block (errno)) + break; } else { @@ -5073,11 +5073,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, if (do_display) redisplay_preserve_echo_area (12); } -#ifdef EWOULDBLOCK - else if (nread == -1 && errno == EWOULDBLOCK) - ; -#endif - else if (nread == -1 && errno == EAGAIN) + else if (nread == -1 && would_block (errno)) ; #ifdef WINDOWSNT /* FIXME: Is this special case still needed? */ @@ -5801,11 +5797,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, if (rv < 0) { - if (errno == EAGAIN -#ifdef EWOULDBLOCK - || errno == EWOULDBLOCK -#endif - ) + if (would_block (errno)) /* Buffer is full. Wait, accepting input; that may allow the program to finish doing output and read more. */ commit 2deb20c1bdef2940629dc2c586d9176b9ea7e203 Author: Paul Eggert Date: Wed Oct 12 09:00:27 2016 -0700 Port last_marked change to full-program optimizers * src/alloc.c (last_marked): Now EXTERNALLY_VISIBLE. diff --git a/src/alloc.c b/src/alloc.c index c5ae8b5..d58532b 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6014,9 +6014,7 @@ mark_glyph_matrix (struct glyph_matrix *matrix) all the references contained in it. */ #define LAST_MARKED_SIZE 500 -/* This is not static to prevent it from being optimized away in an - optimized build, which then makes debugging GC problems harder. */ -Lisp_Object last_marked[LAST_MARKED_SIZE]; +Lisp_Object last_marked[LAST_MARKED_SIZE] EXTERNALLY_VISIBLE; static int last_marked_index; /* For debugging--call abort when we cdr down this many commit 40c426a150c5d885d8a2509358831c9bb1e1c6ad Author: Paul Eggert Date: Wed Oct 12 09:01:03 2016 -0700 Work around Samba bug with ':' in symlink contents * src/filelock.c (current_lock_owner): When reading the contents of a lock, treat the UTF-8 for U+F022 as if it were ':' (Bug#24656). Backport from master. diff --git a/src/filelock.c b/src/filelock.c index 8aaa656..23bb4b8 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -71,8 +71,9 @@ along with GNU Emacs. If not, see . */ /* Normally use a symbolic link to represent a lock. The strategy: to lock a file FN, create a symlink .#FN in FN's - directory, with link data `user@host.pid'. This avoids a single - mount (== failure) point for lock files. + directory, with link data USER@HOST.PID:BOOT. This avoids a single + mount (== failure) point for lock files. The :BOOT is omitted if + the boot time is not available. When the host in the lock data is the current host, we can check if the pid is valid with kill. @@ -101,13 +102,11 @@ along with GNU Emacs. If not, see . */ This is compatible with the locking scheme used by Interleaf (which has contributed this implementation for Emacs), and was designed by - Ethan Jacobson, Kimbo Mundy, and others. - - --karl@cs.umb.edu/karl@hq.ileaf.com. + Karl Berry, Ethan Jacobson, Kimbo Mundy, and others. On some file systems, notably those of MS-Windows, symbolic links - do not work well, so instead of a symlink .#FN -> 'user@host.pid', - the lock is a regular file .#FN with contents 'user@host.pid'. To + do not work well, so instead of a symlink .#FN -> USER@HOST.PID:BOOT, + the lock is a regular file .#FN with contents USER@HOST.PID:BOOT. To establish a lock, a nonce file is created and then renamed to .#FN. On MS-Windows this renaming is atomic unless the lock is forcibly acquired. On other systems the renaming is atomic if the lock is @@ -298,8 +297,8 @@ enum { MAX_LFINFO = 8 * 1024 }; typedef struct { - /* Location of '@', '.', ':' in USER. If there's no colon, COLON - points to the end of USER. */ + /* Location of '@', '.', and ':' (or equivalent) in USER. If there's + no colon or equivalent, COLON points to the end of USER. */ char *at, *dot, *colon; /* Lock file contents USER@HOST.PID with an optional :BOOT_TIME @@ -557,7 +556,7 @@ current_lock_owner (lock_info_type *owner, char *lfname) if (!dot) return -1; - /* The PID is everything from the last `.' to the `:'. */ + /* The PID is everything from the last '.' to the ':' or equivalent. */ if (! c_isdigit (dot[1])) return -1; errno = 0; @@ -565,7 +564,8 @@ current_lock_owner (lock_info_type *owner, char *lfname) if (errno == ERANGE) pid = -1; - /* After the `:', if there is one, comes the boot time. */ + /* After the ':' or equivalent, if there is one, comes the boot time. */ + char *boot = owner->colon + 1; switch (owner->colon[0]) { case 0: @@ -573,10 +573,19 @@ current_lock_owner (lock_info_type *owner, char *lfname) lfinfo_end = owner->colon; break; + case '\357': + /* Treat "\357\200\242" (U+F022 in UTF-8) as if it were ":". + This works around a bug in Samba, which can mistakenly + transliterate ':' to U+F022 in symlink contents (Bug#24656). + See . */ + if (! (boot[0] == '\200' && boot[1] == '\242')) + return -1; + boot += 2; + /* Fall through. */ case ':': - if (! c_isdigit (owner->colon[1])) + if (! c_isdigit (boot[0])) return -1; - boot_time = strtoimax (owner->colon + 1, &lfinfo_end, 10); + boot_time = strtoimax (boot, &lfinfo_end, 10); break; default: commit 27eb668ac34eb3899985718c6879dc11e916d382 Author: Eli Zaretskii Date: Wed Oct 12 11:59:53 2016 +0300 Adapt GDB scripts to '--enable-check-lisp-object-type' builds * etc/emacs-buffer.gdb <$qnil>: New variable. (ybuffer-list, yset-buffer): Use $qnil for comparing against 'nil', as direct comparison with Qnil doesn't work in a build with '--enable-check-lisp-object-type'. * src/.gdbinit: Adapt commands of the temporary breakpoint in init_sys_modes to a build with '--enable-check-lisp-object-type'. diff --git a/etc/emacs-buffer.gdb b/etc/emacs-buffer.gdb index 26c13c1..d51e7ad 100644 --- a/etc/emacs-buffer.gdb +++ b/etc/emacs-buffer.gdb @@ -70,8 +70,10 @@ # Code: -# Force loading of symbols, enough to give us VALMASK etc. -set main +# Force loading of symbols, enough to give us VALBITS etc. +set $dummy = main + 8 +# With some compilers, we need this to give us struct Lisp_Symbol etc.: +set $dummy = Fmake_symbol + 8 # When nonzero, display some extra diagnostics in various commands set $yverbose = 1 @@ -82,6 +84,11 @@ define ygetptr set $ptr = (CHECK_LISP_OBJECT_TYPE ? $ptr.i : $ptr) & VALMASK end +# Get the value of Qnil for comparison. Needed when +# CHECK_LISP_OBJECT_TYPE is non-zero. +ygetptr Qnil +set $qnil = $ptr + define ybuffer-list set $files_only = $yfile_buffers_only set $yfile_buffers_only = 0 @@ -93,10 +100,13 @@ define ybuffer-list set $i = 0 set $alist = Vbuffer_alist - while $alist != Qnil - ygetptr $alist + ygetptr $alist + set $alist = $ptr + while $alist != $qnil set $this = ((struct Lisp_Cons *) $ptr)->car set $alist = ((struct Lisp_Cons *) $ptr)->u.cdr + ygetptr $alist + set $alist = $ptr # Vbuffer_alist elts are pairs of the form (name . buffer) ygetptr $this @@ -104,7 +114,9 @@ define ybuffer-list ygetptr $buf set $buf = (struct buffer *) $ptr - if ! ($files_only && $buf->filename_ == Qnil) + ygetptr $buf->filename_ + set $fname = $ptr + if ! ($files_only && $fname == $qnil) ygetptr $buf->name_ set $name = ((struct Lisp_String *) $ptr)->data set $modp = ($buf->text->modiff > $buf->text->save_modiff) ? '*' : ' ' @@ -112,11 +124,11 @@ define ybuffer-list ygetptr $buf->mode_name_ set $mode = ((struct Lisp_String *) $ptr)->data - if $buf->filename_ != Qnil + if $fname != $qnil ygetptr $buf->filename_ printf "%2d %c %9d %-20s %-10s %s\n", \ $i, $modp, ($buf->text->z_byte - 1), $name, $mode, \ - ((struct Lisp_String *) $ptr)->data + ((struct Lisp_String *) $fname)->data else printf "%2d %c %9d %-20s %-10s\n", \ $i, $modp, ($buf->text->z_byte - 1), $name, $mode @@ -146,15 +158,17 @@ define yset-buffer set $i = $arg0 set $alist = Vbuffer_alist - while ($alist != Qnil && $i > 0) - ygetptr $alist + ygetptr $alist + set $alist = $ptr + while ($alist != $qnil && $i > 0) set $alist = ((struct Lisp_Cons *) $ptr)->u.cdr + ygetptr $alist + set $alist = $ptr set $i-- end # Get car of alist; this is a pair (name . buffer) - ygetptr $alist - set $this = ((struct Lisp_Cons *) $ptr)->car + set $this = ((struct Lisp_Cons *) $alist)->car # Get the buffer object ygetptr $this diff --git a/src/.gdbinit b/src/.gdbinit index a4e9f70..9160ffa 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -1267,8 +1267,7 @@ break terminate_due_to_signal tbreak init_sys_modes commands silent - xgetptr globals.f_Vinitial_window_system - xsymname $ptr + xsymname globals.f_Vinitial_window_system xgetptr $symname set $tem = (struct Lisp_String *) $ptr set $tem = (char *) $tem->data commit dac64e35ddd203be2b841e65cf16e11ce9b1be6a Author: Eli Zaretskii Date: Tue Oct 11 14:38:48 2016 +0300 Avoid optimizing out the last_marked[] array * src/alloc.c : No longer 'static', to avoid having it optimized out in optimized builds, which then makes debugging GC problems harder. diff --git a/src/alloc.c b/src/alloc.c index c7f58a8..c5ae8b5 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6014,7 +6014,9 @@ mark_glyph_matrix (struct glyph_matrix *matrix) all the references contained in it. */ #define LAST_MARKED_SIZE 500 -static Lisp_Object last_marked[LAST_MARKED_SIZE]; +/* This is not static to prevent it from being optimized away in an + optimized build, which then makes debugging GC problems harder. */ +Lisp_Object last_marked[LAST_MARKED_SIZE]; static int last_marked_index; /* For debugging--call abort when we cdr down this many