aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2013-09-08 21:17:12 +0900
committerKenichi Handa2013-09-08 21:17:12 +0900
commit3aff2f57cc348b90c0f8b5926027cd0f0f378070 (patch)
treeff714b2645779c262a714ed7ae1d97a155d21438
parent0ca754d0d8df545ce4c09d65a337f67213e2f82b (diff)
parente8dd0787d9c19e81344552d185e9008031f58723 (diff)
downloademacs-3aff2f57cc348b90c0f8b5926027cd0f0f378070.tar.gz
emacs-3aff2f57cc348b90c0f8b5926027cd0f0f378070.zip
merge trunk
-rw-r--r--ChangeLog9
-rwxr-xr-xautogen/configure26
-rw-r--r--configure.ac12
-rw-r--r--doc/misc/ChangeLog4
-rw-r--r--doc/misc/tramp.texi42
-rw-r--r--etc/NEWS11
-rw-r--r--lisp/ChangeLog139
-rw-r--r--lisp/abbrev.el19
-rw-r--r--lisp/arc-mode.el23
-rw-r--r--lisp/dired-x.el32
-rw-r--r--lisp/dired.el2
-rw-r--r--lisp/emacs-lisp/crm.el62
-rw-r--r--lisp/epa.el71
-rw-r--r--lisp/epg.el5
-rw-r--r--lisp/icomplete.el24
-rw-r--r--lisp/info.el11
-rw-r--r--lisp/minibuffer.el225
-rw-r--r--lisp/net/tramp-gvfs.el6
-rw-r--r--lisp/net/tramp.el107
-rw-r--r--lisp/progmodes/cc-engine.el54
-rw-r--r--lisp/progmodes/cc-langs.el5
-rw-r--r--lisp/progmodes/ruby-mode.el4
-rw-r--r--lisp/replace.el9
-rw-r--r--lisp/textmodes/bibtex.el2
-rw-r--r--src/ChangeLog82
-rw-r--r--src/dispextern.h52
-rw-r--r--src/dispnew.c45
-rw-r--r--src/eval.c7
-rw-r--r--src/font.c6
-rw-r--r--src/frame.c4
-rw-r--r--src/frame.h7
-rw-r--r--src/gfilenotify.c2
-rw-r--r--src/lisp.h3
-rw-r--r--src/term.c19
-rw-r--r--src/w32fns.c8
-rw-r--r--src/window.c23
-rw-r--r--src/window.h6
-rw-r--r--src/xdisp.c249
-rw-r--r--src/xfns.c8
39 files changed, 791 insertions, 634 deletions
diff --git a/ChangeLog b/ChangeLog
index 09cfb9783cc..560f60a1819 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
12013-09-07 Paul Eggert <eggert@cs.ucla.edu>
2
3 Port --without-x --enable-gcc-warnings to Fedora 19.
4 * configure.ac (WERROR_CFLAGS): Omit redundant use of
5 -Wmissing-field-initializers, -Wswitch, -Wtype-limits,
6 -Wunused-parameter. If there is no window system, also omit
7 -Wsuggest-attribute=const and -Wsuggest-attribute=noreturn; this
8 is needed for Fedora 19.
9
12013-09-05 Dmitry Antipov <dmantipov@yandex.ru> 102013-09-05 Dmitry Antipov <dmantipov@yandex.ru>
2 11
3 Make --without-x compatible with --enable-gcc-warnings. 12 Make --without-x compatible with --enable-gcc-warnings.
diff --git a/autogen/configure b/autogen/configure
index 7fe40f5bd51..4be101ce418 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -7656,6 +7656,13 @@ fi
7656 # The following line should be removable at some point. 7656 # The following line should be removable at some point.
7657 nw="$nw -Wsuggest-attribute=pure" 7657 nw="$nw -Wsuggest-attribute=pure"
7658 7658
7659 # This part is merely for shortening the command line,
7660 # since -Wno-FOO needs to be added below regardless.
7661 nw="$nw -Wmissing-field-initializers"
7662 nw="$nw -Wswitch"
7663 nw="$nw -Wtype-limits"
7664 nw="$nw -Wunused-parameter"
7665
7659 # clang is unduly picky about some things. 7666 # clang is unduly picky about some things.
7660 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler is clang" >&5 7667 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler is clang" >&5
7661$as_echo_n "checking whether the compiler is clang... " >&6; } 7668$as_echo_n "checking whether the compiler is clang... " >&6; }
@@ -10342,6 +10349,25 @@ fi
10342 10349
10343if test "$window_system" = none && test "$gl_gcc_warnings" = yes; then 10350if test "$window_system" = none && test "$gl_gcc_warnings" = yes; then
10344 # Too many warnings for now. 10351 # Too many warnings for now.
10352 nw=
10353 nw="$nw -Wsuggest-attribute=const"
10354 nw="$nw -Wsuggest-attribute=noreturn"
10355
10356 gl_warn_set=
10357 set x $WARN_CFLAGS; shift
10358 for gl_warn_item
10359 do
10360 case " $nw " in
10361 *" $gl_warn_item "*)
10362 ;;
10363 *)
10364 gl_warn_set="$gl_warn_set $gl_warn_item"
10365 ;;
10366 esac
10367 done
10368 WARN_CFLAGS=$gl_warn_set
10369
10370
10345 10371
10346{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-unused-variable" >&5 10372{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-unused-variable" >&5
10347$as_echo_n "checking whether C compiler handles -Wno-unused-variable... " >&6; } 10373$as_echo_n "checking whether C compiler handles -Wno-unused-variable... " >&6; }
diff --git a/configure.ac b/configure.ac
index cfec49e5645..c7cdc01e3e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -826,6 +826,13 @@ else
826 # The following line should be removable at some point. 826 # The following line should be removable at some point.
827 nw="$nw -Wsuggest-attribute=pure" 827 nw="$nw -Wsuggest-attribute=pure"
828 828
829 # This part is merely for shortening the command line,
830 # since -Wno-FOO needs to be added below regardless.
831 nw="$nw -Wmissing-field-initializers"
832 nw="$nw -Wswitch"
833 nw="$nw -Wtype-limits"
834 nw="$nw -Wunused-parameter"
835
829 # clang is unduly picky about some things. 836 # clang is unduly picky about some things.
830 AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang], 837 AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
831 [AC_COMPILE_IFELSE( 838 [AC_COMPILE_IFELSE(
@@ -1777,6 +1784,11 @@ fi
1777 1784
1778if test "$window_system" = none && test "$gl_gcc_warnings" = yes; then 1785if test "$window_system" = none && test "$gl_gcc_warnings" = yes; then
1779 # Too many warnings for now. 1786 # Too many warnings for now.
1787 nw=
1788 nw="$nw -Wsuggest-attribute=const"
1789 nw="$nw -Wsuggest-attribute=noreturn"
1790 gl_MANYWARN_COMPLEMENT([WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
1791
1780 gl_WARN_ADD([-Wno-unused-variable]) 1792 gl_WARN_ADD([-Wno-unused-variable])
1781 gl_WARN_ADD([-Wno-unused-but-set-variable]) 1793 gl_WARN_ADD([-Wno-unused-but-set-variable])
1782 gl_WARN_ADD([-Wno-unused-but-set-parameter]) 1794 gl_WARN_ADD([-Wno-unused-but-set-parameter])
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 22148deace0..85143fc2692 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,7 @@
12013-09-06 Michael Albinus <michael.albinus@gmx.de>
2
3 * tramp.texi (Alternative Syntax): Remove chapter.
4
12013-08-28 Paul Eggert <eggert@cs.ucla.edu> 52013-08-28 Paul Eggert <eggert@cs.ucla.edu>
2 6
3 * Makefile.in (SHELL): Now @SHELL@, not /bin/sh, 7 * Makefile.in (SHELL): Now @SHELL@, not /bin/sh,
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 03c6da3b73f..aa4cea58f04 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -225,7 +225,6 @@ Configuring @value{tramp} for use
225Using @value{tramp} 225Using @value{tramp}
226 226
227* Filename Syntax:: @value{tramp} filename conventions. 227* Filename Syntax:: @value{tramp} filename conventions.
228* Alternative Syntax:: URL-like filename syntax.
229* Filename completion:: Filename completion. 228* Filename completion:: Filename completion.
230* Ad-hoc multi-hops:: Declaring multiple hops in the file name. 229* Ad-hoc multi-hops:: Declaring multiple hops in the file name.
231* Remote processes:: Integration with other @value{emacsname} packages. 230* Remote processes:: Integration with other @value{emacsname} packages.
@@ -2356,7 +2355,6 @@ minute you have already forgotten that you hit that key!
2356 2355
2357@menu 2356@menu
2358* Filename Syntax:: @value{tramp} filename conventions. 2357* Filename Syntax:: @value{tramp} filename conventions.
2359* Alternative Syntax:: URL-like filename syntax.
2360* Filename completion:: Filename completion. 2358* Filename completion:: Filename completion.
2361* Ad-hoc multi-hops:: Declaring multiple hops in the file name. 2359* Ad-hoc multi-hops:: Declaring multiple hops in the file name.
2362* Remote processes:: Integration with other @value{emacsname} packages. 2360* Remote processes:: Integration with other @value{emacsname} packages.
@@ -2453,46 +2451,6 @@ by adding @file{#<port>} to the host name, like in @file{@trampfn{ssh,
2453daniel, melancholia#42, .emacs}}. 2451daniel, melancholia#42, .emacs}}.
2454 2452
2455 2453
2456@node Alternative Syntax
2457@section URL-like filename syntax
2458@cindex filename syntax
2459@cindex filename examples
2460
2461Additionally to the syntax described in the previous chapter, it is
2462possible to use a URL-like syntax for @value{tramp}. This can be
2463switched on by customizing the variable @code{tramp-syntax}. Please
2464note that this feature is experimental for the time being.
2465
2466The variable @code{tramp-syntax} must be set before requiring @value{tramp}:
2467
2468@lisp
2469(setq tramp-syntax 'url)
2470(require 'tramp)
2471@end lisp
2472
2473Then, a @value{tramp} filename would look like this:
2474@file{/@var{method}://@var{user}@@@var{machine}:@var{port}/@var{path/to.file}}.
2475@file{/@var{method}://} is mandatory, all other parts are optional.
2476@file{:@var{port}} is useful for methods only who support this.
2477
2478The last example from the previous section would look like this:
2479@file{/ssh://daniel@@melancholia/.emacs}.
2480
2481For the time being, @code{tramp-syntax} can have the following values:
2482
2483@itemize @w{}
2484@ifset emacs
2485@item @code{ftp}---That is the default syntax
2486@item @code{url}---URL-like syntax
2487@end ifset
2488@ifset xemacs
2489@item @code{sep}---That is the default syntax
2490@item @code{url}---URL-like syntax
2491@item @code{ftp}---EFS-like syntax
2492@end ifset
2493@end itemize
2494
2495
2496@node Filename completion 2454@node Filename completion
2497@section Filename completion 2455@section Filename completion
2498@cindex filename completion 2456@cindex filename completion
diff --git a/etc/NEWS b/etc/NEWS
index a6d6f5b04c4..cd69a8e09a0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -332,6 +332,10 @@ This is useful to avoid a query when you have no key for that name.
332*** key bindings to navigate through and select the completions. 332*** key bindings to navigate through and select the completions.
333*** The icomplete-separator is customizable, and its default has changed. 333*** The icomplete-separator is customizable, and its default has changed.
334*** Removed icomplete-show-key-bindings. 334*** Removed icomplete-show-key-bindings.
335*** Icomplete-mode by defaults applies to all forms of minibuffer completion.
336(setq icomplete-with-completion-tables '(internal-complete-buffer))
337will revert to the old behavior.
338
335 339
336** Ido 340** Ido
337*** Ido has a manual now. 341*** Ido has a manual now.
@@ -461,6 +465,8 @@ todo-mode.el has been made obsolete and renamed otodo-mode.el.
461 465
462** Tramp 466** Tramp
463 467
468*** The experimental url syntax for remote file names is withdrawn.
469
464+++ 470+++
465*** New connection method "adb", which allows to access Android 471*** New connection method "adb", which allows to access Android
466devices by the Android Debug Bridge. The variable `tramp-adb-program' 472devices by the Android Debug Bridge. The variable `tramp-adb-program'
@@ -754,6 +760,11 @@ used in place of the 9th element of `file-attributes'.
754`preserve-extended-attributes' as it now handles both SELinux context 760`preserve-extended-attributes' as it now handles both SELinux context
755and ACL entries. 761and ACL entries.
756 762
763** The `common-substring' argument of display-completion-list is obsolete.
764Either use `completion-all-completions' which already returns highlighted
765strings (including for partial or substring completion) or call
766`completion-hilit-commonality' to add the highlight.
767
757** Changes to the Emacs Lisp Coding Conventions in Emacs 24.4 768** Changes to the Emacs Lisp Coding Conventions in Emacs 24.4
758 769
759*** The package descriptor and name of global variables, constants, 770*** The package descriptor and name of global variables, constants,
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 30d00750926..e919a8407ec 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,121 @@
3 * international/characters.el: Set category "^" (Combining) for 3 * international/characters.el: Set category "^" (Combining) for
4 more characters. 4 more characters.
5 5
62013-09-07 Alan Mackenzie <acm@muc.de>
7
8 Correctly fontify Java class constructors.
9 * progmodes/cc-langs.el (c-type-decl-suffix-key): Now matches ")"
10 in Java Mode.
11 (c-recognize-typeless-decls): Set the Java value to t.
12 * progmodes/cc-engine.el (c-forward-decl-or-cast-1): While
13 handling a "(", add a check for, effectively, Java, and handle a
14 "typeless" declaration there.
15
162013-09-07 Roland Winkler <winkler@gnu.org>
17
18 * textmodes/bibtex.el (bibtex-biblatex-entry-alist): Add optional
19 field subtitle for entry type book.
20
212013-09-06 Stefan Monnier <monnier@iro.umontreal.ca>
22
23 * minibuffer.el: Make minibuffer-complete call completion-in-region
24 rather than other way around.
25 (completion--some, completion-pcm--find-all-completions):
26 Don't delay signals when debugging.
27 (minibuffer-completion-contents): Beware fields within the
28 minibuffer contents.
29 (completion-all-sorted-completions): Use defvar-local.
30 (completion--do-completion, completion--cache-all-sorted-completions)
31 (completion-all-sorted-completions, minibuffer-force-complete):
32 Add args `beg' and `end'.
33 (completion--in-region-1): New fun, extracted from minibuffer-complete.
34 (minibuffer-complete): Use completion-in-region.
35 (completion-complete-and-exit): New fun, extracted from
36 minibuffer-complete-and-exit.
37 (minibuffer-complete-and-exit): Use it.
38 (completion--complete-and-exit): Rename from
39 minibuffer--complete-and-exit.
40 (completion-in-region--single-word): New function, extracted from
41 minibuffer-complete-word.
42 (minibuffer-complete-word): Use it.
43 (display-completion-list): Make `common-substring' argument obsolete.
44 (completion--in-region): Call completion--in-region-1 instead of
45 minibuffer-complete.
46 (completion-help-at-point): Pass boundaries to
47 minibuffer-completion-help as args rather than via an overlay.
48 (completion-pcm--string->pattern): Use `any-delim'.
49 (completion-pcm--optimize-pattern): New function.
50 (completion-pcm--pattern->regex): Handle `any-delim'.
51 * icomplete.el (icomplete-forward-completions)
52 (icomplete-backward-completions, icomplete-completions):
53 Adjust calls to completion-all-sorted-completions and
54 completion--cache-all-sorted-completions.
55 (icomplete-with-completion-tables): Default to t.
56 * emacs-lisp/crm.el (crm--current-element): Rename from
57 crm--select-current-element. Don't put an overlay but return the
58 boundaries instead.
59 (crm--completion-command): Take two new args to bind to the boundaries.
60 (crm-completion-help): Adjust accordingly.
61 (crm-complete): Use completion-in-region.
62 (crm-complete-word): Use completion-in-region--single-word.
63 (crm-complete-and-exit): Use completion-complete-and-exit.
64
652013-09-06 Stefan Monnier <monnier@iro.umontreal.ca>
66
67 * dired-x.el (dired-mark-sexp): Bind the vars lexically rather
68 than dynamically.
69
702013-09-06 Juri Linkov <juri@jurta.org>
71
72 * info.el (Info-display-images-node): When image file doesn't exist
73 display text version of the image if it's provided in the Info file.
74 Otherwise, display the location of missing image from SRC attribute.
75 Add help-echo text property from ALT attribute. (Bug#15279)
76
772013-09-06 Stefan Monnier <monnier@iro.umontreal.ca>
78
79 * abbrev.el (edit-abbrevs-mode-map): Rename from edit-abbrevs-map.
80 (edit-abbrevs-mode): Use define-derived-mode.
81
82 * epa.el (epa--encode-coding-string, epa--decode-coding-string)
83 (epa--select-safe-coding-system, epa--derived-mode-p): Make it obvious
84 that it's defined.
85 (epa-key-list-mode, epa-key-mode, epa-info-mode):
86 Use define-derived-mode.
87
88 * epg.el (epg-start-encrypt): Minor CSE simplification.
89
902013-09-06 William Xu <william.xwl@gmail.com>
91
92 * arc-mode.el: Add support for 7za (bug#15264).
93 (archive-7z-program): New var.
94 (archive-zip-extract, archive-zip-expunge, archive-zip-update)
95 (archive-zip-update-case, archive-7z-extract, archive-7z-expunge)
96 (archive-7z-update, archive-zip-extract, archive-7z-summarize): Use it.
97
982013-09-06 Michael Albinus <michael.albinus@gmx.de>
99
100 Remove URL syntax.
101
102 * net/tramp.el (tramp-syntax, tramp-prefix-format)
103 (tramp-postfix-method-format, tramp-prefix-ipv6-format)
104 (tramp-postfix-ipv6-format, tramp-prefix-port-format)
105 (tramp-postfix-host-format, tramp-file-name-regexp)
106 (tramp-completion-file-name-regexp)
107 (tramp-completion-dissect-file-name)
108 (tramp-handle-substitute-in-file-name): Remove 'url case.
109 (tramp-file-name-regexp-url)
110 (tramp-completion-file-name-regexp-url): Remove constants.
111
1122013-09-06 Glenn Morris <rgm@gnu.org>
113
114 * replace.el (replace-string): Doc fix re start/end. (Bug#15275)
115
1162013-09-05 Dmitry Gutov <dgutov@yandex.ru>
117
118 * progmodes/ruby-mode.el (ruby-font-lock-keywords): Move "Perl-ish
119 keywords" below "here-doc beginnings" (Bug#15270).
120
62013-09-05 Stefan Monnier <monnier@iro.umontreal.ca> 1212013-09-05 Stefan Monnier <monnier@iro.umontreal.ca>
7 122
8 * subr.el (pop): Use `car-safe'. 123 * subr.el (pop): Use `car-safe'.
@@ -64,6 +179,30 @@
64 179
652013-09-04 Stefan Monnier <monnier@iro.umontreal.ca> 1802013-09-04 Stefan Monnier <monnier@iro.umontreal.ca>
66 181
182 * vc/vc-dispatcher.el (vc-run-delayed): New macro.
183 (vc-do-command, vc-set-async-update):
184 * vc/vc-mtn.el (vc-mtn-dir-status):
185 * vc/vc-hg.el (vc-hg-dir-status, vc-hg-dir-status-files)
186 (vc-hg-pull, vc-hg-merge-branch):
187 * vc/vc-git.el (vc-git-dir-status-goto-stage, vc-git-pull)
188 (vc-git-merge-branch):
189 * vc/vc-cvs.el (vc-cvs-print-log, vc-cvs-dir-status)
190 (vc-cvs-dir-status-files):
191 * vc/vc-bzr.el (vc-bzr-pull, vc-bzr-merge-branch, vc-bzr-dir-status)
192 (vc-bzr-dir-status-files):
193 * vc/vc-arch.el (vc-arch-dir-status): Use vc-run-delayed.
194 * vc/vc-annotate.el: Use lexical-binding.
195 (vc-annotate-display-select, vc-annotate): Use vc-run-delayed.
196 (vc-sentinel-movepoint): Declare.
197 (vc-annotate): Don't use `goto-line'.
198 * vc/vc.el (vc-diff-internal): Prefer a closure to `(lambda...).
199 (vc-diff-internal, vc-log-internal-common): Use vc-run-delayed.
200 (vc-sentinel-movepoint): Declare.
201 * vc/vc-svn.el: Use lexical-binding.
202 (vc-svn-dir-status, vc-svn-dir-status-files): Use vc-run-delayed.
203 * vc/vc-sccs.el:
204 * vc/vc-rcs.el: Use lexical-binding.
205
67 * autorevert.el (auto-revert-notify-handler): Explicitly ignore 206 * autorevert.el (auto-revert-notify-handler): Explicitly ignore
68 `deleted'. Don't drop errors silently. 207 `deleted'. Don't drop errors silently.
69 208
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index d82e2eabd84..d7d4482693d 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -67,13 +67,15 @@ be replaced by its expansion."
67(put 'abbrev-mode 'safe-local-variable 'booleanp) 67(put 'abbrev-mode 'safe-local-variable 'booleanp)
68 68
69 69
70(defvar edit-abbrevs-map 70(defvar edit-abbrevs-mode-map
71 (let ((map (make-sparse-keymap))) 71 (let ((map (make-sparse-keymap)))
72 (define-key map "\C-x\C-s" 'abbrev-edit-save-buffer) 72 (define-key map "\C-x\C-s" 'abbrev-edit-save-buffer)
73 (define-key map "\C-x\C-w" 'abbrev-edit-save-to-file) 73 (define-key map "\C-x\C-w" 'abbrev-edit-save-to-file)
74 (define-key map "\C-c\C-c" 'edit-abbrevs-redefine) 74 (define-key map "\C-c\C-c" 'edit-abbrevs-redefine)
75 map) 75 map)
76 "Keymap used in `edit-abbrevs'.") 76 "Keymap used in `edit-abbrevs'.")
77(define-obsolete-variable-alias 'edit-abbrevs-map
78 'edit-abbrevs-mode-map "24.4")
77 79
78(defun kill-all-abbrevs () 80(defun kill-all-abbrevs ()
79 "Undefine all defined abbrevs." 81 "Undefine all defined abbrevs."
@@ -144,16 +146,6 @@ Otherwise display all abbrevs."
144 (set-buffer-modified-p nil) 146 (set-buffer-modified-p nil)
145 (current-buffer)))) 147 (current-buffer))))
146 148
147(defun edit-abbrevs-mode ()
148 "Major mode for editing the list of abbrev definitions.
149\\{edit-abbrevs-map}"
150 (interactive)
151 (kill-all-local-variables)
152 (setq major-mode 'edit-abbrevs-mode)
153 (setq mode-name "Edit-Abbrevs")
154 (use-local-map edit-abbrevs-map)
155 (run-mode-hooks 'edit-abbrevs-mode-hook))
156
157(defun edit-abbrevs () 149(defun edit-abbrevs ()
158 "Alter abbrev definitions by editing a list of them. 150 "Alter abbrev definitions by editing a list of them.
159Selects a buffer containing a list of abbrev definitions with 151Selects a buffer containing a list of abbrev definitions with
@@ -1013,6 +1005,11 @@ SORTFUN is passed to `sort' to change the default ordering."
1013 (sort entries (lambda (x y) 1005 (sort entries (lambda (x y)
1014 (funcall sortfun (nth 2 x) (nth 2 y))))))) 1006 (funcall sortfun (nth 2 x) (nth 2 y)))))))
1015 1007
1008;; Keep it after define-abbrev-table, since define-derived-mode uses
1009;; define-abbrev-table.
1010(define-derived-mode edit-abbrevs-mode special-mode "Edit-Abbrevs"
1011 "Major mode for editing the list of abbrev definitions.")
1012
1016(provide 'abbrev) 1013(provide 'abbrev)
1017 1014
1018;;; abbrev.el ends here 1015;;; abbrev.el ends here
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 5f001ad977b..a4f7015c844 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -218,9 +218,14 @@ Archive and member name will be added."
218;; ------------------------------ 218;; ------------------------------
219;; Zip archive configuration 219;; Zip archive configuration
220 220
221(defvar archive-7z-program (let ((7z (or (executable-find "7z")
222 (executable-find "7za"))))
223 (when 7z
224 (file-name-nondirectory 7z))))
225
221(defcustom archive-zip-extract 226(defcustom archive-zip-extract
222 (cond ((executable-find "unzip") '("unzip" "-qq" "-c")) 227 (cond ((executable-find "unzip") '("unzip" "-qq" "-c"))
223 ((executable-find "7z") '("7z" "x" "-so")) 228 (archive-7z-program `(,archive-7z-program "x" "-so"))
224 ((executable-find "pkunzip") '("pkunzip" "-e" "-o-")) 229 ((executable-find "pkunzip") '("pkunzip" "-e" "-o-"))
225 (t '("unzip" "-qq" "-c"))) 230 (t '("unzip" "-qq" "-c")))
226 "Program and its options to run in order to extract a zip file member. 231 "Program and its options to run in order to extract a zip file member.
@@ -239,7 +244,7 @@ be added."
239 244
240(defcustom archive-zip-expunge 245(defcustom archive-zip-expunge
241 (cond ((executable-find "zip") '("zip" "-d" "-q")) 246 (cond ((executable-find "zip") '("zip" "-d" "-q"))
242 ((executable-find "7z") '("7z" "d")) 247 (archive-7z-program `(,archive-7z-program "d"))
243 ((executable-find "pkzip") '("pkzip" "-d")) 248 ((executable-find "pkzip") '("pkzip" "-d"))
244 (t '("zip" "-d" "-q"))) 249 (t '("zip" "-d" "-q")))
245 "Program and its options to run in order to delete zip file members. 250 "Program and its options to run in order to delete zip file members.
@@ -252,7 +257,7 @@ Archive and member names will be added."
252 257
253(defcustom archive-zip-update 258(defcustom archive-zip-update
254 (cond ((executable-find "zip") '("zip" "-q")) 259 (cond ((executable-find "zip") '("zip" "-q"))
255 ((executable-find "7z") '("7z" "u")) 260 (archive-7z-program `(,archive-7z-program "u"))
256 ((executable-find "pkzip") '("pkzip" "-u" "-P")) 261 ((executable-find "pkzip") '("pkzip" "-u" "-P"))
257 (t '("zip" "-q"))) 262 (t '("zip" "-q")))
258 "Program and its options to run in order to update a zip file member. 263 "Program and its options to run in order to update a zip file member.
@@ -266,7 +271,7 @@ file. Archive and member name will be added."
266 271
267(defcustom archive-zip-update-case 272(defcustom archive-zip-update-case
268 (cond ((executable-find "zip") '("zip" "-q" "-k")) 273 (cond ((executable-find "zip") '("zip" "-q" "-k"))
269 ((executable-find "7z") '("7z" "u")) 274 (archive-7z-program `(,archive-7z-program "u"))
270 ((executable-find "pkzip") '("pkzip" "-u" "-P")) 275 ((executable-find "pkzip") '("pkzip" "-u" "-P"))
271 (t '("zip" "-q" "-k"))) 276 (t '("zip" "-q" "-k")))
272 "Program and its options to run in order to update a case fiddled zip member. 277 "Program and its options to run in order to update a case fiddled zip member.
@@ -321,7 +326,7 @@ Archive and member name will be added."
321;; 7z archive configuration 326;; 7z archive configuration
322 327
323(defcustom archive-7z-extract 328(defcustom archive-7z-extract
324 '("7z" "x" "-so") 329 `(,archive-7z-program "x" "-so")
325 "Program and its options to run in order to extract a 7z file member. 330 "Program and its options to run in order to extract a 7z file member.
326Extraction should happen to standard output. Archive and member name will 331Extraction should happen to standard output. Archive and member name will
327be added." 332be added."
@@ -333,7 +338,7 @@ be added."
333 :group 'archive-7z) 338 :group 'archive-7z)
334 339
335(defcustom archive-7z-expunge 340(defcustom archive-7z-expunge
336 '("7z" "d") 341 `(,archive-7z-program "d")
337 "Program and its options to run in order to delete 7z file members. 342 "Program and its options to run in order to delete 7z file members.
338Archive and member names will be added." 343Archive and member names will be added."
339 :version "24.1" 344 :version "24.1"
@@ -344,7 +349,7 @@ Archive and member names will be added."
344 :group 'archive-7z) 349 :group 'archive-7z)
345 350
346(defcustom archive-7z-update 351(defcustom archive-7z-update
347 '("7z" "u") 352 `(,archive-7z-program "u")
348 "Program and its options to run in order to update a 7z file member. 353 "Program and its options to run in order to update a 7z file member.
349Options should ensure that specified directory will be put into the 7z 354Options should ensure that specified directory will be put into the 7z
350file. Archive and member name will be added." 355file. Archive and member name will be added."
@@ -1864,7 +1869,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
1864 (cond 1869 (cond
1865 ((member-ignore-case (car archive-zip-extract) '("pkunzip" "pkzip")) 1870 ((member-ignore-case (car archive-zip-extract) '("pkunzip" "pkzip"))
1866 (archive-*-extract archive name archive-zip-extract)) 1871 (archive-*-extract archive name archive-zip-extract))
1867 ((equal (car archive-zip-extract) "7z") 1872 ((equal (car archive-zip-extract) archive-7z-program)
1868 (let ((archive-7z-extract archive-zip-extract)) 1873 (let ((archive-7z-extract archive-zip-extract))
1869 (archive-7z-extract archive name))) 1874 (archive-7z-extract archive name)))
1870 (t 1875 (t
@@ -2088,7 +2093,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
2088 (file buffer-file-name) 2093 (file buffer-file-name)
2089 (files ())) 2094 (files ()))
2090 (with-temp-buffer 2095 (with-temp-buffer
2091 (call-process "7z" nil t nil "l" "-slt" file) 2096 (call-process archive-7z-program nil t nil "l" "-slt" file)
2092 (goto-char (point-min)) 2097 (goto-char (point-min))
2093 ;; Four dashes start the meta info section that should be skipped. 2098 ;; Four dashes start the meta info section that should be skipped.
2094 ;; Archive members start with more than four dashes. 2099 ;; Archive members start with more than four dashes.
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 3527a3fc756..c6ecbf1e718 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -1,4 +1,4 @@
1;;; dired-x.el --- extra Dired functionality 1;;; dired-x.el --- extra Dired functionality -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1993-1994, 1997, 2001-2013 Free Software Foundation, 3;; Copyright (C) 1993-1994, 1997, 2001-2013 Free Software Foundation,
4;; Inc. 4;; Inc.
@@ -1185,7 +1185,7 @@ results in
1185 (setq count (1+ count) 1185 (setq count (1+ count)
1186 start (1+ start))) 1186 start (1+ start)))
1187 ;; ... and prepend a "../" for each slash found: 1187 ;; ... and prepend a "../" for each slash found:
1188 (dotimes (n count) 1188 (dotimes (_ count)
1189 (setq name1 (concat "../" name1))))) 1189 (setq name1 (concat "../" name1)))))
1190 (make-symbolic-link 1190 (make-symbolic-link
1191 (directory-file-name name1) ; must not link to foo/ 1191 (directory-file-name name1) ; must not link to foo/
@@ -1397,22 +1397,6 @@ Considers buffers closer to the car of `buffer-list' to be more recent."
1397;; Does anyone use this? - lrd 6/29/93. 1397;; Does anyone use this? - lrd 6/29/93.
1398;; Apparently people do use it. - lrd 12/22/97. 1398;; Apparently people do use it. - lrd 12/22/97.
1399 1399
1400(with-no-warnings
1401 ;; Warnings are suppressed to avoid "global/dynamic var `X' lacks a prefix".
1402 ;; This is unbearably ugly, but not more than having global variables
1403 ;; named size, time, name or s, however practical it can be while writing
1404 ;; `dired-mark-sexp' predicates.
1405 (defvar inode)
1406 (defvar s)
1407 (defvar mode)
1408 (defvar nlink)
1409 (defvar uid)
1410 (defvar gid)
1411 (defvar size)
1412 (defvar time)
1413 (defvar name)
1414 (defvar sym))
1415
1416(defun dired-mark-sexp (predicate &optional unflag-p) 1400(defun dired-mark-sexp (predicate &optional unflag-p)
1417 "Mark files for which PREDICATE returns non-nil. 1401 "Mark files for which PREDICATE returns non-nil.
1418With a prefix arg, unmark or unflag those files instead. 1402With a prefix arg, unmark or unflag those files instead.
@@ -1505,7 +1489,17 @@ to mark all zero length files."
1505 (line-end-position)) 1489 (line-end-position))
1506 "")) 1490 ""))
1507 t) 1491 t)
1508 (eval predicate))) 1492 (eval predicate
1493 `((inode . ,inode)
1494 (s . ,s)
1495 (mode . ,mode)
1496 (nlink . ,nlink)
1497 (uid . ,uid)
1498 (gid . ,gid)
1499 (size . ,size)
1500 (time . ,time)
1501 (name . ,name)
1502 (sym . ,sym)))))
1509 (format "'%s file" predicate)))) 1503 (format "'%s file" predicate))))
1510 1504
1511 1505
diff --git a/lisp/dired.el b/lisp/dired.el
index b9f974234fb..f873aea9bf0 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -4352,7 +4352,7 @@ instead.
4352 4352
4353;;;*** 4353;;;***
4354 4354
4355;;;### (autoloads nil "dired-x" "dired-x.el" "130484d4c94bb9929c210774f9e475f5") 4355;;;### (autoloads nil "dired-x" "dired-x.el" "1bf4009b81e55bf51947bc87b2c82994")
4356;;; Generated autoloads from dired-x.el 4356;;; Generated autoloads from dired-x.el
4357 4357
4358(autoload 'dired-jump "dired-x" "\ 4358(autoload 'dired-jump "dired-x" "\
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index b8e327625e7..750e0709591 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -157,33 +157,32 @@ Functions'."
157 predicate 157 predicate
158 flag))) 158 flag)))
159 159
160(defun crm--select-current-element () 160(defun crm--current-element ()
161 "Parse the minibuffer to find the current element. 161 "Parse the minibuffer to find the current element.
162Place an overlay on the element, with a `field' property, and return it." 162Return the element's boundaries as (START . END)."
163 (let* ((bob (minibuffer-prompt-end)) 163 (let ((bob (minibuffer-prompt-end)))
164 (start (save-excursion 164 (cons (save-excursion
165 (if (re-search-backward crm-separator bob t) 165 (if (re-search-backward crm-separator bob t)
166 (match-end 0) 166 (match-end 0)
167 bob))) 167 bob))
168 (end (save-excursion 168 (save-excursion
169 (if (re-search-forward crm-separator nil t) 169 (if (re-search-forward crm-separator nil t)
170 (match-beginning 0) 170 (match-beginning 0)
171 (point-max)))) 171 (point-max))))))
172 (ol (make-overlay start end nil nil t))) 172
173 (overlay-put ol 'field (make-symbol "crm")) 173(defmacro crm--completion-command (beg end &rest body)
174 ol)) 174 "Run BODY with BEG and END bound to the current element's boundaries."
175 175 (declare (indent 2) (debug (sexp sexp &rest body)))
176(defmacro crm--completion-command (command) 176 `(let* ((crm--boundaries (crm--current-element))
177 "Make COMMAND a completion command for `completing-read-multiple'." 177 (,beg (car crm--boundaries))
178 `(let ((ol (crm--select-current-element))) 178 (,end (cdr crm--boundaries)))
179 (unwind-protect 179 ,@body))
180 ,command
181 (delete-overlay ol))))
182 180
183(defun crm-completion-help () 181(defun crm-completion-help ()
184 "Display a list of possible completions of the current minibuffer element." 182 "Display a list of possible completions of the current minibuffer element."
185 (interactive) 183 (interactive)
186 (crm--completion-command (minibuffer-completion-help)) 184 (crm--completion-command beg end
185 (minibuffer-completion-help beg end))
187 nil) 186 nil)
188 187
189(defun crm-complete () 188(defun crm-complete ()
@@ -192,13 +191,18 @@ If no characters can be completed, display a list of possible completions.
192 191
193Return t if the current element is now a valid match; otherwise return nil." 192Return t if the current element is now a valid match; otherwise return nil."
194 (interactive) 193 (interactive)
195 (crm--completion-command (minibuffer-complete))) 194 (crm--completion-command beg end
195 (completion-in-region beg end
196 minibuffer-completion-table
197 minibuffer-completion-predicate)))
196 198
197(defun crm-complete-word () 199(defun crm-complete-word ()
198 "Complete the current element at most a single word. 200 "Complete the current element at most a single word.
199Like `minibuffer-complete-word' but for `completing-read-multiple'." 201Like `minibuffer-complete-word' but for `completing-read-multiple'."
200 (interactive) 202 (interactive)
201 (crm--completion-command (minibuffer-complete-word))) 203 (crm--completion-command beg end
204 (completion-in-region--single-word
205 beg end minibuffer-completion-table minibuffer-completion-predicate)))
202 206
203(defun crm-complete-and-exit () 207(defun crm-complete-and-exit ()
204 "If all of the minibuffer elements are valid completions then exit. 208 "If all of the minibuffer elements are valid completions then exit.
@@ -211,16 +215,14 @@ This function is modeled after `minibuffer-complete-and-exit'."
211 (goto-char (minibuffer-prompt-end)) 215 (goto-char (minibuffer-prompt-end))
212 (while 216 (while
213 (and doexit 217 (and doexit
214 (let ((ol (crm--select-current-element))) 218 (crm--completion-command beg end
215 (goto-char (overlay-end ol)) 219 (let ((end (copy-marker end t)))
216 (unwind-protect 220 (goto-char end)
217 (catch 'exit 221 (setq doexit nil)
218 (minibuffer-complete-and-exit) 222 (completion-complete-and-exit beg end
219 ;; This did not throw `exit', so there was a problem. 223 (lambda () (setq doexit t)))
220 (setq doexit nil)) 224 (goto-char end)
221 (goto-char (overlay-end ol)) 225 (not (eobp))))
222 (delete-overlay ol))
223 (not (eobp)))
224 (looking-at crm-separator)) 226 (looking-at crm-separator))
225 ;; Skip to the next element. 227 ;; Skip to the next element.
226 (goto-char (match-end 0))) 228 (goto-char (match-end 0)))
diff --git a/lisp/epa.el b/lisp/epa.el
index a99fb9230e1..1b06e6ca3bf 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -268,62 +268,40 @@ You should bind this variable with `let', but do not set it globally.")
268 (epg-sub-key-id (car (epg-key-sub-key-list 268 (epg-sub-key-id (car (epg-key-sub-key-list
269 (widget-get widget :value)))))) 269 (widget-get widget :value))))))
270 270
271(eval-and-compile 271(defalias 'epa--encode-coding-string
272 (if (fboundp 'encode-coding-string) 272 (if (fboundp 'encode-coding-string) #'encode-coding-string #'identity))
273 (defalias 'epa--encode-coding-string 'encode-coding-string)
274 (defalias 'epa--encode-coding-string 'identity)))
275 273
276(eval-and-compile 274(defalias 'epa--decode-coding-string
277 (if (fboundp 'decode-coding-string) 275 (if (fboundp 'decode-coding-string) #'decode-coding-string #'identity))
278 (defalias 'epa--decode-coding-string 'decode-coding-string)
279 (defalias 'epa--decode-coding-string 'identity)))
280 276
281(defun epa-key-list-mode () 277(define-derived-mode epa-key-list-mode special-mode "Keys"
282 "Major mode for `epa-list-keys'." 278 "Major mode for `epa-list-keys'."
283 (kill-all-local-variables)
284 (buffer-disable-undo) 279 (buffer-disable-undo)
285 (setq major-mode 'epa-key-list-mode 280 (setq truncate-lines t
286 mode-name "Keys"
287 truncate-lines t
288 buffer-read-only t) 281 buffer-read-only t)
289 (use-local-map epa-key-list-mode-map) 282 (setq-local font-lock-defaults '(epa-font-lock-keywords t))
290 (make-local-variable 'font-lock-defaults)
291 (setq font-lock-defaults '(epa-font-lock-keywords t))
292 ;; In XEmacs, auto-initialization of font-lock is not effective 283 ;; In XEmacs, auto-initialization of font-lock is not effective
293 ;; if buffer-file-name is not set. 284 ;; if buffer-file-name is not set.
294 (font-lock-set-defaults) 285 (font-lock-set-defaults)
295 (make-local-variable 'epa-exit-buffer-function) 286 (make-local-variable 'epa-exit-buffer-function)
296 (make-local-variable 'revert-buffer-function) 287 (setq-local revert-buffer-function #'epa--key-list-revert-buffer))
297 (setq revert-buffer-function 'epa--key-list-revert-buffer)
298 (run-mode-hooks 'epa-key-list-mode-hook))
299 288
300(defun epa-key-mode () 289(define-derived-mode epa-key-mode special-mode "Key"
301 "Major mode for a key description." 290 "Major mode for a key description."
302 (kill-all-local-variables)
303 (buffer-disable-undo) 291 (buffer-disable-undo)
304 (setq major-mode 'epa-key-mode 292 (setq truncate-lines t
305 mode-name "Key"
306 truncate-lines t
307 buffer-read-only t) 293 buffer-read-only t)
308 (use-local-map epa-key-mode-map) 294 (setq-local font-lock-defaults '(epa-font-lock-keywords t))
309 (make-local-variable 'font-lock-defaults)
310 (setq font-lock-defaults '(epa-font-lock-keywords t))
311 ;; In XEmacs, auto-initialization of font-lock is not effective 295 ;; In XEmacs, auto-initialization of font-lock is not effective
312 ;; if buffer-file-name is not set. 296 ;; if buffer-file-name is not set.
313 (font-lock-set-defaults) 297 (font-lock-set-defaults)
314 (make-local-variable 'epa-exit-buffer-function) 298 (make-local-variable 'epa-exit-buffer-function))
315 (run-mode-hooks 'epa-key-mode-hook))
316 299
317(defun epa-info-mode () 300(define-derived-mode epa-info-mode special-mode "Info"
318 "Major mode for `epa-info-buffer'." 301 "Major mode for `epa-info-buffer'."
319 (kill-all-local-variables)
320 (buffer-disable-undo) 302 (buffer-disable-undo)
321 (setq major-mode 'epa-info-mode 303 (setq truncate-lines t
322 mode-name "Info" 304 buffer-read-only t))
323 truncate-lines t
324 buffer-read-only t)
325 (use-local-map epa-info-mode-map)
326 (run-mode-hooks 'epa-info-mode-hook))
327 305
328(defun epa-mark-key (&optional arg) 306(defun epa-mark-key (&optional arg)
329 "Mark a key on the current line. 307 "Mark a key on the current line.
@@ -951,10 +929,10 @@ See the reason described in the `epa-verify-region' documentation."
951 (error "No cleartext tail")) 929 (error "No cleartext tail"))
952 (epa-verify-region cleartext-start cleartext-end)))))) 930 (epa-verify-region cleartext-start cleartext-end))))))
953 931
954(eval-and-compile 932(defalias 'epa--select-safe-coding-system
955 (if (fboundp 'select-safe-coding-system) 933 (if (fboundp 'select-safe-coding-system)
956 (defalias 'epa--select-safe-coding-system 'select-safe-coding-system) 934 #'select-safe-coding-system
957 (defun epa--select-safe-coding-system (_from _to) 935 (lambda (_from _to)
958 buffer-file-coding-system))) 936 buffer-file-coding-system)))
959 937
960;;;###autoload 938;;;###autoload
@@ -1026,16 +1004,16 @@ If no one is selected, default secret key is used. "
1026 'start-open t 1004 'start-open t
1027 'end-open t))))) 1005 'end-open t)))))
1028 1006
1029(eval-and-compile 1007(defalias 'epa--derived-mode-p
1030 (if (fboundp 'derived-mode-p) 1008 (if (fboundp 'derived-mode-p)
1031 (defalias 'epa--derived-mode-p 'derived-mode-p) 1009 #'derived-mode-p
1032 (defun epa--derived-mode-p (&rest modes) 1010 (lambda (&rest modes)
1033 "Non-nil if the current major mode is derived from one of MODES. 1011 "Non-nil if the current major mode is derived from one of MODES.
1034Uses the `derived-mode-parent' property of the symbol to trace backwards." 1012Uses the `derived-mode-parent' property of the symbol to trace backwards."
1035 (let ((parent major-mode)) 1013 (let ((parent major-mode))
1036 (while (and (not (memq parent modes)) 1014 (while (and (not (memq parent modes))
1037 (setq parent (get parent 'derived-mode-parent)))) 1015 (setq parent (get parent 'derived-mode-parent))))
1038 parent)))) 1016 parent))))
1039 1017
1040;;;###autoload 1018;;;###autoload
1041(defun epa-encrypt-region (start end recipients sign signers) 1019(defun epa-encrypt-region (start end recipients sign signers)
@@ -1138,6 +1116,7 @@ If no one is selected, symmetric encryption will be performed. ")
1138 (if (epg-context-result-for context 'import) 1116 (if (epg-context-result-for context 'import)
1139 (epa-display-info (epg-import-result-to-string 1117 (epa-display-info (epg-import-result-to-string
1140 (epg-context-result-for context 'import)))) 1118 (epg-context-result-for context 'import))))
1119 ;; FIXME: Why not use the (otherwise unused) epa--derived-mode-p?
1141 (if (eq major-mode 'epa-key-list-mode) 1120 (if (eq major-mode 'epa-key-list-mode)
1142 (apply #'epa--list-keys epa-list-keys-arguments)))) 1121 (apply #'epa--list-keys epa-list-keys-arguments))))
1143 1122
diff --git a/lisp/epg.el b/lisp/epg.el
index bcd91d8abba..c733a273988 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -2415,9 +2415,8 @@ If you are unsure, use synchronous version of this function
2415 (list "--" (epg-data-file plain))))) 2415 (list "--" (epg-data-file plain)))))
2416 ;; `gpgsm' does not read passphrase from stdin, so waiting is not needed. 2416 ;; `gpgsm' does not read passphrase from stdin, so waiting is not needed.
2417 (unless (eq (epg-context-protocol context) 'CMS) 2417 (unless (eq (epg-context-protocol context) 'CMS)
2418 (if sign 2418 (epg-wait-for-status context
2419 (epg-wait-for-status context '("BEGIN_SIGNING")) 2419 (if sign '("BEGIN_SIGNING") '("BEGIN_ENCRYPTION"))))
2420 (epg-wait-for-status context '("BEGIN_ENCRYPTION"))))
2421 (when (epg-data-string plain) 2420 (when (epg-data-string plain)
2422 (if (eq (process-status (epg-context-process context)) 'run) 2421 (if (eq (process-status (epg-context-process context)) 'run)
2423 (process-send-string (epg-context-process context) 2422 (process-send-string (epg-context-process context)
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 104e3363831..9aec829cd97 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -158,11 +158,13 @@ minibuffer completion.")
158(add-hook 'icomplete-post-command-hook 'icomplete-exhibit) 158(add-hook 'icomplete-post-command-hook 'icomplete-exhibit)
159 159
160;;;_ = icomplete-with-completion-tables 160;;;_ = icomplete-with-completion-tables
161(defvar icomplete-with-completion-tables '(internal-complete-buffer) 161(defcustom icomplete-with-completion-tables t
162 "Specialized completion tables with which icomplete should operate. 162 "Specialized completion tables with which icomplete should operate.
163 163
164Icomplete does not operate with any specialized completion tables 164Icomplete does not operate with any specialized completion tables
165except those on this list.") 165except those on this list."
166 :type '(choice (const :tag "All" t)
167 (repeat function)))
166 168
167(defvar icomplete-minibuffer-map 169(defvar icomplete-minibuffer-map
168 (let ((map (make-sparse-keymap))) 170 (let ((map (make-sparse-keymap)))
@@ -177,24 +179,28 @@ except those on this list.")
177Second entry becomes the first and can be selected with 179Second entry becomes the first and can be selected with
178`minibuffer-force-complete-and-exit'." 180`minibuffer-force-complete-and-exit'."
179 (interactive) 181 (interactive)
180 (let* ((comps (completion-all-sorted-completions)) 182 (let* ((beg (minibuffer-prompt-end))
183 (end (point-max))
184 (comps (completion-all-sorted-completions beg end))
181 (last (last comps))) 185 (last (last comps)))
182 (when comps 186 (when comps
183 (setcdr last (cons (car comps) (cdr last))) 187 (setcdr last (cons (car comps) (cdr last)))
184 (completion--cache-all-sorted-completions (cdr comps))))) 188 (completion--cache-all-sorted-completions beg end (cdr comps)))))
185 189
186(defun icomplete-backward-completions () 190(defun icomplete-backward-completions ()
187 "Step backward completions by one entry. 191 "Step backward completions by one entry.
188Last entry becomes the first and can be selected with 192Last entry becomes the first and can be selected with
189`minibuffer-force-complete-and-exit'." 193`minibuffer-force-complete-and-exit'."
190 (interactive) 194 (interactive)
191 (let* ((comps (completion-all-sorted-completions)) 195 (let* ((beg (minibuffer-prompt-end))
196 (end (point-max))
197 (comps (completion-all-sorted-completions beg end))
192 (last-but-one (last comps 2)) 198 (last-but-one (last comps 2))
193 (last (cdr last-but-one))) 199 (last (cdr last-but-one)))
194 (when (consp last) ; At least two elements in comps 200 (when (consp last) ; At least two elements in comps
195 (setcdr last-but-one (cdr last)) 201 (setcdr last-but-one (cdr last))
196 (push (car last) comps) 202 (push (car last) comps)
197 (completion--cache-all-sorted-completions comps)))) 203 (completion--cache-all-sorted-completions beg end comps))))
198 204
199;;;_ > icomplete-mode (&optional prefix) 205;;;_ > icomplete-mode (&optional prefix)
200;;;###autoload 206;;;###autoload
@@ -263,7 +269,8 @@ and `minibuffer-setup-hook'."
263 "Insert icomplete completions display. 269 "Insert icomplete completions display.
264Should be run via minibuffer `post-command-hook'. See `icomplete-mode' 270Should be run via minibuffer `post-command-hook'. See `icomplete-mode'
265and `minibuffer-setup-hook'." 271and `minibuffer-setup-hook'."
266 (when (and icomplete-mode (icomplete-simple-completing-p)) 272 (when (and icomplete-mode
273 (icomplete-simple-completing-p)) ;Shouldn't be necessary.
267 (save-excursion 274 (save-excursion
268 (goto-char (point-max)) 275 (goto-char (point-max))
269 ; Insert the match-status information: 276 ; Insert the match-status information:
@@ -319,7 +326,8 @@ matches exist. \(Keybindings for uniquely matched commands
319are exhibited within the square braces.)" 326are exhibited within the square braces.)"
320 327
321 (let* ((md (completion--field-metadata (field-beginning))) 328 (let* ((md (completion--field-metadata (field-beginning)))
322 (comps (completion-all-sorted-completions)) 329 (comps (completion-all-sorted-completions
330 (minibuffer-prompt-end) (point-max)))
323 (last (if (consp comps) (last comps))) 331 (last (if (consp comps) (last comps)))
324 (base-size (cdr last)) 332 (base-size (cdr last))
325 (open-bracket (if require-match "(" "[")) 333 (open-bracket (if require-match "(" "["))
diff --git a/lisp/info.el b/lisp/info.el
index 182ad8563aa..65cd7eddcfd 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1595,17 +1595,20 @@ escaped (\\\",\\\\)."
1595 "")) 1595 ""))
1596 (image (if (file-exists-p image-file) 1596 (image (if (file-exists-p image-file)
1597 (create-image image-file) 1597 (create-image image-file)
1598 "[broken image]"))) 1598 (or (cdr (assoc-string "text" parameter-alist))
1599 (and src (concat "[broken image:" src "]"))
1600 "[broken image]"))))
1599 (if (not (get-text-property start 'display)) 1601 (if (not (get-text-property start 'display))
1600 (add-text-properties 1602 (add-text-properties
1601 start (point) `(display ,image rear-nonsticky (display))))) 1603 start (point)
1604 `(display ,image rear-nonsticky (display)
1605 help-echo ,(cdr (assoc-string "alt" parameter-alist))))))
1602 ;; text-only display, show alternative text if provided, or 1606 ;; text-only display, show alternative text if provided, or
1603 ;; otherwise a clue that there's meant to be a picture 1607 ;; otherwise a clue that there's meant to be a picture
1604 (delete-region start (point)) 1608 (delete-region start (point))
1605 (insert (or (cdr (assoc-string "text" parameter-alist)) 1609 (insert (or (cdr (assoc-string "text" parameter-alist))
1606 (cdr (assoc-string "alt" parameter-alist)) 1610 (cdr (assoc-string "alt" parameter-alist))
1607 (and src 1611 (and src (concat "[image:" src "]"))
1608 (concat "[image:" src "]"))
1609 "[image]")))))) 1612 "[image]"))))))
1610 (set-buffer-modified-p nil))) 1613 (set-buffer-modified-p nil)))
1611 1614
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index e07d28a54d0..c505a74c23d 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -38,7 +38,7 @@
38 38
39;;; Bugs: 39;;; Bugs:
40 40
41;; - completion-all-sorted-completions list all the completions, whereas 41;; - completion-all-sorted-completions lists all the completions, whereas
42;; it should only lists the ones that `try-completion' would consider. 42;; it should only lists the ones that `try-completion' would consider.
43;; E.g. it should honor completion-ignored-extensions. 43;; E.g. it should honor completion-ignored-extensions.
44;; - choose-completion can't automatically figure out the boundaries 44;; - choose-completion can't automatically figure out the boundaries
@@ -145,7 +145,7 @@ Like CL's `some'."
145 (let ((firsterror nil) 145 (let ((firsterror nil)
146 res) 146 res)
147 (while (and (not res) xs) 147 (while (and (not res) xs)
148 (condition-case err 148 (condition-case-unless-debug err
149 (setq res (funcall fun (pop xs))) 149 (setq res (funcall fun (pop xs)))
150 (error (unless firsterror (setq firsterror err)) nil))) 150 (error (unless firsterror (setq firsterror err)) nil)))
151 (or res 151 (or res
@@ -623,7 +623,8 @@ If ARGS are provided, then pass MESSAGE through `format'."
623 (message nil))) 623 (message nil)))
624 ;; Clear out any old echo-area message to make way for our new thing. 624 ;; Clear out any old echo-area message to make way for our new thing.
625 (message nil) 625 (message nil)
626 (setq message (if (and (null args) (string-match-p "\\` *\\[.+\\]\\'" message)) 626 (setq message (if (and (null args)
627 (string-match-p "\\` *\\[.+\\]\\'" message))
627 ;; Make sure we can put-text-property. 628 ;; Make sure we can put-text-property.
628 (copy-sequence message) 629 (copy-sequence message)
629 (concat " [" message "]"))) 630 (concat " [" message "]")))
@@ -651,7 +652,7 @@ If ARGS are provided, then pass MESSAGE through `format'."
651 "Return the user input in a minibuffer before point as a string. 652 "Return the user input in a minibuffer before point as a string.
652In Emacs-22, that was what completion commands operated on." 653In Emacs-22, that was what completion commands operated on."
653 (declare (obsolete nil "24.4")) 654 (declare (obsolete nil "24.4"))
654 (buffer-substring (field-beginning) (point))) 655 (buffer-substring (minibuffer-prompt-end) (point)))
655 656
656(defun delete-minibuffer-contents () 657(defun delete-minibuffer-contents ()
657 "Delete all user input in a minibuffer. 658 "Delete all user input in a minibuffer.
@@ -670,8 +671,7 @@ If the value is t the *Completion* buffer is displayed whenever completion
670is requested but cannot be done. 671is requested but cannot be done.
671If the value is `lazy', the *Completions* buffer is only displayed after 672If the value is `lazy', the *Completions* buffer is only displayed after
672the second failed attempt to complete." 673the second failed attempt to complete."
673 :type '(choice (const nil) (const t) (const lazy)) 674 :type '(choice (const nil) (const t) (const lazy)))
674 :group 'minibuffer)
675 675
676(defconst completion-styles-alist 676(defconst completion-styles-alist
677 '((emacs21 677 '((emacs21
@@ -750,7 +750,6 @@ The available styles are listed in `completion-styles-alist'.
750Note that `completion-category-overrides' may override these 750Note that `completion-category-overrides' may override these
751styles for specific categories, such as files, buffers, etc." 751styles for specific categories, such as files, buffers, etc."
752 :type completion--styles-type 752 :type completion--styles-type
753 :group 'minibuffer
754 :version "23.1") 753 :version "23.1")
755 754
756(defcustom completion-category-overrides 755(defcustom completion-category-overrides
@@ -880,7 +879,7 @@ Moves point to the end of the new text."
880 879
881(defcustom completion-cycle-threshold nil 880(defcustom completion-cycle-threshold nil
882 "Number of completion candidates below which cycling is used. 881 "Number of completion candidates below which cycling is used.
883Depending on this setting `minibuffer-complete' may use cycling, 882Depending on this setting `completion-in-region' may use cycling,
884like `minibuffer-force-complete'. 883like `minibuffer-force-complete'.
885If nil, cycling is never used. 884If nil, cycling is never used.
886If t, cycling is always used. 885If t, cycling is always used.
@@ -894,8 +893,7 @@ completion candidates than this number."
894 (over (assq 'cycle (cdr (assq cat completion-category-overrides))))) 893 (over (assq 'cycle (cdr (assq cat completion-category-overrides)))))
895 (if over (cdr over) completion-cycle-threshold))) 894 (if over (cdr over) completion-cycle-threshold)))
896 895
897(defvar completion-all-sorted-completions nil) 896(defvar-local completion-all-sorted-completions nil)
898(make-variable-buffer-local 'completion-all-sorted-completions)
899(defvar-local completion--all-sorted-completions-location nil) 897(defvar-local completion--all-sorted-completions-location nil)
900(defvar completion-cycling nil) 898(defvar completion-cycling nil)
901 899
@@ -906,8 +904,8 @@ completion candidates than this number."
906 (if completion-show-inline-help 904 (if completion-show-inline-help
907 (minibuffer-message msg))) 905 (minibuffer-message msg)))
908 906
909(defun completion--do-completion (&optional try-completion-function 907(defun completion--do-completion (beg end &optional
910 expect-exact) 908 try-completion-function expect-exact)
911 "Do the completion and return a summary of what happened. 909 "Do the completion and return a summary of what happened.
912M = completion was performed, the text was Modified. 910M = completion was performed, the text was Modified.
913C = there were available Completions. 911C = there were available Completions.
@@ -926,9 +924,7 @@ E = after completion we now have an Exact match.
926TRY-COMPLETION-FUNCTION is a function to use in place of `try-completion'. 924TRY-COMPLETION-FUNCTION is a function to use in place of `try-completion'.
927EXPECT-EXACT, if non-nil, means that there is no need to tell the user 925EXPECT-EXACT, if non-nil, means that there is no need to tell the user
928when the buffer's text is already an exact match." 926when the buffer's text is already an exact match."
929 (let* ((beg (field-beginning)) 927 (let* ((string (buffer-substring beg end))
930 (end (field-end))
931 (string (buffer-substring beg end))
932 (md (completion--field-metadata beg)) 928 (md (completion--field-metadata beg))
933 (comp (funcall (or try-completion-function 929 (comp (funcall (or try-completion-function
934 'completion-try-completion) 930 'completion-try-completion)
@@ -963,7 +959,8 @@ when the buffer's text is already an exact match."
963 (if unchanged 959 (if unchanged
964 (goto-char end) 960 (goto-char end)
965 ;; Insert in minibuffer the chars we got. 961 ;; Insert in minibuffer the chars we got.
966 (completion--replace beg end completion)) 962 (completion--replace beg end completion)
963 (setq end (+ beg (length completion))))
967 ;; Move point to its completion-mandated destination. 964 ;; Move point to its completion-mandated destination.
968 (forward-char (- comp-pos (length completion))) 965 (forward-char (- comp-pos (length completion)))
969 966
@@ -972,7 +969,8 @@ when the buffer's text is already an exact match."
972 ;; whether this is a unique completion or not, so try again using 969 ;; whether this is a unique completion or not, so try again using
973 ;; the real case (this shouldn't recurse again, because the next 970 ;; the real case (this shouldn't recurse again, because the next
974 ;; time try-completion will return either t or the exact string). 971 ;; time try-completion will return either t or the exact string).
975 (completion--do-completion try-completion-function expect-exact) 972 (completion--do-completion beg end
973 try-completion-function expect-exact)
976 974
977 ;; It did find a match. Do we match some possibility exactly now? 975 ;; It did find a match. Do we match some possibility exactly now?
978 (let* ((exact (test-completion completion 976 (let* ((exact (test-completion completion
@@ -995,7 +993,7 @@ when the buffer's text is already an exact match."
995 minibuffer-completion-predicate 993 minibuffer-completion-predicate
996 "")) 994 ""))
997 comp-pos))) 995 comp-pos)))
998 (completion-all-sorted-completions)))) 996 (completion-all-sorted-completions beg end))))
999 (completion--flush-all-sorted-completions) 997 (completion--flush-all-sorted-completions)
1000 (cond 998 (cond
1001 ((and (consp (cdr comps)) ;; There's something to cycle. 999 ((and (consp (cdr comps)) ;; There's something to cycle.
@@ -1006,8 +1004,8 @@ when the buffer's text is already an exact match."
1006 ;; Not more than completion-cycle-threshold remaining 1004 ;; Not more than completion-cycle-threshold remaining
1007 ;; completions: let's cycle. 1005 ;; completions: let's cycle.
1008 (setq completed t exact t) 1006 (setq completed t exact t)
1009 (completion--cache-all-sorted-completions comps) 1007 (completion--cache-all-sorted-completions beg end comps)
1010 (minibuffer-force-complete)) 1008 (minibuffer-force-complete beg end))
1011 (completed 1009 (completed
1012 ;; We could also decide to refresh the completions, 1010 ;; We could also decide to refresh the completions,
1013 ;; if they're displayed (and assuming there are 1011 ;; if they're displayed (and assuming there are
@@ -1024,14 +1022,14 @@ when the buffer's text is already an exact match."
1024 (if (pcase completion-auto-help 1022 (if (pcase completion-auto-help
1025 (`lazy (eq this-command last-command)) 1023 (`lazy (eq this-command last-command))
1026 (_ completion-auto-help)) 1024 (_ completion-auto-help))
1027 (minibuffer-completion-help) 1025 (minibuffer-completion-help beg end)
1028 (completion--message "Next char not unique"))) 1026 (completion--message "Next char not unique")))
1029 ;; If the last exact completion and this one were the same, it 1027 ;; If the last exact completion and this one were the same, it
1030 ;; means we've already given a "Complete, but not unique" message 1028 ;; means we've already given a "Complete, but not unique" message
1031 ;; and the user's hit TAB again, so now we give him help. 1029 ;; and the user's hit TAB again, so now we give him help.
1032 (t 1030 (t
1033 (if (and (eq this-command last-command) completion-auto-help) 1031 (if (and (eq this-command last-command) completion-auto-help)
1034 (minibuffer-completion-help)) 1032 (minibuffer-completion-help beg end))
1035 (completion--done completion 'exact 1033 (completion--done completion 'exact
1036 (unless expect-exact 1034 (unless expect-exact
1037 "Complete, but not unique")))) 1035 "Complete, but not unique"))))
@@ -1045,6 +1043,11 @@ If no characters can be completed, display a list of possible completions.
1045If you repeat this command after it displayed such a list, 1043If you repeat this command after it displayed such a list,
1046scroll the window of possible completions." 1044scroll the window of possible completions."
1047 (interactive) 1045 (interactive)
1046 (completion-in-region (minibuffer-prompt-end) (point-max)
1047 minibuffer-completion-table
1048 minibuffer-completion-predicate))
1049
1050(defun completion--in-region-1 (beg end)
1048 ;; If the previous command was not this, 1051 ;; If the previous command was not this,
1049 ;; mark the completion buffer obsolete. 1052 ;; mark the completion buffer obsolete.
1050 (setq this-command 'completion-at-point) 1053 (setq this-command 'completion-at-point)
@@ -1067,17 +1070,17 @@ scroll the window of possible completions."
1067 nil))) 1070 nil)))
1068 ;; If we're cycling, keep on cycling. 1071 ;; If we're cycling, keep on cycling.
1069 ((and completion-cycling completion-all-sorted-completions) 1072 ((and completion-cycling completion-all-sorted-completions)
1070 (minibuffer-force-complete) 1073 (minibuffer-force-complete beg end)
1071 t) 1074 t)
1072 (t (pcase (completion--do-completion) 1075 (t (pcase (completion--do-completion beg end)
1073 (#b000 nil) 1076 (#b000 nil)
1074 (_ t))))) 1077 (_ t)))))
1075 1078
1076(defun completion--cache-all-sorted-completions (comps) 1079(defun completion--cache-all-sorted-completions (beg end comps)
1077 (add-hook 'after-change-functions 1080 (add-hook 'after-change-functions
1078 'completion--flush-all-sorted-completions nil t) 1081 'completion--flush-all-sorted-completions nil t)
1079 (setq completion--all-sorted-completions-location 1082 (setq completion--all-sorted-completions-location
1080 (cons (copy-marker (field-beginning)) (copy-marker (field-end)))) 1083 (cons (copy-marker beg) (copy-marker end)))
1081 (setq completion-all-sorted-completions comps)) 1084 (setq completion-all-sorted-completions comps))
1082 1085
1083(defun completion--flush-all-sorted-completions (&optional start end _len) 1086(defun completion--flush-all-sorted-completions (&optional start end _len)
@@ -1097,10 +1100,10 @@ scroll the window of possible completions."
1097 (if (eq (car bounds) base) md-at-point 1100 (if (eq (car bounds) base) md-at-point
1098 (completion-metadata (substring string 0 base) table pred)))) 1101 (completion-metadata (substring string 0 base) table pred))))
1099 1102
1100(defun completion-all-sorted-completions () 1103(defun completion-all-sorted-completions (start end)
1101 (or completion-all-sorted-completions 1104 (or completion-all-sorted-completions
1102 (let* ((start (field-beginning)) 1105 (let* ((start (or start (minibuffer-prompt-end)))
1103 (end (field-end)) 1106 (end (or end (point-max)))
1104 (string (buffer-substring start end)) 1107 (string (buffer-substring start end))
1105 (md (completion--field-metadata start)) 1108 (md (completion--field-metadata start))
1106 (all (completion-all-completions 1109 (all (completion-all-completions
@@ -1138,18 +1141,20 @@ scroll the window of possible completions."
1138 ;; Cache the result. This is not just for speed, but also so that 1141 ;; Cache the result. This is not just for speed, but also so that
1139 ;; repeated calls to minibuffer-force-complete can cycle through 1142 ;; repeated calls to minibuffer-force-complete can cycle through
1140 ;; all possibilities. 1143 ;; all possibilities.
1141 (completion--cache-all-sorted-completions (nconc all base-size)))))) 1144 (completion--cache-all-sorted-completions
1145 start end (nconc all base-size))))))
1142 1146
1143(defun minibuffer-force-complete-and-exit () 1147(defun minibuffer-force-complete-and-exit ()
1144 "Complete the minibuffer with first of the matches and exit." 1148 "Complete the minibuffer with first of the matches and exit."
1145 (interactive) 1149 (interactive)
1146 (minibuffer-force-complete) 1150 (minibuffer-force-complete)
1147 (minibuffer--complete-and-exit 1151 (completion--complete-and-exit
1152 (minibuffer-prompt-end) (point-max) #'exit-minibuffer
1148 ;; If the previous completion completed to an element which fails 1153 ;; If the previous completion completed to an element which fails
1149 ;; test-completion, then we shouldn't exit, but that should be rare. 1154 ;; test-completion, then we shouldn't exit, but that should be rare.
1150 (lambda () (minibuffer-message "Incomplete")))) 1155 (lambda () (minibuffer-message "Incomplete"))))
1151 1156
1152(defun minibuffer-force-complete () 1157(defun minibuffer-force-complete (&optional start end)
1153 "Complete the minibuffer to an exact match. 1158 "Complete the minibuffer to an exact match.
1154Repeated uses step through the possible completions." 1159Repeated uses step through the possible completions."
1155 (interactive) 1160 (interactive)
@@ -1157,10 +1162,10 @@ Repeated uses step through the possible completions."
1157 ;; FIXME: Need to deal with the extra-size issue here as well. 1162 ;; FIXME: Need to deal with the extra-size issue here as well.
1158 ;; FIXME: ~/src/emacs/t<M-TAB>/lisp/minibuffer.el completes to 1163 ;; FIXME: ~/src/emacs/t<M-TAB>/lisp/minibuffer.el completes to
1159 ;; ~/src/emacs/trunk/ and throws away lisp/minibuffer.el. 1164 ;; ~/src/emacs/trunk/ and throws away lisp/minibuffer.el.
1160 (let* ((start (copy-marker (field-beginning))) 1165 (let* ((start (copy-marker (or start (minibuffer-prompt-end))))
1161 (end (field-end)) 1166 (end (or end (point-max)))
1162 ;; (md (completion--field-metadata start)) 1167 ;; (md (completion--field-metadata start))
1163 (all (completion-all-sorted-completions)) 1168 (all (completion-all-sorted-completions start end))
1164 (base (+ start (or (cdr (last all)) 0)))) 1169 (base (+ start (or (cdr (last all)) 0))))
1165 (cond 1170 (cond
1166 ((not (consp all)) 1171 ((not (consp all))
@@ -1173,10 +1178,11 @@ Repeated uses step through the possible completions."
1173 'finished (when done "Sole completion")))) 1178 'finished (when done "Sole completion"))))
1174 (t 1179 (t
1175 (completion--replace base end (car all)) 1180 (completion--replace base end (car all))
1181 (setq end (+ base (length (car all))))
1176 (completion--done (buffer-substring-no-properties start (point)) 'sole) 1182 (completion--done (buffer-substring-no-properties start (point)) 'sole)
1177 ;; Set cycling after modifying the buffer since the flush hook resets it. 1183 ;; Set cycling after modifying the buffer since the flush hook resets it.
1178 (setq completion-cycling t) 1184 (setq completion-cycling t)
1179 (setq this-command 'completion-at-point) ;For minibuffer-complete. 1185 (setq this-command 'completion-at-point) ;For completion-in-region.
1180 ;; If completing file names, (car all) may be a directory, so we'd now 1186 ;; If completing file names, (car all) may be a directory, so we'd now
1181 ;; have a new set of possible completions and might want to reset 1187 ;; have a new set of possible completions and might want to reset
1182 ;; completion-all-sorted-completions to nil, but we prefer not to, 1188 ;; completion-all-sorted-completions to nil, but we prefer not to,
@@ -1184,7 +1190,7 @@ Repeated uses step through the possible completions."
1184 ;; through the previous possible completions. 1190 ;; through the previous possible completions.
1185 (let ((last (last all))) 1191 (let ((last (last all)))
1186 (setcdr last (cons (car all) (cdr last))) 1192 (setcdr last (cons (car all) (cdr last)))
1187 (completion--cache-all-sorted-completions (cdr all))) 1193 (completion--cache-all-sorted-completions start end (cdr all)))
1188 ;; Make sure repeated uses cycle, even though completion--done might 1194 ;; Make sure repeated uses cycle, even though completion--done might
1189 ;; have added a space or something that moved us outside of the field. 1195 ;; have added a space or something that moved us outside of the field.
1190 ;; (bug#12221). 1196 ;; (bug#12221).
@@ -1223,27 +1229,32 @@ If `minibuffer-completion-confirm' is `confirm-after-completion',
1223 `minibuffer-confirm-exit-commands', and accept the input 1229 `minibuffer-confirm-exit-commands', and accept the input
1224 otherwise." 1230 otherwise."
1225 (interactive) 1231 (interactive)
1226 (minibuffer--complete-and-exit 1232 (completion-complete-and-exit (minibuffer-prompt-end) (point-max)
1233 #'exit-minibuffer))
1234
1235(defun completion-complete-and-exit (beg end exit-function)
1236 (completion--complete-and-exit
1237 beg end exit-function
1227 (lambda () 1238 (lambda ()
1228 (pcase (condition-case nil 1239 (pcase (condition-case nil
1229 (completion--do-completion nil 'expect-exact) 1240 (completion--do-completion beg end
1241 nil 'expect-exact)
1230 (error 1)) 1242 (error 1))
1231 ((or #b001 #b011) (exit-minibuffer)) 1243 ((or #b001 #b011) (funcall exit-function))
1232 (#b111 (if (not minibuffer-completion-confirm) 1244 (#b111 (if (not minibuffer-completion-confirm)
1233 (exit-minibuffer) 1245 (funcall exit-function)
1234 (minibuffer-message "Confirm") 1246 (minibuffer-message "Confirm")
1235 nil)) 1247 nil))
1236 (_ nil))))) 1248 (_ nil)))))
1237 1249
1238(defun minibuffer--complete-and-exit (completion-function) 1250(defun completion--complete-and-exit (beg end
1251 exit-function completion-function)
1239 "Exit from `require-match' minibuffer. 1252 "Exit from `require-match' minibuffer.
1240COMPLETION-FUNCTION is called if the current buffer's content does not 1253COMPLETION-FUNCTION is called if the current buffer's content does not
1241appear to be a match." 1254appear to be a match."
1242 (let ((beg (field-beginning))
1243 (end (field-end)))
1244 (cond 1255 (cond
1245 ;; Allow user to specify null string 1256 ;; Allow user to specify null string
1246 ((= beg end) (exit-minibuffer)) 1257 ((= beg end) (funcall exit-function))
1247 ((test-completion (buffer-substring beg end) 1258 ((test-completion (buffer-substring beg end)
1248 minibuffer-completion-table 1259 minibuffer-completion-table
1249 minibuffer-completion-predicate) 1260 minibuffer-completion-predicate)
@@ -1269,7 +1280,7 @@ appear to be a match."
1269 ;; that file. 1280 ;; that file.
1270 (= (length string) (length compl))) 1281 (= (length string) (length compl)))
1271 (completion--replace beg end compl)))) 1282 (completion--replace beg end compl))))
1272 (exit-minibuffer)) 1283 (funcall exit-function))
1273 1284
1274 ((memq minibuffer-completion-confirm '(confirm confirm-after-completion)) 1285 ((memq minibuffer-completion-confirm '(confirm confirm-after-completion))
1275 ;; The user is permitted to exit with an input that's rejected 1286 ;; The user is permitted to exit with an input that's rejected
@@ -1280,13 +1291,13 @@ appear to be a match."
1280 ;; catches most minibuffer typos). 1291 ;; catches most minibuffer typos).
1281 (and (eq minibuffer-completion-confirm 'confirm-after-completion) 1292 (and (eq minibuffer-completion-confirm 'confirm-after-completion)
1282 (not (memq last-command minibuffer-confirm-exit-commands)))) 1293 (not (memq last-command minibuffer-confirm-exit-commands))))
1283 (exit-minibuffer) 1294 (funcall exit-function)
1284 (minibuffer-message "Confirm") 1295 (minibuffer-message "Confirm")
1285 nil)) 1296 nil))
1286 1297
1287 (t 1298 (t
1288 ;; Call do-completion, but ignore errors. 1299 ;; Call do-completion, but ignore errors.
1289 (funcall completion-function))))) 1300 (funcall completion-function))))
1290 1301
1291(defun completion--try-word-completion (string table predicate point md) 1302(defun completion--try-word-completion (string table predicate point md)
1292 (let ((comp (completion-try-completion string table predicate point md))) 1303 (let ((comp (completion-try-completion string table predicate point md)))
@@ -1381,9 +1392,18 @@ After one word is completed as much as possible, a space or hyphen
1381is added, provided that matches some possible completion. 1392is added, provided that matches some possible completion.
1382Return nil if there is no valid completion, else t." 1393Return nil if there is no valid completion, else t."
1383 (interactive) 1394 (interactive)
1384 (pcase (completion--do-completion 'completion--try-word-completion) 1395 (completion-in-region--single-word
1396 (minibuffer-prompt-end) (point-max)
1397 minibuffer-completion-table minibuffer-completion-predicate))
1398
1399(defun completion-in-region--single-word (beg end collection
1400 &optional predicate)
1401 (let ((minibuffer-completion-table collection)
1402 (minibuffer-completion-predicate predicate))
1403 (pcase (completion--do-completion beg end
1404 #'completion--try-word-completion)
1385 (#b000 nil) 1405 (#b000 nil)
1386 (_ t))) 1406 (_ t))))
1387 1407
1388(defface completions-annotations '((t :inherit italic)) 1408(defface completions-annotations '((t :inherit italic))
1389 "Face to use for annotations in the *Completions* buffer.") 1409 "Face to use for annotations in the *Completions* buffer.")
@@ -1395,7 +1415,6 @@ in columns in the *Completions* buffer.
1395If the value is `horizontal', display completions sorted 1415If the value is `horizontal', display completions sorted
1396horizontally in alphabetical order, rather than down the screen." 1416horizontally in alphabetical order, rather than down the screen."
1397 :type '(choice (const horizontal) (const vertical)) 1417 :type '(choice (const horizontal) (const vertical))
1398 :group 'minibuffer
1399 :version "23.2") 1418 :version "23.2")
1400 1419
1401(defun completion--insert-strings (strings) 1420(defun completion--insert-strings (strings)
@@ -1504,15 +1523,13 @@ See also `display-completion-list'.")
1504 1523
1505(defface completions-first-difference 1524(defface completions-first-difference
1506 '((t (:inherit bold))) 1525 '((t (:inherit bold)))
1507 "Face added on the first uncommon character in completions in *Completions* buffer." 1526 "Face added on the first uncommon character in completions in *Completions* buffer.")
1508 :group 'completion)
1509 1527
1510(defface completions-common-part '((t nil)) 1528(defface completions-common-part '((t nil))
1511 "Face added on the common prefix substring in completions in *Completions* buffer. 1529 "Face added on the common prefix substring in completions in *Completions* buffer.
1512The idea of `completions-common-part' is that you can use it to 1530The idea of `completions-common-part' is that you can use it to
1513make the common parts less visible than normal, so that the rest 1531make the common parts less visible than normal, so that the rest
1514of the differing parts is, by contrast, slightly highlighted." 1532of the differing parts is, by contrast, slightly highlighted.")
1515 :group 'completion)
1516 1533
1517(defun completion-hilit-commonality (completions prefix-len base-size) 1534(defun completion-hilit-commonality (completions prefix-len base-size)
1518 (when completions 1535 (when completions
@@ -1555,12 +1572,8 @@ alternative, the second serves as annotation.
1555The actual completion alternatives, as inserted, are given `mouse-face' 1572The actual completion alternatives, as inserted, are given `mouse-face'
1556properties of `highlight'. 1573properties of `highlight'.
1557At the end, this runs the normal hook `completion-setup-hook'. 1574At the end, this runs the normal hook `completion-setup-hook'.
1558It can find the completion buffer in `standard-output'. 1575It can find the completion buffer in `standard-output'."
1559 1576 (declare (advertised-calling-convention (completions) "24.4"))
1560The obsolete optional arg COMMON-SUBSTRING, if non-nil, should be a string
1561specifying a common substring for adding the faces
1562`completions-first-difference' and `completions-common-part' to
1563the completions buffer."
1564 (if common-substring 1577 (if common-substring
1565 (setq completions (completion-hilit-commonality 1578 (setq completions (completion-hilit-commonality
1566 completions (length common-substring) 1579 completions (length common-substring)
@@ -1647,19 +1660,19 @@ variables.")
1647 (equal pre-msg (and exit-fun (current-message)))) 1660 (equal pre-msg (and exit-fun (current-message))))
1648 (completion--message message)))) 1661 (completion--message message))))
1649 1662
1650(defun minibuffer-completion-help () 1663(defun minibuffer-completion-help (&optional start end)
1651 "Display a list of possible completions of the current minibuffer contents." 1664 "Display a list of possible completions of the current minibuffer contents."
1652 (interactive) 1665 (interactive)
1653 (message "Making completion list...") 1666 (message "Making completion list...")
1654 (let* ((start (field-beginning)) 1667 (let* ((start (or start (minibuffer-prompt-end)))
1655 (end (field-end)) 1668 (end (or end (point-max)))
1656 (string (field-string)) 1669 (string (buffer-substring start end))
1657 (md (completion--field-metadata start)) 1670 (md (completion--field-metadata start))
1658 (completions (completion-all-completions 1671 (completions (completion-all-completions
1659 string 1672 string
1660 minibuffer-completion-table 1673 minibuffer-completion-table
1661 minibuffer-completion-predicate 1674 minibuffer-completion-predicate
1662 (- (point) (field-beginning)) 1675 (- (point) start)
1663 md))) 1676 md)))
1664 (message nil) 1677 (message nil)
1665 (if (or (null completions) 1678 (if (or (null completions)
@@ -1811,7 +1824,6 @@ exit."
1811 (if (memq system-type '(ms-dos windows-nt darwin cygwin)) 1824 (if (memq system-type '(ms-dos windows-nt darwin cygwin))
1812 t nil) 1825 t nil)
1813 "Non-nil means when reading a file name completion ignores case." 1826 "Non-nil means when reading a file name completion ignores case."
1814 :group 'minibuffer
1815 :type 'boolean 1827 :type 'boolean
1816 :version "22.1") 1828 :version "22.1")
1817 1829
@@ -1821,22 +1833,15 @@ exit."
1821 ;; completions" operation as well. 1833 ;; completions" operation as well.
1822 completion-in-region-functions (start end collection predicate) 1834 completion-in-region-functions (start end collection predicate)
1823 (let ((minibuffer-completion-table collection) 1835 (let ((minibuffer-completion-table collection)
1824 (minibuffer-completion-predicate predicate) 1836 (minibuffer-completion-predicate predicate))
1825 (ol (make-overlay start end nil nil t)))
1826 (overlay-put ol 'field 'completion)
1827 ;; HACK: if the text we are completing is already in a field, we 1837 ;; HACK: if the text we are completing is already in a field, we
1828 ;; want the completion field to take priority (e.g. Bug#6830). 1838 ;; want the completion field to take priority (e.g. Bug#6830).
1829 (overlay-put ol 'priority 100)
1830 (when completion-in-region-mode-predicate 1839 (when completion-in-region-mode-predicate
1831 (completion-in-region-mode 1) 1840 (completion-in-region-mode 1)
1832 (setq completion-in-region--data 1841 (setq completion-in-region--data
1833 (list (if (markerp start) start (copy-marker start)) 1842 (list (if (markerp start) start (copy-marker start))
1834 (copy-marker end) collection))) 1843 (copy-marker end) collection)))
1835 ;; FIXME: `minibuffer-complete' should call `completion-in-region' rather 1844 (completion--in-region-1 start end))))
1836 ;; than the other way around!
1837 (unwind-protect
1838 (call-interactively 'minibuffer-complete)
1839 (delete-overlay ol)))))
1840 1845
1841(defvar completion-in-region-mode-map 1846(defvar completion-in-region-mode-map
1842 (let ((map (make-sparse-keymap))) 1847 (let ((map (make-sparse-keymap)))
@@ -2001,19 +2006,14 @@ The completion method is determined by `completion-at-point-functions'."
2001 (lambda () 2006 (lambda ()
2002 ;; We're still in the same completion field. 2007 ;; We're still in the same completion field.
2003 (let ((newstart (car-safe (funcall hookfun)))) 2008 (let ((newstart (car-safe (funcall hookfun))))
2004 (and newstart (= newstart start))))) 2009 (and newstart (= newstart start))))))
2005 (ol (make-overlay start end nil nil t)))
2006 ;; FIXME: We should somehow (ab)use completion-in-region-function or 2010 ;; FIXME: We should somehow (ab)use completion-in-region-function or
2007 ;; introduce a corresponding hook (plus another for word-completion, 2011 ;; introduce a corresponding hook (plus another for word-completion,
2008 ;; and another for force-completion, maybe?). 2012 ;; and another for force-completion, maybe?).
2009 (overlay-put ol 'field 'completion)
2010 (overlay-put ol 'priority 100)
2011 (completion-in-region-mode 1) 2013 (completion-in-region-mode 1)
2012 (setq completion-in-region--data 2014 (setq completion-in-region--data
2013 (list start (copy-marker end) collection)) 2015 (list start (copy-marker end) collection))
2014 (unwind-protect 2016 (minibuffer-completion-help start end)))
2015 (call-interactively 'minibuffer-completion-help)
2016 (delete-overlay ol))))
2017 (`(,hookfun . ,_) 2017 (`(,hookfun . ,_)
2018 ;; The hook function already performed completion :-( 2018 ;; The hook function already performed completion :-(
2019 ;; Not much we can do at this point. 2019 ;; Not much we can do at this point.
@@ -2308,7 +2308,6 @@ the minibuffer empty.
2308For some commands, exiting with an empty minibuffer has a special meaning, 2308For some commands, exiting with an empty minibuffer has a special meaning,
2309such as making the current buffer visit no file in the case of 2309such as making the current buffer visit no file in the case of
2310`set-visited-file-name'." 2310`set-visited-file-name'."
2311 :group 'minibuffer
2312 :type 'boolean) 2311 :type 'boolean)
2313 2312
2314;; Not always defined, but only called if next-read-file-uses-dialog-p says so. 2313;; Not always defined, but only called if next-read-file-uses-dialog-p says so.
@@ -2701,7 +2700,6 @@ expression (not containing character ranges like `a-z')."
2701 ;; Refresh other vars. 2700 ;; Refresh other vars.
2702 (completion-pcm--prepare-delim-re value)) 2701 (completion-pcm--prepare-delim-re value))
2703 :initialize 'custom-initialize-reset 2702 :initialize 'custom-initialize-reset
2704 :group 'minibuffer
2705 :type 'string) 2703 :type 'string)
2706 2704
2707(defcustom completion-pcm-complete-word-inserts-delimiters nil 2705(defcustom completion-pcm-complete-word-inserts-delimiters nil
@@ -2734,7 +2732,8 @@ or a symbol, see `completion-pcm--merge-completions'."
2734 (completion-pcm--string->pattern suffix))) 2732 (completion-pcm--string->pattern suffix)))
2735 (let* ((pattern nil) 2733 (let* ((pattern nil)
2736 (p 0) 2734 (p 0)
2737 (p0 p)) 2735 (p0 p)
2736 (pending nil))
2738 2737
2739 (while (and (setq p (string-match completion-pcm--delim-wild-regex 2738 (while (and (setq p (string-match completion-pcm--delim-wild-regex
2740 string p)) 2739 string p))
@@ -2751,18 +2750,49 @@ or a symbol, see `completion-pcm--merge-completions'."
2751 ;; This is determined by the presence of a submatch-1 which delimits 2750 ;; This is determined by the presence of a submatch-1 which delimits
2752 ;; the prefix. 2751 ;; the prefix.
2753 (if (match-end 1) (setq p (match-end 1))) 2752 (if (match-end 1) (setq p (match-end 1)))
2754 (push (substring string p0 p) pattern) 2753 (unless (= p0 p)
2754 (if pending (push pending pattern))
2755 (push (substring string p0 p) pattern))
2756 (setq pending nil)
2755 (if (eq (aref string p) ?*) 2757 (if (eq (aref string p) ?*)
2756 (progn 2758 (progn
2757 (push 'star pattern) 2759 (push 'star pattern)
2758 (setq p0 (1+ p))) 2760 (setq p0 (1+ p)))
2759 (push 'any pattern) 2761 (push 'any pattern)
2760 (setq p0 p)) 2762 (if (match-end 1)
2761 (cl-incf p)) 2763 (setq p0 p)
2762 2764 (push (substring string p (match-end 0)) pattern)
2765 ;; `any-delim' is used so that "a-b" also finds "array->beginning".
2766 (setq pending 'any-delim)
2767 (setq p0 (match-end 0))))
2768 (setq p p0))
2769
2770 (when (> (length string) p0)
2771 (if pending (push pending pattern))
2772 (push (substring string p0) pattern))
2763 ;; An empty string might be erroneously added at the beginning. 2773 ;; An empty string might be erroneously added at the beginning.
2764 ;; It should be avoided properly, but it's so easy to remove it here. 2774 ;; It should be avoided properly, but it's so easy to remove it here.
2765 (delete "" (nreverse (cons (substring string p0) pattern)))))) 2775 (delete "" (nreverse pattern)))))
2776
2777(defun completion-pcm--optimize-pattern (p)
2778 ;; Remove empty strings in a separate phase since otherwise a ""
2779 ;; might prevent some other optimization, as in '(any "" any).
2780 (setq p (delete "" p))
2781 (let ((n '()))
2782 (while p
2783 (pcase p
2784 (`(,(and s1 (pred stringp)) ,(and s2 (pred stringp)) . ,rest)
2785 (setq p (cons (concat s1 s2) rest)))
2786 (`(,(and p1 (pred symbolp)) ,(and p2 (guard (eq p1 p2))) . ,_)
2787 (setq p (cdr p)))
2788 (`(star ,(pred symbolp) . ,rest) (setq p `(star . ,rest)))
2789 (`(,(pred symbolp) star . ,rest) (setq p `(star . ,rest)))
2790 (`(point ,(or `any `any-delim) . ,rest) (setq p `(point . ,rest)))
2791 (`(,(or `any `any-delim) point . ,rest) (setq p `(point . ,rest)))
2792 (`(any ,(or `any `any-delim) . ,rest) (setq p `(any . ,rest)))
2793 (`(,(pred symbolp)) (setq p nil)) ;Implicit terminating `any'.
2794 (_ (push (pop p) n))))
2795 (nreverse n)))
2766 2796
2767(defun completion-pcm--pattern->regex (pattern &optional group) 2797(defun completion-pcm--pattern->regex (pattern &optional group)
2768 (let ((re 2798 (let ((re
@@ -2771,8 +2801,13 @@ or a symbol, see `completion-pcm--merge-completions'."
2771 (lambda (x) 2801 (lambda (x)
2772 (cond 2802 (cond
2773 ((stringp x) (regexp-quote x)) 2803 ((stringp x) (regexp-quote x))
2774 ((if (consp group) (memq x group) group) "\\(.*?\\)") 2804 (t
2775 (t ".*?"))) 2805 (let ((re (if (eq x 'any-delim)
2806 (concat completion-pcm--delim-wild-regex "*?")
2807 ".*?")))
2808 (if (if (consp group) (memq x group) group)
2809 (concat "\\(" re "\\)")
2810 re)))))
2776 pattern 2811 pattern
2777 "")))) 2812 ""))))
2778 ;; Avoid pathological backtracking. 2813 ;; Avoid pathological backtracking.
@@ -2846,11 +2881,11 @@ filter out additional entries (because TABLE might not obey PRED)."
2846 (setq string (substring string (car bounds) (+ point (cdr bounds)))) 2881 (setq string (substring string (car bounds) (+ point (cdr bounds))))
2847 (let* ((relpoint (- point (car bounds))) 2882 (let* ((relpoint (- point (car bounds)))
2848 (pattern (completion-pcm--string->pattern string relpoint)) 2883 (pattern (completion-pcm--string->pattern string relpoint))
2849 (all (condition-case err 2884 (all (condition-case-unless-debug err
2850 (funcall filter 2885 (funcall filter
2851 (completion-pcm--all-completions 2886 (completion-pcm--all-completions
2852 prefix pattern table pred)) 2887 prefix pattern table pred))
2853 (error (unless firsterror (setq firsterror err)) nil)))) 2888 (error (setq firsterror err) nil))))
2854 (when (and (null all) 2889 (when (and (null all)
2855 (> (car bounds) 0) 2890 (> (car bounds) 0)
2856 (null (ignore-errors (try-completion prefix table pred)))) 2891 (null (ignore-errors (try-completion prefix table pred))))
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index e70400af820..a1ead96eaea 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1424,7 +1424,8 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
1424 (string-match "^/?\\([^/]+\\)" localname) 1424 (string-match "^/?\\([^/]+\\)" localname)
1425 (list (tramp-gvfs-mount-spec-entry "type" "smb-share") 1425 (list (tramp-gvfs-mount-spec-entry "type" "smb-share")
1426 (tramp-gvfs-mount-spec-entry "server" host) 1426 (tramp-gvfs-mount-spec-entry "server" host)
1427 (tramp-gvfs-mount-spec-entry "share" (match-string 1 localname)))) 1427 (tramp-gvfs-mount-spec-entry
1428 "share" (match-string 1 localname))))
1428 ((string-equal "obex" method) 1429 ((string-equal "obex" method)
1429 (list (tramp-gvfs-mount-spec-entry "type" method) 1430 (list (tramp-gvfs-mount-spec-entry "type" method)
1430 (tramp-gvfs-mount-spec-entry 1431 (tramp-gvfs-mount-spec-entry
@@ -1441,7 +1442,8 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
1441 ,@(when domain 1442 ,@(when domain
1442 (list (tramp-gvfs-mount-spec-entry "domain" domain))) 1443 (list (tramp-gvfs-mount-spec-entry "domain" domain)))
1443 ,@(when port 1444 ,@(when port
1444 (list (tramp-gvfs-mount-spec-entry "port" (number-to-string port)))))) 1445 (list (tramp-gvfs-mount-spec-entry
1446 "port" (number-to-string port))))))
1445 (mount-pref 1447 (mount-pref
1446 (if (and (string-match "\\`dav" method) 1448 (if (and (string-match "\\`dav" method)
1447 (string-match "^/?[^/]+" localname)) 1449 (string-match "^/?[^/]+" localname))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 6c3ae376dc3..727536b2e10 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -690,7 +690,7 @@ Useful for \"rsync\" like methods.")
690;; Tramp only knows how to deal with `file-name-handler-alist', not 690;; Tramp only knows how to deal with `file-name-handler-alist', not
691;; the other places. 691;; the other places.
692 692
693;; Currently, we have the choice between 'ftp, 'sep, and 'url. 693;; Currently, we have the choice between 'ftp and 'sep.
694;;;###autoload 694;;;###autoload
695(defcustom tramp-syntax 695(defcustom tramp-syntax
696 (if (featurep 'xemacs) 'sep 'ftp) 696 (if (featurep 'xemacs) 'sep 'ftp)
@@ -699,20 +699,15 @@ Useful for \"rsync\" like methods.")
699It can have the following values: 699It can have the following values:
700 700
701 'ftp -- Ange-FTP respective EFS like syntax (GNU Emacs default) 701 'ftp -- Ange-FTP respective EFS like syntax (GNU Emacs default)
702 'sep -- Syntax as defined for XEmacs (not available yet for GNU Emacs) 702 'sep -- Syntax as defined for XEmacs."
703 'url -- URL-like syntax."
704 :group 'tramp 703 :group 'tramp
705 :type (if (featurep 'xemacs) 704 :version "24.4"
706 '(choice (const :tag "EFS" ftp) 705 :type `(choice (const :tag ,(if (featurep 'xemacs) "EFS" "Ange-FTP") ftp)
707 (const :tag "XEmacs" sep) 706 (const :tag "XEmacs" sep)))
708 (const :tag "URL" url))
709 '(choice (const :tag "Ange-FTP" ftp)
710 (const :tag "URL" url))))
711 707
712(defconst tramp-prefix-format 708(defconst tramp-prefix-format
713 (cond ((equal tramp-syntax 'ftp) "/") 709 (cond ((equal tramp-syntax 'ftp) "/")
714 ((equal tramp-syntax 'sep) "/[") 710 ((equal tramp-syntax 'sep) "/[")
715 ((equal tramp-syntax 'url) "/")
716 (t (error "Wrong `tramp-syntax' defined"))) 711 (t (error "Wrong `tramp-syntax' defined")))
717 "String matching the very beginning of Tramp file names. 712 "String matching the very beginning of Tramp file names.
718Used in `tramp-make-tramp-file-name'.") 713Used in `tramp-make-tramp-file-name'.")
@@ -729,7 +724,6 @@ Should always start with \"^\". Derived from `tramp-prefix-format'.")
729(defconst tramp-postfix-method-format 724(defconst tramp-postfix-method-format
730 (cond ((equal tramp-syntax 'ftp) ":") 725 (cond ((equal tramp-syntax 'ftp) ":")
731 ((equal tramp-syntax 'sep) "/") 726 ((equal tramp-syntax 'sep) "/")
732 ((equal tramp-syntax 'url) "://")
733 (t (error "Wrong `tramp-syntax' defined"))) 727 (t (error "Wrong `tramp-syntax' defined")))
734 "String matching delimiter between method and user or host names. 728 "String matching delimiter between method and user or host names.
735Used in `tramp-make-tramp-file-name'.") 729Used in `tramp-make-tramp-file-name'.")
@@ -776,7 +770,6 @@ Derived from `tramp-postfix-user-format'.")
776(defconst tramp-prefix-ipv6-format 770(defconst tramp-prefix-ipv6-format
777 (cond ((equal tramp-syntax 'ftp) "[") 771 (cond ((equal tramp-syntax 'ftp) "[")
778 ((equal tramp-syntax 'sep) "") 772 ((equal tramp-syntax 'sep) "")
779 ((equal tramp-syntax 'url) "[")
780 (t (error "Wrong `tramp-syntax' defined"))) 773 (t (error "Wrong `tramp-syntax' defined")))
781 "String matching left hand side of IPv6 addresses. 774 "String matching left hand side of IPv6 addresses.
782Used in `tramp-make-tramp-file-name'.") 775Used in `tramp-make-tramp-file-name'.")
@@ -796,7 +789,6 @@ Derived from `tramp-prefix-ipv6-format'.")
796(defconst tramp-postfix-ipv6-format 789(defconst tramp-postfix-ipv6-format
797 (cond ((equal tramp-syntax 'ftp) "]") 790 (cond ((equal tramp-syntax 'ftp) "]")
798 ((equal tramp-syntax 'sep) "") 791 ((equal tramp-syntax 'sep) "")
799 ((equal tramp-syntax 'url) "]")
800 (t (error "Wrong `tramp-syntax' defined"))) 792 (t (error "Wrong `tramp-syntax' defined")))
801 "String matching right hand side of IPv6 addresses. 793 "String matching right hand side of IPv6 addresses.
802Used in `tramp-make-tramp-file-name'.") 794Used in `tramp-make-tramp-file-name'.")
@@ -809,7 +801,6 @@ Derived from `tramp-postfix-ipv6-format'.")
809(defconst tramp-prefix-port-format 801(defconst tramp-prefix-port-format
810 (cond ((equal tramp-syntax 'ftp) "#") 802 (cond ((equal tramp-syntax 'ftp) "#")
811 ((equal tramp-syntax 'sep) "#") 803 ((equal tramp-syntax 'sep) "#")
812 ((equal tramp-syntax 'url) ":")
813 (t (error "Wrong `tramp-syntax' defined"))) 804 (t (error "Wrong `tramp-syntax' defined")))
814 "String matching delimiter between host names and port numbers.") 805 "String matching delimiter between host names and port numbers.")
815 806
@@ -838,7 +829,6 @@ Derived from `tramp-postfix-hop-format'.")
838(defconst tramp-postfix-host-format 829(defconst tramp-postfix-host-format
839 (cond ((equal tramp-syntax 'ftp) ":") 830 (cond ((equal tramp-syntax 'ftp) ":")
840 ((equal tramp-syntax 'sep) "]") 831 ((equal tramp-syntax 'sep) "]")
841 ((equal tramp-syntax 'url) "")
842 (t (error "Wrong `tramp-syntax' defined"))) 832 (t (error "Wrong `tramp-syntax' defined")))
843 "String matching delimiter between host names and localnames. 833 "String matching delimiter between host names and localnames.
844Used in `tramp-make-tramp-file-name'.") 834Used in `tramp-make-tramp-file-name'.")
@@ -909,15 +899,9 @@ XEmacs uses a separate filename syntax for Tramp and EFS.
909See `tramp-file-name-structure' for more explanations.") 899See `tramp-file-name-structure' for more explanations.")
910 900
911;;;###autoload 901;;;###autoload
912(defconst tramp-file-name-regexp-url "\\`/[^/|:]+://"
913 "Value for `tramp-file-name-regexp' for URL-like remoting.
914See `tramp-file-name-structure' for more explanations.")
915
916;;;###autoload
917(defconst tramp-file-name-regexp 902(defconst tramp-file-name-regexp
918 (cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified) 903 (cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified)
919 ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate) 904 ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate)
920 ((equal tramp-syntax 'url) tramp-file-name-regexp-url)
921 (t (error "Wrong `tramp-syntax' defined"))) 905 (t (error "Wrong `tramp-syntax' defined")))
922 "Regular expression matching file names handled by Tramp. 906 "Regular expression matching file names handled by Tramp.
923This regexp should match Tramp file names but no other file names. 907This regexp should match Tramp file names but no other file names.
@@ -952,16 +936,9 @@ XEmacs uses a separate filename syntax for Tramp and EFS.
952See `tramp-file-name-structure' for more explanations.") 936See `tramp-file-name-structure' for more explanations.")
953 937
954;;;###autoload 938;;;###autoload
955(defconst tramp-completion-file-name-regexp-url
956 "\\`/[^/:]+\\(:\\(/\\(/[^/]*\\)?\\)?\\)?\\'"
957 "Value for `tramp-completion-file-name-regexp' for URL-like remoting.
958See `tramp-file-name-structure' for more explanations.")
959
960;;;###autoload
961(defconst tramp-completion-file-name-regexp 939(defconst tramp-completion-file-name-regexp
962 (cond ((equal tramp-syntax 'ftp) tramp-completion-file-name-regexp-unified) 940 (cond ((equal tramp-syntax 'ftp) tramp-completion-file-name-regexp-unified)
963 ((equal tramp-syntax 'sep) tramp-completion-file-name-regexp-separate) 941 ((equal tramp-syntax 'sep) tramp-completion-file-name-regexp-separate)
964 ((equal tramp-syntax 'url) tramp-completion-file-name-regexp-url)
965 (t (error "Wrong `tramp-syntax' defined"))) 942 (t (error "Wrong `tramp-syntax' defined")))
966 "Regular expression matching file names handled by Tramp completion. 943 "Regular expression matching file names handled by Tramp completion.
967This regexp should match partial Tramp file names only. 944This regexp should match partial Tramp file names only.
@@ -2542,64 +2519,40 @@ They are collected by `tramp-completion-dissect-file-name1'."
2542 tramp-prefix-ipv6-regexp 2519 tramp-prefix-ipv6-regexp
2543 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$") 2520 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
2544 nil 1 2 nil)) 2521 nil 1 2 nil))
2545 ;; "/method:user" "/[method/user" "/method://user" 2522 ;; "/method:user" "/[method/user"
2546 (tramp-completion-file-name-structure7 2523 (tramp-completion-file-name-structure7
2547 (list (concat tramp-prefix-regexp 2524 (list (concat tramp-prefix-regexp
2548 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp 2525 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
2549 "\\(" tramp-user-regexp x-nil "\\)$") 2526 "\\(" tramp-user-regexp x-nil "\\)$")
2550 1 2 nil nil)) 2527 1 2 nil nil))
2551 ;; "/method:host" "/[method/host" "/method://host" 2528 ;; "/method:host" "/[method/host"
2552 (tramp-completion-file-name-structure8 2529 (tramp-completion-file-name-structure8
2553 (list (concat tramp-prefix-regexp 2530 (list (concat tramp-prefix-regexp
2554 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp 2531 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
2555 "\\(" tramp-host-regexp x-nil "\\)$") 2532 "\\(" tramp-host-regexp x-nil "\\)$")
2556 1 nil 2 nil)) 2533 1 nil 2 nil))
2557 ;; "/method:[ipv6" "/[method/ipv6" "/method://[ipv6" 2534 ;; "/method:[ipv6" "/[method/ipv6"
2558 (tramp-completion-file-name-structure9 2535 (tramp-completion-file-name-structure9
2559 (list (concat tramp-prefix-regexp 2536 (list (concat tramp-prefix-regexp
2560 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp 2537 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
2561 tramp-prefix-ipv6-regexp 2538 tramp-prefix-ipv6-regexp
2562 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$") 2539 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
2563 1 nil 2 nil)) 2540 1 nil 2 nil))
2564 ;; "/method:user@host" "/[method/user@host" "/method://user@host" 2541 ;; "/method:user@host" "/[method/user@host"
2565 (tramp-completion-file-name-structure10 2542 (tramp-completion-file-name-structure10
2566 (list (concat tramp-prefix-regexp 2543 (list (concat tramp-prefix-regexp
2567 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp 2544 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
2568 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp 2545 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp
2569 "\\(" tramp-host-regexp x-nil "\\)$") 2546 "\\(" tramp-host-regexp x-nil "\\)$")
2570 1 2 3 nil)) 2547 1 2 3 nil))
2571 ;; "/method:user@[ipv6" "/[method/user@ipv6" "/method://user@[ipv6" 2548 ;; "/method:user@[ipv6" "/[method/user@ipv6"
2572 (tramp-completion-file-name-structure11 2549 (tramp-completion-file-name-structure11
2573 (list (concat tramp-prefix-regexp 2550 (list (concat tramp-prefix-regexp
2574 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp 2551 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
2575 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp 2552 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp
2576 tramp-prefix-ipv6-regexp 2553 tramp-prefix-ipv6-regexp
2577 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$") 2554 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
2578 1 2 3 nil)) 2555 1 2 3 nil)))
2579 ;; "/method: "/method:/"
2580 (tramp-completion-file-name-structure12
2581 (list
2582 (if (equal tramp-syntax 'url)
2583 (concat tramp-prefix-regexp
2584 "\\(" tramp-method-regexp "\\)"
2585 "\\(" (substring tramp-postfix-method-regexp 0 1)
2586 "\\|" (substring tramp-postfix-method-regexp 1 2) "\\)"
2587 "\\(" "\\)$")
2588 ;; Should not match if not URL syntax.
2589 (concat tramp-prefix-regexp "/$"))
2590 1 3 nil nil))
2591 ;; "/method: "/method:/"
2592 (tramp-completion-file-name-structure13
2593 (list
2594 (if (equal tramp-syntax 'url)
2595 (concat tramp-prefix-regexp
2596 "\\(" tramp-method-regexp "\\)"
2597 "\\(" (substring tramp-postfix-method-regexp 0 1)
2598 "\\|" (substring tramp-postfix-method-regexp 1 2) "\\)"
2599 "\\(" "\\)$")
2600 ;; Should not match if not URL syntax.
2601 (concat tramp-prefix-regexp "/$"))
2602 1 nil 3 nil)))
2603 2556
2604 (mapc (lambda (structure) 2557 (mapc (lambda (structure)
2605 (add-to-list 'result 2558 (add-to-list 'result
@@ -2616,8 +2569,6 @@ They are collected by `tramp-completion-dissect-file-name1'."
2616 tramp-completion-file-name-structure9 2569 tramp-completion-file-name-structure9
2617 tramp-completion-file-name-structure10 2570 tramp-completion-file-name-structure10
2618 tramp-completion-file-name-structure11 2571 tramp-completion-file-name-structure11
2619 tramp-completion-file-name-structure12
2620 tramp-completion-file-name-structure13
2621 tramp-file-name-structure)) 2572 tramp-file-name-structure))
2622 2573
2623 (delq nil result))) 2574 (delq nil result)))
@@ -3289,35 +3240,19 @@ User is always nil."
3289 3240
3290(defun tramp-handle-substitute-in-file-name (filename) 3241(defun tramp-handle-substitute-in-file-name (filename)
3291 "Like `substitute-in-file-name' for Tramp files. 3242 "Like `substitute-in-file-name' for Tramp files.
3292\"//\" and \"/~\" substitute only in the local filename part. 3243\"//\" and \"/~\" substitute only in the local filename part."
3293If the URL Tramp syntax is chosen, \"//\" as method delimiter and \"/~\" at
3294beginning of local filename are not substituted."
3295 ;; First, we must replace environment variables. 3244 ;; First, we must replace environment variables.
3296 (setq filename (tramp-replace-environment-variables filename)) 3245 (setq filename (tramp-replace-environment-variables filename))
3297 (with-parsed-tramp-file-name filename nil 3246 (with-parsed-tramp-file-name filename nil
3298 (if (equal tramp-syntax 'url) 3247 ;; Ignore in LOCALNAME everything before "//" or "/~".
3299 ;; We need to check localname only. The other parts cannot contain 3248 (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
3300 ;; "//" or "/~". 3249 (setq filename
3301 (if (and (> (length localname) 1) 3250 (concat (file-remote-p filename)
3302 (or (string-match "//" localname) 3251 (replace-match "\\1" nil nil localname)))
3303 (string-match "/~" localname 1))) 3252 ;; "/m:h:~" does not work for completion. We use "/m:h:~/".
3304 (tramp-run-real-handler 'substitute-in-file-name (list filename)) 3253 (when (string-match "~$" filename)
3305 (tramp-make-tramp-file-name 3254 (setq filename (concat filename "/"))))
3306 (when method (substitute-in-file-name method)) 3255 (tramp-run-real-handler 'substitute-in-file-name (list filename))))
3307 (when user (substitute-in-file-name user))
3308 (when host (substitute-in-file-name host))
3309 (when localname
3310 (tramp-run-real-handler
3311 'substitute-in-file-name (list localname)))))
3312 ;; Ignore in LOCALNAME everything before "//" or "/~".
3313 (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
3314 (setq filename
3315 (concat (file-remote-p filename)
3316 (replace-match "\\1" nil nil localname)))
3317 ;; "/m:h:~" does not work for completion. We use "/m:h:~/".
3318 (when (string-match "~$" filename)
3319 (setq filename (concat filename "/"))))
3320 (tramp-run-real-handler 'substitute-in-file-name (list filename)))))
3321 3256
3322(defun tramp-handle-unhandled-file-name-directory (_filename) 3257(defun tramp-handle-unhandled-file-name-directory (_filename)
3323 "Like `unhandled-file-name-directory' for Tramp files." 3258 "Like `unhandled-file-name-directory' for Tramp files."
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index db2a6c68539..c8a9c461a9d 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6905,32 +6905,38 @@ comment at the start of cc-engine.el for more info."
6905 6905
6906 ;; Skip over type decl prefix operators. (Note similar code in 6906 ;; Skip over type decl prefix operators. (Note similar code in
6907 ;; `c-font-lock-declarators'.) 6907 ;; `c-font-lock-declarators'.)
6908 (while (and (looking-at c-type-decl-prefix-key) 6908 (if (and c-recognize-typeless-decls
6909 (if (and (c-major-mode-is 'c++-mode) 6909 (equal c-type-decl-prefix-key "\\<\\>"))
6910 (match-beginning 3)) 6910 (when (eq (char-after) ?\()
6911 ;; If the third submatch matches in C++ then
6912 ;; we're looking at an identifier that's a
6913 ;; prefix only if it specifies a member pointer.
6914 (when (setq got-identifier (c-forward-name))
6915 (if (looking-at "\\(::\\)")
6916 ;; We only check for a trailing "::" and
6917 ;; let the "*" that should follow be
6918 ;; matched in the next round.
6919 (progn (setq got-identifier nil) t)
6920 ;; It turned out to be the real identifier,
6921 ;; so stop.
6922 nil))
6923 t))
6924
6925 (if (eq (char-after) ?\()
6926 (progn 6911 (progn
6927 (setq paren-depth (1+ paren-depth)) 6912 (setq paren-depth (1+ paren-depth))
6928 (forward-char)) 6913 (forward-char)))
6929 (unless got-prefix-before-parens 6914 (while (and (looking-at c-type-decl-prefix-key)
6930 (setq got-prefix-before-parens (= paren-depth 0))) 6915 (if (and (c-major-mode-is 'c++-mode)
6931 (setq got-prefix t) 6916 (match-beginning 3))
6932 (goto-char (match-end 1))) 6917 ;; If the third submatch matches in C++ then
6933 (c-forward-syntactic-ws)) 6918 ;; we're looking at an identifier that's a
6919 ;; prefix only if it specifies a member pointer.
6920 (when (setq got-identifier (c-forward-name))
6921 (if (looking-at "\\(::\\)")
6922 ;; We only check for a trailing "::" and
6923 ;; let the "*" that should follow be
6924 ;; matched in the next round.
6925 (progn (setq got-identifier nil) t)
6926 ;; It turned out to be the real identifier,
6927 ;; so stop.
6928 nil))
6929 t))
6930
6931 (if (eq (char-after) ?\()
6932 (progn
6933 (setq paren-depth (1+ paren-depth))
6934 (forward-char))
6935 (unless got-prefix-before-parens
6936 (setq got-prefix-before-parens (= paren-depth 0)))
6937 (setq got-prefix t)
6938 (goto-char (match-end 1)))
6939 (c-forward-syntactic-ws)))
6934 6940
6935 (setq got-parens (> paren-depth 0)) 6941 (setq got-parens (> paren-depth 0))
6936 6942
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 0116e9ec3dd..80e6189822b 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -2816,7 +2816,8 @@ is in effect when this is matched (see `c-identifier-syntax-table')."
2816 "\\>") 2816 "\\>")
2817 "") 2817 "")
2818 "\\)") 2818 "\\)")
2819 (java idl) "\\([\[\(]\\)") 2819 java "\\([\[\(\)]\\)"
2820 idl "\\([\[\(]\\)")
2820(c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key) 2821(c-lang-defvar c-type-decl-suffix-key (c-lang-const c-type-decl-suffix-key)
2821 'dont-doc) 2822 'dont-doc)
2822 2823
@@ -2937,7 +2938,7 @@ calls before a brace block. This setting does not affect declarations
2937that are preceded by a declaration starting keyword, so 2938that are preceded by a declaration starting keyword, so
2938e.g. `c-typeless-decl-kwds' may still be used when it's set to nil." 2939e.g. `c-typeless-decl-kwds' may still be used when it's set to nil."
2939 t nil 2940 t nil
2940 (c c++ objc) t) 2941 (c c++ objc java) t)
2941(c-lang-defvar c-recognize-typeless-decls 2942(c-lang-defvar c-recognize-typeless-decls
2942 (c-lang-const c-recognize-typeless-decls)) 2943 (c-lang-const c-recognize-typeless-decls))
2943 2944
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index acc7738ae5c..0f868255589 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1862,11 +1862,11 @@ See `font-lock-syntax-table'.")
1862 "using") 1862 "using")
1863 'symbols)) 1863 'symbols))
1864 1 'font-lock-builtin-face) 1864 1 'font-lock-builtin-face)
1865 ;; Perl-ish keywords
1866 "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$"
1867 ;; here-doc beginnings 1865 ;; here-doc beginnings
1868 `(,ruby-here-doc-beg-re 0 (unless (ruby-singleton-class-p (match-beginning 0)) 1866 `(,ruby-here-doc-beg-re 0 (unless (ruby-singleton-class-p (match-beginning 0))
1869 'font-lock-string-face)) 1867 'font-lock-string-face))
1868 ;; Perl-ish keywords
1869 "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$"
1870 ;; variables 1870 ;; variables
1871 `(,(concat ruby-font-lock-keyword-beg-re 1871 `(,(concat ruby-font-lock-keyword-beg-re
1872 "\\_<\\(nil\\|self\\|true\\|false\\)\\>") 1872 "\\_<\\(nil\\|self\\|true\\|false\\)\\>")
diff --git a/lisp/replace.el b/lisp/replace.el
index 5e44677b0f8..abb59a674e3 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -490,12 +490,13 @@ If `replace-lax-whitespace' is non-nil, a space or spaces in the string
490to be replaced will match a sequence of whitespace chars defined by the 490to be replaced will match a sequence of whitespace chars defined by the
491regexp in `search-whitespace-regexp'. 491regexp in `search-whitespace-regexp'.
492 492
493In Transient Mark mode, if the mark is active, operate on the contents
494of the region. Otherwise, operate from point to the end of the buffer.
495
496Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace 493Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
497only matches surrounded by word boundaries. 494only matches surrounded by word boundaries.
498Fourth and fifth arg START and END specify the region to operate on. 495
496Operates on the region between START and END (if both are nil, from point
497to the end of the buffer). Interactively, if Transient Mark mode is
498enabled and the mark is active, operates on the contents of the region;
499otherwise from point to the end of the buffer.
499 500
500Use \\<minibuffer-local-map>\\[next-history-element] \ 501Use \\<minibuffer-local-map>\\[next-history-element] \
501to pull the last incremental search string to the minibuffer 502to pull the last incremental search string to the minibuffer
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 171f373317a..795c04e31e1 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -468,7 +468,7 @@ alternatives, starting from zero."
468 nil 468 nil
469 (("editor") ("editora") ("editorb") ("editorc") 469 (("editor") ("editora") ("editorb") ("editorc")
470 ("translator") ("annotator") ("commentator") 470 ("translator") ("annotator") ("commentator")
471 ("introduction") ("foreword") ("afterword") ("titleaddon") 471 ("introduction") ("foreword") ("afterword") ("subtitle") ("titleaddon")
472 ("maintitle") ("mainsubtitle") ("maintitleaddon") 472 ("maintitle") ("mainsubtitle") ("maintitleaddon")
473 ("language") ("origlanguage") ("volume") ("part") ("edition") ("volumes") 473 ("language") ("origlanguage") ("volume") ("part") ("edition") ("volumes")
474 ("series") ("number") ("note") ("publisher") ("location") ("isbn") 474 ("series") ("number") ("note") ("publisher") ("location") ("isbn")
diff --git a/src/ChangeLog b/src/ChangeLog
index d4a7abefd57..7f4c3f731f4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,85 @@
12013-09-07 Paul Eggert <eggert@cs.ucla.edu>
2
3 Port --without-x --enable-gcc-warnings to Fedora 19.
4 * gfilenotify.c (globals_of_gfilenotify):
5 Call g_type_init only if using an older glib version that needs it.
6
72013-09-06 Dmitry Antipov <dmantipov@yandex.ru>
8
9 * lisp.h (last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
10 (last_glyphless_glyph_merged_face_id): Remove declarations.
11 * dispextern.h (merge_glyphless_glyph_face): Add prototype.
12 * xdisp.c (last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
13 (last_glyphless_glyph_merged_face_id): Now static.
14 (merge_escape_glyph_face): New function, refactored from...
15 (get_next_display_element): ...here.
16 (merge_glyphless_glyph_face): New function, refactored from...
17 (produce_glyphless_glyph): ...here...
18 * term.c (produce_glyphless_glyph): ...and here.
19
202013-09-06 Stefan Monnier <monnier@iro.umontreal.ca>
21
22 * eval.c (eval_sub): Only call Ffunction if necessary.
23
242013-09-06 Dmitry Antipov <dmantipov@yandex.ru>
25
26 Attempt to make redisplay more selective when changing cursor type.
27 * frame.h (struct frame): New bitfield cursor_type_changed.
28 * xdisp.c (cursor_type_changed): Remove.
29 (try_cursor_movement, redisplay_window, try_window_id)
30 (set_frame_cursor_types, try_window_reusing_current_matrix):
31 Adjust to use per-frame bitfield.
32 (redisplay_internal): Look for cursor type change on each visible
33 frame and consider all frames if cursor type has been changed on
34 the frame other than selected. If cursor type has been changed on
35 selected frame only, do not use fast update.
36
372013-09-06 Dmitry Antipov <dmantipov@yandex.ru>
38
39 Attempt to make redisplay more selective when changing fonts.
40 * frame.h (struct frame): New bitfield fonts_changed.
41 * dispextern.h (fonts_changed_p, adjust_glyphs): Remove declaration.
42 (adjust_frame_glyphs): Add prototype.
43 * dispnew.c (fonts_changed_p): Remove.
44 (adjust_glyphs): Remove because we do not
45 adjust matrices on all frames at once any more.
46 (adjust_frame_glyphs): Block and unblock input here.
47 (adjust_glyph_matrix): Use fonts_changed.
48 (change_frame_size_1): Use adjust_frame_glyphs.
49 * font.c (font_open_entity): Use fonts_changed.
50 * frame.c (set_menu_bar_lines, Fmake_terminal_frame):
51 * w32fns.c (x_set_menu_bar_lines, x_set_tool_bar_lines, Fx_show_tip):
52 * window.c (Fdelete_other_windows_internal, Fwindow_resize_apply)
53 (Fsplit_window_internal, Fdelete_window_internal, grow_mini_window)
54 (shrink_mini_window, Fresize_mini_window_internal)
55 (window_scroll_pixel_based, Fset_window_configuration)
56 (apply_window_adjustment, Fset_window_vscroll):
57 * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines, Fx_show_tip):
58 Use adjust_frame_glyphs.
59 * xdisp.c (redisplay_tool_bar, redisplay_window, try_window)
60 (try_window_reusing_current_matrix, try_window_id, display_line)
61 (IT_EXPAND_MATRIX_WIDTH): Use fonts_changed.
62 (redisplay_internal): Consider fonts_changed and adjust frame
63 matrices for each frame only if the frame is visible. If font
64 has been changed on some frame during full redisplay, retry
65 only visible frames where the font has been actually changed.
66
672013-09-05 Dmitry Antipov <dmantipov@yandex.ru>
68
69 Cache current header and mode line height for each window.
70 * window.h (struct window): New fields mode_line_height
71 and header_line_height.
72 * window.c (make_window): Initialize them.
73 * dispextern.h (CURRENT_MODE_LINE_HEIGHT)
74 (CURRENT_HEADER_LINE_HEIGHT): Use them. Adjust comment.
75 (current_mode_line_height, current_header_line_height):
76 Remove declaration.
77 * xdisp.c (current_mode_line_height, current_header_line_height):
78 Remove.
79 (pos_visible_p, init_xdisp): Adjust user.
80 (redisplay_window): Invalidate mode_line_height and
81 header_line_height if current and desired matrices do not agree.
82
12013-09-05 Dmitry Antipov <dmantipov@yandex.ru> 832013-09-05 Dmitry Antipov <dmantipov@yandex.ru>
2 84
3 * fontset.c, window.c, xdisp.c (toplevel): Use TERM_HEADER. 85 * fontset.c, window.c, xdisp.c (toplevel): Use TERM_HEADER.
diff --git a/src/dispextern.h b/src/dispextern.h
index 947e50fa4dd..f15da1e6564 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1195,12 +1195,6 @@ struct glyph_row *matrix_row (struct glyph_matrix *, int);
1195 ((ROW)->phys_height - (ROW)->phys_ascent \ 1195 ((ROW)->phys_height - (ROW)->phys_ascent \
1196 > (ROW)->height - (ROW)->ascent) 1196 > (ROW)->height - (ROW)->ascent)
1197 1197
1198/* True means that fonts have been loaded since the last glyph
1199 matrix adjustments. The function redisplay_internal adjusts glyph
1200 matrices when this flag is true. */
1201
1202extern bool fonts_changed_p;
1203
1204/* A glyph for a space. */ 1198/* A glyph for a space. */
1205 1199
1206extern struct glyph space_glyph; 1200extern struct glyph space_glyph;
@@ -1428,31 +1422,31 @@ struct glyph_string
1428#define CURRENT_MODE_LINE_FACE_ID(W) \ 1422#define CURRENT_MODE_LINE_FACE_ID(W) \
1429 (CURRENT_MODE_LINE_FACE_ID_3((W), XWINDOW (selected_window), (W))) 1423 (CURRENT_MODE_LINE_FACE_ID_3((W), XWINDOW (selected_window), (W)))
1430 1424
1431/* Return the current height of the mode line of window W. If not 1425/* Return the current height of the mode line of window W. If not known
1432 known from current_mode_line_height, look at W's current glyph 1426 from W->mode_line_height, look at W's current glyph matrix, or return
1433 matrix, or return a default based on the height of the font of the 1427 a default based on the height of the font of the face `mode-line'. */
1434 face `mode-line'. */
1435 1428
1436#define CURRENT_MODE_LINE_HEIGHT(W) \ 1429#define CURRENT_MODE_LINE_HEIGHT(W) \
1437 (current_mode_line_height >= 0 \ 1430 (W->mode_line_height >= 0 \
1438 ? current_mode_line_height \ 1431 ? W->mode_line_height \
1439 : (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \ 1432 : (W->mode_line_height \
1440 ? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \ 1433 = (MATRIX_MODE_LINE_HEIGHT (W->current_matrix) \
1441 : estimate_mode_line_height (XFRAME ((W)->frame), \ 1434 ? MATRIX_MODE_LINE_HEIGHT (W->current_matrix) \
1442 CURRENT_MODE_LINE_FACE_ID (W)))) 1435 : estimate_mode_line_height \
1436 (XFRAME (W->frame), CURRENT_MODE_LINE_FACE_ID (W)))))
1443 1437
1444/* Return the current height of the header line of window W. If not 1438/* Return the current height of the header line of window W. If not known
1445 known from current_header_line_height, look at W's current glyph 1439 from W->header_line_height, look at W's current glyph matrix, or return
1446 matrix, or return an estimation based on the height of the font of 1440 an estimation based on the height of the font of the face `header-line'. */
1447 the face `header-line'. */
1448 1441
1449#define CURRENT_HEADER_LINE_HEIGHT(W) \ 1442#define CURRENT_HEADER_LINE_HEIGHT(W) \
1450 (current_header_line_height >= 0 \ 1443 (W->header_line_height >= 0 \
1451 ? current_header_line_height \ 1444 ? W->header_line_height \
1452 : (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \ 1445 : (W->header_line_height \
1453 ? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \ 1446 = (MATRIX_HEADER_LINE_HEIGHT (W->current_matrix) \
1454 : estimate_mode_line_height (XFRAME ((W)->frame), \ 1447 ? MATRIX_HEADER_LINE_HEIGHT (W->current_matrix) \
1455 HEADER_LINE_FACE_ID))) 1448 : estimate_mode_line_height \
1449 (XFRAME (W->frame), HEADER_LINE_FACE_ID))))
1456 1450
1457/* Return the height of the desired mode line of window W. */ 1451/* Return the height of the desired mode line of window W. */
1458 1452
@@ -3201,7 +3195,6 @@ int frame_mode_line_height (struct frame *);
3201extern Lisp_Object Qtool_bar; 3195extern Lisp_Object Qtool_bar;
3202extern bool redisplaying_p; 3196extern bool redisplaying_p;
3203extern int help_echo_showing_p; 3197extern int help_echo_showing_p;
3204extern int current_mode_line_height, current_header_line_height;
3205extern Lisp_Object help_echo_string, help_echo_window; 3198extern Lisp_Object help_echo_string, help_echo_window;
3206extern Lisp_Object help_echo_object, previous_help_echo_string; 3199extern Lisp_Object help_echo_object, previous_help_echo_string;
3207extern ptrdiff_t help_echo_pos; 3200extern ptrdiff_t help_echo_pos;
@@ -3215,6 +3208,7 @@ extern ptrdiff_t compute_display_string_pos (struct text_pos *,
3215extern ptrdiff_t compute_display_string_end (ptrdiff_t, 3208extern ptrdiff_t compute_display_string_end (ptrdiff_t,
3216 struct bidi_string_data *); 3209 struct bidi_string_data *);
3217extern void produce_stretch_glyph (struct it *); 3210extern void produce_stretch_glyph (struct it *);
3211extern int merge_glyphless_glyph_face (struct it *);
3218 3212
3219#ifdef HAVE_WINDOW_SYSTEM 3213#ifdef HAVE_WINDOW_SYSTEM
3220 3214
@@ -3455,7 +3449,7 @@ extern void cancel_line (int, struct frame *);
3455extern void init_desired_glyphs (struct frame *); 3449extern void init_desired_glyphs (struct frame *);
3456extern bool update_frame (struct frame *, bool, bool); 3450extern bool update_frame (struct frame *, bool, bool);
3457extern void bitch_at_user (void); 3451extern void bitch_at_user (void);
3458void adjust_glyphs (struct frame *); 3452extern void adjust_frame_glyphs (struct frame *);
3459void free_glyphs (struct frame *); 3453void free_glyphs (struct frame *);
3460void free_window_matrices (struct window *); 3454void free_window_matrices (struct window *);
3461void check_glyph_memory (void); 3455void check_glyph_memory (void);
diff --git a/src/dispnew.c b/src/dispnew.c
index 1d7cad13e6d..00abf65248c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -77,7 +77,6 @@ struct dim
77static void update_frame_line (struct frame *, int); 77static void update_frame_line (struct frame *, int);
78static int required_matrix_height (struct window *); 78static int required_matrix_height (struct window *);
79static int required_matrix_width (struct window *); 79static int required_matrix_width (struct window *);
80static void adjust_frame_glyphs (struct frame *);
81static void change_frame_size_1 (struct frame *, int, int, bool, bool, bool); 80static void change_frame_size_1 (struct frame *, int, int, bool, bool, bool);
82static void increment_row_positions (struct glyph_row *, ptrdiff_t, ptrdiff_t); 81static void increment_row_positions (struct glyph_row *, ptrdiff_t, ptrdiff_t);
83static void fill_up_frame_row_with_spaces (struct glyph_row *, int); 82static void fill_up_frame_row_with_spaces (struct glyph_row *, int);
@@ -152,16 +151,6 @@ static int glyph_pool_count;
152 151
153static struct frame *frame_matrix_frame; 152static struct frame *frame_matrix_frame;
154 153
155/* True means that fonts have been loaded since the last glyph
156 matrix adjustments. Redisplay must stop, and glyph matrices must
157 be adjusted when this flag becomes true during display. The
158 reason fonts can be loaded so late is that fonts of fontsets are
159 loaded on demand. Another reason is that a line contains many
160 characters displayed by zero width or very narrow glyphs of
161 variable-width fonts. */
162
163bool fonts_changed_p;
164
165/* Convert vpos and hpos from frame to window and vice versa. 154/* Convert vpos and hpos from frame to window and vice versa.
166 This may only be used for terminal frames. */ 155 This may only be used for terminal frames. */
167 156
@@ -433,7 +422,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
433 || right != matrix->right_margin_glyphs); 422 || right != matrix->right_margin_glyphs);
434 423
435 if (!marginal_areas_changed_p 424 if (!marginal_areas_changed_p
436 && !fonts_changed_p 425 && !XFRAME (w->frame)->fonts_changed
437 && !header_line_changed_p 426 && !header_line_changed_p
438 && matrix->window_left_col == WINDOW_LEFT_EDGE_COL (w) 427 && matrix->window_left_col == WINDOW_LEFT_EDGE_COL (w)
439 && matrix->window_top_line == WINDOW_TOP_EDGE_LINE (w) 428 && matrix->window_top_line == WINDOW_TOP_EDGE_LINE (w)
@@ -1799,37 +1788,17 @@ allocate_matrices_for_window_redisplay (struct window *w)
1799 } 1788 }
1800} 1789}
1801 1790
1802 1791/* Allocate/reallocate glyph matrices of a single frame F.
1803/* Re-allocate/ re-compute glyph matrices on frame F. If F is null, 1792 This function must be called when a new frame is created,
1804 do it for all frames; otherwise do it just for the given frame. 1793 its size changes, or its window configuration changes. */
1805 This function must be called when a new frame is created, its size
1806 changes, or its window configuration changes. */
1807 1794
1808void 1795void
1809adjust_glyphs (struct frame *f) 1796adjust_frame_glyphs (struct frame *f)
1810{ 1797{
1811 /* Block input so that expose events and other events that access 1798 /* Block input so that expose events and other events that access
1812 glyph matrices are not processed while we are changing them. */ 1799 glyph matrices are not processed while we are changing them. */
1813 block_input (); 1800 block_input ();
1814 1801
1815 if (f)
1816 adjust_frame_glyphs (f);
1817 else
1818 {
1819 Lisp_Object tail, lisp_frame;
1820
1821 FOR_EACH_FRAME (tail, lisp_frame)
1822 adjust_frame_glyphs (XFRAME (lisp_frame));
1823 }
1824
1825 unblock_input ();
1826}
1827
1828/* Allocate/reallocate glyph matrices of a single frame F. */
1829
1830static void
1831adjust_frame_glyphs (struct frame *f)
1832{
1833 if (FRAME_WINDOW_P (f)) 1802 if (FRAME_WINDOW_P (f))
1834 adjust_frame_glyphs_for_window_redisplay (f); 1803 adjust_frame_glyphs_for_window_redisplay (f);
1835 else 1804 else
@@ -1839,6 +1808,8 @@ adjust_frame_glyphs (struct frame *f)
1839 adjust_decode_mode_spec_buffer (f); 1808 adjust_decode_mode_spec_buffer (f);
1840 1809
1841 f->glyphs_initialized_p = 1; 1810 f->glyphs_initialized_p = 1;
1811
1812 unblock_input ();
1842} 1813}
1843 1814
1844/* Return true if any window in the tree has nonzero window margins. See 1815/* Return true if any window in the tree has nonzero window margins. See
@@ -5546,7 +5517,7 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth,
5546 w->cursor.vpos = w->cursor.y = 0; 5517 w->cursor.vpos = w->cursor.y = 0;
5547 } 5518 }
5548 5519
5549 adjust_glyphs (f); 5520 adjust_frame_glyphs (f);
5550 calculate_costs (f); 5521 calculate_costs (f);
5551 SET_FRAME_GARBAGED (f); 5522 SET_FRAME_GARBAGED (f);
5552 f->resized_p = 1; 5523 f->resized_p = 1;
diff --git a/src/eval.c b/src/eval.c
index 1ce14ae94a6..9db4d1fd81b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2146,11 +2146,10 @@ eval_sub (Lisp_Object form)
2146 2146
2147 /* Optimize for no indirection. */ 2147 /* Optimize for no indirection. */
2148 fun = original_fun; 2148 fun = original_fun;
2149 if (SYMBOLP (fun) && !NILP (fun) 2149 if (!SYMBOLP (fun))
2150 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2151 fun = indirect_function (fun);
2152 else
2153 fun = Ffunction (Fcons (fun, Qnil)); 2150 fun = Ffunction (Fcons (fun, Qnil));
2151 else if (!NILP (fun) && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2152 fun = indirect_function (fun);
2154 2153
2155 if (SUBRP (fun)) 2154 if (SUBRP (fun))
2156 { 2155 {
diff --git a/src/font.c b/src/font.c
index 49398e1b876..2606a25dff8 100644
--- a/src/font.c
+++ b/src/font.c
@@ -2866,14 +2866,14 @@ font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size)
2866 { 2866 {
2867 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width; 2867 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width;
2868 FRAME_SMALLEST_FONT_HEIGHT (f) = height; 2868 FRAME_SMALLEST_FONT_HEIGHT (f) = height;
2869 fonts_changed_p = 1; 2869 f->fonts_changed = 1;
2870 } 2870 }
2871 else 2871 else
2872 { 2872 {
2873 if (FRAME_SMALLEST_CHAR_WIDTH (f) > min_width) 2873 if (FRAME_SMALLEST_CHAR_WIDTH (f) > min_width)
2874 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width, fonts_changed_p = 1; 2874 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width, f->fonts_changed = 1;
2875 if (FRAME_SMALLEST_FONT_HEIGHT (f) > height) 2875 if (FRAME_SMALLEST_FONT_HEIGHT (f) > height)
2876 FRAME_SMALLEST_FONT_HEIGHT (f) = height, fonts_changed_p = 1; 2876 FRAME_SMALLEST_FONT_HEIGHT (f) = height, f->fonts_changed = 1;
2877 } 2877 }
2878#endif 2878#endif
2879 2879
diff --git a/src/frame.c b/src/frame.c
index b4638ed53c8..0f1560df157 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -224,7 +224,7 @@ set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
224 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 224 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
225 FRAME_MENU_BAR_LINES (f) = nlines; 225 FRAME_MENU_BAR_LINES (f) = nlines;
226 set_menu_bar_lines_1 (f->root_window, nlines - olines); 226 set_menu_bar_lines_1 (f->root_window, nlines - olines);
227 adjust_glyphs (f); 227 adjust_frame_glyphs (f);
228 } 228 }
229} 229}
230 230
@@ -712,7 +712,7 @@ affects all frames on the same terminal device. */)
712 change_frame_size (f, height, width, 0, 0, 0); 712 change_frame_size (f, height, width, 0, 0, 0);
713 } 713 }
714 714
715 adjust_glyphs (f); 715 adjust_frame_glyphs (f);
716 calculate_costs (f); 716 calculate_costs (f);
717 XSETFRAME (frame, f); 717 XSETFRAME (frame, f);
718 718
diff --git a/src/frame.h b/src/frame.h
index 17b6089120a..3dfbac15709 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -210,6 +210,13 @@ struct frame
210 unsigned external_tool_bar : 1; 210 unsigned external_tool_bar : 1;
211#endif 211#endif
212 212
213 /* Nonzero means that fonts have been loaded since the last glyph
214 matrix adjustments. */
215 unsigned fonts_changed : 1;
216
217 /* Nonzero means that cursor type has been changed. */
218 unsigned cursor_type_changed : 1;
219
213 /* Margin at the top of the frame. Used to display the tool-bar. */ 220 /* Margin at the top of the frame. Used to display the tool-bar. */
214 int tool_bar_lines; 221 int tool_bar_lines;
215 222
diff --git a/src/gfilenotify.c b/src/gfilenotify.c
index 8f13c72df81..7415c3a2413 100644
--- a/src/gfilenotify.c
+++ b/src/gfilenotify.c
@@ -249,7 +249,9 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */)
249void 249void
250globals_of_gfilenotify (void) 250globals_of_gfilenotify (void)
251{ 251{
252#if ! GLIB_CHECK_VERSION (2, 36, 0)
252 g_type_init (); 253 g_type_init ();
254#endif
253 watch_list = Qnil; 255 watch_list = Qnil;
254} 256}
255 257
diff --git a/src/lisp.h b/src/lisp.h
index 27359ffeb3f..38b538d9bc2 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3359,9 +3359,6 @@ extern Lisp_Object Qglyphless_char;
3359extern Lisp_Object QCdata, QCfile; 3359extern Lisp_Object QCdata, QCfile;
3360extern Lisp_Object QCmap; 3360extern Lisp_Object QCmap;
3361extern Lisp_Object Qrisky_local_variable; 3361extern Lisp_Object Qrisky_local_variable;
3362extern struct frame *last_glyphless_glyph_frame;
3363extern int last_glyphless_glyph_face_id;
3364extern int last_glyphless_glyph_merged_face_id;
3365extern int noninteractive_need_newline; 3362extern int noninteractive_need_newline;
3366extern Lisp_Object echo_area_buffer[2]; 3363extern Lisp_Object echo_area_buffer[2];
3367extern void add_to_log (const char *, Lisp_Object, Lisp_Object); 3364extern void add_to_log (const char *, Lisp_Object, Lisp_Object);
diff --git a/src/term.c b/src/term.c
index aa61fde06ee..0270c1eefa6 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1800,27 +1800,10 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str)
1800static void 1800static void
1801produce_glyphless_glyph (struct it *it, Lisp_Object acronym) 1801produce_glyphless_glyph (struct it *it, Lisp_Object acronym)
1802{ 1802{
1803 int face_id; 1803 int len, face_id = merge_glyphless_glyph_face (it);
1804 int len;
1805 char buf[sizeof "\\x" + max (6, (sizeof it->c * CHAR_BIT + 3) / 4)]; 1804 char buf[sizeof "\\x" + max (6, (sizeof it->c * CHAR_BIT + 3) / 4)];
1806 char const *str = " "; 1805 char const *str = " ";
1807 1806
1808 /* Get a face ID for the glyph by utilizing a cache (the same way as
1809 done for `escape-glyph' in get_next_display_element). */
1810 if (it->f == last_glyphless_glyph_frame
1811 && it->face_id == last_glyphless_glyph_face_id)
1812 {
1813 face_id = last_glyphless_glyph_merged_face_id;
1814 }
1815 else
1816 {
1817 /* Merge the `glyphless-char' face into the current face. */
1818 face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
1819 last_glyphless_glyph_frame = it->f;
1820 last_glyphless_glyph_face_id = it->face_id;
1821 last_glyphless_glyph_merged_face_id = face_id;
1822 }
1823
1824 if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) 1807 if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
1825 { 1808 {
1826 /* As there's no way to produce a thin space, we produce a space 1809 /* As there's no way to produce a thin space, we produce a space
diff --git a/src/w32fns.c b/src/w32fns.c
index b8c445a3a36..58c63d959ef 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1637,7 +1637,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1637 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); 1637 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
1638 do_pending_window_change (0); 1638 do_pending_window_change (0);
1639 } 1639 }
1640 adjust_glyphs (f); 1640 adjust_frame_glyphs (f);
1641} 1641}
1642 1642
1643 1643
@@ -1679,7 +1679,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1679 1679
1680 FRAME_TOOL_BAR_LINES (f) = nlines; 1680 FRAME_TOOL_BAR_LINES (f) = nlines;
1681 resize_frame_windows (f, FRAME_LINES (f), 0); 1681 resize_frame_windows (f, FRAME_LINES (f), 0);
1682 adjust_glyphs (f); 1682 adjust_frame_glyphs (f);
1683 1683
1684 /* We also have to make sure that the internal border at the top of 1684 /* We also have to make sure that the internal border at the top of
1685 the frame, below the menu bar or tool bar, is redrawn when the 1685 the frame, below the menu bar or tool bar, is redrawn when the
@@ -6059,7 +6059,7 @@ Text larger than the specified size is clipped. */)
6059 } 6059 }
6060 6060
6061 FRAME_TOTAL_COLS (f) = WINDOW_TOTAL_COLS (w); 6061 FRAME_TOTAL_COLS (f) = WINDOW_TOTAL_COLS (w);
6062 adjust_glyphs (f); 6062 adjust_frame_glyphs (f);
6063 w->pseudo_window_p = 1; 6063 w->pseudo_window_p = 1;
6064 6064
6065 /* Display the tooltip text in a temporary buffer. */ 6065 /* Display the tooltip text in a temporary buffer. */
@@ -6128,7 +6128,7 @@ Text larger than the specified size is clipped. */)
6128 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 6128 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
6129 w->total_cols = width; 6129 w->total_cols = width;
6130 FRAME_TOTAL_COLS (f) = width; 6130 FRAME_TOTAL_COLS (f) = width;
6131 adjust_glyphs (f); 6131 adjust_frame_glyphs (f);
6132 w->pseudo_window_p = 1; 6132 w->pseudo_window_p = 1;
6133 clear_glyph_matrix (w->desired_matrix); 6133 clear_glyph_matrix (w->desired_matrix);
6134 clear_glyph_matrix (w->current_matrix); 6134 clear_glyph_matrix (w->current_matrix);
diff --git a/src/window.c b/src/window.c
index d8a6976e090..6a52ed7e166 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2945,7 +2945,7 @@ window-start value is reasonable when this function is called. */)
2945 } 2945 }
2946 } 2946 }
2947 2947
2948 adjust_glyphs (f); 2948 adjust_frame_glyphs (f);
2949 unblock_input (); 2949 unblock_input ();
2950 2950
2951 run_window_configuration_change_hook (f); 2951 run_window_configuration_change_hook (f);
@@ -3419,6 +3419,7 @@ make_window (void)
3419 non-Lisp data, so do it only for slots which should not be zero. */ 3419 non-Lisp data, so do it only for slots which should not be zero. */
3420 w->nrows_scale_factor = w->ncols_scale_factor = 1; 3420 w->nrows_scale_factor = w->ncols_scale_factor = 1;
3421 w->left_fringe_width = w->right_fringe_width = -1; 3421 w->left_fringe_width = w->right_fringe_width = -1;
3422 w->mode_line_height = w->header_line_height = -1;
3422 w->phys_cursor_type = -1; 3423 w->phys_cursor_type = -1;
3423 w->phys_cursor_width = -1; 3424 w->phys_cursor_width = -1;
3424 w->scroll_bar_width = -1; 3425 w->scroll_bar_width = -1;
@@ -3644,7 +3645,7 @@ be applied on the Elisp level. */)
3644 windows_or_buffers_changed++; 3645 windows_or_buffers_changed++;
3645 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3646 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3646 3647
3647 adjust_glyphs (f); 3648 adjust_frame_glyphs (f);
3648 unblock_input (); 3649 unblock_input ();
3649 3650
3650 run_window_configuration_change_hook (f); 3651 run_window_configuration_change_hook (f);
@@ -3914,7 +3915,7 @@ set correctly. See the code of `split-window' for how this is done. */)
3914 3915
3915 block_input (); 3916 block_input ();
3916 window_resize_apply (p, horflag); 3917 window_resize_apply (p, horflag);
3917 adjust_glyphs (f); 3918 adjust_frame_glyphs (f);
3918 /* Set buffer of NEW to buffer of reference window. Don't run 3919 /* Set buffer of NEW to buffer of reference window. Don't run
3919 any hooks. */ 3920 any hooks. */
3920 set_window_buffer (new, r->contents, 0, 1); 3921 set_window_buffer (new, r->contents, 0, 1);
@@ -4043,7 +4044,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4043 recombine_windows (sibling); 4044 recombine_windows (sibling);
4044 } 4045 }
4045 4046
4046 adjust_glyphs (f); 4047 adjust_frame_glyphs (f);
4047 4048
4048 if (!WINDOW_LIVE_P (FRAME_SELECTED_WINDOW (f))) 4049 if (!WINDOW_LIVE_P (FRAME_SELECTED_WINDOW (f)))
4049 /* We deleted the frame's selected window. */ 4050 /* We deleted the frame's selected window. */
@@ -4130,7 +4131,7 @@ grow_mini_window (struct window *w, int delta)
4130 w->total_lines -= XINT (value); 4131 w->total_lines -= XINT (value);
4131 /* Enforce full redisplay. FIXME: make it more selective. */ 4132 /* Enforce full redisplay. FIXME: make it more selective. */
4132 windows_or_buffers_changed++; 4133 windows_or_buffers_changed++;
4133 adjust_glyphs (f); 4134 adjust_frame_glyphs (f);
4134 unblock_input (); 4135 unblock_input ();
4135 } 4136 }
4136} 4137}
@@ -4164,7 +4165,7 @@ shrink_mini_window (struct window *w)
4164 w->total_lines = 1; 4165 w->total_lines = 1;
4165 /* Enforce full redisplay. FIXME: make it more selective. */ 4166 /* Enforce full redisplay. FIXME: make it more selective. */
4166 windows_or_buffers_changed++; 4167 windows_or_buffers_changed++;
4167 adjust_glyphs (f); 4168 adjust_frame_glyphs (f);
4168 unblock_input (); 4169 unblock_input ();
4169 } 4170 }
4170 /* If the above failed for whatever strange reason we must make a 4171 /* If the above failed for whatever strange reason we must make a
@@ -4205,7 +4206,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4205 4206
4206 windows_or_buffers_changed++; 4207 windows_or_buffers_changed++;
4207 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4208 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
4208 adjust_glyphs (f); 4209 adjust_frame_glyphs (f);
4209 unblock_input (); 4210 unblock_input ();
4210 4211
4211 run_window_configuration_change_hook (f); 4212 run_window_configuration_change_hook (f);
@@ -4476,7 +4477,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror)
4476 visible. */ 4477 visible. */
4477 w->vscroll = (it.last_visible_y 4478 w->vscroll = (it.last_visible_y
4478 - it.current_y + it.max_ascent + it.max_descent); 4479 - it.current_y + it.max_ascent + it.max_descent);
4479 adjust_glyphs (it.f); 4480 adjust_frame_glyphs (it.f);
4480 } 4481 }
4481 else 4482 else
4482 { 4483 {
@@ -5753,7 +5754,7 @@ the return value is nil. Otherwise the value is t. */)
5753 ++n; 5754 ++n;
5754 } 5755 }
5755 5756
5756 adjust_glyphs (f); 5757 adjust_frame_glyphs (f);
5757 unblock_input (); 5758 unblock_input ();
5758 5759
5759 /* Scan dead buffer windows. */ 5760 /* Scan dead buffer windows. */
@@ -6082,7 +6083,7 @@ apply_window_adjustment (struct window *w)
6082 clear_glyph_matrix (w->current_matrix); 6083 clear_glyph_matrix (w->current_matrix);
6083 w->window_end_valid = 0; 6084 w->window_end_valid = 0;
6084 windows_or_buffers_changed++; 6085 windows_or_buffers_changed++;
6085 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6086 adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w)));
6086} 6087}
6087 6088
6088 6089
@@ -6348,7 +6349,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */)
6348 /* Adjust glyph matrix of the frame if the virtual display 6349 /* Adjust glyph matrix of the frame if the virtual display
6349 area becomes larger than before. */ 6350 area becomes larger than before. */
6350 if (w->vscroll < 0 && w->vscroll < old_dy) 6351 if (w->vscroll < 0 && w->vscroll < old_dy)
6351 adjust_glyphs (f); 6352 adjust_frame_glyphs (f);
6352 6353
6353 /* Prevent redisplay shortcuts. */ 6354 /* Prevent redisplay shortcuts. */
6354 XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; 6355 XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1;
diff --git a/src/window.h b/src/window.h
index efe03737052..f5ae81149b3 100644
--- a/src/window.h
+++ b/src/window.h
@@ -264,6 +264,12 @@ struct window
264 A value of -1 means use frame values. */ 264 A value of -1 means use frame values. */
265 int scroll_bar_width; 265 int scroll_bar_width;
266 266
267 /* Effective height of the mode line, or -1 if not known. */
268 int mode_line_height;
269
270 /* Effective height of the header line, or -1 if not known. */
271 int header_line_height;
272
267 /* Z - the buffer position of the last glyph in the current 273 /* Z - the buffer position of the last glyph in the current
268 matrix of W. Only valid if window_end_valid is nonzero. */ 274 matrix of W. Only valid if window_end_valid is nonzero. */
269 ptrdiff_t window_end_pos; 275 ptrdiff_t window_end_pos;
diff --git a/src/xdisp.c b/src/xdisp.c
index c096fcd340f..d5def065936 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -512,10 +512,6 @@ int update_mode_lines;
512 512
513int windows_or_buffers_changed; 513int windows_or_buffers_changed;
514 514
515/* Nonzero means a frame's cursor type has been changed. */
516
517static int cursor_type_changed;
518
519/* Nonzero after display_mode_line if %l was used and it displayed a 515/* Nonzero after display_mode_line if %l was used and it displayed a
520 line number. */ 516 line number. */
521 517
@@ -573,12 +569,6 @@ static int last_height;
573 569
574int help_echo_showing_p; 570int help_echo_showing_p;
575 571
576/* If >= 0, computed, exact values of mode-line and header-line height
577 to use in the macros CURRENT_MODE_LINE_HEIGHT and
578 CURRENT_HEADER_LINE_HEIGHT. */
579
580int current_mode_line_height, current_header_line_height;
581
582/* The maximum distance to look ahead for text properties. Values 572/* The maximum distance to look ahead for text properties. Values
583 that are too small let us call compute_char_face and similar 573 that are too small let us call compute_char_face and similar
584 functions too often which is expensive. Values that are too large 574 functions too often which is expensive. Values that are too large
@@ -1349,12 +1339,12 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1349 1339
1350 /* Compute exact mode line heights. */ 1340 /* Compute exact mode line heights. */
1351 if (WINDOW_WANTS_MODELINE_P (w)) 1341 if (WINDOW_WANTS_MODELINE_P (w))
1352 current_mode_line_height 1342 w->mode_line_height
1353 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w), 1343 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
1354 BVAR (current_buffer, mode_line_format)); 1344 BVAR (current_buffer, mode_line_format));
1355 1345
1356 if (WINDOW_WANTS_HEADER_LINE_P (w)) 1346 if (WINDOW_WANTS_HEADER_LINE_P (w))
1357 current_header_line_height 1347 w->header_line_height
1358 = display_mode_line (w, HEADER_LINE_FACE_ID, 1348 = display_mode_line (w, HEADER_LINE_FACE_ID,
1359 BVAR (current_buffer, header_line_format)); 1349 BVAR (current_buffer, header_line_format));
1360 1350
@@ -1647,8 +1637,6 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1647 if (old_buffer) 1637 if (old_buffer)
1648 set_buffer_internal_1 (old_buffer); 1638 set_buffer_internal_1 (old_buffer);
1649 1639
1650 current_header_line_height = current_mode_line_height = -1;
1651
1652 if (visible_p && w->hscroll > 0) 1640 if (visible_p && w->hscroll > 0)
1653 *x -= 1641 *x -=
1654 window_hscroll_limited (w, WINDOW_XFRAME (w)) 1642 window_hscroll_limited (w, WINDOW_XFRAME (w))
@@ -6678,17 +6666,59 @@ lookup_glyphless_char_display (int c, struct it *it)
6678 return glyphless_method; 6666 return glyphless_method;
6679} 6667}
6680 6668
6681/* Load IT's display element fields with information about the next 6669/* Merge escape glyph face and cache the result. */
6682 display element from the current position of IT. Value is zero if
6683 end of buffer (or C string) is reached. */
6684 6670
6685static struct frame *last_escape_glyph_frame = NULL; 6671static struct frame *last_escape_glyph_frame = NULL;
6686static int last_escape_glyph_face_id = (1 << FACE_ID_BITS); 6672static int last_escape_glyph_face_id = (1 << FACE_ID_BITS);
6687static int last_escape_glyph_merged_face_id = 0; 6673static int last_escape_glyph_merged_face_id = 0;
6688 6674
6689struct frame *last_glyphless_glyph_frame = NULL; 6675static int
6690int last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); 6676merge_escape_glyph_face (struct it *it)
6691int last_glyphless_glyph_merged_face_id = 0; 6677{
6678 int face_id;
6679
6680 if (it->f == last_escape_glyph_frame
6681 && it->face_id == last_escape_glyph_face_id)
6682 face_id = last_escape_glyph_merged_face_id;
6683 else
6684 {
6685 /* Merge the `escape-glyph' face into the current face. */
6686 face_id = merge_faces (it->f, Qescape_glyph, 0, it->face_id);
6687 last_escape_glyph_frame = it->f;
6688 last_escape_glyph_face_id = it->face_id;
6689 last_escape_glyph_merged_face_id = face_id;
6690 }
6691 return face_id;
6692}
6693
6694/* Likewise for glyphless glyph face. */
6695
6696static struct frame *last_glyphless_glyph_frame = NULL;
6697static int last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
6698static int last_glyphless_glyph_merged_face_id = 0;
6699
6700int
6701merge_glyphless_glyph_face (struct it *it)
6702{
6703 int face_id;
6704
6705 if (it->f == last_glyphless_glyph_frame
6706 && it->face_id == last_glyphless_glyph_face_id)
6707 face_id = last_glyphless_glyph_merged_face_id;
6708 else
6709 {
6710 /* Merge the `glyphless-char' face into the current face. */
6711 face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
6712 last_glyphless_glyph_frame = it->f;
6713 last_glyphless_glyph_face_id = it->face_id;
6714 last_glyphless_glyph_merged_face_id = face_id;
6715 }
6716 return face_id;
6717}
6718
6719/* Load IT's display element fields with information about the next
6720 display element from the current position of IT. Value is zero if
6721 end of buffer (or C string) is reached. */
6692 6722
6693static int 6723static int
6694get_next_display_element (struct it *it) 6724get_next_display_element (struct it *it)
@@ -6836,24 +6866,10 @@ get_next_display_element (struct it *it)
6836 g = GLYPH_CODE_CHAR (gc); 6866 g = GLYPH_CODE_CHAR (gc);
6837 lface_id = GLYPH_CODE_FACE (gc); 6867 lface_id = GLYPH_CODE_FACE (gc);
6838 } 6868 }
6839 if (lface_id) 6869
6840 { 6870 face_id = (lface_id
6841 face_id = merge_faces (it->f, Qt, lface_id, it->face_id); 6871 ? merge_faces (it->f, Qt, lface_id, it->face_id)
6842 } 6872 : merge_escape_glyph_face (it));
6843 else if (it->f == last_escape_glyph_frame
6844 && it->face_id == last_escape_glyph_face_id)
6845 {
6846 face_id = last_escape_glyph_merged_face_id;
6847 }
6848 else
6849 {
6850 /* Merge the escape-glyph face into the current face. */
6851 face_id = merge_faces (it->f, Qescape_glyph, 0,
6852 it->face_id);
6853 last_escape_glyph_frame = it->f;
6854 last_escape_glyph_face_id = it->face_id;
6855 last_escape_glyph_merged_face_id = face_id;
6856 }
6857 6873
6858 XSETINT (it->ctl_chars[0], g); 6874 XSETINT (it->ctl_chars[0], g);
6859 XSETINT (it->ctl_chars[1], c ^ 0100); 6875 XSETINT (it->ctl_chars[1], c ^ 0100);
@@ -6885,27 +6901,10 @@ get_next_display_element (struct it *it)
6885 escape_glyph = GLYPH_CODE_CHAR (gc); 6901 escape_glyph = GLYPH_CODE_CHAR (gc);
6886 lface_id = GLYPH_CODE_FACE (gc); 6902 lface_id = GLYPH_CODE_FACE (gc);
6887 } 6903 }
6888 if (lface_id) 6904
6889 { 6905 face_id = (lface_id
6890 /* The display table specified a face. 6906 ? merge_faces (it->f, Qt, lface_id, it->face_id)
6891 Merge it into face_id and also into escape_glyph. */ 6907 : merge_escape_glyph_face (it));
6892 face_id = merge_faces (it->f, Qt, lface_id,
6893 it->face_id);
6894 }
6895 else if (it->f == last_escape_glyph_frame
6896 && it->face_id == last_escape_glyph_face_id)
6897 {
6898 face_id = last_escape_glyph_merged_face_id;
6899 }
6900 else
6901 {
6902 /* Merge the escape-glyph face into the current face. */
6903 face_id = merge_faces (it->f, Qescape_glyph, 0,
6904 it->face_id);
6905 last_escape_glyph_frame = it->f;
6906 last_escape_glyph_face_id = it->face_id;
6907 last_escape_glyph_merged_face_id = face_id;
6908 }
6909 6908
6910 /* Draw non-ASCII hyphen with just highlighting: */ 6909 /* Draw non-ASCII hyphen with just highlighting: */
6911 6910
@@ -11993,7 +11992,7 @@ redisplay_tool_bar (struct frame *f)
11993 if (WINDOW_TOTAL_LINES (w) != old_height) 11992 if (WINDOW_TOTAL_LINES (w) != old_height)
11994 { 11993 {
11995 clear_glyph_matrix (w->desired_matrix); 11994 clear_glyph_matrix (w->desired_matrix);
11996 fonts_changed_p = 1; 11995 f->fonts_changed = 1;
11997 return 1; 11996 return 1;
11998 } 11997 }
11999 } 11998 }
@@ -12094,7 +12093,7 @@ redisplay_tool_bar (struct frame *f)
12094 { 12093 {
12095 clear_glyph_matrix (w->desired_matrix); 12094 clear_glyph_matrix (w->desired_matrix);
12096 f->n_tool_bar_rows = nrows; 12095 f->n_tool_bar_rows = nrows;
12097 fonts_changed_p = 1; 12096 f->fonts_changed = 1;
12098 return 1; 12097 return 1;
12099 } 12098 }
12100 } 12099 }
@@ -12980,15 +12979,6 @@ redisplay_internal (void)
12980 last_glyphless_glyph_frame = NULL; 12979 last_glyphless_glyph_frame = NULL;
12981 last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); 12980 last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
12982 12981
12983 /* If new fonts have been loaded that make a glyph matrix adjustment
12984 necessary, do it. */
12985 if (fonts_changed_p)
12986 {
12987 adjust_glyphs (NULL);
12988 ++windows_or_buffers_changed;
12989 fonts_changed_p = 0;
12990 }
12991
12992 /* If face_change_count is non-zero, init_iterator will free all 12982 /* If face_change_count is non-zero, init_iterator will free all
12993 realized faces, which includes the faces referenced from current 12983 realized faces, which includes the faces referenced from current
12994 matrices. So, we can't reuse current matrices in this case. */ 12984 matrices. So, we can't reuse current matrices in this case. */
@@ -13019,7 +13009,19 @@ redisplay_internal (void)
13019 struct frame *f = XFRAME (frame); 13009 struct frame *f = XFRAME (frame);
13020 13010
13021 if (FRAME_VISIBLE_P (f)) 13011 if (FRAME_VISIBLE_P (f))
13022 ++number_of_visible_frames; 13012 {
13013 ++number_of_visible_frames;
13014 /* Adjust matrices for visible frames only. */
13015 if (f->fonts_changed)
13016 {
13017 adjust_frame_glyphs (f);
13018 f->fonts_changed = 0;
13019 }
13020 /* If cursor type has been changed on the frame
13021 other than selected, consider all frames. */
13022 if (f != sf && f->cursor_type_changed)
13023 update_mode_lines++;
13024 }
13023 clear_desired_matrices (f); 13025 clear_desired_matrices (f);
13024 } 13026 }
13025 13027
@@ -13068,8 +13070,7 @@ redisplay_internal (void)
13068 } 13070 }
13069 13071
13070 consider_all_windows_p = (update_mode_lines 13072 consider_all_windows_p = (update_mode_lines
13071 || buffer_shared_and_changed () 13073 || buffer_shared_and_changed ());
13072 || cursor_type_changed);
13073 13074
13074 /* If specs for an arrow have changed, do thorough redisplay 13075 /* If specs for an arrow have changed, do thorough redisplay
13075 to ensure we remove any arrow that should no longer exist. */ 13076 to ensure we remove any arrow that should no longer exist. */
@@ -13103,9 +13104,7 @@ redisplay_internal (void)
13103 if (!display_last_displayed_message_p) 13104 if (!display_last_displayed_message_p)
13104 message_cleared_p = 0; 13105 message_cleared_p = 0;
13105 13106
13106 if (fonts_changed_p) 13107 if (window_height_changed_p)
13107 goto retry;
13108 else if (window_height_changed_p)
13109 { 13108 {
13110 consider_all_windows_p = 1; 13109 consider_all_windows_p = 1;
13111 ++update_mode_lines; 13110 ++update_mode_lines;
@@ -13162,6 +13161,7 @@ redisplay_internal (void)
13162 && !current_buffer->prevent_redisplay_optimizations_p 13161 && !current_buffer->prevent_redisplay_optimizations_p
13163 && FRAME_VISIBLE_P (XFRAME (w->frame)) 13162 && FRAME_VISIBLE_P (XFRAME (w->frame))
13164 && !FRAME_OBSCURED_P (XFRAME (w->frame)) 13163 && !FRAME_OBSCURED_P (XFRAME (w->frame))
13164 && !XFRAME (w->frame)->cursor_type_changed
13165 /* Make sure recorded data applies to current buffer, etc. */ 13165 /* Make sure recorded data applies to current buffer, etc. */
13166 && this_line_buffer == current_buffer 13166 && this_line_buffer == current_buffer
13167 && match_p 13167 && match_p
@@ -13380,6 +13380,8 @@ redisplay_internal (void)
13380 && !EQ (FRAME_TTY (f)->top_frame, frame)) 13380 && !EQ (FRAME_TTY (f)->top_frame, frame))
13381 continue; 13381 continue;
13382 13382
13383 retry_frame:
13384
13383 if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf) 13385 if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf)
13384 { 13386 {
13385 /* Mark all the scroll bars to be removed; we'll redeem 13387 /* Mark all the scroll bars to be removed; we'll redeem
@@ -13399,20 +13401,22 @@ redisplay_internal (void)
13399 if (FRAME_TERMINAL (f)->judge_scroll_bars_hook) 13401 if (FRAME_TERMINAL (f)->judge_scroll_bars_hook)
13400 FRAME_TERMINAL (f)->judge_scroll_bars_hook (f); 13402 FRAME_TERMINAL (f)->judge_scroll_bars_hook (f);
13401 13403
13402 /* If fonts changed, display again. */
13403 /* ??? rms: I suspect it is a mistake to jump all the way
13404 back to retry here. It should just retry this frame. */
13405 if (fonts_changed_p)
13406 goto retry;
13407
13408 if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f)) 13404 if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f))
13409 { 13405 {
13406 /* If fonts changed on visible frame, display again. */
13407 if (f->fonts_changed)
13408 {
13409 adjust_frame_glyphs (f);
13410 f->fonts_changed = 0;
13411 goto retry_frame;
13412 }
13413
13410 /* See if we have to hscroll. */ 13414 /* See if we have to hscroll. */
13411 if (!f->already_hscrolled_p) 13415 if (!f->already_hscrolled_p)
13412 { 13416 {
13413 f->already_hscrolled_p = 1; 13417 f->already_hscrolled_p = 1;
13414 if (hscroll_windows (f->root_window)) 13418 if (hscroll_windows (f->root_window))
13415 goto retry; 13419 goto retry_frame;
13416 } 13420 }
13417 13421
13418 /* Prevent various kinds of signals during display 13422 /* Prevent various kinds of signals during display
@@ -13426,6 +13430,7 @@ redisplay_internal (void)
13426 /* Update the display. */ 13430 /* Update the display. */
13427 set_window_update_flags (XWINDOW (f->root_window), 1); 13431 set_window_update_flags (XWINDOW (f->root_window), 1);
13428 pending |= update_frame (f, 0, 0); 13432 pending |= update_frame (f, 0, 0);
13433 f->cursor_type_changed = 0;
13429 f->updated_p = 1; 13434 f->updated_p = 1;
13430 } 13435 }
13431 } 13436 }
@@ -13470,7 +13475,7 @@ redisplay_internal (void)
13470 13475
13471 update: 13476 update:
13472 /* If fonts changed, display again. */ 13477 /* If fonts changed, display again. */
13473 if (fonts_changed_p) 13478 if (sf->fonts_changed)
13474 goto retry; 13479 goto retry;
13475 13480
13476 /* Prevent various kinds of signals during display update. 13481 /* Prevent various kinds of signals during display update.
@@ -13487,6 +13492,7 @@ redisplay_internal (void)
13487 13492
13488 XWINDOW (selected_window)->must_be_updated_p = 1; 13493 XWINDOW (selected_window)->must_be_updated_p = 1;
13489 pending = update_frame (sf, 0, 0); 13494 pending = update_frame (sf, 0, 0);
13495 sf->cursor_type_changed = 0;
13490 } 13496 }
13491 13497
13492 /* We may have called echo_area_display at the top of this 13498 /* We may have called echo_area_display at the top of this
@@ -13501,6 +13507,7 @@ redisplay_internal (void)
13501 { 13507 {
13502 XWINDOW (mini_window)->must_be_updated_p = 1; 13508 XWINDOW (mini_window)->must_be_updated_p = 1;
13503 pending |= update_frame (mini_frame, 0, 0); 13509 pending |= update_frame (mini_frame, 0, 0);
13510 mini_frame->cursor_type_changed = 0;
13504 if (!pending && hscroll_windows (mini_window)) 13511 if (!pending && hscroll_windows (mini_window))
13505 goto retry; 13512 goto retry;
13506 } 13513 }
@@ -13541,7 +13548,6 @@ redisplay_internal (void)
13541 13548
13542 update_mode_lines = 0; 13549 update_mode_lines = 0;
13543 windows_or_buffers_changed = 0; 13550 windows_or_buffers_changed = 0;
13544 cursor_type_changed = 0;
13545 } 13551 }
13546 13552
13547 /* Start SIGIO interrupts coming again. Having them off during the 13553 /* Start SIGIO interrupts coming again. Having them off during the
@@ -14983,7 +14989,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14983 cases. */ 14989 cases. */
14984 && !update_mode_lines 14990 && !update_mode_lines
14985 && !windows_or_buffers_changed 14991 && !windows_or_buffers_changed
14986 && !cursor_type_changed 14992 && !f->cursor_type_changed
14987 /* Can't use this case if highlighting a region. When a 14993 /* Can't use this case if highlighting a region. When a
14988 region exists, cursor movement has to do more than just 14994 region exists, cursor movement has to do more than just
14989 set the cursor. */ 14995 set the cursor. */
@@ -15330,9 +15336,8 @@ set_vertical_scroll_bar (struct window *w)
15330/* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only 15336/* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only
15331 selected_window is redisplayed. 15337 selected_window is redisplayed.
15332 15338
15333 We can return without actually redisplaying the window if 15339 We can return without actually redisplaying the window if fonts has been
15334 fonts_changed_p. In that case, redisplay_internal will 15340 changed on window's frame. In that case, redisplay_internal will retry. */
15335 retry. */
15336 15341
15337static void 15342static void
15338redisplay_window (Lisp_Object window, int just_this_one_p) 15343redisplay_window (Lisp_Object window, int just_this_one_p)
@@ -15717,7 +15722,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15717 debug_method_add (w, "try_window_id %d", tem); 15722 debug_method_add (w, "try_window_id %d", tem);
15718#endif 15723#endif
15719 15724
15720 if (fonts_changed_p) 15725 if (f->fonts_changed)
15721 goto need_larger_matrices; 15726 goto need_larger_matrices;
15722 if (tem > 0) 15727 if (tem > 0)
15723 goto done; 15728 goto done;
@@ -15787,12 +15792,12 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15787 IF_DEBUG (debug_method_add (w, "1")); 15792 IF_DEBUG (debug_method_add (w, "1"));
15788 if (try_window (window, startp, TRY_WINDOW_CHECK_MARGINS) < 0) 15793 if (try_window (window, startp, TRY_WINDOW_CHECK_MARGINS) < 0)
15789 /* -1 means we need to scroll. 15794 /* -1 means we need to scroll.
15790 0 means we need new matrices, but fonts_changed_p 15795 0 means we need new matrices, but fonts_changed
15791 is set in that case, so we will detect it below. */ 15796 is set in that case, so we will detect it below. */
15792 goto try_to_scroll; 15797 goto try_to_scroll;
15793 } 15798 }
15794 15799
15795 if (fonts_changed_p) 15800 if (f->fonts_changed)
15796 goto need_larger_matrices; 15801 goto need_larger_matrices;
15797 15802
15798 if (w->cursor.vpos >= 0) 15803 if (w->cursor.vpos >= 0)
@@ -15980,7 +15985,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15980 /* Redisplay the window. */ 15985 /* Redisplay the window. */
15981 if (!current_matrix_up_to_date_p 15986 if (!current_matrix_up_to_date_p
15982 || windows_or_buffers_changed 15987 || windows_or_buffers_changed
15983 || cursor_type_changed 15988 || f->cursor_type_changed
15984 /* Don't use try_window_reusing_current_matrix in this case 15989 /* Don't use try_window_reusing_current_matrix in this case
15985 because it can have changed the buffer. */ 15990 because it can have changed the buffer. */
15986 || !NILP (Vwindow_scroll_functions) 15991 || !NILP (Vwindow_scroll_functions)
@@ -15993,7 +15998,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15993 /* If new fonts have been loaded (due to fontsets), give up. We 15998 /* If new fonts have been loaded (due to fontsets), give up. We
15994 have to start a new redisplay since we need to re-adjust glyph 15999 have to start a new redisplay since we need to re-adjust glyph
15995 matrices. */ 16000 matrices. */
15996 if (fonts_changed_p) 16001 if (f->fonts_changed)
15997 goto need_larger_matrices; 16002 goto need_larger_matrices;
15998 16003
15999 /* If cursor did not appear assume that the middle of the window is 16004 /* If cursor did not appear assume that the middle of the window is
@@ -16106,7 +16111,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16106 if (WINDOW_WANTS_MODELINE_P (w) 16111 if (WINDOW_WANTS_MODELINE_P (w)
16107 && CURRENT_MODE_LINE_HEIGHT (w) != DESIRED_MODE_LINE_HEIGHT (w)) 16112 && CURRENT_MODE_LINE_HEIGHT (w) != DESIRED_MODE_LINE_HEIGHT (w))
16108 { 16113 {
16109 fonts_changed_p = 1; 16114 f->fonts_changed = 1;
16115 w->mode_line_height = -1;
16110 MATRIX_MODE_LINE_ROW (w->current_matrix)->height 16116 MATRIX_MODE_LINE_ROW (w->current_matrix)->height
16111 = DESIRED_MODE_LINE_HEIGHT (w); 16117 = DESIRED_MODE_LINE_HEIGHT (w);
16112 } 16118 }
@@ -16116,12 +16122,13 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16116 if (WINDOW_WANTS_HEADER_LINE_P (w) 16122 if (WINDOW_WANTS_HEADER_LINE_P (w)
16117 && CURRENT_HEADER_LINE_HEIGHT (w) != DESIRED_HEADER_LINE_HEIGHT (w)) 16123 && CURRENT_HEADER_LINE_HEIGHT (w) != DESIRED_HEADER_LINE_HEIGHT (w))
16118 { 16124 {
16119 fonts_changed_p = 1; 16125 f->fonts_changed = 1;
16126 w->header_line_height = -1;
16120 MATRIX_HEADER_LINE_ROW (w->current_matrix)->height 16127 MATRIX_HEADER_LINE_ROW (w->current_matrix)->height
16121 = DESIRED_HEADER_LINE_HEIGHT (w); 16128 = DESIRED_HEADER_LINE_HEIGHT (w);
16122 } 16129 }
16123 16130
16124 if (fonts_changed_p) 16131 if (f->fonts_changed)
16125 goto need_larger_matrices; 16132 goto need_larger_matrices;
16126 } 16133 }
16127 16134
@@ -16186,8 +16193,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16186 } 16193 }
16187#endif /* HAVE_WINDOW_SYSTEM */ 16194#endif /* HAVE_WINDOW_SYSTEM */
16188 16195
16189 /* We go to this label, with fonts_changed_p set, 16196 /* We go to this label, with fonts_changed set, if it is
16190 if it is necessary to try again using larger glyph matrices. 16197 necessary to try again using larger glyph matrices.
16191 We have to redeem the scroll bar even in this case, 16198 We have to redeem the scroll bar even in this case,
16192 because the loop in redisplay_internal expects that. */ 16199 because the loop in redisplay_internal expects that. */
16193 need_larger_matrices: 16200 need_larger_matrices:
@@ -16259,7 +16266,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16259 { 16266 {
16260 if (display_line (&it)) 16267 if (display_line (&it))
16261 last_text_row = it.glyph_row - 1; 16268 last_text_row = it.glyph_row - 1;
16262 if (fonts_changed_p && !(flags & TRY_WINDOW_IGNORE_FONTS_CHANGE)) 16269 if (f->fonts_changed && !(flags & TRY_WINDOW_IGNORE_FONTS_CHANGE))
16263 return 0; 16270 return 0;
16264 } 16271 }
16265 16272
@@ -16357,7 +16364,7 @@ try_window_reusing_current_matrix (struct window *w)
16357 /* Don't try to reuse the display if windows have been split 16364 /* Don't try to reuse the display if windows have been split
16358 or such. */ 16365 or such. */
16359 || windows_or_buffers_changed 16366 || windows_or_buffers_changed
16360 || cursor_type_changed) 16367 || f->cursor_type_changed)
16361 return 0; 16368 return 0;
16362 16369
16363 /* Can't do this if region may have changed. */ 16370 /* Can't do this if region may have changed. */
@@ -16405,8 +16412,7 @@ try_window_reusing_current_matrix (struct window *w)
16405 w->cursor.vpos = -1; 16412 w->cursor.vpos = -1;
16406 last_text_row = last_reused_text_row = NULL; 16413 last_text_row = last_reused_text_row = NULL;
16407 16414
16408 while (it.current_y < it.last_visible_y 16415 while (it.current_y < it.last_visible_y && !f->fonts_changed)
16409 && !fonts_changed_p)
16410 { 16416 {
16411 /* If we have reached into the characters in the START row, 16417 /* If we have reached into the characters in the START row,
16412 that means the line boundaries have changed. So we 16418 that means the line boundaries have changed. So we
@@ -16617,7 +16623,7 @@ try_window_reusing_current_matrix (struct window *w)
16617 if (pt_row == NULL) 16623 if (pt_row == NULL)
16618 w->cursor.vpos = -1; 16624 w->cursor.vpos = -1;
16619 last_text_row = NULL; 16625 last_text_row = NULL;
16620 while (it.current_y < it.last_visible_y && !fonts_changed_p) 16626 while (it.current_y < it.last_visible_y && !f->fonts_changed)
16621 if (display_line (&it)) 16627 if (display_line (&it))
16622 last_text_row = it.glyph_row - 1; 16628 last_text_row = it.glyph_row - 1;
16623 16629
@@ -17129,7 +17135,7 @@ try_window_id (struct window *w)
17129 GIVE_UP (1); 17135 GIVE_UP (1);
17130 17136
17131 /* This flag is used to prevent redisplay optimizations. */ 17137 /* This flag is used to prevent redisplay optimizations. */
17132 if (windows_or_buffers_changed || cursor_type_changed) 17138 if (windows_or_buffers_changed || f->cursor_type_changed)
17133 GIVE_UP (2); 17139 GIVE_UP (2);
17134 17140
17135 /* Verify that narrowing has not changed. 17141 /* Verify that narrowing has not changed.
@@ -17460,7 +17466,7 @@ try_window_id (struct window *w)
17460 last_text_row = NULL; 17466 last_text_row = NULL;
17461 overlay_arrow_seen = 0; 17467 overlay_arrow_seen = 0;
17462 while (it.current_y < it.last_visible_y 17468 while (it.current_y < it.last_visible_y
17463 && !fonts_changed_p 17469 && !f->fonts_changed
17464 && (first_unchanged_at_end_row == NULL 17470 && (first_unchanged_at_end_row == NULL
17465 || IT_CHARPOS (it) < stop_pos)) 17471 || IT_CHARPOS (it) < stop_pos))
17466 { 17472 {
@@ -17468,7 +17474,7 @@ try_window_id (struct window *w)
17468 last_text_row = it.glyph_row - 1; 17474 last_text_row = it.glyph_row - 1;
17469 } 17475 }
17470 17476
17471 if (fonts_changed_p) 17477 if (f->fonts_changed)
17472 return -1; 17478 return -1;
17473 17479
17474 17480
@@ -17715,8 +17721,7 @@ try_window_id (struct window *w)
17715 17721
17716 /* Display the rest of the lines at the window end. */ 17722 /* Display the rest of the lines at the window end. */
17717 it.glyph_row = MATRIX_ROW (desired_matrix, it.vpos); 17723 it.glyph_row = MATRIX_ROW (desired_matrix, it.vpos);
17718 while (it.current_y < it.last_visible_y 17724 while (it.current_y < it.last_visible_y && !f->fonts_changed)
17719 && !fonts_changed_p)
17720 { 17725 {
17721 /* Is it always sure that the display agrees with lines in 17726 /* Is it always sure that the display agrees with lines in
17722 the current matrix? I don't think so, so we mark rows 17727 the current matrix? I don't think so, so we mark rows
@@ -19252,7 +19257,7 @@ display_line (struct it *it)
19252 >= it->w->desired_matrix->nrows) 19257 >= it->w->desired_matrix->nrows)
19253 { 19258 {
19254 it->w->nrows_scale_factor++; 19259 it->w->nrows_scale_factor++;
19255 fonts_changed_p = 1; 19260 it->f->fonts_changed = 1;
19256 return 0; 19261 return 0;
19257 } 19262 }
19258 19263
@@ -23980,12 +23985,12 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
23980 23985
23981#define IT_EXPAND_MATRIX_WIDTH(it, area) \ 23986#define IT_EXPAND_MATRIX_WIDTH(it, area) \
23982 { \ 23987 { \
23983 if (!fonts_changed_p \ 23988 if (!it->f->fonts_changed \
23984 && (it->glyph_row->glyphs[area] \ 23989 && (it->glyph_row->glyphs[area] \
23985 < it->glyph_row->glyphs[area + 1])) \ 23990 < it->glyph_row->glyphs[area + 1])) \
23986 { \ 23991 { \
23987 it->w->ncols_scale_factor++; \ 23992 it->w->ncols_scale_factor++; \
23988 fonts_changed_p = 1; \ 23993 it->f->fonts_changed = 1; \
23989 } \ 23994 } \
23990 } 23995 }
23991 23996
@@ -24901,21 +24906,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
24901 base_height = it->ascent + it->descent; 24906 base_height = it->ascent + it->descent;
24902 base_width = font->average_width; 24907 base_width = font->average_width;
24903 24908
24904 /* Get a face ID for the glyph by utilizing a cache (the same way as 24909 face_id = merge_glyphless_glyph_face (it);
24905 done for `escape-glyph' in get_next_display_element). */
24906 if (it->f == last_glyphless_glyph_frame
24907 && it->face_id == last_glyphless_glyph_face_id)
24908 {
24909 face_id = last_glyphless_glyph_merged_face_id;
24910 }
24911 else
24912 {
24913 /* Merge the `glyphless-char' face into the current face. */
24914 face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
24915 last_glyphless_glyph_frame = it->f;
24916 last_glyphless_glyph_face_id = it->face_id;
24917 last_glyphless_glyph_merged_face_id = face_id;
24918 }
24919 24910
24920 if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) 24911 if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
24921 { 24912 {
@@ -25956,7 +25947,7 @@ set_frame_cursor_types (struct frame *f, Lisp_Object arg)
25956 FRAME_BLINK_OFF_CURSOR (f) = DEFAULT_CURSOR; 25947 FRAME_BLINK_OFF_CURSOR (f) = DEFAULT_CURSOR;
25957 25948
25958 /* Make sure the cursor gets redrawn. */ 25949 /* Make sure the cursor gets redrawn. */
25959 cursor_type_changed = 1; 25950 f->cursor_type_changed = 1;
25960} 25951}
25961 25952
25962 25953
@@ -29686,8 +29677,6 @@ Its value should be an ASCII acronym string, `hex-code', `empty-box', or
29686void 29677void
29687init_xdisp (void) 29678init_xdisp (void)
29688{ 29679{
29689 current_header_line_height = current_mode_line_height = -1;
29690
29691 CHARPOS (this_line_start_pos) = 0; 29680 CHARPOS (this_line_start_pos) = 0;
29692 29681
29693 if (!noninteractive) 29682 if (!noninteractive)
diff --git a/src/xfns.c b/src/xfns.c
index b08fc76524c..4e8442dd3a3 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1201,7 +1201,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1201 clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix); 1201 clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix);
1202 } 1202 }
1203#endif /* not USE_X_TOOLKIT && not USE_GTK */ 1203#endif /* not USE_X_TOOLKIT && not USE_GTK */
1204 adjust_glyphs (f); 1204 adjust_frame_glyphs (f);
1205 run_window_configuration_change_hook (f); 1205 run_window_configuration_change_hook (f);
1206} 1206}
1207 1207
@@ -1264,7 +1264,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1264 1264
1265 FRAME_TOOL_BAR_LINES (f) = nlines; 1265 FRAME_TOOL_BAR_LINES (f) = nlines;
1266 resize_frame_windows (f, FRAME_LINES (f), 0); 1266 resize_frame_windows (f, FRAME_LINES (f), 0);
1267 adjust_glyphs (f); 1267 adjust_frame_glyphs (f);
1268 1268
1269 /* We also have to make sure that the internal border at the top of 1269 /* We also have to make sure that the internal border at the top of
1270 the frame, below the menu bar or tool bar, is redrawn when the 1270 the frame, below the menu bar or tool bar, is redrawn when the
@@ -5486,7 +5486,7 @@ Text larger than the specified size is clipped. */)
5486 } 5486 }
5487 5487
5488 FRAME_TOTAL_COLS (f) = w->total_cols; 5488 FRAME_TOTAL_COLS (f) = w->total_cols;
5489 adjust_glyphs (f); 5489 adjust_frame_glyphs (f);
5490 w->pseudo_window_p = 1; 5490 w->pseudo_window_p = 1;
5491 5491
5492 /* Display the tooltip text in a temporary buffer. */ 5492 /* Display the tooltip text in a temporary buffer. */
@@ -5554,7 +5554,7 @@ Text larger than the specified size is clipped. */)
5554 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 5554 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5555 w->total_cols = width; 5555 w->total_cols = width;
5556 FRAME_TOTAL_COLS (f) = width; 5556 FRAME_TOTAL_COLS (f) = width;
5557 adjust_glyphs (f); 5557 adjust_frame_glyphs (f);
5558 clear_glyph_matrix (w->desired_matrix); 5558 clear_glyph_matrix (w->desired_matrix);
5559 clear_glyph_matrix (w->current_matrix); 5559 clear_glyph_matrix (w->current_matrix);
5560 try_window (FRAME_ROOT_WINDOW (f), pos, 0); 5560 try_window (FRAME_ROOT_WINDOW (f), pos, 0);