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 diff --git a/lisp/dired.el b/lisp/dired.el index 0abb521cc5b..ba762277ae7 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3365,9 +3365,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) @@ -3384,9 +3389,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)) diff --git a/lisp/electric.el b/lisp/electric.el index 5f4304462dd..cee35621397 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.") 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 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) 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") diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 15868bd2e8f..82905a5b964 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/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/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)) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index f95e67f4f56..dff0fd1365c 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1408,7 +1408,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. 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) 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); 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 diff --git a/src/xdisp.c b/src/xdisp.c index f1c6b9ff699..016e7044caf 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)); diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index a5bce172c94..bfc62049ccd 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)