From 104f3e51fe6d22cf0ee280509df1b133cb8e1f89 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Fri, 17 Nov 2017 15:39:02 +0200 Subject: [PATCH 01/13] Document how to enter whitespace when using grep-read-files * lisp/progmodes/grep.el (lgrep, rgrep, grep-read-files): Explain how to enter whitespace when using grep-read-files. (Bug#29303) * lisp/progmodes/project.el (project-find-regexp): Likewise. * lisp/vc/vc-git.el (vc-git-grep): Likewise. --- lisp/progmodes/grep.el | 12 +++++++++--- lisp/progmodes/project.el | 6 +++++- lisp/vc/vc-git.el | 4 +++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index d0404fdeaf4..c2d80223541 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -904,7 +904,9 @@ substitution string. Note dynamic scoping of variables.") (defun grep-read-files (regexp) "Read a file-name pattern arg for interactive grep. -The pattern can include shell wildcards." +The pattern can include shell wildcards. As whitespace triggers +completion when entering a pattern, including it requires +quoting, e.g. `\\[quoted-insert]'." (let* ((bn (or (buffer-file-name) (replace-regexp-in-string "<[0-9]+>\\'" "" (buffer-name)))) (fn (and bn @@ -954,7 +956,9 @@ The pattern can include shell wildcards." "Run grep, searching for REGEXP in FILES in directory DIR. The search is limited to file names matching shell pattern FILES. FILES may use abbreviations defined in `grep-files-aliases', e.g. -entering `ch' is equivalent to `*.[ch]'. +entering `ch' is equivalent to `*.[ch]'. As whitespace triggers +completion when entering a pattern, including it requires +quoting, e.g. `\\[quoted-insert]'. With \\[universal-argument] prefix, you can edit the constructed shell command line before it is executed. @@ -1032,7 +1036,9 @@ This command shares argument histories with \\[rgrep] and \\[grep]." "Recursively grep for REGEXP in FILES in directory tree rooted at DIR. The search is limited to file names matching shell pattern FILES. FILES may use abbreviations defined in `grep-files-aliases', e.g. -entering `ch' is equivalent to `*.[ch]'. +entering `ch' is equivalent to `*.[ch]'. As whitespace triggers +completion when entering a pattern, including it requires +quoting, e.g. `\\[quoted-insert]'. With \\[universal-argument] prefix, you can edit the constructed shell command line before it is executed. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 9dc0da4ad5c..93a945edaa4 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -307,7 +307,11 @@ DIRS must contain directory names." (defun project-find-regexp (regexp) "Find all matches for REGEXP in the current project's roots. With \\[universal-argument] prefix, you can specify the directory -to search in, and the file name pattern to search for." +to search in, and the file name pattern to search for. The +pattern may use abbreviations defined in `grep-files-aliases', +e.g. entering `ch' is equivalent to `*.[ch]'. As whitespace +triggers completion when entering a pattern, including it +requires quoting, e.g. `\\[quoted-insert]'." (interactive (list (project--read-regexp))) (let* ((pr (project-current t)) (dirs (if current-prefix-arg diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ed85603f828..060072ea54d 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1407,7 +1407,9 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"." "Run git grep, searching for REGEXP in FILES in directory DIR. The search is limited to file names matching shell pattern FILES. FILES may use abbreviations defined in `grep-files-aliases', e.g. -entering `ch' is equivalent to `*.[ch]'. +entering `ch' is equivalent to `*.[ch]'. As whitespace triggers +completion when entering a pattern, including it requires +quoting, e.g. `\\[quoted-insert]'. With \\[universal-argument] prefix, you can edit the constructed shell command line before it is executed. From 648c128b5f5eb8988aabcc2073b706d2561acd15 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 17 Nov 2017 17:41:23 +0200 Subject: [PATCH 02/13] More fixes in src/.gdbinit * src/.gdbinit (pwinx): Update to match 'struct window'. (pcursorx): Use "." instead of "->" because the argument is a struct, not a pointer. --- src/.gdbinit | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/.gdbinit b/src/.gdbinit index 48bb5dfadb8..e22d03ea476 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -352,7 +352,7 @@ end define pcursorx set $cp = $arg0 - printf "y=%d x=%d vpos=%d hpos=%d", $cp->y, $cp->x, $cp->vpos, $cp->hpos + printf "y=%d x=%d vpos=%d hpos=%d", $cp.y, $cp.x, $cp.vpos, $cp.hpos end document pcursorx Pretty print a window cursor. @@ -369,11 +369,11 @@ end define pwinx set $w = $arg0 - if ($w->mini_p != Qnil) + if ($w->mini != 0) printf "Mini " end - printf "Window %d ", $int - xgetptr $w->buffer + printf "Window %d ", $w->sequence_number + xgetptr $w->contents set $tem = (struct buffer *) $ptr xgetptr $tem->name_ printf "%s", ((struct Lisp_String *) $ptr)->u.s.data @@ -381,16 +381,14 @@ define pwinx xgetptr $w->start set $tem = (struct Lisp_Marker *) $ptr printf "start=%d end:", $tem->charpos - if ($w->window_end_valid != Qnil) - xgetint $w->window_end_pos - printf "pos=%d", $int - xgetint $w->window_end_vpos - printf " vpos=%d", $int + if ($w->window_end_valid != 0) + printf "pos=%d", $w->window_end_pos + printf " vpos=%d", $w->window_end_vpos else printf "invalid" end printf " vscroll=%d", $w->vscroll - if ($w->force_start != Qnil) + if ($w->force_start != 0) printf " FORCE_START" end if ($w->must_be_updated_p) From 90add182a4d7b42942722d6cffb1ca213e546a37 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 17 Nov 2017 21:37:04 +0200 Subject: [PATCH 03/13] Prevent aborts in line-move-visual * src/indent.c (line_number_display_width): Avoid assertion violations in init_iterator when the window's buffer was temporarily switched without updating window-start. (Bug#29326) --- src/indent.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/indent.c b/src/indent.c index 192eec72efe..5f931a511e4 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1959,21 +1959,26 @@ line_number_display_width (struct window *w, int *width, int *pixel_width) else { struct it it; - struct text_pos wstart; + struct text_pos startpos; bool saved_restriction = false; ptrdiff_t count = SPECPDL_INDEX (); - SET_TEXT_POS_FROM_MARKER (wstart, w->start); + SET_TEXT_POS_FROM_MARKER (startpos, w->start); void *itdata = bidi_shelve_cache (); - /* We must start from window's start point, but it could be - outside the accessible region. */ - if (wstart.charpos < BEGV || wstart.charpos > ZV) + /* We want to start from window's start point, but it could be + outside the accessible region, in which case we widen the + buffer temporarily. It could even be beyond the buffer's end + (Org mode's display of source code snippets is known to cause + that), in which case we just punt and start from point instead. */ + if (startpos.charpos > Z) + SET_TEXT_POS (startpos, PT, PT_BYTE); + if (startpos.charpos < BEGV || startpos.charpos > ZV) { record_unwind_protect (save_restriction_restore, save_restriction_save ()); Fwiden (); saved_restriction = true; } - start_display (&it, w, wstart); + start_display (&it, w, startpos); /* The call to move_it_by_lines below will not generate a line number if the first line shown in the window is hscrolled such that all of its display elements are out of view. So we From 3e801240986af911e5d97828a2743b04237c9f9c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 18 Nov 2017 11:42:06 +0200 Subject: [PATCH 04/13] Improve documentation of dired-next/prev-marked-file * lisp/dired.el (dired-next-marked-file, dired-prev-marked-file): Doc fixes. (Bug#29340) --- lisp/dired.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/dired.el b/lisp/dired.el index f1a74639a94..eb88e273758 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3363,9 +3363,14 @@ argument or confirmation)." (save-excursion (not (dired-move-to-filename)))) (defun dired-next-marked-file (arg &optional wrap opoint) - "Move to the next marked file. -If WRAP is non-nil, wrap around to the beginning of the buffer if -we reach the end." + "Move to the ARGth next marked file. +ARG is the numeric prefix argument and defaults to 1. +If WRAP is non-nil, which happens interactively, wrap around +to the beginning of the buffer and search from there, if no +marked file is found after this line. +Optional argument OPOINT specifies the buffer position to +return to if no ARGth marked file is found; it defaults to +the position where this command was invoked." (interactive "p\np") (or opoint (setq opoint (point)));; return to where interactively started (if (if (> arg 0) @@ -3382,9 +3387,11 @@ we reach the end." (dired-next-marked-file arg nil opoint)))) (defun dired-prev-marked-file (arg &optional wrap) - "Move to the previous marked file. -If WRAP is non-nil, wrap around to the end of the buffer if we -reach the beginning of the buffer." + "Move to the ARGth previous marked file. +ARG is the numeric prefix argument and defaults to 1. +If WRAP is non-nil, which happens interactively, wrap around +to the end of the buffer and search backwards from there, if +no ARGth marked file is found before this line." (interactive "p\np") (dired-next-marked-file (- arg) wrap)) From 29520b083f4bddbf5f7d3bbf0b3d30f31025f4f8 Mon Sep 17 00:00:00 2001 From: OGAWA Hirofumi Date: Sat, 18 Nov 2017 12:29:41 +0200 Subject: [PATCH 05/13] Fix quick-calc in C mode with hex values * lisp/calc/calc-aent.el (math-read-token): Make sure the match against "0[xX][0-9a-fA-F]+" is found at math-exp-pos. See http://lists.gnu.org/archive/html/emacs-devel/2017-11/msg00174.html for the details. Copyright-paperwork-exempt: yes --- lisp/calc/calc-aent.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index f70a6d0eb07..997ac3d583f 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -728,7 +728,9 @@ in Calc algebraic input.") math-exp-str (1- math-exp-pos)) (1- math-exp-pos)))))) (or (and (memq calc-language calc-lang-c-type-hex) - (string-match "0[xX][0-9a-fA-F]+" math-exp-str math-exp-pos)) + (eq (string-match "0[xX][0-9a-fA-F]+" math-exp-str + math-exp-pos) + math-exp-pos)) (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-zA-Zα-ωΑ-Ω:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?" math-exp-str math-exp-pos)) (setq math-exp-token 'number From cbd319a351cc60bf67f6d682809282c889598ece Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 18 Nov 2017 13:06:22 +0200 Subject: [PATCH 06/13] Fix case-folding in Occur * lisp/replace.el (occur-engine): Bind case-fold-search in each buffer we search. (Bug#29254) --- lisp/replace.el | 346 +++++++++++++++++++++++++----------------------- 1 file changed, 178 insertions(+), 168 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index cdaeb9240ad..80e584517ce 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1643,175 +1643,185 @@ See also `multi-occur'." (inhibit-field-text-motion t) (headerpt (with-current-buffer out-buf (point)))) (with-current-buffer buf - (or coding - ;; Set CODING only if the current buffer locally - ;; binds buffer-file-coding-system. - (not (local-variable-p 'buffer-file-coding-system)) - (setq coding buffer-file-coding-system)) - (save-excursion - (goto-char (point-min)) ;; begin searching in the buffer - (while (not (eobp)) - (setq origpt (point)) - (when (setq endpt (re-search-forward regexp nil t)) - (setq lines (1+ lines)) ;; increment matching lines count - (setq matchbeg (match-beginning 0)) - ;; Get beginning of first match line and end of the last. - (save-excursion - (goto-char matchbeg) - (setq begpt (line-beginning-position)) - (goto-char endpt) - (setq endpt (line-end-position))) - ;; Sum line numbers up to the first match line. - (setq curr-line (+ curr-line (count-lines origpt begpt))) - (setq marker (make-marker)) - (set-marker marker matchbeg) - (setq curstring (occur-engine-line begpt endpt keep-props)) - ;; Highlight the matches - (let ((len (length curstring)) - (start 0)) - ;; Count empty lines that don't use next loop (Bug#22062). - (when (zerop len) - (setq matches (1+ matches))) - (while (and (< start len) - (string-match regexp curstring start)) - (setq matches (1+ matches)) - (add-text-properties - (match-beginning 0) (match-end 0) - '(occur-match t) curstring) - (when match-face - ;; Add `match-face' to faces copied from the buffer. - (add-face-text-property + ;; The following binding is for when case-fold-search + ;; has a local binding in the original buffer, in which + ;; case we cannot bind it globally and let that have + ;; effect in every buffer we search. + (let ((case-fold-search case-fold)) + (or coding + ;; Set CODING only if the current buffer locally + ;; binds buffer-file-coding-system. + (not (local-variable-p 'buffer-file-coding-system)) + (setq coding buffer-file-coding-system)) + (save-excursion + (goto-char (point-min)) ;; begin searching in the buffer + (while (not (eobp)) + (setq origpt (point)) + (when (setq endpt (re-search-forward regexp nil t)) + (setq lines (1+ lines)) ;; increment matching lines count + (setq matchbeg (match-beginning 0)) + ;; Get beginning of first match line and end of the last. + (save-excursion + (goto-char matchbeg) + (setq begpt (line-beginning-position)) + (goto-char endpt) + (setq endpt (line-end-position))) + ;; Sum line numbers up to the first match line. + (setq curr-line (+ curr-line (count-lines origpt begpt))) + (setq marker (make-marker)) + (set-marker marker matchbeg) + (setq curstring (occur-engine-line begpt endpt keep-props)) + ;; Highlight the matches + (let ((len (length curstring)) + (start 0)) + ;; Count empty lines that don't use next loop (Bug#22062). + (when (zerop len) + (setq matches (1+ matches))) + (while (and (< start len) + (string-match regexp curstring start)) + (setq matches (1+ matches)) + (add-text-properties (match-beginning 0) (match-end 0) - match-face nil curstring)) - ;; Avoid infloop (Bug#7593). - (let ((end (match-end 0))) - (setq start (if (= start end) (1+ start) end))))) - ;; Generate the string to insert for this match - (let* ((match-prefix - ;; Using 7 digits aligns tabs properly. - (apply #'propertize (format "%7d:" curr-line) - (append - (when prefix-face - `(font-lock-face ,prefix-face)) - `(occur-prefix t mouse-face (highlight) - ;; Allow insertion of text at - ;; the end of the prefix (for - ;; Occur Edit mode). - front-sticky t rear-nonsticky t - occur-target ,marker follow-link t - help-echo "mouse-2: go to this occurrence")))) - (match-str - ;; We don't put `mouse-face' on the newline, - ;; because that loses. And don't put it - ;; on context lines to reduce flicker. - (propertize curstring 'mouse-face (list 'highlight) - 'occur-target marker - 'follow-link t - 'help-echo - "mouse-2: go to this occurrence")) - (out-line - (concat - match-prefix - ;; Add non-numeric prefix to all non-first lines - ;; of multi-line matches. - (replace-regexp-in-string - "\n" - (if prefix-face - (propertize "\n :" 'font-lock-face prefix-face) - "\n :") - match-str) - ;; Add marker at eol, but no mouse props. - (propertize "\n" 'occur-target marker))) - (data - (if (= nlines 0) - ;; The simple display style - out-line - ;; The complex multi-line display style. - (setq ret (occur-context-lines - out-line nlines keep-props begpt endpt - curr-line prev-line prev-after-lines - prefix-face)) - ;; Set first elem of the returned list to `data', - ;; and the second elem to `prev-after-lines'. - (setq prev-after-lines (nth 1 ret)) - (nth 0 ret)))) - ;; Actually insert the match display data - (with-current-buffer out-buf - (when (and list-matching-lines-jump-to-current-line - (not multi-occur-p) - (not orig-line-shown-p) - (>= curr-line orig-line)) - (insert - (concat - (propertize - (format "%7d:%s" orig-line orig-line-str) - 'face list-matching-lines-current-line-face - 'mouse-face 'mode-line-highlight - 'help-echo "Current line") "\n")) - (setq orig-line-shown-p t finalpt (point))) - (insert data))) - (goto-char endpt)) - (if endpt - (progn - ;; Sum line numbers between first and last match lines. - (setq curr-line (+ curr-line (count-lines begpt endpt) - ;; Add 1 for empty last match line since - ;; count-lines returns 1 line less. - (if (and (bolp) (eolp)) 1 0))) - ;; On to the next match... - (forward-line 1)) - (goto-char (point-max))) - (setq prev-line (1- curr-line))) - ;; Insert original line if haven't done yet. - (when (and list-matching-lines-jump-to-current-line - (not multi-occur-p) - (not orig-line-shown-p)) - (with-current-buffer out-buf - (insert - (concat - (propertize - (format "%7d:%s" orig-line orig-line-str) - 'face list-matching-lines-current-line-face - 'mouse-face 'mode-line-highlight - 'help-echo "Current line") "\n")))) - ;; Flush remaining context after-lines. - (when prev-after-lines - (with-current-buffer out-buf - (insert (apply #'concat (occur-engine-add-prefix - prev-after-lines prefix-face))))))) - (when (not (zerop lines)) ;; is the count zero? - (setq global-lines (+ global-lines lines) - global-matches (+ global-matches matches)) - (with-current-buffer out-buf - (goto-char headerpt) - (let ((beg (point)) - end) - (insert (propertize - (format "%d match%s%s%s in buffer: %s%s\n" - matches (if (= matches 1) "" "es") - ;; Don't display the same number of lines - ;; and matches in case of 1 match per line. - (if (= lines matches) - "" (format " in %d line%s" - lines (if (= lines 1) "" "s"))) - ;; Don't display regexp for multi-buffer. - (if (> (length buffers) 1) - "" (occur-regexp-descr regexp)) - (buffer-name buf) - (if in-region-p - (format " within region: %d-%d" - occur--region-start - occur--region-end) - "")) - 'read-only t)) - (setq end (point)) - (add-text-properties beg end `(occur-title ,buf)) - (when title-face - (add-face-text-property beg end title-face)) - (goto-char (if finalpt - (setq occur--final-pos - (cl-incf finalpt (- end beg))) - (point-min))))))))) + '(occur-match t) curstring) + (when match-face + ;; Add `match-face' to faces copied from the buffer. + (add-face-text-property + (match-beginning 0) (match-end 0) + match-face nil curstring)) + ;; Avoid infloop (Bug#7593). + (let ((end (match-end 0))) + (setq start (if (= start end) (1+ start) end))))) + ;; Generate the string to insert for this match + (let* ((match-prefix + ;; Using 7 digits aligns tabs properly. + (apply #'propertize (format "%7d:" curr-line) + (append + (when prefix-face + `(font-lock-face ,prefix-face)) + `(occur-prefix t mouse-face (highlight) + ;; Allow insertion of text + ;; at the end of the prefix + ;; (for Occur Edit mode). + front-sticky t + rear-nonsticky t + occur-target ,marker + follow-link t + help-echo "mouse-2: go to this occurrence")))) + (match-str + ;; We don't put `mouse-face' on the newline, + ;; because that loses. And don't put it + ;; on context lines to reduce flicker. + (propertize curstring 'mouse-face (list 'highlight) + 'occur-target marker + 'follow-link t + 'help-echo + "mouse-2: go to this occurrence")) + (out-line + (concat + match-prefix + ;; Add non-numeric prefix to all non-first lines + ;; of multi-line matches. + (replace-regexp-in-string + "\n" + (if prefix-face + (propertize + "\n :" 'font-lock-face prefix-face) + "\n :") + match-str) + ;; Add marker at eol, but no mouse props. + (propertize "\n" 'occur-target marker))) + (data + (if (= nlines 0) + ;; The simple display style + out-line + ;; The complex multi-line display style. + (setq ret (occur-context-lines + out-line nlines keep-props begpt + endpt curr-line prev-line + prev-after-lines prefix-face)) + ;; Set first elem of the returned list to `data', + ;; and the second elem to `prev-after-lines'. + (setq prev-after-lines (nth 1 ret)) + (nth 0 ret)))) + ;; Actually insert the match display data + (with-current-buffer out-buf + (when (and list-matching-lines-jump-to-current-line + (not multi-occur-p) + (not orig-line-shown-p) + (>= curr-line orig-line)) + (insert + (concat + (propertize + (format "%7d:%s" orig-line orig-line-str) + 'face list-matching-lines-current-line-face + 'mouse-face 'mode-line-highlight + 'help-echo "Current line") "\n")) + (setq orig-line-shown-p t finalpt (point))) + (insert data))) + (goto-char endpt)) + (if endpt + (progn + ;; Sum line numbers between first and last match lines. + (setq curr-line (+ curr-line (count-lines begpt endpt) + ;; Add 1 for empty last match line + ;; since count-lines returns one + ;; line less. + (if (and (bolp) (eolp)) 1 0))) + ;; On to the next match... + (forward-line 1)) + (goto-char (point-max))) + (setq prev-line (1- curr-line))) + ;; Insert original line if haven't done yet. + (when (and list-matching-lines-jump-to-current-line + (not multi-occur-p) + (not orig-line-shown-p)) + (with-current-buffer out-buf + (insert + (concat + (propertize + (format "%7d:%s" orig-line orig-line-str) + 'face list-matching-lines-current-line-face + 'mouse-face 'mode-line-highlight + 'help-echo "Current line") "\n")))) + ;; Flush remaining context after-lines. + (when prev-after-lines + (with-current-buffer out-buf + (insert (apply #'concat (occur-engine-add-prefix + prev-after-lines prefix-face))))))) + (when (not (zerop lines)) ;; is the count zero? + (setq global-lines (+ global-lines lines) + global-matches (+ global-matches matches)) + (with-current-buffer out-buf + (goto-char headerpt) + (let ((beg (point)) + end) + (insert (propertize + (format "%d match%s%s%s in buffer: %s%s\n" + matches (if (= matches 1) "" "es") + ;; Don't display the same number of lines + ;; and matches in case of 1 match per line. + (if (= lines matches) + "" (format " in %d line%s" + lines + (if (= lines 1) "" "s"))) + ;; Don't display regexp for multi-buffer. + (if (> (length buffers) 1) + "" (occur-regexp-descr regexp)) + (buffer-name buf) + (if in-region-p + (format " within region: %d-%d" + occur--region-start + occur--region-end) + "")) + 'read-only t)) + (setq end (point)) + (add-text-properties beg end `(occur-title ,buf)) + (when title-face + (add-face-text-property beg end title-face)) + (goto-char (if finalpt + (setq occur--final-pos + (cl-incf finalpt (- end beg))) + (point-min)))))))))) ;; Display total match count and regexp for multi-buffer. (when (and (not (zerop global-lines)) (> (length buffers) 1)) (goto-char (point-min)) From 63c773399e954eb027853557b0a20dbcc67b669e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 18 Nov 2017 13:14:52 +0200 Subject: [PATCH 07/13] ; * lisp/ido.el (ido-find-alternate-file): Doc fix. (Bug#29278) --- lisp/ido.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ido.el b/lisp/ido.el index 4f1e36ba914..96a362f7608 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -4302,7 +4302,7 @@ For details of keybindings, see `ido-find-file'." ;;;###autoload (defun ido-find-alternate-file () - "Switch to another file and show it in another window. + "Find another file, select its buffer, kill previous buffer. The file name is selected interactively by typing a substring. For details of keybindings, see `ido-find-file'." (interactive) From 319c2de9dab577ea97f6c63cb8fd5b7ac3da82b0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 18 Nov 2017 13:41:03 +0200 Subject: [PATCH 08/13] Avoid assertion violations in echo_area_display * src/xdisp.c (echo_area_display): Don't try redisplaying the echo area if the selected-frame's mini-window is nil. (Bug#27647) --- src/xdisp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/xdisp.c b/src/xdisp.c index 4c82737e410..02c5d76e06b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11510,6 +11510,9 @@ echo_area_display (bool update_frame_p) struct frame *sf = SELECTED_FRAME (); mini_window = FRAME_MINIBUF_WINDOW (sf); + if (NILP (mini_window)) + return; + w = XWINDOW (mini_window); f = XFRAME (WINDOW_FRAME (w)); From 4c21d04057d5f4f801d57e8aa2ffdab834ddc48a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 18 Nov 2017 13:46:13 +0200 Subject: [PATCH 09/13] Fix a typo in doc string of electric-indent-functions-without-reindent * lisp/electric.el (electric-indent-functions-without-reindent): Doc fix. (Bug#29304) --- lisp/electric.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/electric.el b/lisp/electric.el index d7929945db2..5ce747410b6 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -227,7 +227,7 @@ Python does not lend itself to fully automatic indentation.") haskell-indentation-indent-line haskell-indent-cycle haskell-simple-indent yaml-indent-line) "List of indent functions that can't reindent. -If `line-indent-function' is one of those, then `electric-indent-mode' will +If `indent-line-function' is one of those, then `electric-indent-mode' will not try to reindent lines. It is normally better to make the major mode set `electric-indent-inhibit', but this can be used as a workaround.") From c355529baedf3a5f03a8a4ee5904a5918f456b64 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 18 Nov 2017 14:24:03 +0100 Subject: [PATCH 10/13] Fix bug in tramp-handle-file-truename * lisp/net/tramp.el (tramp-handle-file-truename): Expand localname. * test/lisp/net/tramp-tests.el (tramp-test21-file-links): Check also relative symbolic links. --- lisp/net/tramp.el | 3 ++- test/lisp/net/tramp-tests.el | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 3d5dcbdbb14..aadfcadebcf 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3207,7 +3207,8 @@ User is always nil." (if (file-remote-p symlink-target) (let (file-name-handler-alist) (tramp-compat-file-name-quote symlink-target)) - symlink-target) + (expand-file-name + symlink-target (file-name-directory v2-localname))) v2-localname))))) (when (>= numchase numchase-limit) (tramp-error diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index cf85b071e19..62f72a3f6f6 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -2671,7 +2671,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (should-error (make-symbolic-link tmp-name1 tmp-name2) :type 'file-already-exists) - ;; number means interactive case. + ;; A number means interactive case. (cl-letf (((symbol-function 'yes-or-no-p) 'ignore)) (should-error (make-symbolic-link tmp-name1 tmp-name2 0) @@ -2783,6 +2783,15 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (should (string-equal (file-truename tmp-name1) (file-truename tmp-name2))) (should (file-equal-p tmp-name1 tmp-name2)) + ;; Check relative symlink file name. + (delete-file tmp-name2) + (let ((default-directory tramp-test-temporary-file-directory)) + (make-symbolic-link (file-name-nondirectory tmp-name1) tmp-name2)) + (should (file-symlink-p tmp-name2)) + (should-not (string-equal tmp-name2 (file-truename tmp-name2))) + (should + (string-equal (file-truename tmp-name1) (file-truename tmp-name2))) + (should (file-equal-p tmp-name1 tmp-name2)) ;; Symbolic links could look like a remote file name. ;; They must be quoted then. (delete-file tmp-name2) From 90075e8e1e6d6d7b6b49cb20ecdbb5d3de53d48b Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 18 Nov 2017 15:08:32 +0100 Subject: [PATCH 11/13] Fix symlink flag in tramp-gvfs-handle-file-attributes * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-attributes): Set proper symlink file mode flag. --- lisp/net/tramp-gvfs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 709ea4670a8..424e77b0eba 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -992,7 +992,7 @@ If FILE-SYSTEM is non-nil, return file system attributes." (tramp-file-mode-from-int (string-to-number n)) (format "%s%s%s%s------" - (if dirp "d" "-") + (if dirp "d" (if res-symlink-target "l" "-")) (if (equal (cdr (assoc "access::can-read" attributes)) "FALSE") "-" "r") From e9dd580cc8b3134eb82d758efb070a3ab8dd3e9a Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sat, 18 Nov 2017 14:52:39 +0000 Subject: [PATCH 12/13] Filter obtrusive events in help-read-key-sequence. This fixes most of bug #29272. * lisp/help.el (help-read-key-sequence): After a mouse event, pause for 0.01s, discarding any events (such as ) received in this time, before polling for the double-click (etc.) events which may follow. This fixes the infinite loop which occurred whwn events triggered a sit-for whilst handling menu events. --- lisp/help.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/help.el b/lisp/help.el index fbb9fc8cbe6..212e3679dad 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -728,11 +728,17 @@ with `mouse-movement' events." Describe the following key, mouse click, or menu item: ")) ((and (pred vectorp) (let `(,key0 . ,_) (aref key 0)) (guard (symbolp key0)) (let keyname (symbol-name key0))) - (if no-mouse-movement - (string-match "mouse-movement" keyname) - (and (string-match "\\(mouse\\|down\\|click\\|drag\\)" - keyname) - (not (sit-for (/ double-click-time 1000.0) t))))))) + (or + (and no-mouse-movement + (string-match "mouse-movement" keyname)) + (and (string-match "\\(mouse\\|down\\|click\\|drag\\)" + keyname) + (progn + ;; Discard events (e.g. ) which might + ;; spuriously trigger the `sit-for'. + (sleep-for 0.01) + (while (read-event nil nil 0.01)) + (not (sit-for (/ double-click-time 1000.0) t)))))))) (list key ;; If KEY is a down-event, read and include the From 6e6bf60eab1e921605064e3d39ea080639f8e0f6 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Sat, 18 Nov 2017 19:19:32 +0100 Subject: [PATCH 13/13] Don't let delete_frame select a tooltip frame (Bug#27647) * src/frame.c (delete_frame): Don't select a tooltip frame. (Bug#27647) --- src/frame.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frame.c b/src/frame.c index 2b32751c0d3..aacb27ec790 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1920,6 +1920,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=15025. */ FOR_EACH_FRAME (tail, frame1) if (!EQ (frame, frame1) + && NILP (Fframe_parameter (frame1, Qtooltip)) && (FRAME_TERMINAL (XFRAME (frame)) == FRAME_TERMINAL (XFRAME (frame1))) && FRAME_VISIBLE_P (XFRAME (frame1))) @@ -1930,7 +1931,9 @@ delete_frame (Lisp_Object frame, Lisp_Object force) { FOR_EACH_FRAME (tail, frame1) { - if (! EQ (frame, frame1) && FRAME_LIVE_P (XFRAME (frame1))) + if (!EQ (frame, frame1) + && FRAME_LIVE_P (XFRAME (frame1)) + && NILP (Fframe_parameter (frame1, Qtooltip))) { /* Do not change a text terminal's top-frame. */ struct frame *f1 = XFRAME (frame1);