aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CONTRIBUTE4
-rw-r--r--ChangeLog51
-rwxr-xr-xbuild-aux/git-hooks/commit-msg20
-rw-r--r--doc/emacs/ChangeLog4
-rw-r--r--doc/emacs/buffers.texi11
-rw-r--r--doc/emacs/building.texi2
-rw-r--r--doc/lispref/ChangeLog121
-rw-r--r--doc/lispref/abbrevs.texi9
-rw-r--r--doc/lispref/backups.texi4
-rw-r--r--doc/lispref/buffers.texi2
-rw-r--r--doc/lispref/commands.texi9
-rw-r--r--doc/lispref/compile.texi1
-rw-r--r--doc/lispref/control.texi9
-rw-r--r--doc/lispref/customize.texi4
-rw-r--r--doc/lispref/debugging.texi6
-rw-r--r--doc/lispref/display.texi91
-rw-r--r--doc/lispref/files.texi6
-rw-r--r--doc/lispref/frames.texi8
-rw-r--r--doc/lispref/functions.texi5
-rw-r--r--doc/lispref/hash.texi2
-rw-r--r--doc/lispref/help.texi2
-rw-r--r--doc/lispref/keymaps.texi4
-rw-r--r--doc/lispref/lists.texi9
-rw-r--r--doc/lispref/loading.texi4
-rw-r--r--doc/lispref/macros.texi3
-rw-r--r--doc/lispref/markers.texi7
-rw-r--r--doc/lispref/minibuf.texi5
-rw-r--r--doc/lispref/modes.texi4
-rw-r--r--doc/lispref/nonascii.texi5
-rw-r--r--doc/lispref/os.texi18
-rw-r--r--doc/lispref/positions.texi1
-rw-r--r--doc/lispref/processes.texi3
-rw-r--r--doc/lispref/searching.texi5
-rw-r--r--doc/lispref/strings.texi7
-rw-r--r--doc/lispref/syntax.texi7
-rw-r--r--doc/lispref/text.texi9
-rw-r--r--doc/lispref/variables.texi3
-rw-r--r--doc/lispref/windows.texi2
-rw-r--r--doc/misc/efaq.texi2
-rw-r--r--doc/misc/smtpmail.texi2
-rw-r--r--etc/ChangeLog8
-rw-r--r--etc/NEWS15
-rw-r--r--etc/PROBLEMS15
-rw-r--r--etc/grep.txt6
-rw-r--r--etc/tutorials/TUTORIAL.es230
-rw-r--r--lib-src/ChangeLog8
-rw-r--r--lib-src/Makefile.in12
-rw-r--r--lisp/ChangeLog332
-rw-r--r--lisp/Makefile.in7
-rw-r--r--lisp/comint.el16
-rw-r--r--lisp/desktop.el2
-rw-r--r--lisp/dired.el2
-rw-r--r--lisp/dnd.el21
-rw-r--r--lisp/emacs-lisp/find-func.el65
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/gnus-cloud.el9
-rw-r--r--lisp/gnus/message.el10
-rw-r--r--lisp/gnus/mm-decode.el1
-rw-r--r--lisp/gnus/nnvirtual.el8
-rw-r--r--lisp/international/mule.el167
-rw-r--r--lisp/language/misc-lang.el3
-rw-r--r--lisp/menu-bar.el51
-rw-r--r--lisp/minibuffer.el5
-rw-r--r--lisp/net/eww.el18
-rw-r--r--lisp/net/shr.el104
-rw-r--r--lisp/net/tramp-gw.el9
-rw-r--r--lisp/net/tramp-sh.el53
-rw-r--r--lisp/net/tramp.el277
-rw-r--r--lisp/nxml/rng-uri.el2
-rw-r--r--lisp/obsolete/pc-select.el12
-rw-r--r--lisp/org/org-clock.el4
-rw-r--r--lisp/org/org-ctags.el8
-rw-r--r--lisp/org/ox-html.el2
-rw-r--r--lisp/org/ox-latex.el2
-rw-r--r--lisp/org/ox-publish.el2
-rw-r--r--lisp/org/ox.el6
-rw-r--r--lisp/progmodes/elisp-mode.el95
-rw-r--r--lisp/progmodes/etags.el5
-rw-r--r--lisp/progmodes/js.el2
-rw-r--r--lisp/progmodes/python.el591
-rw-r--r--lisp/progmodes/sh-script.el2
-rw-r--r--lisp/progmodes/xref.el28
-rw-r--r--lisp/saveplace.el44
-rw-r--r--lisp/simple.el10
-rw-r--r--lisp/startup.el2
-rw-r--r--lisp/subr.el4
-rw-r--r--lisp/textmodes/tex-mode.el50
-rw-r--r--lisp/vc/compare-w.el25
-rw-r--r--lisp/vc/vc-dir.el11
-rw-r--r--lisp/vc/vc-git.el7
-rw-r--r--lisp/window.el7
-rw-r--r--src/ChangeLog120
-rw-r--r--src/Makefile.in43
-rw-r--r--src/buffer.c4
-rw-r--r--src/composite.c3
-rw-r--r--src/decompress.c51
-rw-r--r--src/dispextern.h5
-rw-r--r--src/editfns.c16
-rw-r--r--src/filelock.c7
-rw-r--r--src/frame.c2
-rw-r--r--src/gnutls.c775
-rw-r--r--src/image.c932
-rw-r--r--src/nsimage.m8
-rw-r--r--src/sysdep.c132
-rw-r--r--src/term.c2
-rw-r--r--src/w32.h13
-rw-r--r--src/xdisp.c171
-rw-r--r--src/xml.c94
-rw-r--r--src/xrdb.c5
-rw-r--r--src/xselect.c95
-rw-r--r--src/xsettings.c94
-rw-r--r--src/xterm.c22
-rw-r--r--src/xterm.h8
-rw-r--r--test/ChangeLog69
-rw-r--r--test/automated/data/flymake/test.pl2
-rw-r--r--test/automated/electric-tests.el11
-rw-r--r--test/automated/let-alist.el1
-rw-r--r--test/automated/python-tests.el509
-rw-r--r--test/automated/tramp-tests.el7
120 files changed, 3866 insertions, 2187 deletions
diff --git a/.gitignore b/.gitignore
index d05352e7124..97adfb95610 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,7 @@ makefile
48/confdefs.h 48/confdefs.h
49/config.status 49/config.status
50/configure.lineno 50/configure.lineno
51/conftest*
51src/config.h 52src/config.h
52src/epaths.h 53src/epaths.h
53 54
diff --git a/CONTRIBUTE b/CONTRIBUTE
index 3bc49cf3ea3..0e019d31597 100644
--- a/CONTRIBUTE
+++ b/CONTRIBUTE
@@ -57,7 +57,7 @@ following modifications:
57 the rationale for a change; that can be done in the commit message 57 the rationale for a change; that can be done in the commit message
58 between the summary line and the file entries. 58 between the summary line and the file entries.
59 59
60** Changelog notes 60** ChangeLog notes
61 61
62- Emacs generally follows the GNU coding standards when it comes to 62- Emacs generally follows the GNU coding standards when it comes to
63 ChangeLogs: 63 ChangeLogs:
@@ -67,7 +67,7 @@ following modifications:
67 now), because `...' is so widely used elsewhere in Emacs. 67 now), because `...' is so widely used elsewhere in Emacs.
68 68
69- Some of the rules in the GNU coding standards section 5.2 69- Some of the rules in the GNU coding standards section 5.2
70 "Commenting Your Work" also apply to Changelog entries: they must be 70 "Commenting Your Work" also apply to ChangeLog entries: they must be
71 in English, and be complete sentences starting with a capital and 71 in English, and be complete sentences starting with a capital and
72 ending with a period (except the summary line should not end in a 72 ending with a period (except the summary line should not end in a
73 period). 73 period).
diff --git a/ChangeLog b/ChangeLog
index 90d7c0bb613..6557ef9552f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
12014-12-29 Paul Eggert <eggert@cs.ucla.edu>
2
3 system-name's returned value can vary
4 Also, the system-name variable is now obsolete.
5 Fixes Bug#19438.
6 * doc/lispref/os.texi (System Environment):
7 * etc/NEWS: Document this.
8 * doc/misc/efaq.texi:
9 (Displaying the current file name in the titlebar):
10 * lisp/desktop.el (desktop-save-frameset):
11 * lisp/dnd.el (dnd-get-local-file-uri):
12 * lisp/gnus/message.el (message-make-fqdn):
13 * lisp/gnus/nnvirtual.el (nnvirtual-retrieve-headers)
14 (nnvirtual-update-xref-header):
15 * lisp/nxml/rng-uri.el (rng-uri-file-name-1):
16 * lisp/org/org-clock.el (org-clock-save):
17 * src/filelock.c (current_lock_owner):
18 * src/xrdb.c (get_environ_db):
19 * src/xterm.c (same_x_server):
20 * src/xterm.c (x_term_init):
21 Prefer (system-name) to system-name, and avoid naming
22 locals 'system-name'.
23 * doc/misc/smtpmail.texi (Server workarounds): Fix grammar.
24 * lisp/startup.el (system-name): Now an obsolete variable.
25 * src/editfns.c (cached_system_name): New static var.
26 (init_and_cache_system_name): New function.
27 (init_editfns, Fsystem_name): Use it.
28 (syms_of_editfns): Initialize it and Vsystem_name to the same value.
29 * src/sysdep.c [HAVE_SOCKETS]: Don't include <sys/socket.h>, <netdb.h>.
30 (h_errno) [TRY_AGAIN && !HAVE_H_ERRNO]: Remove decl.
31 (init_system_name) [HAVE_SOCKETS]: Don't canonicalize the name.
32 Don't create a new string if the current value is already correct.
33
342014-12-28 Paul Eggert <eggert@cs.ucla.edu>
35
36 * build-aux/git-hooks/commit-msg: Allow tabs.
37 Treat them as if they were expanded to spaces, with tab stops
38 every 8 columns.
39
402014-12-27 Paul Eggert <eggert@cs.ucla.edu>
41
42 * .gitignore: Ignore /conftest*.
43
442014-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
45
46 * build-aux/git-hooks/commit-msg (at_sign): Bump up line-length limit
47 to 78.
48
12014-12-25 Paul Eggert <eggert@cs.ucla.edu> 492014-12-25 Paul Eggert <eggert@cs.ucla.edu>
2 50
3 Prefer stpcpy to strcat 51 Prefer stpcpy to strcat
@@ -308,7 +356,8 @@
308 356
3092014-11-11 Eric S. Raymond <esr@thyrsus.com> 3572014-11-11 Eric S. Raymond <esr@thyrsus.com>
310 358
311 * Makefile.in: git transition - set VCWITNESS appropriately for git. 359 Git transition.
360 * Makefile.in (src): Set VCSWITNESS appropriately for git.
312 361
313 All bzr revision IDS, and all CVS revision IDs for which a commit 362 All bzr revision IDS, and all CVS revision IDs for which a commit
314 could be identified, were changed to time-date!committer version 363 could be identified, were changed to time-date!committer version
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index 5eb994c6fe0..9b6179ee613 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -87,8 +87,17 @@ exec $awk '
87 status = 1 87 status = 1
88 } 88 }
89 89
90 72 < length && $0 ~ space { 90 {
91 print "Line longer than 72 characters in commit message" 91 # Expand tabs to spaces for length calculations etc.
92 while (match($0, /\t/)) {
93 before_tab = substr($0, 1, RSTART - 1)
94 after_tab = substr($0, RSTART + 1)
95 $0 = sprintf("%s%*s%s", before_tab, 8 - (RSTART - 1) % 8, "", after_tab)
96 }
97 }
98
99 78 < length && $0 ~ space {
100 print "Line longer than 78 characters in commit message"
92 status = 1 101 status = 1
93 } 102 }
94 103
@@ -103,12 +112,7 @@ exec $awk '
103 } 112 }
104 113
105 $0 ~ non_print { 114 $0 ~ non_print {
106 if (gsub(/\t/, "")) { 115 print "Unprintable character in commit message"
107 print "Tab in commit message; please use spaces instead"
108 }
109 if ($0 ~ non_print) {
110 print "Unprintable character in commit message"
111 }
112 status = 1 116 status = 1
113 } 117 }
114 118
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 7081c19c3f0..0016ee074ad 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,7 @@
12014-12-27 Eli Zaretskii <eliz@gnu.org>
2
3 * buffers.texi (Kill Buffer): Improve indexing.
4
12014-12-24 Stephen Leake <stephen_leake@stephe-leake.org> 52014-12-24 Stephen Leake <stephen_leake@stephe-leake.org>
2 6
3 * trouble.texi: Move user-level information from CONTRIBUTE here. 7 * trouble.texi: Move user-level information from CONTRIBUTE here.
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index 54a84989e2e..f036d856fbe 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -269,11 +269,16 @@ can also be used to copy text from one buffer to another.
269@section Killing Buffers 269@section Killing Buffers
270 270
271@cindex killing buffers 271@cindex killing buffers
272@cindex close buffer
273@cindex close file
272 If you continue an Emacs session for a while, you may accumulate a 274 If you continue an Emacs session for a while, you may accumulate a
273large number of buffers. You may then find it convenient to @dfn{kill} 275large number of buffers. You may then find it convenient to @dfn{kill}
274the buffers you no longer need. On most operating systems, killing a 276the buffers you no longer need. (Some other editors call this
275buffer releases its space back to the operating system so that other 277operation @dfn{close}, and talk about ``closing the buffer'' or
276programs can use it. Here are some commands for killing buffers: 278``closing the file'' visited in the buffer.) On most operating
279systems, killing a buffer releases its space back to the operating
280system so that other programs can use it. Here are some commands for
281killing buffers:
277 282
278@table @kbd 283@table @kbd
279@item C-x k @var{bufname} @key{RET} 284@item C-x k @var{bufname} @key{RET}
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index e0ed11ff862..e1993e5ed30 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -1358,7 +1358,7 @@ searches through each directory in the Emacs Lisp load path, trying to
1358find a file matching that library name. If the library name is 1358find a file matching that library name. If the library name is
1359@samp{@var{foo}}, it tries looking for files named 1359@samp{@var{foo}}, it tries looking for files named
1360@file{@var{foo}.elc}, @file{@var{foo}.el}, and @file{@var{foo}}. The 1360@file{@var{foo}.elc}, @file{@var{foo}.el}, and @file{@var{foo}}. The
1361default behaviour is to load the first file found. This command 1361default behavior is to load the first file found. This command
1362prefers @file{.elc} files over @file{.el} files because compiled files 1362prefers @file{.elc} files over @file{.el} files because compiled files
1363load and run faster. If it finds that @file{@var{lib}.el} is newer 1363load and run faster. If it finds that @file{@var{lib}.el} is newer
1364than @file{@var{lib}.elc}, it issues a warning, in case someone made 1364than @file{@var{lib}.elc}, it issues a warning, in case someone made
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 2d964cf6505..c9f576af5e6 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,118 @@
12014-12-30 Martin Rudalics <rudalics@gmx.at>
2
3 * display.texi (Temporary Displays): Amend description of
4 `with-temp-buffer-window'. Add descriptions for
5 `with-current-buffer-window', `with-displayed-buffer-window' and
6 `temp-buffer-resize-mode', `temp-buffer-max-height' and
7 `temp-buffer-max-width'.
8
92014-12-27 Glenn Morris <rgm@gnu.org>
10
11 * control.texi (Pattern matching case statement):
12 * os.texi (Desktop Notifications):
13 * modes.texi (Defining Minor Modes, SMIE Lexer): Markup fixes.
14
152014-12-27 Eli Zaretskii <eliz@gnu.org>
16
17 * windows.texi (Recombining Windows): Index subject of sections.
18
19 * variables.texi (Variables with Restricted Values)
20 (Generalized Variables): Index subject of sections.
21
22 * text.texi (Buffer Contents, Examining Properties)
23 (Changing Properties, Property Search, Substitution): Index
24 subject of sections.
25
26 * syntax.texi (Motion and Syntax, Parsing Expressions)
27 (Motion via Parsing, Position Parse, Control Parsing): Index
28 subject of sections.
29
30 * strings.texi (Predicates for Strings, Creating Strings)
31 (Modifying Strings, Text Comparison): Index subject of sections.
32
33 * searching.texi (Syntax of Regexps, Regexp Special)
34 (Regexp Functions, Regexp Functions): Index subject of sections.
35
36 * processes.texi (Subprocess Creation, Process Information): Index
37 subject of sections.
38
39 * positions.texi (Screen Lines): Index subject of sections.
40
41 * nonascii.texi (Scanning Charsets, Specifying Coding Systems):
42 Index subject of sections.
43
44 * minibuf.texi (Text from Minibuffer, Object from Minibuffer)
45 (Multiple Queries, Minibuffer Contents): Index subject of
46 sections.
47
48 * markers.texi (Predicates on Markers, Creating Markers)
49 (Information from Markers, Moving Markers): Index subject of
50 sections.
51
52 * macros.texi (Defining Macros, Problems with Macros): Index
53 subject of sections.
54
55 * loading.texi (Loading Non-ASCII, Where Defined): Index subject
56 of sections.
57
58 * lists.texi (List-related Predicates, List Variables, Setcar)
59 (Setcdr, Plist Access): Index subject of sections.
60
61 * keymaps.texi (Controlling Active Maps, Scanning Keymaps)
62 (Modifying Menus): Index subject of sections.
63
64 * help.texi (Accessing Documentation, Help Functions): Index
65 subject of sections.
66
67 * hash.texi (Hash Access): Index subject of sections.
68
69 * functions.texi (Core Advising Primitives)
70 (Advising Named Functions, Porting old advices): Index subject of
71 sections.
72
73 * frames.texi (Creating Frames, Initial Parameters)
74 (Position Parameters, Buffer Parameters, Minibuffers and Frames)
75 (Pop-Up Menus, Drag and Drop): Index subject of sections.
76
77 * files.texi (Visiting Functions, Kinds of Files)
78 (Unique File Names): Index subject of sections.
79
80 * display.texi (Refresh Screen, Echo Area Customization)
81 (Warning Variables, Warning Options, Delayed Warnings)
82 (Temporary Displays, Managing Overlays, Overlay Properties)
83 (Finding Overlays, Size of Displayed Text, Defining Faces)
84 (Attribute Functions, Displaying Faces, Face Remapping)
85 (Basic Faces, Font Lookup, Fontsets, Replacing Specs)
86 (Defining Images, Showing Images): Index subject of sections.
87
88 * debugging.texi (Debugging, Explicit Debug)
89 (Invoking the Debugger, Excess Open, Excess Close): Index subject
90 of sections.
91
92 * customize.texi (Defining New Types, Applying Customizations)
93 (Custom Themes): Index subject of sections.
94
95 * control.texi (Sequencing, Combining Conditions)
96 (Processing of Errors, Cleanups): Index subject of sections.
97
98 * compile.texi (Eval During Compile): Index subject of sections.
99
100 * commands.texi (Using Interactive, Distinguish Interactive)
101 (Command Loop Info, Classifying Events, Event Mod)
102 (Invoking the Input Method): Index subject of sections.
103
104 * buffers.texi (Buffer List, Buffer Gap): Index subject of sections.
105
106 * backups.texi (Making Backups, Numbered Backups, Backup Names)
107 (Reverting): Index subject of sections.
108
109 * abbrevs.texi (Abbrev Tables, Defining Abbrevs, Abbrev Files)
110 (Abbrev Expansion, Standard Abbrev Tables, Abbrev Properties)
111 (Abbrev Table Properties): Index subject of sections.
112
113 * os.texi (Time of Day, Time Conversion, Time Parsing)
114 (Time Calculations, Idle Timers): Index subject of sections.
115
12014-12-25 Martin Rudalics <rudalics@gmx.at> 1162014-12-25 Martin Rudalics <rudalics@gmx.at>
2 117
3 * windows.texi (Windows): Resync @menu order with @node order. 118 * windows.texi (Windows): Resync @menu order with @node order.
@@ -37,6 +152,12 @@
37 152
38 * display.texi (Low-Level Font): Document font-info and query-font. 153 * display.texi (Low-Level Font): Document font-info and query-font.
39 154
1552014-12-18 Stefan Monnier <monnier@iro.umontreal.ca>
156
157 * display.texi (Forcing Redisplay): Remove references to
158 redisplay-dont-pause and redisplay-preemption-period (which doesn't
159 even exist).
160
402014-12-16 Nicolas Petton <petton.nicolas@gmail.com> 1612014-12-16 Nicolas Petton <petton.nicolas@gmail.com>
41 162
42 * sequences.texi (Seq Library): Add documentation for seq.el. 163 * sequences.texi (Seq Library): Add documentation for seq.el.
diff --git a/doc/lispref/abbrevs.texi b/doc/lispref/abbrevs.texi
index 73a3f5f1e05..c00af616240 100644
--- a/doc/lispref/abbrevs.texi
+++ b/doc/lispref/abbrevs.texi
@@ -59,6 +59,7 @@ expanded in the buffer. For the user-level commands for abbrevs, see
59 59
60@node Abbrev Tables 60@node Abbrev Tables
61@section Abbrev Tables 61@section Abbrev Tables
62@cindex abbrev tables
62 63
63 This section describes how to create and manipulate abbrev tables. 64 This section describes how to create and manipulate abbrev tables.
64 65
@@ -126,6 +127,7 @@ to add these to @var{name} separately.)
126 127
127@node Defining Abbrevs 128@node Defining Abbrevs
128@section Defining Abbrevs 129@section Defining Abbrevs
130@cindex defining abbrevs
129 131
130 @code{define-abbrev} is the low-level basic function for defining an 132 @code{define-abbrev} is the low-level basic function for defining an
131abbrev in an abbrev table. 133abbrev in an abbrev table.
@@ -181,6 +183,7 @@ callers.
181 183
182@node Abbrev Files 184@node Abbrev Files
183@section Saving Abbrevs in Files 185@section Saving Abbrevs in Files
186@cindex save abbrevs in files
184 187
185 A file of saved abbrev definitions is actually a file of Lisp code. 188 A file of saved abbrev definitions is actually a file of Lisp code.
186The abbrevs are saved in the form of a Lisp program to define the same 189The abbrevs are saved in the form of a Lisp program to define the same
@@ -232,6 +235,9 @@ define the same abbrevs. If @var{filename} is @code{nil} or omitted,
232 235
233@node Abbrev Expansion 236@node Abbrev Expansion
234@section Looking Up and Expanding Abbreviations 237@section Looking Up and Expanding Abbreviations
238@cindex looking up abbrevs
239@cindex expanding abbrevs
240@cindex abbrevs, looking up and expanding
235 241
236 Abbrevs are usually expanded by certain interactive commands, 242 Abbrevs are usually expanded by certain interactive commands,
237including @code{self-insert-command}. This section describes the 243including @code{self-insert-command}. This section describes the
@@ -367,6 +373,7 @@ definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}.
367 373
368@node Standard Abbrev Tables 374@node Standard Abbrev Tables
369@section Standard Abbrev Tables 375@section Standard Abbrev Tables
376@cindex standard abbrev tables
370 377
371 Here we list the variables that hold the abbrev tables for the 378 Here we list the variables that hold the abbrev tables for the
372preloaded major modes of Emacs. 379preloaded major modes of Emacs.
@@ -409,6 +416,7 @@ Properties}.
409 416
410@node Abbrev Properties 417@node Abbrev Properties
411@section Abbrev Properties 418@section Abbrev Properties
419@cindex abbrev properties
412 420
413Abbrevs have properties, some of which influence the way they work. 421Abbrevs have properties, some of which influence the way they work.
414You can provide them as arguments to @code{define-abbrev}, and 422You can provide them as arguments to @code{define-abbrev}, and
@@ -449,6 +457,7 @@ modifies the capitalization of the expansion.
449 457
450@node Abbrev Table Properties 458@node Abbrev Table Properties
451@section Abbrev Table Properties 459@section Abbrev Table Properties
460@cindex abbrev table properties
452 461
453Like abbrevs, abbrev tables have properties, some of which influence 462Like abbrevs, abbrev tables have properties, some of which influence
454the way they work. You can provide them as arguments to 463the way they work. You can provide them as arguments to
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi
index 63f8f227c84..ca30f3e17ca 100644
--- a/doc/lispref/backups.texi
+++ b/doc/lispref/backups.texi
@@ -50,6 +50,7 @@ don't want them any more, or Emacs can delete them automatically.
50 50
51@node Making Backups 51@node Making Backups
52@subsection Making Backup Files 52@subsection Making Backup Files
53@cindex making backup files
53 54
54@defun backup-buffer 55@defun backup-buffer
55 This function makes a backup of the file visited by the current 56 This function makes a backup of the file visited by the current
@@ -238,6 +239,7 @@ The default is 200.
238 239
239@node Numbered Backups 240@node Numbered Backups
240@subsection Making and Deleting Numbered Backup Files 241@subsection Making and Deleting Numbered Backup Files
242@cindex numbered backups
241 243
242 If a file's name is @file{foo}, the names of its numbered backup 244 If a file's name is @file{foo}, the names of its numbered backup
243versions are @file{foo.~@var{v}~}, for various integers @var{v}, like 245versions are @file{foo.~@var{v}~}, for various integers @var{v}, like
@@ -299,6 +301,7 @@ file. The default is@tie{}2.
299 301
300@node Backup Names 302@node Backup Names
301@subsection Naming Backup Files 303@subsection Naming Backup Files
304@cindex naming backup files
302 305
303 The functions in this section are documented mainly because you can 306 The functions in this section are documented mainly because you can
304customize the naming conventions for backup files by redefining them. 307customize the naming conventions for backup files by redefining them.
@@ -668,6 +671,7 @@ not initialize @code{auto-save-list-file-name}.
668 671
669@node Reverting 672@node Reverting
670@section Reverting 673@section Reverting
674@cindex reverting buffers
671 675
672 If you have made extensive changes to a file and then change your mind 676 If you have made extensive changes to a file and then change your mind
673about them, you can get rid of them by reading in the previous version 677about them, you can get rid of them by reading in the previous version
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 5ac2d6786e8..7c4fb876135 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -762,6 +762,7 @@ signal an error if the current buffer is read-only.
762@node Buffer List 762@node Buffer List
763@section The Buffer List 763@section The Buffer List
764@cindex buffer list 764@cindex buffer list
765@cindex listing all buffers
765 766
766 The @dfn{buffer list} is a list of all live buffers. The order of the 767 The @dfn{buffer list} is a list of all live buffers. The order of the
767buffers in this list is based primarily on how recently each buffer has 768buffers in this list is based primarily on how recently each buffer has
@@ -1215,6 +1216,7 @@ in the text it is swapped with will not interfere with auto-saving.
1215 1216
1216@node Buffer Gap 1217@node Buffer Gap
1217@section The Buffer Gap 1218@section The Buffer Gap
1219@cindex buffer gap
1218 1220
1219 Emacs buffers are implemented using an invisible @dfn{gap} to make 1221 Emacs buffers are implemented using an invisible @dfn{gap} to make
1220insertion and deletion faster. Insertion works by filling in part of 1222insertion and deletion faster. Insertion works by filling in part of
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index e5db4d87539..c2b7038e2ec 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -147,6 +147,7 @@ code.
147@node Using Interactive 147@node Using Interactive
148@subsection Using @code{interactive} 148@subsection Using @code{interactive}
149@cindex arguments, interactive entry 149@cindex arguments, interactive entry
150@cindex interactive spec, using
150 151
151 This section describes how to write the @code{interactive} form that 152 This section describes how to write the @code{interactive} form that
152makes a Lisp function an interactively-callable command, and how to 153makes a Lisp function an interactively-callable command, and how to
@@ -747,6 +748,8 @@ part of the prompt.
747 748
748@node Distinguish Interactive 749@node Distinguish Interactive
749@section Distinguish Interactive Calls 750@section Distinguish Interactive Calls
751@cindex distinguish interactive calls
752@cindex is this call interactive
750 753
751 Sometimes a command should display additional visual feedback (such 754 Sometimes a command should display additional visual feedback (such
752as an informative message in the echo area) for interactive calls 755as an informative message in the echo area) for interactive calls
@@ -835,6 +838,7 @@ Here is another example that contrasts direct and indirect calls to
835 838
836@node Command Loop Info 839@node Command Loop Info
837@section Information from the Command Loop 840@section Information from the Command Loop
841@cindex command loop variables
838 842
839The editor command loop sets several Lisp variables to keep status 843The editor command loop sets several Lisp variables to keep status
840records for itself and for commands that are run. With the exception of 844records for itself and for commands that are run. With the exception of
@@ -1859,6 +1863,7 @@ bind it to the @code{signal usr1} event sequence:
1859@node Classifying Events 1863@node Classifying Events
1860@subsection Classifying Events 1864@subsection Classifying Events
1861@cindex event type 1865@cindex event type
1866@cindex classifying events
1862 1867
1863 Every event has an @dfn{event type}, which classifies the event for 1868 Every event has an @dfn{event type}, which classifies the event for
1864key binding purposes. For a keyboard event, the event type equals the 1869key binding purposes. For a keyboard event, the event type equals the
@@ -2584,6 +2589,9 @@ then continues to wait for a valid input character, or keyboard-quit.
2584 2589
2585@node Event Mod 2590@node Event Mod
2586@subsection Modifying and Translating Input Events 2591@subsection Modifying and Translating Input Events
2592@cindex modifiers of events
2593@cindex translating input events
2594@cindex event translation
2587 2595
2588 Emacs modifies every event it reads according to 2596 Emacs modifies every event it reads according to
2589@code{extra-keyboard-modifiers}, then translates it through 2597@code{extra-keyboard-modifiers}, then translates it through
@@ -2665,6 +2673,7 @@ at the level of @code{read-key-sequence}.
2665 2673
2666@node Invoking the Input Method 2674@node Invoking the Input Method
2667@subsection Invoking the Input Method 2675@subsection Invoking the Input Method
2676@cindex invoking input method
2668 2677
2669 The event-reading functions invoke the current input method, if any 2678 The event-reading functions invoke the current input method, if any
2670(@pxref{Input Methods}). If the value of @code{input-method-function} 2679(@pxref{Input Methods}). If the value of @code{input-method-function}
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index fe492df1d94..cb6cba99c11 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -347,6 +347,7 @@ it does nothing. It always returns @var{function}.
347 347
348@node Eval During Compile 348@node Eval During Compile
349@section Evaluation During Compilation 349@section Evaluation During Compilation
350@cindex eval during compilation
350 351
351 These features permit you to write code to be evaluated during 352 These features permit you to write code to be evaluated during
352compilation of a program. 353compilation of a program.
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index ea212337c96..1e9f3461d0f 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -44,6 +44,8 @@ structure constructs (@pxref{Macros}).
44 44
45@node Sequencing 45@node Sequencing
46@section Sequencing 46@section Sequencing
47@cindex sequencing
48@cindex sequential execution
47 49
48 Evaluating forms in the order they appear is the most common way 50 Evaluating forms in the order they appear is the most common way
49control passes from one form to another. In some contexts, such as in a 51control passes from one form to another. In some contexts, such as in a
@@ -368,8 +370,8 @@ that location.
368More specifically, a Q-pattern can take the following forms: 370More specifically, a Q-pattern can take the following forms:
369@table @code 371@table @code
370@item (@var{qpattern1} . @var{qpattern2}) 372@item (@var{qpattern1} . @var{qpattern2})
371This pattern matches any cons cell whose @code{car} matches @var{QPATTERN1} and 373This pattern matches any cons cell whose @code{car} matches @var{qpattern1} and
372whose @code{cdr} matches @var{PATTERN2}. 374whose @code{cdr} matches @var{pattern2}.
373@item [@var{qpattern1} @var{qpattern2} @dots{} @var{qpatternm}] 375@item [@var{qpattern1} @var{qpattern2} @dots{} @var{qpatternm}]
374This pattern matches a vector of length @var{M} whose 0..(@var{M}-1)th 376This pattern matches a vector of length @var{M} whose 0..(@var{M}-1)th
375elements match @var{qpattern1}, @var{qpattern2} @dots{} @var{qpatternm}, 377elements match @var{qpattern1}, @var{qpattern2} @dots{} @var{qpatternm},
@@ -405,6 +407,7 @@ the variable @code{x}.
405 407
406@node Combining Conditions 408@node Combining Conditions
407@section Constructs for Combining Conditions 409@section Constructs for Combining Conditions
410@cindex combining conditions
408 411
409 This section describes three constructs that are often used together 412 This section describes three constructs that are often used together
410with @code{if} and @code{cond} to express complicated conditions. The 413with @code{if} and @code{cond} to express complicated conditions. The
@@ -962,6 +965,7 @@ concept of continuable errors.
962 965
963@node Processing of Errors 966@node Processing of Errors
964@subsubsection How Emacs Processes Errors 967@subsubsection How Emacs Processes Errors
968@cindex processing of errors
965 969
966When an error is signaled, @code{signal} searches for an active 970When an error is signaled, @code{signal} searches for an active
967@dfn{handler} for the error. A handler is a sequence of Lisp 971@dfn{handler} for the error. A handler is a sequence of Lisp
@@ -1367,6 +1371,7 @@ and their conditions.
1367 1371
1368@node Cleanups 1372@node Cleanups
1369@subsection Cleaning Up from Nonlocal Exits 1373@subsection Cleaning Up from Nonlocal Exits
1374@cindex nonlocal exits, cleaning up
1370 1375
1371 The @code{unwind-protect} construct is essential whenever you 1376 The @code{unwind-protect} construct is essential whenever you
1372temporarily put a data structure in an inconsistent state; it permits 1377temporarily put a data structure in an inconsistent state; it permits
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi
index 0c6497fb4ef..cdf599b8f16 100644
--- a/doc/lispref/customize.texi
+++ b/doc/lispref/customize.texi
@@ -1227,6 +1227,8 @@ arguments, which will be used when creating the @code{radio-button} or
1227 1227
1228@node Defining New Types 1228@node Defining New Types
1229@subsection Defining New Types 1229@subsection Defining New Types
1230@cindex customization types, define new
1231@cindex define new customization types
1230 1232
1231In the previous sections we have described how to construct elaborate 1233In the previous sections we have described how to construct elaborate
1232type specifications for @code{defcustom}. In some cases you may want 1234type specifications for @code{defcustom}. In some cases you may want
@@ -1296,6 +1298,7 @@ its @code{:type} argument only when needed.
1296 1298
1297@node Applying Customizations 1299@node Applying Customizations
1298@section Applying Customizations 1300@section Applying Customizations
1301@cindex applying customizations
1299 1302
1300The following functions are responsible for installing the user's 1303The following functions are responsible for installing the user's
1301customization settings for variables and faces, respectively. When 1304customization settings for variables and faces, respectively. When
@@ -1353,6 +1356,7 @@ evaluated. @var{comment} is a string describing the customization.
1353@node Custom Themes 1356@node Custom Themes
1354@section Custom Themes 1357@section Custom Themes
1355 1358
1359@cindex custom themes
1356 @dfn{Custom themes} are collections of settings that can be enabled 1360 @dfn{Custom themes} are collections of settings that can be enabled
1357or disabled as a unit. @xref{Custom Themes,,, emacs, The GNU Emacs 1361or disabled as a unit. @xref{Custom Themes,,, emacs, The GNU Emacs
1358Manual}. Each Custom theme is defined by an Emacs Lisp source file, 1362Manual}. Each Custom theme is defined by an Emacs Lisp source file,
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 66f12a022cb..0b3c47f4339 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -5,6 +5,7 @@
5@c See the file elisp.texi for copying conditions. 5@c See the file elisp.texi for copying conditions.
6@node Debugging 6@node Debugging
7@chapter Debugging Lisp Programs 7@chapter Debugging Lisp Programs
8@cindex debugging lisp programs
8 9
9 There are several ways to find and investigate problems in an Emacs 10 There are several ways to find and investigate problems in an Emacs
10Lisp program. 11Lisp program.
@@ -284,6 +285,8 @@ not currently set up to break on entry.
284 285
285@node Explicit Debug 286@node Explicit Debug
286@subsection Explicit Entry to the Debugger 287@subsection Explicit Entry to the Debugger
288@cindex debugger, explicit entry
289@cindex force entry to debugger
287 290
288 You can cause the debugger to be called at a certain point in your 291 You can cause the debugger to be called at a certain point in your
289program by writing the expression @code{(debug)} at that point. To do 292program by writing the expression @code{(debug)} at that point. To do
@@ -456,6 +459,7 @@ Toggle the display of local variables of the current stack frame.
456 459
457@node Invoking the Debugger 460@node Invoking the Debugger
458@subsection Invoking the Debugger 461@subsection Invoking the Debugger
462@cindex invoking lisp debugger
459 463
460 Here we describe in full detail the function @code{debug} that is used 464 Here we describe in full detail the function @code{debug} that is used
461to invoke the debugger. 465to invoke the debugger.
@@ -707,6 +711,7 @@ find the mismatch.)
707 711
708@node Excess Open 712@node Excess Open
709@subsection Excess Open Parentheses 713@subsection Excess Open Parentheses
714@cindex excess open parentheses
710 715
711 The first step is to find the defun that is unbalanced. If there is 716 The first step is to find the defun that is unbalanced. If there is
712an excess open parenthesis, the way to do this is to go to the end of 717an excess open parenthesis, the way to do this is to go to the end of
@@ -741,6 +746,7 @@ anything.
741 746
742@node Excess Close 747@node Excess Close
743@subsection Excess Close Parentheses 748@subsection Excess Close Parentheses
749@cindex excess close parentheses
744 750
745 To deal with an excess close parenthesis, first go to the beginning 751 To deal with an excess close parenthesis, first go to the beginning
746of the file, then type @kbd{C-u -1 C-M-u} to find the end of the first 752of the file, then type @kbd{C-u -1 C-M-u} to find the end of the first
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 48860c8ebef..14a98f32ffb 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -39,6 +39,8 @@ that Emacs presents to the user.
39 39
40@node Refresh Screen 40@node Refresh Screen
41@section Refreshing the Screen 41@section Refreshing the Screen
42@cindex refresh the screen
43@cindex screen refresh
42 44
43 The function @code{redraw-frame} clears and redisplays the entire 45 The function @code{redraw-frame} clears and redisplays the entire
44contents of a given frame (@pxref{Frames}). This is useful if the 46contents of a given frame (@pxref{Frames}). This is useful if the
@@ -534,6 +536,7 @@ are logged that share a common prefix ending in @samp{...}.
534 536
535@node Echo Area Customization 537@node Echo Area Customization
536@subsection Echo Area Customization 538@subsection Echo Area Customization
539@cindex echo area customization
537 540
538 These variables control details of how the echo area works. 541 These variables control details of how the echo area works.
539 542
@@ -661,6 +664,7 @@ specify a specific warning type.
661 664
662@node Warning Variables 665@node Warning Variables
663@subsection Warning Variables 666@subsection Warning Variables
667@cindex warning variables
664 668
665 Programs can customize how their warnings appear by binding 669 Programs can customize how their warnings appear by binding
666the variables described in this section. 670the variables described in this section.
@@ -738,6 +742,7 @@ all.
738 742
739@node Warning Options 743@node Warning Options
740@subsection Warning Options 744@subsection Warning Options
745@cindex warning options
741 746
742 These variables are used by users to control what happens 747 These variables are used by users to control what happens
743when a Lisp program reports a warning. 748when a Lisp program reports a warning.
@@ -771,6 +776,7 @@ that warning is not logged.
771 776
772@node Delayed Warnings 777@node Delayed Warnings
773@subsection Delayed Warnings 778@subsection Delayed Warnings
779@cindex delayed warnings
774 780
775Sometimes, you may wish to avoid showing a warning while a command is 781Sometimes, you may wish to avoid showing a warning while a command is
776running, and only show it only after the end of the command. You can 782running, and only show it only after the end of the command. You can
@@ -1094,6 +1100,8 @@ You can use a display table to substitute other text for the ellipsis
1094 1100
1095@node Temporary Displays 1101@node Temporary Displays
1096@section Temporary Displays 1102@section Temporary Displays
1103@cindex temporary display
1104@cindex temporary buffer display
1097 1105
1098 Temporary displays are used by Lisp programs to put output into a 1106 Temporary displays are used by Lisp programs to put output into a
1099buffer and then present it to the user for perusal rather than for 1107buffer and then present it to the user for perusal rather than for
@@ -1186,12 +1194,6 @@ it prints into the buffer named @var{buffer-or-name} and displays that
1186buffer in some window. Unlike @code{with-output-to-temp-buffer}, 1194buffer in some window. Unlike @code{with-output-to-temp-buffer},
1187however, it does not automatically switch that buffer to Help mode. 1195however, it does not automatically switch that buffer to Help mode.
1188 1196
1189Like @code{with-output-to-temp-buffer} it neither makes the buffer
1190specified by @var{buffer-or-name} current when executing @var{body}.
1191@findex with-current-buffer-window
1192The otherwise identical macro @code{with-current-buffer-window} can be
1193used to execute @var{body} with that buffer current.
1194
1195The argument @var{buffer-or-name} specifies the temporary buffer. It 1197The argument @var{buffer-or-name} specifies the temporary buffer. It
1196can be either a buffer, which must already exist, or a string, in which 1198can be either a buffer, which must already exist, or a string, in which
1197case a buffer of that name is created, if necessary. The buffer is 1199case a buffer of that name is created, if necessary. The buffer is
@@ -1199,14 +1201,14 @@ marked as unmodified and read-only when @code{with-temp-buffer-window}
1199exits. 1201exits.
1200 1202
1201This macro does not call @code{temp-buffer-show-function}. Rather, it 1203This macro does not call @code{temp-buffer-show-function}. Rather, it
1202passes the @var{action} argument to @code{display-buffer} in order to 1204passes the @var{action} argument to @code{display-buffer}
1203display the buffer. 1205(@pxref{Choosing Window}) in order to display the buffer.
1204 1206
1205The value of the last form in @var{body} is returned, unless the 1207The value of the last form in @var{body} is returned, unless the
1206argument @var{quit-function} is specified. In that case, it is called 1208argument @var{quit-function} is specified. In that case, it is called
1207with two arguments: the window showing the buffer and the result of 1209with two arguments: the window showing the buffer and the result of
1208@var{body}. The final return value is then whatever 1210@var{body}. The final return value is then whatever @var{quit-function}
1209@var{quit-function} returns. 1211returns.
1210 1212
1211@vindex temp-buffer-window-setup-hook 1213@vindex temp-buffer-window-setup-hook
1212@vindex temp-buffer-window-show-hook 1214@vindex temp-buffer-window-show-hook
@@ -1215,6 +1217,56 @@ and @code{temp-buffer-window-show-hook} in place of the analogous hooks
1215run by @code{with-output-to-temp-buffer}. 1217run by @code{with-output-to-temp-buffer}.
1216@end defmac 1218@end defmac
1217 1219
1220The two constructs described next are mostly identical to
1221@code{with-temp-buffer-window} but differ from it as specified:
1222
1223@defmac with-current-buffer-window buffer-or-name action quit-function &rest body
1224This macro is like @code{with-temp-buffer-window} but unlike that makes
1225the buffer specified by @var{buffer-or-name} current for running
1226@var{body}.
1227@end defmac
1228
1229@defmac with-displayed-buffer-window buffer-or-name action quit-function &rest body
1230This macro is like @code{with-current-buffer-window} but unlike that
1231displays the buffer specified by @var{buffer-or-name} @emph{before}
1232running @var{body}.
1233@end defmac
1234
1235A window showing a temporary buffer can be fit to the size of that
1236buffer using the following mode:
1237
1238@defopt temp-buffer-resize-mode
1239When this minor mode is enabled, windows showing a temporary buffer are
1240automatically resized to fit their buffer's contents.
1241
1242A window is resized if and only if it has been specially created for the
1243buffer. In particular, windows that have shown another buffer before
1244are not resized. By default, this mode uses @code{fit-window-to-buffer}
1245(@pxref{Resizing Windows}) for resizing. You can specify a different
1246function by customizing the options @code{temp-buffer-max-height} and
1247@code{temp-buffer-max-width} below.
1248@end defopt
1249
1250@defopt temp-buffer-max-height
1251This option specifies the maximum height (in lines) of a window
1252displaying a temporary buffer when @code{temp-buffer-resize-mode} is
1253enabled. It can also be a function to be called to choose the height
1254for such a buffer. It gets one argument, the buffer, and should return
1255a positive integer. At the time the function is called, the window to
1256be resized is selected.
1257@end defopt
1258
1259@defopt temp-buffer-max-width
1260This option specifies the maximum width of a window (in columns)
1261displaying a temporary buffer when @code{temp-buffer-resize-mode} is
1262enabled. It can also be a function to be called to choose the width for
1263such a buffer. It gets one argument, the buffer, and should return a
1264positive integer. At the time the function is called, the window to be
1265resized is selected.
1266@end defopt
1267
1268The following function uses the current buffer for temporal display:
1269
1218@defun momentary-string-display string position &optional char message 1270@defun momentary-string-display string position &optional char message
1219This function momentarily displays @var{string} in the current buffer at 1271This function momentarily displays @var{string} in the current buffer at
1220@var{position}. It has no effect on the undo list or on the buffer's 1272@var{position}. It has no effect on the undo list or on the buffer's
@@ -1305,6 +1357,8 @@ inside the overlay or outside, and likewise for the end of the overlay.
1305 1357
1306@node Managing Overlays 1358@node Managing Overlays
1307@subsection Managing Overlays 1359@subsection Managing Overlays
1360@cindex managing overlays
1361@cindex overlays, managing
1308 1362
1309 This section describes the functions to create, delete and move 1363 This section describes the functions to create, delete and move
1310overlays, and to examine their contents. Overlay changes are not 1364overlays, and to examine their contents. Overlay changes are not
@@ -1465,6 +1519,7 @@ faster if you do @code{(overlay-recenter (point-max))} first.
1465 1519
1466@node Overlay Properties 1520@node Overlay Properties
1467@subsection Overlay Properties 1521@subsection Overlay Properties
1522@cindex overlay properties
1468 1523
1469 Overlay properties are like text properties in that the properties that 1524 Overlay properties are like text properties in that the properties that
1470alter how a character is displayed can come from either source. But in 1525alter how a character is displayed can come from either source. But in
@@ -1717,6 +1772,8 @@ Properties}.
1717 1772
1718@node Finding Overlays 1773@node Finding Overlays
1719@subsection Searching for Overlays 1774@subsection Searching for Overlays
1775@cindex searching for overlays
1776@cindex overlays, searching for
1720 1777
1721@defun overlays-at pos &optional sorted 1778@defun overlays-at pos &optional sorted
1722This function returns a list of all the overlays that cover the character at 1779This function returns a list of all the overlays that cover the character at
@@ -1784,6 +1841,8 @@ changes.
1784 1841
1785@node Size of Displayed Text 1842@node Size of Displayed Text
1786@section Size of Displayed Text 1843@section Size of Displayed Text
1844@cindex size of text on display
1845@cindex character width on display
1787 1846
1788Since not all characters have the same width, these functions let you 1847Since not all characters have the same width, these functions let you
1789check the width of a character. @xref{Primitive Indent}, and 1848check the width of a character. @xref{Primitive Indent}, and
@@ -2274,6 +2333,7 @@ suitable for use with @code{:stipple} (see above). It returns
2274 2333
2275@node Defining Faces 2334@node Defining Faces
2276@subsection Defining Faces 2335@subsection Defining Faces
2336@cindex defining faces
2277 2337
2278@cindex face spec 2338@cindex face spec
2279 The usual way to define a face is through the @code{defface} macro. 2339 The usual way to define a face is through the @code{defface} macro.
@@ -2448,6 +2508,7 @@ Any other value of @var{spec-type} is reserved for internal use.
2448 2508
2449@node Attribute Functions 2509@node Attribute Functions
2450@subsection Face Attribute Functions 2510@subsection Face Attribute Functions
2511@cindex face attributes, access and modification
2451 2512
2452 This section describes functions for directly accessing and 2513 This section describes functions for directly accessing and
2453modifying the attributes of a named face. 2514modifying the attributes of a named face.
@@ -2649,6 +2710,8 @@ a non-@code{nil} @code{:inverse-video} attribute.
2649 2710
2650@node Displaying Faces 2711@node Displaying Faces
2651@subsection Displaying Faces 2712@subsection Displaying Faces
2713@cindex displaying faces
2714@cindex face merging
2652 2715
2653 When Emacs displays a given piece of text, the visual appearance of 2716 When Emacs displays a given piece of text, the visual appearance of
2654the text may be determined by faces drawn from different sources. If 2717the text may be determined by faces drawn from different sources. If
@@ -2704,6 +2767,7 @@ at the next level of face merging.
2704 2767
2705@node Face Remapping 2768@node Face Remapping
2706@subsection Face Remapping 2769@subsection Face Remapping
2770@cindex face remapping
2707 2771
2708 The variable @code{face-remapping-alist} is used for buffer-local or 2772 The variable @code{face-remapping-alist} is used for buffer-local or
2709global changes in the appearance of a face. For instance, it is used 2773global changes in the appearance of a face. For instance, it is used
@@ -2901,6 +2965,7 @@ usually assign faces to around 400 to 600 characters at each call.
2901 2965
2902@node Basic Faces 2966@node Basic Faces
2903@subsection Basic Faces 2967@subsection Basic Faces
2968@cindex basic faces
2904 2969
2905If your Emacs Lisp program needs to assign some faces to text, it is 2970If your Emacs Lisp program needs to assign some faces to text, it is
2906often a good idea to use certain existing faces or inherit from them, 2971often a good idea to use certain existing faces or inherit from them,
@@ -3067,6 +3132,8 @@ nominal heights and widths would suggest.
3067 3132
3068@node Font Lookup 3133@node Font Lookup
3069@subsection Looking Up Fonts 3134@subsection Looking Up Fonts
3135@cindex font lookup
3136@cindex looking up fonts
3070 3137
3071@defun x-list-fonts name &optional reference-face frame maximum width 3138@defun x-list-fonts name &optional reference-face frame maximum width
3072This function returns a list of available font names that match 3139This function returns a list of available font names that match
@@ -3124,6 +3191,7 @@ encoding of the font.
3124 3191
3125@node Fontsets 3192@node Fontsets
3126@subsection Fontsets 3193@subsection Fontsets
3194@cindex fontset
3127 3195
3128 A @dfn{fontset} is a list of fonts, each assigned to a range of 3196 A @dfn{fontset} is a list of fonts, each assigned to a range of
3129character codes. An individual font cannot display the whole range of 3197character codes. An individual font cannot display the whole range of
@@ -4237,6 +4305,7 @@ display specifications and what they mean.
4237 4305
4238@node Replacing Specs 4306@node Replacing Specs
4239@subsection Display Specs That Replace The Text 4307@subsection Display Specs That Replace The Text
4308@cindex replacing display specs
4240 4309
4241 Some kinds of display specifications specify something to display 4310 Some kinds of display specifications specify something to display
4242instead of the text that has the property. These are called 4311instead of the text that has the property. These are called
@@ -5113,6 +5182,7 @@ Supports the @code{:index} property. @xref{Multi-Frame Images}.
5113 5182
5114@node Defining Images 5183@node Defining Images
5115@subsection Defining Images 5184@subsection Defining Images
5185@cindex define image
5116 5186
5117 The functions @code{create-image}, @code{defimage} and 5187 The functions @code{create-image}, @code{defimage} and
5118@code{find-image} provide convenient ways to create image descriptors. 5188@code{find-image} provide convenient ways to create image descriptors.
@@ -5240,6 +5310,7 @@ Here is an example of using @code{image-load-path-for-library}:
5240 5310
5241@node Showing Images 5311@node Showing Images
5242@subsection Showing Images 5312@subsection Showing Images
5313@cindex show image
5243 5314
5244 You can use an image descriptor by setting up the @code{display} 5315 You can use an image descriptor by setting up the @code{display}
5245property yourself, but it is easier to use the functions in this 5316property yourself, but it is easier to use the functions in this
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index b79d5df67c8..55da631a3f7 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -81,6 +81,8 @@ computer program, however, it is good to keep the distinction in mind.
81 81
82@node Visiting Functions 82@node Visiting Functions
83@subsection Functions for Visiting Files 83@subsection Functions for Visiting Files
84@cindex visiting files, functions for
85@cindex how to visit files
84 86
85 This section describes the functions normally used to visit files. 87 This section describes the functions normally used to visit files.
86For historical reasons, these functions have names starting with 88For historical reasons, these functions have names starting with
@@ -948,6 +950,8 @@ Unix. These conventions are also followed by @code{file-attributes}
948 950
949@node Kinds of Files 951@node Kinds of Files
950@subsection Distinguishing Kinds of Files 952@subsection Distinguishing Kinds of Files
953@cindex file classification
954@cindex classification of file types
951 955
952 This section describes how to distinguish various kinds of files, such 956 This section describes how to distinguish various kinds of files, such
953as directories, symbolic links, and ordinary files. 957as directories, symbolic links, and ordinary files.
@@ -2300,6 +2304,8 @@ through the immediately preceding @samp{/}).
2300 2304
2301@node Unique File Names 2305@node Unique File Names
2302@subsection Generating Unique File Names 2306@subsection Generating Unique File Names
2307@cindex unique file names
2308@cindex temporary files
2303 2309
2304 Some programs need to write temporary files. Here is the usual way to 2310 Some programs need to write temporary files. Here is the usual way to
2305construct a name for such a file: 2311construct a name for such a file:
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 0bded22eade..c1da337c6cc 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -106,6 +106,7 @@ for @code{framep} above.
106 106
107@node Creating Frames 107@node Creating Frames
108@section Creating Frames 108@section Creating Frames
109@cindex frame creation
109 110
110To create a new frame, call the function @code{make-frame}. 111To create a new frame, call the function @code{make-frame}.
111 112
@@ -484,6 +485,7 @@ parameter values to frames that will be created henceforth.
484 485
485@node Initial Parameters 486@node Initial Parameters
486@subsection Initial Frame Parameters 487@subsection Initial Frame Parameters
488@cindex parameters of initial frame
487 489
488You can specify the parameters for the initial startup frame by 490You can specify the parameters for the initial startup frame by
489setting @code{initial-frame-alist} in your init file (@pxref{Init 491setting @code{initial-frame-alist} in your init file (@pxref{Init
@@ -623,6 +625,7 @@ named, this parameter will be @code{nil}.
623@node Position Parameters 625@node Position Parameters
624@subsubsection Position Parameters 626@subsubsection Position Parameters
625@cindex window position on display 627@cindex window position on display
628@cindex frame position
626 629
627 Position parameters' values are normally measured in pixels, but on 630 Position parameters' values are normally measured in pixels, but on
628text terminals they count characters or lines instead. 631text terminals they count characters or lines instead.
@@ -833,6 +836,8 @@ integer). @xref{Line Height}, for more information.
833 836
834@node Buffer Parameters 837@node Buffer Parameters
835@subsubsection Buffer Parameters 838@subsubsection Buffer Parameters
839@cindex frame, which buffers to display
840@cindex buffers to display on frame
836 841
837 These frame parameters, meaningful on all kinds of terminals, deal 842 These frame parameters, meaningful on all kinds of terminals, deal
838with which buffers have been, or should, be displayed in the frame. 843with which buffers have been, or should, be displayed in the frame.
@@ -1663,6 +1668,7 @@ is used whenever that frame is selected. If the frame has a minibuffer,
1663you can get it with @code{minibuffer-window} (@pxref{Definition of 1668you can get it with @code{minibuffer-window} (@pxref{Definition of
1664minibuffer-window}). 1669minibuffer-window}).
1665 1670
1671@cindex frame without a minibuffer
1666However, you can also create a frame with no minibuffer. Such a frame 1672However, you can also create a frame with no minibuffer. Such a frame
1667must use the minibuffer window of some other frame. When you create the 1673must use the minibuffer window of some other frame. When you create the
1668frame, you can explicitly specify the minibuffer window to use (in some 1674frame, you can explicitly specify the minibuffer window to use (in some
@@ -2070,6 +2076,7 @@ allows to know if the pointer has been hidden.
2070 2076
2071@node Pop-Up Menus 2077@node Pop-Up Menus
2072@section Pop-Up Menus 2078@section Pop-Up Menus
2079@cindex menus, popup
2073 2080
2074 A Lisp program can pop up a menu so that the user can choose an 2081 A Lisp program can pop up a menu so that the user can choose an
2075alternative with the mouse. On a text terminal, if the mouse is not 2082alternative with the mouse. On a text terminal, if the mouse is not
@@ -2334,6 +2341,7 @@ clipboard as empty.
2334 2341
2335@node Drag and Drop 2342@node Drag and Drop
2336@section Drag and Drop 2343@section Drag and Drop
2344@cindex drag and drop
2337 2345
2338@vindex x-dnd-test-function 2346@vindex x-dnd-test-function
2339@vindex x-dnd-known-types 2347@vindex x-dnd-known-types
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 0ac084b668e..9555c218da5 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -1214,7 +1214,8 @@ ways to do it. The added function is also called a piece of @emph{advice}.
1214@end menu 1214@end menu
1215 1215
1216@node Core Advising Primitives 1216@node Core Advising Primitives
1217@subsection Primitives to manipulate advice 1217@subsection Primitives to manipulate advices
1218@cindex advice, add and remove
1218 1219
1219@defmac add-function where place function &optional props 1220@defmac add-function where place function &optional props
1220This macro is the handy way to add the advice @var{function} to the function 1221This macro is the handy way to add the advice @var{function} to the function
@@ -1316,6 +1317,7 @@ the current prefix argument.
1316 1317
1317@node Advising Named Functions 1318@node Advising Named Functions
1318@subsection Advising Named Functions 1319@subsection Advising Named Functions
1320@cindex advising named functions
1319 1321
1320A common use of advice is for named functions and macros. 1322A common use of advice is for named functions and macros.
1321You could just use @code{add-function} as in: 1323You could just use @code{add-function} as in:
@@ -1508,6 +1510,7 @@ More specifically, the composition of the two functions behaves like:
1508 1510
1509@node Porting old advice 1511@node Porting old advice
1510@subsection Adapting code using the old defadvice 1512@subsection Adapting code using the old defadvice
1513@cindex old advices, porting
1511 1514
1512A lot of code uses the old @code{defadvice} mechanism, which is largely made 1515A lot of code uses the old @code{defadvice} mechanism, which is largely made
1513obsolete by the new @code{advice-add}, whose implementation and semantics is 1516obsolete by the new @code{advice-add}, whose implementation and semantics is
diff --git a/doc/lispref/hash.texi b/doc/lispref/hash.texi
index 536777add72..323a2edca12 100644
--- a/doc/lispref/hash.texi
+++ b/doc/lispref/hash.texi
@@ -188,6 +188,8 @@ Such objects may be added to the hash table after it is created.
188 188
189@node Hash Access 189@node Hash Access
190@section Hash Table Access 190@section Hash Table Access
191@cindex accessing hash tables
192@cindex hash table access
191 193
192 This section describes the functions for accessing and storing 194 This section describes the functions for accessing and storing
193associations in a hash table. In general, any Lisp object can be used 195associations in a hash table. In general, any Lisp object can be used
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index 20fb0e651f9..2e3b51e28e2 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -90,6 +90,7 @@ hyperlinks in the @file{*Help*} buffer.)
90 90
91@node Accessing Documentation 91@node Accessing Documentation
92@section Access to Documentation Strings 92@section Access to Documentation Strings
93@cindex accessing documentation strings
93 94
94@defun documentation-property symbol property &optional verbatim 95@defun documentation-property symbol property &optional verbatim
95This function returns the documentation string recorded in 96This function returns the documentation string recorded in
@@ -507,6 +508,7 @@ non-@code{nil}, the return value is always a vector.
507 508
508@node Help Functions 509@node Help Functions
509@section Help Functions 510@section Help Functions
511@cindex help functions
510 512
511 Emacs provides a variety of built-in help functions, all accessible to 513 Emacs provides a variety of built-in help functions, all accessible to
512the user as subcommands of the prefix @kbd{C-h}. For more information 514the user as subcommands of the prefix @kbd{C-h}. For more information
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index e652da03385..91dc5ea464e 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -782,6 +782,7 @@ Lookup}.
782 782
783@node Controlling Active Maps 783@node Controlling Active Maps
784@section Controlling the Active Keymaps 784@section Controlling the Active Keymaps
785@cindex active keymap, controlling
785 786
786@defvar global-map 787@defvar global-map
787This variable contains the default global keymap that maps Emacs 788This variable contains the default global keymap that maps Emacs
@@ -1806,6 +1807,8 @@ local map.
1806 1807
1807@node Scanning Keymaps 1808@node Scanning Keymaps
1808@section Scanning Keymaps 1809@section Scanning Keymaps
1810@cindex scanning keymaps
1811@cindex keymaps, scanning
1809 1812
1810 This section describes functions used to scan all the current keymaps 1813 This section describes functions used to scan all the current keymaps
1811for the sake of printing help information. 1814for the sake of printing help information.
@@ -2775,6 +2778,7 @@ function keys.
2775 2778
2776@node Modifying Menus 2779@node Modifying Menus
2777@subsection Modifying Menus 2780@subsection Modifying Menus
2781@cindex menu modification
2778 2782
2779 When you insert a new item in an existing menu, you probably want to 2783 When you insert a new item in an existing menu, you probably want to
2780put it in a particular place among the menu's existing items. If you 2784put it in a particular place among the menu's existing items. If you
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 21be5cca4fc..e4383354f6f 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -84,6 +84,8 @@ structure made out of cons cells as a @dfn{list structure}.
84 84
85@node List-related Predicates 85@node List-related Predicates
86@section Predicates on Lists 86@section Predicates on Lists
87@cindex predicates for lists
88@cindex list predicates
87 89
88 The following predicates test whether a Lisp object is an atom, 90 The following predicates test whether a Lisp object is an atom,
89whether it is a cons cell or is a list, or whether it is the 91whether it is a cons cell or is a list, or whether it is the
@@ -662,6 +664,8 @@ Some examples:
662 664
663@node List Variables 665@node List Variables
664@section Modifying List Variables 666@section Modifying List Variables
667@cindex modify a list
668@cindex list modification
665 669
666 These functions, and one macro, provide convenient ways 670 These functions, and one macro, provide convenient ways
667to modify a list which is stored in a variable. 671to modify a list which is stored in a variable.
@@ -818,6 +822,8 @@ new @sc{car} or @sc{cdr}.
818 822
819@node Setcar 823@node Setcar
820@subsection Altering List Elements with @code{setcar} 824@subsection Altering List Elements with @code{setcar}
825@cindex replace list element
826@cindex list, replace element
821 827
822 Changing the @sc{car} of a cons cell is done with @code{setcar}. When 828 Changing the @sc{car} of a cons cell is done with @code{setcar}. When
823used on a list, @code{setcar} replaces one element of a list with a 829used on a list, @code{setcar} replaces one element of a list with a
@@ -923,6 +929,7 @@ x2: |
923 929
924@node Setcdr 930@node Setcdr
925@subsection Altering the CDR of a List 931@subsection Altering the CDR of a List
932@cindex replace part of list
926 933
927 The lowest-level primitive for modifying a @sc{cdr} is @code{setcdr}: 934 The lowest-level primitive for modifying a @sc{cdr} is @code{setcdr}:
928 935
@@ -1759,6 +1766,8 @@ and later discarded; this is not possible with a property list.
1759 1766
1760@node Plist Access 1767@node Plist Access
1761@subsection Property Lists Outside Symbols 1768@subsection Property Lists Outside Symbols
1769@cindex plist access
1770@cindex accessing plist properties
1762 1771
1763 The following functions can be used to manipulate property lists. 1772 The following functions can be used to manipulate property lists.
1764They all compare property names using @code{eq}. 1773They all compare property names using @code{eq}.
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index a07c2e8a792..a0393c957d4 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -419,6 +419,8 @@ the shadowed files as a string.
419 419
420@node Loading Non-ASCII 420@node Loading Non-ASCII
421@section Loading Non-@acronym{ASCII} Characters 421@section Loading Non-@acronym{ASCII} Characters
422@cindex loading, and non-ASCII characters
423@cindex non-ASCII characters in loaded files
422 424
423 When Emacs Lisp programs contain string constants with non-@acronym{ASCII} 425 When Emacs Lisp programs contain string constants with non-@acronym{ASCII}
424characters, these can be represented within Emacs either as unibyte 426characters, these can be represented within Emacs either as unibyte
@@ -907,6 +909,8 @@ with a call to @code{provide}. The order of the elements in the
907 909
908@node Where Defined 910@node Where Defined
909@section Which File Defined a Certain Symbol 911@section Which File Defined a Certain Symbol
912@cindex symbol, where defined
913@cindex where was a symbol defined
910 914
911@defun symbol-file symbol &optional type 915@defun symbol-file symbol &optional type
912This function returns the name of the file that defined @var{symbol}. 916This function returns the name of the file that defined @var{symbol}.
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi
index 9be12fa431b..8a4741c2ff1 100644
--- a/doc/lispref/macros.texi
+++ b/doc/lispref/macros.texi
@@ -194,6 +194,8 @@ During Compile}).
194 194
195@node Defining Macros 195@node Defining Macros
196@section Defining Macros 196@section Defining Macros
197@cindex defining macros
198@cindex macro, how to define
197 199
198 A Lisp macro object is a list whose @sc{car} is @code{macro}, and 200 A Lisp macro object is a list whose @sc{car} is @code{macro}, and
199whose @sc{cdr} is a function. Expansion of the macro works 201whose @sc{cdr} is a function. Expansion of the macro works
@@ -253,6 +255,7 @@ Form}.
253 255
254@node Problems with Macros 256@node Problems with Macros
255@section Common Problems Using Macros 257@section Common Problems Using Macros
258@cindex macro caveats
256 259
257 Macro expansion can have counterintuitive consequences. This 260 Macro expansion can have counterintuitive consequences. This
258section describes some important consequences that can lead to 261section describes some important consequences that can lead to
diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi
index 51b87ab1e5b..5902a3a836f 100644
--- a/doc/lispref/markers.texi
+++ b/doc/lispref/markers.texi
@@ -118,6 +118,8 @@ m1
118 118
119@node Predicates on Markers 119@node Predicates on Markers
120@section Predicates on Markers 120@section Predicates on Markers
121@cindex predicates for markers
122@cindex markers, predicates for
121 123
122 You can test an object to see whether it is a marker, or whether it is 124 You can test an object to see whether it is a marker, or whether it is
123either an integer or a marker. The latter test is useful in connection 125either an integer or a marker. The latter test is useful in connection
@@ -141,6 +143,8 @@ integer or floating point) or a marker, @code{nil} otherwise.
141 143
142@node Creating Markers 144@node Creating Markers
143@section Functions that Create Markers 145@section Functions that Create Markers
146@cindex creating markers
147@cindex marker creation
144 148
145 When you create a new marker, you can make it point nowhere, or point 149 When you create a new marker, you can make it point nowhere, or point
146to the present position of point, or to the beginning or end of the 150to the present position of point, or to the beginning or end of the
@@ -269,6 +273,7 @@ if they both point nowhere.
269 273
270@node Information from Markers 274@node Information from Markers
271@section Information from Markers 275@section Information from Markers
276@cindex marker information
272 277
273 This section describes the functions for accessing the components of a 278 This section describes the functions for accessing the components of a
274marker object. 279marker object.
@@ -342,6 +347,8 @@ specify the insertion type, create them with insertion type
342 347
343@node Moving Markers 348@node Moving Markers
344@section Moving Marker Positions 349@section Moving Marker Positions
350@cindex moving markers
351@cindex marker, how to move position
345 352
346 This section describes how to change the position of an existing 353 This section describes how to change the position of an existing
347marker. When you do this, be sure you know whether the marker is used 354marker. When you do this, be sure you know whether the marker is used
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 57ae0e999b4..e6d6ad001e5 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -107,6 +107,7 @@ are available in batch mode.
107 107
108@node Text from Minibuffer 108@node Text from Minibuffer
109@section Reading Text Strings with the Minibuffer 109@section Reading Text Strings with the Minibuffer
110@cindex minibuffer input, reading text strings
110 111
111 The most basic primitive for minibuffer input is 112 The most basic primitive for minibuffer input is
112@code{read-from-minibuffer}, which can be used to read either a string 113@code{read-from-minibuffer}, which can be used to read either a string
@@ -390,6 +391,7 @@ following bindings, in addition to those of @code{minibuffer-local-map}:
390 391
391@node Object from Minibuffer 392@node Object from Minibuffer
392@section Reading Lisp Objects with the Minibuffer 393@section Reading Lisp Objects with the Minibuffer
394@cindex minibuffer input, reading lisp objects
393 395
394 This section describes functions for reading Lisp objects with the 396 This section describes functions for reading Lisp objects with the
395minibuffer. 397minibuffer.
@@ -2044,6 +2046,7 @@ Do you really want to remove everything? (yes or no)
2044 2046
2045@node Multiple Queries 2047@node Multiple Queries
2046@section Asking Multiple Y-or-N Questions 2048@section Asking Multiple Y-or-N Questions
2049@cindex multiple yes-or-no questions
2047 2050
2048 When you have a series of similar questions to ask, such as ``Do you 2051 When you have a series of similar questions to ask, such as ``Do you
2049want to save this buffer'' for each buffer in turn, you should use 2052want to save this buffer'' for each buffer in turn, you should use
@@ -2285,6 +2288,8 @@ default value is 0.25.
2285 2288
2286@node Minibuffer Contents 2289@node Minibuffer Contents
2287@section Minibuffer Contents 2290@section Minibuffer Contents
2291@cindex access minibuffer contents
2292@cindex minibuffer contents, accessing
2288 2293
2289 These functions access the minibuffer prompt and contents. 2294 These functions access the minibuffer prompt and contents.
2290 2295
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index d67bac63b15..509982a008e 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1490,7 +1490,7 @@ A positive prefix argument enables the mode, any other prefix argument
1490disables it. From Lisp, an argument of @code{toggle} toggles the mode, 1490disables it. From Lisp, an argument of @code{toggle} toggles the mode,
1491whereas an omitted or @code{nil} argument enables the mode. 1491whereas an omitted or @code{nil} argument enables the mode.
1492This makes it easy to enable the minor mode in a major mode hook, for example. 1492This makes it easy to enable the minor mode in a major mode hook, for example.
1493If @var{doc} is nil, the macro supplies a default documentation string 1493If @var{doc} is @code{nil}, the macro supplies a default documentation string
1494explaining the above. 1494explaining the above.
1495 1495
1496By default, it also defines a variable named @var{mode}, which is set to 1496By default, it also defines a variable named @var{mode}, which is set to
@@ -3659,7 +3659,7 @@ For example:
3659Notice how those lexers return the empty string when in front of 3659Notice how those lexers return the empty string when in front of
3660parentheses. This is because SMIE automatically takes care of the 3660parentheses. This is because SMIE automatically takes care of the
3661parentheses defined in the syntax table. More specifically if the lexer 3661parentheses defined in the syntax table. More specifically if the lexer
3662returns nil or an empty string, SMIE tries to handle the corresponding 3662returns @code{nil} or an empty string, SMIE tries to handle the corresponding
3663text as a sexp according to syntax tables. 3663text as a sexp according to syntax tables.
3664 3664
3665@node SMIE Tricks 3665@node SMIE Tricks
diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi
index 902eb405411..fedf933b2d9 100644
--- a/doc/lispref/nonascii.texi
+++ b/doc/lispref/nonascii.texi
@@ -783,6 +783,8 @@ of them is @code{nil}, it defaults to the first or last codepoint of
783 783
784@node Scanning Charsets 784@node Scanning Charsets
785@section Scanning for Character Sets 785@section Scanning for Character Sets
786@cindex scanning for character sets
787@cindex character set, searching
786 788
787 Sometimes it is useful to find out which character set a particular 789 Sometimes it is useful to find out which character set a particular
788character belongs to. One use for this is in determining which coding 790character belongs to. One use for this is in determining which coding
@@ -1620,6 +1622,9 @@ contents (as it usually does), it should examine the contents of
1620 1622
1621@node Specifying Coding Systems 1623@node Specifying Coding Systems
1622@subsection Specifying a Coding System for One Operation 1624@subsection Specifying a Coding System for One Operation
1625@cindex specify coding system
1626@cindex force coding system for operation
1627@cindex coding system for operation
1623 1628
1624 You can specify the coding system for a specific operation by binding 1629 You can specify the coding system for a specific operation by binding
1625the variables @code{coding-system-for-read} and/or 1630the variables @code{coding-system-for-read} and/or
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index b7094479db2..91bd19036f7 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -917,13 +917,6 @@ This function returns the name of the machine you are running on, as a
917string. 917string.
918@end defun 918@end defun
919 919
920 The symbol @code{system-name} is a variable as well as a function. In
921fact, the function returns whatever value the variable
922@code{system-name} currently holds. Thus, you can set the variable
923@code{system-name} in case Emacs is confused about the name of your
924system. The variable is also useful for constructing frame titles
925(@pxref{Frame Titles}).
926
927@c FIXME seems like this section is not the best place for this option? 920@c FIXME seems like this section is not the best place for this option?
928@defopt mail-host-address 921@defopt mail-host-address
929If this variable is non-@code{nil}, it is used instead of 922If this variable is non-@code{nil}, it is used instead of
@@ -1208,6 +1201,7 @@ return value is @code{nil}.
1208 1201
1209@node Time of Day 1202@node Time of Day
1210@section Time of Day 1203@section Time of Day
1204@cindex time of day
1211 1205
1212 This section explains how to determine the current time and time 1206 This section explains how to determine the current time and time
1213zone. 1207zone.
@@ -1320,6 +1314,7 @@ time zone.
1320@node Time Conversion 1314@node Time Conversion
1321@section Time Conversion 1315@section Time Conversion
1322@cindex calendrical information 1316@cindex calendrical information
1317@cindex time conversion
1323 1318
1324 These functions convert time values (@pxref{Time of Day}) into 1319 These functions convert time values (@pxref{Time of Day}) into
1325calendrical information and vice versa. 1320calendrical information and vice versa.
@@ -1415,6 +1410,9 @@ on others, years as early as 1901 do work.
1415 1410
1416@node Time Parsing 1411@node Time Parsing
1417@section Parsing and Formatting Times 1412@section Parsing and Formatting Times
1413@cindex time parsing
1414@cindex time formatting
1415@cindex formatting time values
1418 1416
1419 These functions convert time values to text in a string, and vice versa. 1417 These functions convert time values to text in a string, and vice versa.
1420Time values are lists of two to four integers (@pxref{Time of Day}). 1418Time values are lists of two to four integers (@pxref{Time of Day}).
@@ -1643,6 +1641,9 @@ interactively, it prints the duration in the echo area.
1643 1641
1644@node Time Calculations 1642@node Time Calculations
1645@section Time Calculations 1643@section Time Calculations
1644@cindex time calculations
1645@cindex comparing time values
1646@cindex calendrical computations
1646 1647
1647 These functions perform calendrical computations using time values 1648 These functions perform calendrical computations using time values
1648(@pxref{Time of Day}). 1649(@pxref{Time of Day}).
@@ -1823,6 +1824,7 @@ cause anything special to happen.
1823 1824
1824@node Idle Timers 1825@node Idle Timers
1825@section Idle Timers 1826@section Idle Timers
1827@cindex idle timers
1826 1828
1827 Here is how to set up a timer that runs when Emacs is idle for a 1829 Here is how to set up a timer that runs when Emacs is idle for a
1828certain length of time. Aside from how to set them up, idle timers 1830certain length of time. Aside from how to set them up, idle timers
@@ -2529,7 +2531,7 @@ The server's version number.
2529The specification version the server is compliant with. 2531The specification version the server is compliant with.
2530@end table 2532@end table
2531 2533
2532If @var{SPEC_VERSION} is @code{nil}, the server supports a 2534If @var{spec_version} is @code{nil}, the server supports a
2533specification prior to @samp{"1.0"}. 2535specification prior to @samp{"1.0"}.
2534@end defun 2536@end defun
2535 2537
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index 032baa9d2e3..24ff5d8c86b 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -465,6 +465,7 @@ beginning or end of a line.
465 465
466@node Screen Lines 466@node Screen Lines
467@subsection Motion by Screen Lines 467@subsection Motion by Screen Lines
468@cindex screen lines, moving by
468 469
469 The line functions in the previous section count text lines, delimited 470 The line functions in the previous section count text lines, delimited
470only by newline characters. By contrast, these functions count screen 471only by newline characters. By contrast, these functions count screen
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 0952cc15f03..856831d16c6 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -63,6 +63,8 @@ Processes}.
63 63
64@node Subprocess Creation 64@node Subprocess Creation
65@section Functions that Create Subprocesses 65@section Functions that Create Subprocesses
66@cindex create subprocess
67@cindex process creation
66 68
67 There are three primitives that create a new subprocess in which to run 69 There are three primitives that create a new subprocess in which to run
68a program. One of them, @code{start-process}, creates an asynchronous 70a program. One of them, @code{start-process}, creates an asynchronous
@@ -734,6 +736,7 @@ happen sooner or later).
734 736
735@node Process Information 737@node Process Information
736@section Process Information 738@section Process Information
739@cindex process information
737 740
738 Several functions return information about processes. 741 Several functions return information about processes.
739 742
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 992ad001fe7..19c515f3ca2 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -257,6 +257,8 @@ it easier to verify even very complex regexps.
257 257
258@node Syntax of Regexps 258@node Syntax of Regexps
259@subsection Syntax of Regular Expressions 259@subsection Syntax of Regular Expressions
260@cindex regexp syntax
261@cindex syntax of regular expressions
260 262
261 Regular expressions have a syntax in which a few characters are 263 Regular expressions have a syntax in which a few characters are
262special constructs and the rest are @dfn{ordinary}. An ordinary 264special constructs and the rest are @dfn{ordinary}. An ordinary
@@ -294,6 +296,7 @@ need to use one of the special regular expression constructs.
294 296
295@node Regexp Special 297@node Regexp Special
296@subsubsection Special Characters in Regular Expressions 298@subsubsection Special Characters in Regular Expressions
299@cindex regexp, special characters in
297 300
298 Here is a list of the characters that are special in a regular 301 Here is a list of the characters that are special in a regular
299expression. 302expression.
@@ -894,6 +897,7 @@ beyond the minimum needed to end a sentence.
894 897
895 These functions operate on regular expressions. 898 These functions operate on regular expressions.
896 899
900@cindex quote special characters in regexp
897@defun regexp-quote string 901@defun regexp-quote string
898This function returns a regular expression whose only exact match is 902This function returns a regular expression whose only exact match is
899@var{string}. Using this regular expression in @code{looking-at} will 903@var{string}. Using this regular expression in @code{looking-at} will
@@ -924,6 +928,7 @@ whitespace:
924@end example 928@end example
925@end defun 929@end defun
926 930
931@cindex optimize regexp
927@defun regexp-opt strings &optional paren 932@defun regexp-opt strings &optional paren
928This function returns an efficient regular expression that will match 933This function returns an efficient regular expression that will match
929any of the strings in the list @var{strings}. This is useful when you 934any of the strings in the list @var{strings}. This is useful when you
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 1ecc5671a90..026c7a77df2 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -92,6 +92,8 @@ representations and to encode and decode character codes.
92 92
93@node Predicates for Strings 93@node Predicates for Strings
94@section Predicates for Strings 94@section Predicates for Strings
95@cindex predicates for strings
96@cindex string predicates
95 97
96For more information about general sequence and array predicates, 98For more information about general sequence and array predicates,
97see @ref{Sequences Arrays Vectors}, and @ref{Arrays}. 99see @ref{Sequences Arrays Vectors}, and @ref{Arrays}.
@@ -113,6 +115,8 @@ character (i.e., an integer), @code{nil} otherwise.
113 115
114@node Creating Strings 116@node Creating Strings
115@section Creating Strings 117@section Creating Strings
118@cindex creating strings
119@cindex string creation
116 120
117 The following functions create strings, either from scratch, or by 121 The following functions create strings, either from scratch, or by
118putting strings together, or by taking them apart. 122putting strings together, or by taking them apart.
@@ -367,6 +371,8 @@ usual value is @w{@code{"[ \f\t\n\r\v]+"}}.
367 371
368@node Modifying Strings 372@node Modifying Strings
369@section Modifying Strings 373@section Modifying Strings
374@cindex modifying strings
375@cindex string modification
370 376
371 The most basic way to alter the contents of an existing string is with 377 The most basic way to alter the contents of an existing string is with
372@code{aset} (@pxref{Array Functions}). @code{(aset @var{string} 378@code{aset} (@pxref{Array Functions}). @code{(aset @var{string}
@@ -400,6 +406,7 @@ zeros. It may also change @var{string}'s length.
400@node Text Comparison 406@node Text Comparison
401@section Comparison of Characters and Strings 407@section Comparison of Characters and Strings
402@cindex string equality 408@cindex string equality
409@cindex text comparison
403 410
404@defun char-equal character1 character2 411@defun char-equal character1 character2
405This function returns @code{t} if the arguments represent the same 412This function returns @code{t} if the arguments represent the same
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index 25e6089491e..33577e74157 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -592,6 +592,8 @@ in turn, repeatedly, until they all return @code{nil}.
592 592
593@node Motion and Syntax 593@node Motion and Syntax
594@section Motion and Syntax 594@section Motion and Syntax
595@cindex moving across syntax classes
596@cindex skipping characters of certain syntax
595 597
596 This section describes functions for moving across characters that 598 This section describes functions for moving across characters that
597have certain syntax classes. 599have certain syntax classes.
@@ -631,6 +633,8 @@ expression prefix syntax class, and characters with the @samp{p} flag.
631 633
632@node Parsing Expressions 634@node Parsing Expressions
633@section Parsing Expressions 635@section Parsing Expressions
636@cindex parsing expressions
637@cindex scanning expressions
634 638
635 This section describes functions for parsing and scanning balanced 639 This section describes functions for parsing and scanning balanced
636expressions. We will refer to such expressions as @dfn{sexps}, 640expressions. We will refer to such expressions as @dfn{sexps},
@@ -673,6 +677,7 @@ result, Emacs treats them as four consecutive empty string constants.
673 677
674@node Motion via Parsing 678@node Motion via Parsing
675@subsection Motion Commands Based on Parsing 679@subsection Motion Commands Based on Parsing
680@cindex motion based on parsing
676 681
677 This section describes simple point-motion functions that operate 682 This section describes simple point-motion functions that operate
678based on parsing expressions. 683based on parsing expressions.
@@ -738,6 +743,7 @@ cannot exceed that many.
738 743
739@node Position Parse 744@node Position Parse
740@subsection Finding the Parse State for a Position 745@subsection Finding the Parse State for a Position
746@cindex parse state for a position
741 747
742 For syntactic analysis, such as in indentation, often the useful 748 For syntactic analysis, such as in indentation, often the useful
743thing is to compute the syntactic state corresponding to a given buffer 749thing is to compute the syntactic state corresponding to a given buffer
@@ -919,6 +925,7 @@ nicely.
919 925
920@node Control Parsing 926@node Control Parsing
921@subsection Parameters to Control Parsing 927@subsection Parameters to Control Parsing
928@cindex parsing, control parameters
922 929
923@defvar multibyte-syntax-as-symbol 930@defvar multibyte-syntax-as-symbol
924If this variable is non-@code{nil}, @code{scan-sexps} treats all 931If this variable is non-@code{nil}, @code{scan-sexps} treats all
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 06d1381278c..379fb295654 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -162,6 +162,7 @@ the end of a line.
162 162
163@node Buffer Contents 163@node Buffer Contents
164@section Examining Buffer Contents 164@section Examining Buffer Contents
165@cindex buffer portion as string
165 166
166 This section describes functions that allow a Lisp program to 167 This section describes functions that allow a Lisp program to
167convert any portion of the text in the buffer into a string. 168convert any portion of the text in the buffer into a string.
@@ -2679,6 +2680,8 @@ along with the characters; this includes such diverse functions as
2679 2680
2680@node Examining Properties 2681@node Examining Properties
2681@subsection Examining Text Properties 2682@subsection Examining Text Properties
2683@cindex examining text properties
2684@cindex text properties, examining
2682 2685
2683 The simplest way to examine text properties is to ask for the value of 2686 The simplest way to examine text properties is to ask for the value of
2684a particular property of a particular character. For that, use 2687a particular property of a particular character. For that, use
@@ -2770,6 +2773,8 @@ used instead. Here is an example:
2770 2773
2771@node Changing Properties 2774@node Changing Properties
2772@subsection Changing Text Properties 2775@subsection Changing Text Properties
2776@cindex changing text properties
2777@cindex text properties, changing
2773 2778
2774 The primitives for changing properties apply to a specified range of 2779 The primitives for changing properties apply to a specified range of
2775text in a buffer or string. The function @code{set-text-properties} 2780text in a buffer or string. The function @code{set-text-properties}
@@ -2933,6 +2938,8 @@ buffer but does not copy its properties.
2933 2938
2934@node Property Search 2939@node Property Search
2935@subsection Text Property Search Functions 2940@subsection Text Property Search Functions
2941@cindex searching text properties
2942@cindex text properties, searching
2936 2943
2937 In typical use of text properties, most of the time several or many 2944 In typical use of text properties, most of the time several or many
2938consecutive characters have the same value for a property. Rather than 2945consecutive characters have the same value for a property. Rather than
@@ -3991,6 +3998,8 @@ coalesced whenever possible. @xref{Property Search}.
3991 3998
3992@node Substitution 3999@node Substitution
3993@section Substituting for a Character Code 4000@section Substituting for a Character Code
4001@cindex replace characters in region
4002@cindex substitute characters
3994 4003
3995 The following functions replace characters within a specified region 4004 The following functions replace characters within a specified region
3996based on their character codes. 4005based on their character codes.
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index e890dbce359..b3466e60c4e 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -1951,6 +1951,7 @@ foo
1951 1951
1952@node Variables with Restricted Values 1952@node Variables with Restricted Values
1953@section Variables with Restricted Values 1953@section Variables with Restricted Values
1954@cindex lisp variables defined in C, restrictions
1954 1955
1955 Ordinary Lisp variables can be assigned any value that is a valid 1956 Ordinary Lisp variables can be assigned any value that is a valid
1956Lisp object. However, certain Lisp variables are not defined in Lisp, 1957Lisp object. However, certain Lisp variables are not defined in Lisp,
@@ -1987,6 +1988,8 @@ Attempting to assign them any other value will result in an error:
1987@node Generalized Variables 1988@node Generalized Variables
1988@section Generalized Variables 1989@section Generalized Variables
1989 1990
1991@cindex generalized variable
1992@cindex place form
1990A @dfn{generalized variable} or @dfn{place form} is one of the many places 1993A @dfn{generalized variable} or @dfn{place form} is one of the many places
1991in Lisp memory where values can be stored. The simplest place form is 1994in Lisp memory where values can be stored. The simplest place form is
1992a regular Lisp variable. But the @sc{car}s and @sc{cdr}s of lists, elements 1995a regular Lisp variable. But the @sc{car}s and @sc{cdr}s of lists, elements
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 7c8d0b084b5..a172a4a4d87 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -1252,6 +1252,8 @@ are the opposite of what they are in those other functions.
1252 1252
1253@node Recombining Windows 1253@node Recombining Windows
1254@section Recombining Windows 1254@section Recombining Windows
1255@cindex recombining windows
1256@cindex windows, recombining
1255 1257
1256When deleting the last sibling of a window @var{W}, its parent window 1258When deleting the last sibling of a window @var{W}, its parent window
1257is deleted too, with @var{W} replacing it in the window tree. This 1259is deleted too, with @var{W} replacing it in the window tree. This
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index 0159101916d..71c5ae0a6c2 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -1469,7 +1469,7 @@ machine at which Emacs was invoked. This is done by setting
1469@code{frame-title-format} to the default value of 1469@code{frame-title-format} to the default value of
1470 1470
1471@lisp 1471@lisp
1472(multiple-frames "%b" ("" invocation-name "@@" system-name)) 1472(multiple-frames "%b" ("" invocation-name "@@" (system-name)))
1473@end lisp 1473@end lisp
1474 1474
1475To modify the behavior such that frame titlebars contain the buffer's 1475To modify the behavior such that frame titlebars contain the buffer's
diff --git a/doc/misc/smtpmail.texi b/doc/misc/smtpmail.texi
index f539cd0e224..9cddbfaf68a 100644
--- a/doc/misc/smtpmail.texi
+++ b/doc/misc/smtpmail.texi
@@ -368,7 +368,7 @@ implement support for common requirements.
368@vindex smtpmail-local-domain 368@vindex smtpmail-local-domain
369 The variable @code{smtpmail-local-domain} controls the hostname sent 369 The variable @code{smtpmail-local-domain} controls the hostname sent
370in the first @code{EHLO} or @code{HELO} command sent to the server. 370in the first @code{EHLO} or @code{HELO} command sent to the server.
371It should only be set if the @code{system-name} function returns a 371It should be set only if the @code{system-name} function returns a
372name that isn't accepted by the server. Do not set this variable 372name that isn't accepted by the server. Do not set this variable
373unless your server complains. 373unless your server complains.
374 374
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 814b94dde08..3c48c51c255 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,11 @@
12014-12-30 Paul Eggert <eggert@cs.ucla.edu>
2
3 * PROBLEMS: Omit obsolete mention of FQDNs.
4
52014-12-27 Álvar Ibeas <ibeas@gmx.com> (tiny change)
6
7 * tutorials/TUTORIAL.es: Improve style consistency. Spelling fixes.
8
12014-12-25 Karl Fogel <kfogel@red-bean.com> 92014-12-25 Karl Fogel <kfogel@red-bean.com>
2 10
3 * NEWS: Mention new buffer display behavior for `shell'. 11 * NEWS: Mention new buffer display behavior for `shell'.
diff --git a/etc/NEWS b/etc/NEWS
index 14933aa8b0c..ae0cb70c833 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -401,10 +401,13 @@ and comments.
401the color range from `vc-annotate-color-map' is applied to the 401the color range from `vc-annotate-color-map' is applied to the
402background or to the foreground. 402background or to the foreground.
403 403
404*** compare-windows now compares text with the most recently used window 404*** `compare-windows' now compares text with the most recently used window
405instead of the next window. The new option `compare-windows-get-window-function' 405instead of the next window. The new option `compare-windows-get-window-function'
406allows to customize this. 406allows to customize this.
407 407
408*** Two new faces `compare-windows-removed' and `compare-windows-added'
409replace the obsolete face `compare-windows'.
410
408** Calculator: decimal display mode uses "," groups, so it's more 411** Calculator: decimal display mode uses "," groups, so it's more
409fitting for use in money calculations; factorial works with 412fitting for use in money calculations; factorial works with
410non-integer inputs. 413non-integer inputs.
@@ -453,6 +456,11 @@ easier binding, which is now unoccupied (`M-,').
453alias for a private variable. `xref-push-marker-stack' and 456alias for a private variable. `xref-push-marker-stack' and
454`xref-pop-marker-stack' should be used to mutate it instead. 457`xref-pop-marker-stack' should be used to mutate it instead.
455 458
459** etags
460As a result of the above, these commands are now obsolete:
461`find-tag-other-window', `find-tag-other-frame', `find-tag-regexp',
462`tags-apropos' and `tags-loop-continue'.
463
456** Obsolete packages 464** Obsolete packages
457 465
458--- 466---
@@ -533,6 +541,11 @@ optional repeat-count argument.
533 541
534** Function `sort' can deal with vectors. 542** Function `sort' can deal with vectors.
535 543
544** Function `system-name' now returns an updated value if the current
545system's name has changed or if the Emacs process has changed systems,
546and to avoid long waits it no longer consults DNS to canonicalize the
547name. The variable `system-name' is now obsolete.
548
536--- 549---
537** New utilities in subr-x.el: 550** New utilities in subr-x.el:
538*** New macros `if-let' and `when-let' allow defining bindings and to 551*** New macros `if-let' and `when-let' allow defining bindings and to
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 67a26b93b2a..e1463f14bfc 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -364,8 +364,8 @@ For example, (system-name) returns some variation on
364"localhost.localdomain", rather the name you were expecting. 364"localhost.localdomain", rather the name you were expecting.
365 365
366You need to configure your machine with a fully qualified domain name, 366You need to configure your machine with a fully qualified domain name,
367(i.e. a name with at least one ".") either in /etc/hosts, 367(i.e., a name with at least one "."), either in /etc/hostname
368/etc/hostname, the NIS, or wherever your system calls for specifying this. 368or wherever your system calls for specifying this.
369 369
370If you cannot fix the configuration, you can set the Lisp variable 370If you cannot fix the configuration, you can set the Lisp variable
371mail-host-address to the value you want. 371mail-host-address to the value you want.
@@ -457,17 +457,6 @@ problem by adding this to your .cshrc file:
457 endif 457 endif
458 endif 458 endif
459 459
460*** Emacs startup on GNU/Linux systems (and possibly other systems) is slow.
461
462This can happen if the system is misconfigured and Emacs can't get the
463full qualified domain name, FQDN. You should have your FQDN in the
464/etc/hosts file, something like this:
465
466127.0.0.1 localhost
467129.187.137.82 nuc04.t30.physik.tu-muenchen.de nuc04
468
469The way to set this up may vary on non-GNU systems.
470
471*** Attempting to visit remote files via ange-ftp fails. 460*** Attempting to visit remote files via ange-ftp fails.
472 461
473If the error message is "ange-ftp-file-modtime: Specified time is not 462If the error message is "ange-ftp-file-modtime: Specified time is not
diff --git a/etc/grep.txt b/etc/grep.txt
index 523b1fa404c..b96a916f905 100644
--- a/etc/grep.txt
+++ b/etc/grep.txt
@@ -39,7 +39,7 @@ grep -nH --color=always -e "INFO tree" ../info/*
39 39
40* GNU grep 2.5.1 on lines starting with a number and colon 40* GNU grep 2.5.1 on lines starting with a number and colon
41 41
42grep -nH -e "Universal Time" ../lispref/* 42grep -nH --color=always -e "Universal Time" ../doc/lispref/*
43../lispref/os.texi:1010:0:00 January 1, 1970 UTC (Coordinated Universal Time) 43../lispref/os.texi:1010:0:00 January 1, 1970 UTC (Coordinated Universal Time)
44 44
45* GNU grep 2.5.1 with context lines 45* GNU grep 2.5.1 with context lines
@@ -78,8 +78,8 @@ bzr grep --color=always -in "org-element-map"
78lisp/org/org.el:21047: (org-element-map 78lisp/org/org.el:21047: (org-element-map
79 79
80* git-grep 80* git-grep
81 with `[diff "el"] xfuncname = "^(\\(.*)$"' in .gitconfig 81 with `[diff "lisp"] xfuncname = "^(\\(.*)$"' in .gitconfig
82 and `*.el diff=el' in .gitattributes 82 and `*.el diff=lisp' in .gitattributes
83 83
84git --no-pager grep -inH -p -e "org-element-map" 84git --no-pager grep -inH -p -e "org-element-map"
85lisp/org/org.el=20969=(defun org-fill-paragraph (&optional justify) 85lisp/org/org.el=20969=(defun org-fill-paragraph (&optional justify)
diff --git a/etc/tutorials/TUTORIAL.es b/etc/tutorials/TUTORIAL.es
index 604aaf76c3a..0983e5d0507 100644
--- a/etc/tutorials/TUTORIAL.es
+++ b/etc/tutorials/TUTORIAL.es
@@ -16,7 +16,7 @@ ocasión, usaremos las siguientes abreviaturas.
16Nota importante: para terminar la sesión de Emacs teclee C-x C-c (dos 16Nota importante: para terminar la sesión de Emacs teclee C-x C-c (dos
17caracteres). Para cancelar un comando parcialmente introducido, 17caracteres). Para cancelar un comando parcialmente introducido,
18teclee C-g. 18teclee C-g.
19Los caracteres ">>" en el margen izquierdo indican instrucciones para 19Los caracteres «>>» en el margen izquierdo indican instrucciones para
20que usted trate de usar un comando. Por ejemplo: 20que usted trate de usar un comando. Por ejemplo:
21<<Blank lines inserted around following line by help-with-tutorial>> 21<<Blank lines inserted around following line by help-with-tutorial>>
22[Mitad de página en blanco para propósitos didácticos. El texto continúa abajo] 22[Mitad de página en blanco para propósitos didácticos. El texto continúa abajo]
@@ -67,11 +67,11 @@ Es útil moverse de una pantalla completa a otra pero, ¿cómo moverse a
67un lugar específico dentro del texto en la pantalla? 67un lugar específico dentro del texto en la pantalla?
68 68
69Puede hacerlo de diversas formas. Puede usar las teclas de flechas, 69Puede hacerlo de diversas formas. Puede usar las teclas de flechas,
70pero es mas eficiente mantener las manos en la posición estándar y 70pero es más eficiente mantener las manos en la posición estándar y
71usar los comandos C-p, C-b, C-f, y C-n. Estos caracteres son 71usar los comandos C-p, C-b, C-f, y C-n. Estos caracteres son
72equivalentes a las cuatro teclas de flechas, de esta manera: 72equivalentes a las cuatro teclas de flechas, de esta manera:
73 73
74 Línea anterior, C-P 74 Línea anterior, C-p
75 : 75 :
76 : 76 :
77 Atrás, C-b.... Posición actual del cursor .... Adelante, C-f 77 Atrás, C-b.... Posición actual del cursor .... Adelante, C-f
@@ -111,7 +111,7 @@ C-f puede moverse a través de una nueva línea igual que C-b.
111 111
112Cuando pase el tope o el final de la pantalla, se mostrará el texto 112Cuando pase el tope o el final de la pantalla, se mostrará el texto
113más allá del borde de la pantalla. Esto recibe el nombre de 113más allá del borde de la pantalla. Esto recibe el nombre de
114"desplazamiento". Esto le permite a Emacs mover el cursor al lugar 114«desplazamiento». Esto le permite a Emacs mover el cursor al lugar
115especificado en el texto sin moverlo fuera de la pantalla. 115especificado en el texto sin moverlo fuera de la pantalla.
116 116
117>> Intente mover el cursor fuera del borde de la pantalla con C-n, y 117>> Intente mover el cursor fuera del borde de la pantalla con C-n, y
@@ -133,10 +133,10 @@ dirección opuesta.
133 133
134Note el paralelo entre C-f y C-b de un lado y M-f y M-b del otro. Muy 134Note el paralelo entre C-f y C-b de un lado y M-f y M-b del otro. Muy
135frecuentemente los caracteres Meta se usan para operaciones 135frecuentemente los caracteres Meta se usan para operaciones
136relacionadas, con las unidades definidas por el lenguaje (palabras, 136relacionadas con las unidades definidas por el lenguaje (palabras,
137oraciones y párrafos), mientras los caracteres Control operan sobre 137oraciones y párrafos), mientras los caracteres Control operan sobre
138unidades básicas que son independientes de lo que está editando 138unidades básicas que son independientes de lo que está editando
139(caracteres, líneas, etc). 139(caracteres, líneas, etc.).
140 140
141Este paralelo se aplica entre líneas y oraciones: C-a y C-e para 141Este paralelo se aplica entre líneas y oraciones: C-a y C-e para
142moverse al comienzo o al final de la línea; y M-a y M-e para mover al 142moverse al comienzo o al final de la línea; y M-a y M-e para mover al
@@ -149,7 +149,7 @@ Vea cómo la repetición de C-a no hace nada, pero la repetición de M-a
149sigue moviendo una oración más. Aunque no son muy análogas, cada una 149sigue moviendo una oración más. Aunque no son muy análogas, cada una
150parece natural. 150parece natural.
151 151
152La ubicación del cursor en el texto se llama también "punto". En 152La ubicación del cursor en el texto se llama también «punto». En
153otras palabras, el cursor muestra sobre la pantalla donde está 153otras palabras, el cursor muestra sobre la pantalla donde está
154situado el punto dentro del texto. 154situado el punto dentro del texto.
155 155
@@ -178,7 +178,7 @@ Otros dos comandos importantes de movimiento del cursor son M-< (META
178Menor que), el cual se mueve al comienzo del texto entero, y M-> (META 178Menor que), el cual se mueve al comienzo del texto entero, y M-> (META
179Mayor que), el cual se mueve al final del texto entero. 179Mayor que), el cual se mueve al final del texto entero.
180 180
181En la mayoría de las terminales, el "<" está sobre la coma, por lo 181En la mayoría de las terminales, el «<» está sobre la coma, por lo
182tanto tiene que usar la tecla shift para teclearlo. En estas 182tanto tiene que usar la tecla shift para teclearlo. En estas
183terminales tendrá que usar la tecla shift también al teclear M-<; sin 183terminales tendrá que usar la tecla shift también al teclear M-<; sin
184la tecla shift, usted estaría escribiendo M-coma. 184la tecla shift, usted estaría escribiendo M-coma.
@@ -207,7 +207,7 @@ una tecla META (o EDIT o ALT), hay una manera alternativa para
207ingresar un argumento numérico: teclear los dígitos mientras presiona 207ingresar un argumento numérico: teclear los dígitos mientras presiona
208la tecla META. Recomendamos aprender el método C-u porque éste 208la tecla META. Recomendamos aprender el método C-u porque éste
209funciona en cualquier terminal. El argumento numérico es también 209funciona en cualquier terminal. El argumento numérico es también
210llamado un "argumento prefijo", porque usted teclea el argumento antes 210llamado un «argumento prefijo», porque usted teclea el argumento antes
211del comando al que se aplica. 211del comando al que se aplica.
212 212
213Por ejemplo, C-u 8 C-f mueve hacia adelante ocho caracteres. 213Por ejemplo, C-u 8 C-f mueve hacia adelante ocho caracteres.
@@ -253,7 +253,7 @@ comienzo de un comando que no quiere finalizar.
253 253
254>> Escriba C-u 100 para hacer un argumento numérico de 100, y luego 254>> Escriba C-u 100 para hacer un argumento numérico de 100, y luego
255 pruebe C-g. 255 pruebe C-g.
256 Ahora pruebe C-f. Esto deberá mover sólo un carácter, ya que 256 Ahora pruebe C-f. Esto deberá mover solo un carácter, ya que
257 canceló el argumento con C-g. 257 canceló el argumento con C-g.
258 258
259Si ha tecleado <ESC> por error, puede desecharlo con un C-g. 259Si ha tecleado <ESC> por error, puede desecharlo con un C-g.
@@ -262,7 +262,7 @@ Si ha tecleado <ESC> por error, puede desecharlo con un C-g.
262* COMANDOS DESACTIVADOS 262* COMANDOS DESACTIVADOS
263----------------------- 263-----------------------
264 264
265Algunos comandos de Emacs están "desactivados" de manera que los 265Algunos comandos de Emacs están «desactivados» de manera que los
266usuarios principiantes no puedan usarlos accidentalmente. 266usuarios principiantes no puedan usarlos accidentalmente.
267 267
268Si teclea uno de los comandos desactivados, Emacs muestra un mensaje 268Si teclea uno de los comandos desactivados, Emacs muestra un mensaje
@@ -271,7 +271,7 @@ continuar y ejecutar el comando.
271 271
272Si realmente quiere intentar el comando, teclee Espacio como repuesta 272Si realmente quiere intentar el comando, teclee Espacio como repuesta
273a la pregunta. Normalmente, si no quiere ejecutar el comando 273a la pregunta. Normalmente, si no quiere ejecutar el comando
274desactivado, conteste la pregunta con "n". 274desactivado, conteste la pregunta con «n».
275 275
276>> Escriba C-x C-l (que es un comando desactivado), a continuación 276>> Escriba C-x C-l (que es un comando desactivado), a continuación
277 escriba n para responder la pregunta. 277 escriba n para responder la pregunta.
@@ -280,7 +280,7 @@ desactivado, conteste la pregunta con "n".
280* VENTANAS 280* VENTANAS
281---------- 281----------
282 282
283Emacs puede tener varias "ventanas", cada una mostrando su propio texto. 283Emacs puede tener varias «ventanas», cada una mostrando su propio texto.
284Explicaremos después cómo usar múltiples ventanas. Ahora mismo 284Explicaremos después cómo usar múltiples ventanas. Ahora mismo
285queremos explicar cómo deshacerse de ventanas adicionales y volver a 285queremos explicar cómo deshacerse de ventanas adicionales y volver a
286la edición básica en una ventana. Es sencillo: 286la edición básica en una ventana. Es sencillo:
@@ -310,15 +310,15 @@ cuatro caracteres.
310 310
311Si quiere insertar un texto, basta con que lo teclee. Los caracteres 311Si quiere insertar un texto, basta con que lo teclee. Los caracteres
312normales, como A, 7, *, etc. se insertan nada más teclearlos. Teclee 312normales, como A, 7, *, etc. se insertan nada más teclearlos. Teclee
313<Return> (la tecla "Enter" o "Intro") para insertar un carácter de 313<Return> (la tecla «Enter» o «Intro») para insertar un carácter de
314nueva línea. 314nueva línea.
315 315
316Para borrar el carácter que precede al cursor, oprima <DEL>. Es una 316Para borrar el carácter que precede al cursor, oprima <DEL>. Es una
317tecla alargada, normalmente etiquetada como "Backspace" o "Del", o con 317tecla alargada, normalmente etiquetada como «Backspace» o «Del», o con
318una flecha apuntando a la izquierda; la misma que suele utilizar fuera 318una flecha apuntando a la izquierda; la misma que suele utilizar fuera
319de Emacs para borrar el último carácter introducido. 319de Emacs para borrar el último carácter introducido.
320 320
321Puede haber otra tecla llamada "Del" o "Supr" en otra parte, pero ésa 321Puede haber otra tecla llamada «Del» o «Supr» en otra parte, pero ésa
322no es <DEL>. 322no es <DEL>.
323 323
324>> Haga esto ahora: teclee unos pocos caracteres, después bórrelos 324>> Haga esto ahora: teclee unos pocos caracteres, después bórrelos
@@ -327,9 +327,9 @@ no es <DEL>.
327 personal de él. 327 personal de él.
328 328
329Cuando una línea de texto se hace muy grande para una sola línea de la 329Cuando una línea de texto se hace muy grande para una sola línea de la
330pantalla, la línea de texto "continúa" en una segunda línea en la 330pantalla, la línea de texto «continúa» en una segunda línea en la
331pantalla. Si está usando un entorno gráfico, se mostrarán pequeñas 331pantalla. Si está usando un entorno gráfico, se mostrarán pequeñas
332flechas curvas en las estrechas franjas vacías (los "márgenes" derecho 332flechas curvas en las estrechas franjas vacías (los «márgenes» derecho
333e izquierdo) a cada lado del área de texto, para indicar que la línea 333e izquierdo) a cada lado del área de texto, para indicar que la línea
334continúa. Si está utilizando una terminal, la continuación se señala 334continúa. Si está utilizando una terminal, la continuación se señala
335mediante una barra invertida («\») en la última columna de la derecha. 335mediante una barra invertida («\») en la última columna de la derecha.
@@ -357,13 +357,13 @@ circundante, puede además insertar espacio en blanco tras el carácter
357de fin de línea, de forma que, al seguir tecleando en la línea recién 357de fin de línea, de forma que, al seguir tecleando en la línea recién
358creada, el texto que tecleamos quede alineado con el de la línea 358creada, el texto que tecleamos quede alineado con el de la línea
359anterior. Este comportamiento (que la pulsación de una tecla no solo 359anterior. Este comportamiento (que la pulsación de una tecla no solo
360inserte el carácter correspondiente) se denomina "eléctrico". 360inserte el carácter correspondiente) se denomina «eléctrico».
361 361
362>> Veamos un ejemplo de comportamiento "eléctrico" de <Return> 362>> Veamos un ejemplo de comportamiento «eléctrico» de <Return>
363 Teclee <Return> al final de esta línea. 363 Teclee <Return> al final de esta línea.
364 364
365Fíjese que, tras insertar el carácter de nueva línea, Emacs inserta 365Fíjese que, tras insertar el carácter de nueva línea, Emacs inserta
366también espacios para que el cursor se sitúe bajo la "T" de "Teclee". 366también espacios para que el cursor se sitúe bajo la «T» de «Teclee».
367 367
368Recuerde que a la mayoría de los comandos de Emacs se les puede dar un 368Recuerde que a la mayoría de los comandos de Emacs se les puede dar un
369factor de repetición; esto incluye los caracteres de texto. Repetir 369factor de repetición; esto incluye los caracteres de texto. Repetir
@@ -375,7 +375,7 @@ Ya ha aprendido la manera más básica de teclear algo en Emacs y
375corregir errores. Puede borrar por palabras o por líneas. He aquí un 375corregir errores. Puede borrar por palabras o por líneas. He aquí un
376resumen de las operaciones de borrado: 376resumen de las operaciones de borrado:
377 377
378 <DEL> borra el carácter justo antes que el cursor 378 <DEL> borra el carácter justo antes del cursor
379 C-d borra el siguiente carácter después del cursor 379 C-d borra el siguiente carácter después del cursor
380 380
381 M-<DEL> Elimina la palabra inmediatamente antes del 381 M-<DEL> Elimina la palabra inmediatamente antes del
@@ -389,29 +389,29 @@ Note que <DEL> y C-d, comparados con M-<DEL> y M-d, extienden el
389paralelismo iniciado por C-f y M-f (bien, <DEL> no es realmente una 389paralelismo iniciado por C-f y M-f (bien, <DEL> no es realmente una
390tecla de control, pero no nos preocuparemos de eso ahora). C-k y M-k, 390tecla de control, pero no nos preocuparemos de eso ahora). C-k y M-k,
391en cierta forma, son como C-e y M-e, en que las líneas de unos 391en cierta forma, son como C-e y M-e, en que las líneas de unos
392corresponden a sentencias en los otros. 392corresponden a oraciones en los otros.
393 393
394También puede eliminar un segmento contiguo de texto con un método 394También puede eliminar un segmento contiguo de texto con un método
395uniforme. Muévase a un extremo de ese segmento de texto, y teclee C-@ 395uniforme. Muévase a un extremo de ese segmento de texto, y teclee C-@
396o C-SPC (cualquiera de los dos). (SPC es la barra espaciadora.) 396o C-<SPC> (cualquiera de los dos). (<SPC> es la barra espaciadora.)
397Luego, mueva el cursor al otro extremo del texto que desea eliminar. 397Luego, mueva el cursor al otro extremo del texto que desea eliminar.
398Al hacerlo, Emacs resaltará el texto situado entre el cursor y la 398Al hacerlo, Emacs resaltará el texto situado entre el cursor y la
399posición en la que tecleó C-SPC. Finalmente, teclee C-w. Eso elimina 399posición en la que tecleó C-<SPC>. Finalmente, teclee C-w. Eso elimina
400todo el texto entre las dos posiciones. 400todo el texto entre las dos posiciones.
401 401
402>> Mueva el cursor a la letra T del inicio del párrafo anterior. 402>> Mueva el cursor a la letra T del inicio del párrafo anterior.
403>> Teclee C-SPC. Emacs debe mostrar el mensaje "Mark set" en la parte 403>> Teclee C-<SPC>. Emacs debe mostrar el mensaje «Mark set» en la parte
404 de abajo de la pantalla. 404 de abajo de la pantalla.
405>> Mueva el cursor a la x en "extremo", en la segunda línea del 405>> Mueva el cursor a la x en «extremo», en la segunda línea del
406 párrafo. 406 párrafo.
407>> Teclee C-w. Esto eliminará el texto que comienza desde la T, y 407>> Teclee C-w. Esto eliminará el texto que comienza desde la T, y
408 termina justo antes de la x. 408 termina justo antes de la x.
409 409
410La diferencia entre "eliminar" y "borrar" es que el texto "eliminado" 410La diferencia entre «eliminar» y «borrar» es que el texto «eliminado»
411puede ser reinsertado (en cualquier posición), mientras que las cosas 411puede ser reinsertado (en cualquier posición), mientras que las cosas
412"borradas" no pueden ser reinsertadas (sin embargo, es posible 412«borradas» no pueden ser reinsertadas (sin embargo, es posible
413deshacer el borrado; ver más abajo). La reinserción de texto 413deshacer el borrado; ver más abajo). La reinserción de texto
414eliminado se llama "yanking" o "pegar". Generalmente, los comandos 414eliminado se llama «yanking» o «pegar». Generalmente, los comandos
415que pueden quitar mucho texto lo eliminan (para que pueda pegarlo de 415que pueden quitar mucho texto lo eliminan (para que pueda pegarlo de
416nuevo) mientras que los comandos que quitan solo un carácter, o solo 416nuevo) mientras que los comandos que quitan solo un carácter, o solo
417líneas en blanco y espacios, borran (y por tanto no se puede pegar lo 417líneas en blanco y espacios, borran (y por tanto no se puede pegar lo
@@ -426,17 +426,17 @@ borran. Con un argumento, eliminan.
426Note que al teclear C-k una sola vez elimina el contenido de la línea, 426Note que al teclear C-k una sola vez elimina el contenido de la línea,
427y un segundo C-k elimina la línea misma, y hace que todas las otras 427y un segundo C-k elimina la línea misma, y hace que todas las otras
428líneas se muevan hacia arriba. C-k trata un argumento numérico 428líneas se muevan hacia arriba. C-k trata un argumento numérico
429especialmente: Elimina ese número de líneas y TAMBIÉN sus 429especialmente: elimina ese número de líneas y TAMBIÉN sus
430contenidos. Esto no es una simple repetición. C-u 2 C-k elimina dos 430contenidos. Esto no es una simple repetición. C-u 2 C-k elimina dos
431líneas y sus nuevas líneas, tecleando C-k dos veces no hace esto. 431líneas y sus nuevas líneas, tecleando C-k dos veces no hace esto.
432 432
433Reinsertar texto eliminado se denomina "yanking" o "pegar". (Piense 433Reinsertar texto eliminado se denomina «yanking» o «pegar». (Piense
434en ello como pegar de nuevo, o traer de vuelta, algún texto que le fue 434en ello como pegar de nuevo, o traer de vuelta, algún texto que le fue
435quitado.) Puede pegar el texto eliminado, ya sea el lugar en que fue 435quitado.) Puede pegar el texto eliminado, ya sea el lugar en que fue
436eliminado, o en otra parte del buffer, o hasta en un archivo 436eliminado, o en otra parte del buffer, o hasta en un archivo
437diferente. Puede pegar el texto varias veces, lo que hace varias 437diferente. Puede pegar el texto varias veces, lo que hace varias
438copias de él. Algunos editores se refieren a eliminar y reinsertar 438copias de él. Algunos editores se refieren a eliminar y reinsertar
439como "cortar" y "pegar" (consulte el Glosario en el manual de Emacs). 439como «cortar» y «pegar» (consulte el Glosario en el manual de Emacs).
440 440
441El comando para pegar es C-y. Reinserta el último texto eliminado, en 441El comando para pegar es C-y. Reinserta el último texto eliminado, en
442la posición actual del cursor. 442la posición actual del cursor.
@@ -460,7 +460,7 @@ Después de haber tecleado C-y para conseguir la eliminación más
460reciente, tecleando M-y reemplaza el texto pegado con la eliminación 460reciente, tecleando M-y reemplaza el texto pegado con la eliminación
461previa. Tecleando M-y una y otra vez traerá las eliminaciones 461previa. Tecleando M-y una y otra vez traerá las eliminaciones
462anteriores. Cuando haya encontrado el texto que buscaba, no tiene que 462anteriores. Cuando haya encontrado el texto que buscaba, no tiene que
463hacer nada para conservarlo. Sólo siga con su edición, dejando el 463hacer nada para conservarlo. Solo siga con su edición, dejando el
464texto pegado en donde está. 464texto pegado en donde está.
465 465
466Si teclea M-y suficientes veces, regresa al punto inicial (la 466Si teclea M-y suficientes veces, regresa al punto inicial (la
@@ -513,29 +513,29 @@ si puede pegarlo con C-y; no hay diferencia alguna para deshacer.
513 513
514Para que pueda hacer permanente el texto que edite, lo debe colocar en 514Para que pueda hacer permanente el texto que edite, lo debe colocar en
515un archivo. De otra manera, éste se perderá cuando cierre Emacs. 515un archivo. De otra manera, éste se perderá cuando cierre Emacs.
516Para poder poner su texto en un archivo, debe "encontrar" el archivo 516Para poder poner su texto en un archivo, debe «encontrar» el archivo
517antes de ingresar el texto. (Esto se llama también "visitar" el 517antes de ingresar el texto. (Esto se llama también «visitar» el
518archivo.) 518archivo.)
519 519
520Encontrar un archivo significa que puede ver su contenido dentro de 520Encontrar un archivo significa que puede ver su contenido dentro de
521Emacs. En cierta forma, es como si estuviera editando el archivo 521Emacs. En cierta forma, es como si estuviera editando el archivo
522mismo. Sin embargo los cambios que haga mediante Emacs no serán 522mismo. Sin embargo los cambios que haga mediante Emacs no serán
523permanentes hasta que "guarde" el archivo. Esto es para evitar dejar 523permanentes hasta que «guarde» el archivo. Esto es para evitar dejar
524un archivo a medio cambiar en el sistema cuando no quiera. Incluso 524un archivo a medio cambiar en el sistema cuando no quiera. Incluso
525cuando guarde, Emacs dejará el archivo original bajo un nombre 525cuando guarde, Emacs dejará el archivo original bajo un nombre
526cambiado en caso de que luego decida que sus cambios fueron un error. 526cambiado en caso de que luego decida que sus cambios fueron un error.
527 527
528Si mira cerca del final de la pantalla podrá ver una línea que 528Si mira cerca del final de la pantalla podrá ver una línea que
529comienza con guiones, y empieza con " -:--- TUTORIAL.es" o algo así. 529comienza con guiones, y empieza con « U:--- TUTORIAL.es» o algo así.
530Esta parte de la pantalla normalmente muestra el nombre del archivo 530Esta parte de la pantalla normalmente muestra el nombre del archivo
531que está visitando. En este momento está visitando su propia copia 531que está visitando. En este momento está visitando su propia copia
532del tutorial de Emacs, que se llama "TUTORIAL.es". Cuando encuentre 532del tutorial de Emacs, que se llama «TUTORIAL.es». Cuando encuentre
533un archivo con Emacs, el nombre de ese archivo aparecerá en ese mismo 533un archivo con Emacs, el nombre de ese archivo aparecerá en ese mismo
534punto. 534punto.
535 535
536Una cosa especial acerca del comando para encontrar un archivo, es que 536Una cosa especial acerca del comando para encontrar un archivo es que
537tendrá que decir qué nombre de archivo desea. Decimos que el comando 537tendrá que decir qué nombre de archivo desea. Decimos que el comando
538"lee un argumento" (en este caso, el argumento es el nombre del 538«lee un argumento» (en este caso, el argumento es el nombre del
539archivo). Después de teclear el comando: 539archivo). Después de teclear el comando:
540 540
541 C-x C-f Encontrar un archivo 541 C-x C-f Encontrar un archivo
@@ -565,19 +565,19 @@ comando
565 565
566Esto copia el texto dentro de Emacs al archivo. La primera vez que 566Esto copia el texto dentro de Emacs al archivo. La primera vez que
567haga esto, Emacs renombrará el archivo original con un nuevo nombre 567haga esto, Emacs renombrará el archivo original con un nuevo nombre
568para que éste no se pierda. El nuevo nombre se hace agregando "~" al 568para que éste no se pierda. El nuevo nombre se hace agregando «~» al
569final del nombre del archivo original. Cuando guardar haya terminado, 569final del nombre del archivo original. Cuando guardar haya terminado,
570Emacs mostrará el nombre del archivo escrito. 570Emacs mostrará el nombre del archivo escrito.
571 571
572>> Teclee C-x C-s TUTORIAL.es <Return> 572>> Teclee C-x C-s TUTORIAL.es <Return>
573 Esto guardará el tutorial en un archivo llamado TUTORIAL.es, y 573 Esto guardará el tutorial en un archivo llamado TUTORIAL.es, y
574 mostrará "Wrote ...TUTORIAL.es" al final de la pantalla. 574 mostrará «Wrote ...TUTORIAL.es» al final de la pantalla.
575 575
576Puede encontrar un archivo existente, para verlo o editarlo. También 576Puede encontrar un archivo existente, para verlo o editarlo. También
577puede hacerlo con un archivo que no exista. Ésta es la forma de crear 577puede hacerlo con un archivo que no exista. Ésta es la forma de crear
578un archivo en Emacs: encuentre el archivo, que está inicialmente vacío, 578un archivo en Emacs: encuentre el archivo, que está inicialmente vacío,
579luego comience a insertar el texto para ese archivo. Cuando invoque 579luego comience a insertar el texto para ese archivo. Cuando invoque
580"guardar" el archivo, Emacs creará realmente el archivo con el texto 580«guardar» el archivo, Emacs creará realmente el archivo con el texto
581que ha insertado. De ahí en adelante, puede considerar que está 581que ha insertado. De ahí en adelante, puede considerar que está
582editando un archivo existente. 582editando un archivo existente.
583 583
@@ -591,7 +591,7 @@ C-f. De esta forma puede mantener un gran número de archivos dentro
591de Emacs. 591de Emacs.
592 592
593Emacs almacena cada texto del archivo dentro de un objeto llamado 593Emacs almacena cada texto del archivo dentro de un objeto llamado
594"buffer". Al encontrar un archivo se crea un nuevo buffer dentro de 594«buffer». Al encontrar un archivo se crea un nuevo buffer dentro de
595Emacs. Para mirar la lista de los buffers que existen actualmente, 595Emacs. Para mirar la lista de los buffers que existen actualmente,
596teclee: 596teclee:
597 597
@@ -605,14 +605,14 @@ una ventana de Emacs es siempre parte de algún buffer.
605 605
606>> Teclee C-x 1 para deshacerse de la lista de buffers. 606>> Teclee C-x 1 para deshacerse de la lista de buffers.
607 607
608Cuando tenga varios buffers, solo uno de ellos es "actual" en algún 608Cuando tenga varios buffers, solo uno de ellos es «actual» en algún
609momento. Ese buffer es el que actualmente edita. Si quiere editar 609momento. Ese buffer es el que actualmente edita. Si quiere editar
610otro buffer, necesita "cambiar" a él. Si quiere cambiar a un buffer 610otro buffer, necesita «cambiar» a él. Si quiere cambiar a un buffer
611que corresponde a un archivo, puede hacerlo visitando el archivo de 611que corresponde a un archivo, puede hacerlo visitando el archivo de
612nuevo con C-x C-f. Pero existe una manera más rápida: use el comando 612nuevo con C-x C-f. Pero existe una manera más rápida: use el comando
613C-x b. En ese comando, necesita teclear el nombre de buffer. 613C-x b. En ese comando, necesita teclear el nombre de buffer.
614 614
615>> Cree un archivo llamado "foo" tecleando C-x C-f foo <Return>. 615>> Cree un archivo llamado «foo» tecleando C-x C-f foo <Return>.
616 Después teclee C-x b TUTORIAL.es <Return> para regresar a este 616 Después teclee C-x b TUTORIAL.es <Return> para regresar a este
617 tutorial. 617 tutorial.
618 618
@@ -622,12 +622,12 @@ esto no es así siempre. La lista de buffers que hace con C-x C-b
622muestra el nombre de cada buffer y de su archivo correspondiente. 622muestra el nombre de cada buffer y de su archivo correspondiente.
623 623
624Algunos buffers no corresponden a un archivo. El buffer llamado 624Algunos buffers no corresponden a un archivo. El buffer llamado
625"*Buffer List*", que contiene la lista de buffers que ha creado con 625«*Buffer List*», que contiene la lista de buffers que ha creado con
626C-x C-b, no tiene archivo. Este buffer TUTORIAL.es al principio no 626C-x C-b, no tiene archivo. Este buffer TUTORIAL.es al principio no
627tenía archivo, pero ahora sí, porque en la sección anterior tecleó 627tenía archivo, pero ahora sí, porque en la sección anterior tecleó
628C-x C-s y lo guardó en un archivo. 628C-x C-s y lo guardó en un archivo.
629 629
630El buffer llamado "*Messages*" tampoco tiene un archivo 630El buffer llamado «*Messages*» tampoco tiene un archivo
631correspondiente. Este buffer contiene los mensajes que han aparecido 631correspondiente. Este buffer contiene los mensajes que han aparecido
632en la línea de abajo durante su sesión de Emacs. 632en la línea de abajo durante su sesión de Emacs.
633 633
@@ -649,7 +649,7 @@ guardado. Le pregunta, por cada buffer, si quiere guardarlo o no.
649 649
650>> Inserte una línea de texto, luego teclee C-x s. 650>> Inserte una línea de texto, luego teclee C-x s.
651 Debería preguntarle si desea guardar el buffer llamado TUTORIAL.es. 651 Debería preguntarle si desea guardar el buffer llamado TUTORIAL.es.
652 Conteste si a la pregunta tecleando "y". 652 Conteste «sí» a la pregunta tecleando «y».
653 653
654 654
655* EXTENDER EL CONJUNTO DE COMANDOS 655* EXTENDER EL CONJUNTO DE COMANDOS
@@ -675,14 +675,14 @@ Si está utilizando una pantalla gráfica, no necesita ningún comando
675especial para cambiar de Emacs a otra aplicación. Puede hacerlo con 675especial para cambiar de Emacs a otra aplicación. Puede hacerlo con
676el ratón, o mediante el gestor de ventanas. Sin embargo, si está 676el ratón, o mediante el gestor de ventanas. Sin embargo, si está
677usando una terminal que solo puede mostrar una aplicación a la vez, 677usando una terminal que solo puede mostrar una aplicación a la vez,
678tendrá que "suspender" Emacs para poder acceder a otras aplicaciones. 678tendrá que «suspender» Emacs para poder acceder a otras aplicaciones.
679 679
680C-z es el comando para salir de Emacs *temporalmente*: para que pueda 680C-z es el comando para salir de Emacs *temporalmente*: para que pueda
681regresar a la misma sesión de Emacs después. Cuando Emacs está 681regresar a la misma sesión de Emacs después. Cuando Emacs está
682ejecutándose en una terminal, C-z "suspende" Emacs; esto es, se 682ejecutándose en una terminal, C-z «suspende» Emacs; esto es, se
683regresa al intérprete de comandos pero no se destruye Emacs. En los 683regresa al intérprete de comandos pero no se destruye Emacs. En los
684intérpretes de comandos más comunes, puede reanudar Emacs con el 684intérpretes de comandos más comunes, puede reanudar Emacs con el
685comando "fg" o con "%emacs". 685comando «fg» o con «%emacs».
686 686
687El momento para usar C-x C-c es cuando está listo para salir del 687El momento para usar C-x C-c es cuando está listo para salir del
688sistema. Es además el paso correcto para salir de un Emacs invocado 688sistema. Es además el paso correcto para salir de un Emacs invocado
@@ -706,7 +706,7 @@ con menos frecuencia, o únicamente en ciertos modos. Un ejemplo es el
706comando replace-string, el cual substituye una cadena de caracteres 706comando replace-string, el cual substituye una cadena de caracteres
707por otra en todo el buffer. Cuando teclea M-x, Emacs le pregunta al 707por otra en todo el buffer. Cuando teclea M-x, Emacs le pregunta al
708final de la pantalla con M-x y debe escribir el nombre del comando; en 708final de la pantalla con M-x y debe escribir el nombre del comando; en
709este caso "replace-string". Solo teclee "repl s<TAB>" y Emacs 709este caso «replace-string». Solo teclee «repl s<TAB>» y Emacs
710completará el nombre. (<TAB> es la tecla del tabulador, que 710completará el nombre. (<TAB> es la tecla del tabulador, que
711habitualmenté está situada sobre la tecla de bloquear mayúsculas o la 711habitualmenté está situada sobre la tecla de bloquear mayúsculas o la
712de shift, en el lado izquierdo del teclado.) Para aceptar el comando 712de shift, en el lado izquierdo del teclado.) Para aceptar el comando
@@ -721,7 +721,7 @@ Debe terminar cada argumento con <Return>.
721 M-x repl s<Return>cambiado<Return>alterado<Return>. 721 M-x repl s<Return>cambiado<Return>alterado<Return>.
722 722
723 Note cómo ha cambiado la línea: ha substituido la palabra 723 Note cómo ha cambiado la línea: ha substituido la palabra
724 "cambiado" por "alterado" en cada ocurrencia, después de la 724 «cambiado» por «alterado» en cada ocurrencia, después de la
725 posición inicial del cursor. 725 posición inicial del cursor.
726 726
727 727
@@ -730,10 +730,10 @@ Debe terminar cada argumento con <Return>.
730 730
731Si ha hecho cambios en un archivo, pero no los ha guardado, éstos 731Si ha hecho cambios en un archivo, pero no los ha guardado, éstos
732podrían perderse si su computadora falla. Para protegerlo de esto, 732podrían perderse si su computadora falla. Para protegerlo de esto,
733Emacs periódicamente escribe un archivo "auto guardado" para cada 733Emacs escribe periódicamente un archivo «auto guardado» para cada
734archivo que está editando. El nombre del archivo auto guardado tiene 734archivo que está editando. El nombre del archivo auto guardado tiene
735un # al principio y al final; por ejemplo, si su archivo se llama 735un # al principio y al final; por ejemplo, si su archivo se llama
736"hola.c", su archivo auto guardado es "#hola.c#". Cuando guarda por 736«hola.c», su archivo auto guardado es «#hola.c#». Cuando guarda por
737la vía normal, Emacs borra su archivo de auto guardado. 737la vía normal, Emacs borra su archivo de auto guardado.
738 738
739Si la computadora falla, puede recuperar su edición de auto guardado 739Si la computadora falla, puede recuperar su edición de auto guardado
@@ -748,16 +748,16 @@ para seguir adelante y recuperar la información de auto guardado.
748 748
749Si Emacs ve que usted está tecleando comandos de multicaracteres 749Si Emacs ve que usted está tecleando comandos de multicaracteres
750lentamente, se los muestra al final de la pantalla en un área llamada 750lentamente, se los muestra al final de la pantalla en un área llamada
751"área de eco". El área de eco contiene la línea final de la pantalla. 751«área de eco». El área de eco contiene la línea final de la pantalla.
752 752
753 753
754* LÍNEA DE MODO 754* LÍNEA DE MODO
755--------------- 755---------------
756 756
757La línea inmediatamente encima del área de eco recibe el nombre de 757La línea inmediatamente encima del área de eco recibe el nombre de
758"línea de modo" o "mode line". La línea de modo dice algo así: 758«línea de modo» o «mode line». La línea de modo dice algo así:
759 759
760 -:**- TUTORIAL.es 63% L749 (Fundamental) 760 U:**- TUTORIAL.es 63% L749 (Fundamental)
761 761
762Esta línea da información útil acerca del estado de Emacs y del texto 762Esta línea da información útil acerca del estado de Emacs y del texto
763que está editando. 763que está editando.
@@ -766,9 +766,9 @@ Ya sabe qué significa el nombre del archivo: es el archivo que usted
766ha encontrado. NN% indica su posición actual en el texto; esto 766ha encontrado. NN% indica su posición actual en el texto; esto
767significa que NN por ciento del texto está encima de la parte superior 767significa que NN por ciento del texto está encima de la parte superior
768de la pantalla. Si el principio del archivo está en la pantalla, éste 768de la pantalla. Si el principio del archivo está en la pantalla, éste
769dirá "Top" en vez de " 0%". Si el final del texto está en la 769dirá «Top» en vez de « 0%». Si el final del texto está en la
770pantalla, dirá "Bot". Si está mirando un texto tan pequeño que cabe 770pantalla, dirá «Bot». Si está mirando un texto tan pequeño que cabe
771entero en la pantalla, el modo de línea dirá "All". 771entero en la pantalla, el modo de línea dirá «All».
772 772
773La L y los dígitos señalan la posición de otra forma: indican el 773La L y los dígitos señalan la posición de otra forma: indican el
774número de línea actual del punto. 774número de línea actual del punto.
@@ -780,13 +780,13 @@ parte de la línea de modo no muestra asteriscos, solo guiones.
780La parte de la línea de modo dentro de los paréntesis es para 780La parte de la línea de modo dentro de los paréntesis es para
781indicarle en qué modo de edición está. El modo por omisión es 781indicarle en qué modo de edición está. El modo por omisión es
782Fundamental, el cual está usando ahora. Éste es un ejemplo de un 782Fundamental, el cual está usando ahora. Éste es un ejemplo de un
783"modo mayor". 783«modo mayor».
784 784
785Emacs tiene diferentes modos mayores. Algunos están hechos para 785Emacs tiene diferentes modos mayores. Algunos están hechos para
786editar diferentes lenguajes y/o clases de texto, tales como modo de 786editar diferentes lenguajes y/o clases de texto, tales como modo de
787Lisp, modo de Texto, etc. En cualquier momento uno y solo un modo 787Lisp, modo de Texto, etc. En cualquier momento uno y solo un modo
788mayor está activo, y su nombre siempre se puede encontrar en la línea 788mayor está activo, y su nombre siempre se puede encontrar en la línea
789de modo, justo en donde "Fundamental" está ahora. 789de modo, justo en donde «Fundamental» está ahora.
790 790
791Cada modo mayor hace que algunos comandos actúen diferente. Por 791Cada modo mayor hace que algunos comandos actúen diferente. Por
792ejemplo, hay comandos para crear comentarios en un programa, y como 792ejemplo, hay comandos para crear comentarios en un programa, y como
@@ -808,7 +808,7 @@ modo Fundamental, M-f y M-b trataban los apóstrofes como separadores
808de palabras. 808de palabras.
809 809
810Los modos mayores normalmente hacen cambios sutiles como el anterior: 810Los modos mayores normalmente hacen cambios sutiles como el anterior:
811la mayoría de comandos hacen "el mismo trabajo" en cada modo mayor, 811la mayoría de comandos hacen «el mismo trabajo» en cada modo mayor,
812pero funcionan de forma un poco diferente. 812pero funcionan de forma un poco diferente.
813 813
814Para ver la documentación del modo mayor actual, teclee C-h m. 814Para ver la documentación del modo mayor actual, teclee C-h m.
@@ -840,11 +840,11 @@ Puede activar el modo Auto Fill al hacer M-x auto-fill-mode <Return>.
840Cuando el modo esté activado, puede desactivarlo nuevamente usando M-x 840Cuando el modo esté activado, puede desactivarlo nuevamente usando M-x
841auto-fill-mode <Return>. Si el modo está desactivado, este comando lo 841auto-fill-mode <Return>. Si el modo está desactivado, este comando lo
842activa, y si el modo está activado, este comando lo desactiva. 842activa, y si el modo está activado, este comando lo desactiva.
843Decimos que el comando "cambia el modo". 843Decimos que el comando «cambia el modo».
844 844
845>> teclee M-x auto-fill-mode <Return> ahora. Luego inserte una línea 845>> teclee M-x auto-fill-mode <Return> ahora. Luego inserte una línea
846 de "asdf " repetidas veces hasta que la vea dividida en dos líneas. 846 de «asdf » repetidas veces hasta que la vea dividida en dos líneas.
847 Debe intercalar espacios porque Auto Fill sólo rompe líneas en los 847 Debe intercalar espacios porque Auto Fill solo rompe líneas en los
848 espacios. 848 espacios.
849 849
850El margen está normalmente puesto en 70 caracteres, pero puede 850El margen está normalmente puesto en 70 caracteres, pero puede
@@ -867,48 +867,48 @@ ese párrafo.
867* BUSCAR 867* BUSCAR
868-------- 868--------
869 869
870Emacs puede hacer búsquedas de cadenas (una "cadena" es un grupo de 870Emacs puede hacer búsquedas de cadenas (una «cadena» es un grupo de
871caracteres contiguos) hacia adelante a través del texto o hacia atrás 871caracteres contiguos) hacia adelante a través del texto o hacia atrás
872en el mismo. La búsqueda de una cadena es un comando de movimiento de 872en el mismo. La búsqueda de una cadena es un comando de movimiento de
873cursor; mueve el cursor al próximo lugar donde esa cadena aparece. 873cursor; mueve el cursor al próximo lugar donde esa cadena aparece.
874 874
875El comando de búsqueda de Emacs es "incremental". Esto significa que 875El comando de búsqueda de Emacs es «incremental». Esto significa que
876la búsqueda ocurre mientras teclea la cadena para buscarla. 876la búsqueda ocurre mientras teclea la cadena para buscarla.
877 877
878El comando para iniciar una búsqueda es C-s para búsqueda hacia 878El comando para iniciar una búsqueda es C-s para búsqueda hacia
879adelante, y C-r para la búsqueda hacia atrás. ¡PERO ESPERE! No los 879adelante, y C-r para la búsqueda hacia atrás. ¡PERO ESPERE! No los
880intente aún. 880intente aún.
881 881
882Cuando teclee C-s verá que la cadena "I-search" aparece como una 882Cuando teclee C-s verá que la cadena «I-search» aparece como una
883petición en el área de eco. Esto le indica que Emacs está en lo que 883petición en el área de eco. Esto le indica que Emacs está en lo que
884se conoce como búsqueda incremental, esperando que teclee lo que 884se conoce como búsqueda incremental, esperando que teclee lo que
885quiere buscar. <Return> termina una búsqueda. 885quiere buscar. <Return> termina una búsqueda.
886 886
887>> Ahora teclee C-s para comenzar la búsqueda. LENTAMENTE, una letra 887>> Ahora teclee C-s para comenzar la búsqueda. LENTAMENTE, una letra
888 a la vez, teclee la palabra "cursor", haciendo pausa después de 888 a la vez, teclee la palabra «cursor», haciendo pausa después de
889 cada carácter para notar lo que pasa con el cursor. 889 cada carácter para notar lo que pasa con el cursor.
890 Ahora ha buscado "cursor", una vez. 890 Ahora ha buscado «cursor», una vez.
891>> Teclee C-s de nuevo, para buscar la siguiente ocurrencia de 891>> Teclee C-s de nuevo, para buscar la siguiente ocurrencia de
892 "cursor". 892 «cursor».
893>> Ahora teclee <DEL> cuatro veces y vea como se mueve el cursor. 893>> Ahora teclee <DEL> cuatro veces y vea como se mueve el cursor.
894>> Teclee <Return> para terminar la búsqueda. 894>> Teclee <Return> para terminar la búsqueda.
895 895
896¿Vió lo que ocurrió? Emacs, en una búsqueda incremental, trata de ir 896¿Vio lo que ocurrió? Emacs, en una búsqueda incremental, trata de ir
897a la ocurrencia de la cadena que ha tecleado hasta el momento. Para 897a la ocurrencia de la cadena que ha tecleado hasta el momento. Para
898ir a la próxima ocurrencia de "cursor" solo teclee C-s de nuevo. Si 898ir a la próxima ocurrencia de «cursor» solo teclee C-s de nuevo. Si
899tal ocurrencia no existe, Emacs pita y le dice que la búsqueda actual 899tal ocurrencia no existe, Emacs pita y le dice que la búsqueda actual
900está fallando ("failing"). C-g también termina la búsqueda. 900está fallando («failing»). C-g también termina la búsqueda.
901 901
902Si se encuentra en medio de una búsqueda incremental y teclea <DEL>, 902Si se encuentra en medio de una búsqueda incremental y teclea <DEL>,
903la búsqueda "vuelve" a un punto anterior. Si teclea <DEL> justo 903la búsqueda «vuelve» a un punto anterior. Si teclea <DEL> justo
904después de teclear C-s para avanzar hasta la siguiente ocurrencia de 904después de teclear C-s para avanzar hasta la siguiente ocurrencia de
905la cadena buscada, el cursor retrocede a una ocurrencia previa. Si no 905la cadena buscada, el cursor retrocede a una ocurrencia previa. Si no
906hay ocurrencias previas, <DEL> borra el último carácter de la cadena 906hay ocurrencias previas, <DEL> borra el último carácter de la cadena
907buscada. Por ejemplo, suponga que ha tecleado "c", para buscar la 907buscada. Por ejemplo, suponga que ha tecleado «c», para buscar la
908primera ocurrencia de "c". Ahora, si teclea "u", el cursor se moverá 908primera ocurrencia de «c». Ahora, si teclea «u», el cursor se moverá
909a la primera ocurrencia de "cu". Ahora teclee <DEL>. Esto borra la 909a la primera ocurrencia de «cu». Ahora teclee <DEL>. Esto borra la
910"u" de la cadena buscada, y el cursor vuelve a la primera ocurrencia 910«u» de la cadena buscada, y el cursor vuelve a la primera ocurrencia
911de "c". 911de «c».
912 912
913Si está en medio de una búsqueda y teclea un carácter control o meta 913Si está en medio de una búsqueda y teclea un carácter control o meta
914(con algunas pocas excepciones: los caracteres que son especiales en 914(con algunas pocas excepciones: los caracteres que son especiales en
@@ -926,8 +926,8 @@ la búsqueda se invierte.
926 926
927Una de las características agradables de Emacs es que se puede mostrar 927Una de las características agradables de Emacs es que se puede mostrar
928más de una ventana en la pantalla al mismo tiempo. (Note que Emacs 928más de una ventana en la pantalla al mismo tiempo. (Note que Emacs
929usa el término "marcos", descrito en la siguiente sección, para 929usa el término «marcos», descrito en la siguiente sección, para
930referirse a lo que otras aplicaciones llaman "ventanas". El manual de 930referirse a lo que otras aplicaciones llaman «ventanas». El manual de
931Emacs contiene un Glosario de términos.) 931Emacs contiene un Glosario de términos.)
932 932
933>> Mueva el cursor a esta línea y teclee C-l C-l. 933>> Mueva el cursor a esta línea y teclee C-l C-l.
@@ -939,7 +939,7 @@ Emacs contiene un Glosario de términos.)
939>> Teclee C-M-v para desplazar la ventana inferior. 939>> Teclee C-M-v para desplazar la ventana inferior.
940 (Si no tiene una tecla META real, teclee ESC C-v.) 940 (Si no tiene una tecla META real, teclee ESC C-v.)
941 941
942>> Teclee C-x o ("o" para "otro") para mover el cursor a la ventana 942>> Teclee C-x o («o» para «otro») para mover el cursor a la ventana
943 inferior. 943 inferior.
944>> Use C-v y M-v en la ventana inferior para desplazarla. 944>> Use C-v y M-v en la ventana inferior para desplazarla.
945 Siga leyendo estas direcciones en la ventana superior. 945 Siga leyendo estas direcciones en la ventana superior.
@@ -949,7 +949,7 @@ Emacs contiene un Glosario de términos.)
949 El cursor en la ventana superior está justo donde estaba antes. 949 El cursor en la ventana superior está justo donde estaba antes.
950 950
951Puede continuar usando C-x o para cambiar entre las ventanas. La 951Puede continuar usando C-x o para cambiar entre las ventanas. La
952"ventana seleccionada", donde tiene lugar casi toda la edición, es la 952«ventana seleccionada», donde tiene lugar casi toda la edición, es la
953que tiene un cursor muy visible que parpadea cuando usted no está 953que tiene un cursor muy visible que parpadea cuando usted no está
954tecleando. Las otras ventanas tienen su propia posición del cursor; 954tecleando. Las otras ventanas tienen su propia posición del cursor;
955si está ejecutando Emacs en una pantalla gráfica, esos cursores se 955si está ejecutando Emacs en una pantalla gráfica, esos cursores se
@@ -962,7 +962,7 @@ C-M-v.
962 962
963C-M-v es un ejemplo de un carácter CONTROL-META. Si tiene una tecla 963C-M-v es un ejemplo de un carácter CONTROL-META. Si tiene una tecla
964META (o Alt), puede teclear C-M-v pulsando a la vez CONTROL y META 964META (o Alt), puede teclear C-M-v pulsando a la vez CONTROL y META
965mientras teclea v. No importa qué tecla "vaya primero", CONTROL o 965mientras teclea v. No importa qué tecla «vaya primero», CONTROL o
966META, porque las dos teclas actúan modificando los caracteres que 966META, porque las dos teclas actúan modificando los caracteres que
967teclea. 967teclea.
968 968
@@ -975,8 +975,8 @@ sí mismo, no es una tecla modificadora.
975 ventana de abajo. 975 ventana de abajo.
976 976
977(Si hubiera tecleado C-x 1 en la ventana inferior, esto eliminaría la 977(Si hubiera tecleado C-x 1 en la ventana inferior, esto eliminaría la
978superior. Piense en este comando como "mantener sólo una 978superior. Piense en este comando como «mantener solo una
979ventana--aquella en la cual estoy.") 979ventanaaquella en la cual estoy—».)
980 980
981No tiene por qué mostrarse el mismo buffer en ambas ventanas. Si usa 981No tiene por qué mostrarse el mismo buffer en ambas ventanas. Si usa
982C-x C-f para encontrar un archivo en una ventana, la otra ventana no 982C-x C-f para encontrar un archivo en una ventana, la otra ventana no
@@ -997,10 +997,10 @@ diferentes:
997* MÚLTIPLES MARCOS 997* MÚLTIPLES MARCOS
998------------------ 998------------------
999 999
1000Emacs puede crear también múltiples "marcos". Marco es como 1000Emacs puede crear también múltiples «marcos». Marco es como
1001denominamos a un grupo de ventanas, junto con sus menus, barras de 1001denominamos a un grupo de ventanas, junto con sus menús, barras de
1002desplazamiento, áreas de eco, etc. En entornos gráficos, lo que Emacs 1002desplazamiento, áreas de eco, etc. En entornos gráficos, lo que Emacs
1003denomina "marco" es lo que otras aplicaciones llaman "ventana". En 1003denomina «marco» es lo que otras aplicaciones llaman «ventana». En
1004entornos gráficos, es posible mostrar varios marcos al mismo tiempo. 1004entornos gráficos, es posible mostrar varios marcos al mismo tiempo.
1005En una terminal, solo se puede mostrar un marco a la vez. 1005En una terminal, solo se puede mostrar un marco a la vez.
1006 1006
@@ -1015,7 +1015,7 @@ El primer marco no tiene nada de especial.
1015 1015
1016También puede destruir un marco mediante el método normal que ofrezca 1016También puede destruir un marco mediante el método normal que ofrezca
1017el entorno gráfico (a menudo, pinchando con el ratón en un botón 1017el entorno gráfico (a menudo, pinchando con el ratón en un botón
1018etiquetado como "X" en alguna de las esquinas superiores del marco). 1018etiquetado como «X» en alguna de las esquinas superiores del marco).
1019Si al hacer eso destruye el último marco de Emacs, la aplicación 1019Si al hacer eso destruye el último marco de Emacs, la aplicación
1020termina. 1020termina.
1021 1021
@@ -1023,24 +1023,24 @@ termina.
1023* NIVELES RECURSIVOS DE EDICIÓN 1023* NIVELES RECURSIVOS DE EDICIÓN
1024-------------------------------- 1024--------------------------------
1025 1025
1026Algunas veces entrará a lo que es llamado un "nivel recursivo de 1026Algunas veces entrará a lo que es llamado un «nivel recursivo de
1027edición". Esto se indica en la línea de modo mediante corchetes en la 1027edición». Esto se indica en la línea de modo mediante corchetes en la
1028línea de modo, rodeando los paréntesis del nombre del modo mayor. Por 1028línea de modo, rodeando los paréntesis del nombre del modo mayor. Por
1029ejemplo, probablemente vea [(Fundamental)] en vez de (Fundamental). 1029ejemplo, probablemente vea [(Fundamental)] en vez de (Fundamental).
1030 1030
1031Para salir de los niveles recursivos de edición, teclee ESC ESC ESC. 1031Para salir de los niveles recursivos de edición, teclee ESC ESC ESC.
1032Éste es un comando de "salida" para todo propósito. También lo puede 1032Éste es un comando de «salida» para todo propósito. También lo puede
1033usar para eliminar ventanas extras, y salir del minibuffer. 1033usar para eliminar ventanas extras, y salir del minibuffer.
1034 1034
1035>> Teclee M-x para entrar a un minibuffer; luego teclee ESC ESC ESC 1035>> Teclee M-x para entrar a un minibuffer; luego teclee ESC ESC ESC
1036 para salir. 1036 para salir.
1037 1037
1038No se puede usar C-g para salir de los "niveles recursivos de 1038No se puede usar C-g para salir de los «niveles recursivos de
1039edición". Esto es porque C-g es usado para cancelar comandos y 1039edición». Esto es porque C-g es usado para cancelar comandos y
1040argumentos DENTRO del nivel recursivo de edición. 1040argumentos DENTRO del nivel recursivo de edición.
1041 1041
1042 1042
1043* CONSEGUIR MAS AYUDA 1043* CONSEGUIR MÁS AYUDA
1044--------------------- 1044---------------------
1045 1045
1046En este tutorial hemos tratado de ofrecer suficiente información para 1046En este tutorial hemos tratado de ofrecer suficiente información para
@@ -1048,8 +1048,8 @@ que empiece a usar Emacs. Hay tanto disponible en Emacs que sería
1048imposible explicar todo aquí. Sin embargo, quizá desee aprender más 1048imposible explicar todo aquí. Sin embargo, quizá desee aprender más
1049sobre Emacs, ya que tiene muchas otras características útiles. Emacs 1049sobre Emacs, ya que tiene muchas otras características útiles. Emacs
1050provee comandos para leer documentación acerca de los comandos de 1050provee comandos para leer documentación acerca de los comandos de
1051Emacs. Todos estos comandos de "ayuda" comienzan con el carácter 1051Emacs. Todos estos comandos de «ayuda» comienzan con el carácter
1052Control-h, que es llamado "el carácter de Ayuda (Help)". 1052Control-h, que es llamado «el carácter de Ayuda (Help)».
1053 1053
1054Para usar las funciones de ayuda, teclee el carácter C-h, y luego un 1054Para usar las funciones de ayuda, teclee el carácter C-h, y luego un
1055carácter que especifica qué tipo de ayuda quiere. Si está REALMENTE 1055carácter que especifica qué tipo de ayuda quiere. Si está REALMENTE
@@ -1069,12 +1069,12 @@ una descripción muy breve del comando.
1069 1069
1070 C-p runs the command previous-line 1070 C-p runs the command previous-line
1071 1071
1072Esto le dice el "nombre de la función". Ya que los nombres de las 1072Esto le dice el «nombre de la función». Ya que los nombres de las
1073funciones se eligen para indicar lo que hace el comando, pueden servir 1073funciones se eligen para indicar lo que hace el comando, pueden servir
1074como una breve documentación: suficiente para recordarle los comandos 1074como una breve documentación: suficiente para recordarle los comandos
1075que ha aprendido. 1075que ha aprendido.
1076 1076
1077Los comandos de múltiples caracteres tales como C-x C-s y (sí no tiene 1077Los comandos de múltiples caracteres tales como C-x C-s y (si no tiene
1078las teclas META o EDIT o ALT) <ESC>v también están permitidos después 1078las teclas META o EDIT o ALT) <ESC>v también están permitidos después
1079de C-h c. 1079de C-h c.
1080 1080
@@ -1113,7 +1113,7 @@ pregunte por ella.
1113>> Teclee C-h a file <Return>. 1113>> Teclee C-h a file <Return>.
1114 1114
1115Esto muestra en otra ventana una lista de todos los comandos M-x con 1115Esto muestra en otra ventana una lista de todos los comandos M-x con
1116la palabra "file" en sus nombres. Verá los comandos de caracteres 1116la palabra «file» en sus nombres. Verá los comandos de caracteres
1117listados junto a los nombres de los comandos correspondientes (por 1117listados junto a los nombres de los comandos correspondientes (por
1118ejemplo, C-x C-f junto a find-file). 1118ejemplo, C-x C-f junto a find-file).
1119 1119
@@ -1123,7 +1123,7 @@ ejemplo, C-x C-f junto a find-file).
1123>> Teclee C-x 1 para borrar la ventana de ayuda. 1123>> Teclee C-x 1 para borrar la ventana de ayuda.
1124 1124
1125 C-h i Leer los manuales incluidos (alias Info). Este comando 1125 C-h i Leer los manuales incluidos (alias Info). Este comando
1126 lo pone en un buffer especial llamado "*info*" donde 1126 lo pone en un buffer especial llamado «*info*» donde
1127 puede leer manuales de los paquetes instalados en su 1127 puede leer manuales de los paquetes instalados en su
1128 sistema. Teclee m emacs <Return> para leer el manual 1128 sistema. Teclee m emacs <Return> para leer el manual
1129 de Emacs. Si nunca ha usado Info, teclee ? y Emacs y 1129 de Emacs. Si nunca ha usado Info, teclee ? y Emacs y
@@ -1137,22 +1137,22 @@ ejemplo, C-x C-f junto a find-file).
1137--------------------- 1137---------------------
1138 1138
1139Puede aprender más acerca de Emacs leyendo su manual, ya sea como 1139Puede aprender más acerca de Emacs leyendo su manual, ya sea como
1140libro o en el propio Emacs (use el menú Ayuda, "Help", o teclee C-h 1140libro o en el propio Emacs (use el menú Ayuda, «Help», o teclee C-h
1141r). Dos características que pueden gustarle son la completación, que 1141r). Dos características que pueden gustarle son la completación, que
1142ahorra teclear, y dired, que simplifica el manejo de archivos. 1142ahorra teclear, y dired, que simplifica el manejo de archivos.
1143 1143
1144La completación es una manera de ahorrar teclear innecesariamente. 1144La completación es una manera de ahorrar teclear innecesariamente.
1145Por ejemplo, si quiere cambiarse al buffer "*Messages*", puede teclear 1145Por ejemplo, si quiere cambiarse al buffer «*Messages*», puede teclear
1146C-x b *M<Tab> y Emacs encontrará el resto del nombre del buffer tan 1146C-x b *M<Tab> y Emacs encontrará el resto del nombre del buffer tan
1147lejos como pueda determinar de lo que ya haya tecleado. La 1147lejos como pueda determinar de lo que ya haya tecleado. La
1148completación también funciona con nombres de comandos y de archivos. 1148completación también funciona con nombres de comandos y de archivos.
1149La completación se describe en el Info del manual de Emacs en el nodo 1149La completación se describe en el Info del manual de Emacs en el nodo
1150llamado "Completion". 1150llamado «Completion».
1151 1151
1152Dired le permite listar los archivos en un directorio (y opcionalmente 1152Dired le permite listar los archivos en un directorio (y opcionalmente
1153sus subdirectorios), moverse alrededor de esa lista, visitar, 1153sus subdirectorios), moverse alrededor de esa lista, visitar,
1154renombrar, borrar y aparte de eso operar en los archivos. Dired está 1154renombrar, borrar y aparte de eso operar en los archivos. Dired está
1155descrito en el manual de Emacs en el nodo llamado "Dired". 1155descrito en el manual de Emacs en el nodo llamado «Dired».
1156 1156
1157El manual también describe otras características de Emacs. 1157El manual también describe otras características de Emacs.
1158 1158
@@ -1164,7 +1164,7 @@ Para salir permanentemente de Emacs use C-x C-c.
1164 1164
1165Este tutorial intenta ser comprensible para todos los usuarios nuevos, 1165Este tutorial intenta ser comprensible para todos los usuarios nuevos,
1166así que si encuentra algo que no esté claro, no se quede parado 1166así que si encuentra algo que no esté claro, no se quede parado
1167culpándose a sí mismo: ¡Quéjese! 1167culpándose a sí mismo: ¡quéjese!
1168 1168
1169 1169
1170* COPIA 1170* COPIA
@@ -1200,7 +1200,7 @@ La versión en español ha sido actualizada por:
1200 Rafael Sepúlveda <drs@gnulinux.org.mx> 1200 Rafael Sepúlveda <drs@gnulinux.org.mx>
1201 Juanma Barranquero <lekktu@gmail.com> 1201 Juanma Barranquero <lekktu@gmail.com>
1202 1202
1203Por favor, en caso de duda, sólo es válido el original en inglés de la 1203Por favor, en caso de duda, solo es válido el original en inglés de la
1204siguiente nota de derechos de reproducción (que puede encontrar en el 1204siguiente nota de derechos de reproducción (que puede encontrar en el
1205archivo TUTORIAL). 1205archivo TUTORIAL).
1206 1206
@@ -1220,7 +1220,7 @@ Copyright (C) 1985, 1996, 1998, 2001-2014 Free Software Foundation, Inc.
1220Las condiciones para copiar Emacs mismo son más complejas, pero con el 1220Las condiciones para copiar Emacs mismo son más complejas, pero con el
1221mismo espíritu. Por favor lea el archivo COPYING y luego distribuya 1221mismo espíritu. Por favor lea el archivo COPYING y luego distribuya
1222copias de GNU Emacs a sus amigos. ¡Ayude a erradicar el 1222copias de GNU Emacs a sus amigos. ¡Ayude a erradicar el
1223obstruccionismo del software ("propietariedad") usando, escribiendo, y 1223obstruccionismo del software («propietariedad») usando, escribiendo, y
1224compartiendo software libre! 1224compartiendo software libre!
1225 1225
1226--- end of TUTORIAL.es --- 1226--- end of TUTORIAL.es ---
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 600cc67c2ff..07a72ecaf0d 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,11 @@
12014-12-27 Eli Zaretskii <eliz@gnu.org>
2
3 * Makefile.in (etags_libs, ebrowse${EXEEXT}, profile${EXEEXT})
4 (make-docfile${EXEEXT}, movemail${EXEEXT})
5 (update-game-score${EXEEXT}): Put $(NTLIB) before $(LOADLIBES),
6 since GCC sometimes calls stpcpy when it sees strcpy, under
7 optimization switches.
8
12014-12-14 Paul Eggert <eggert@cs.ucla.edu> 92014-12-14 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 * etags.c (analyze_regex): Rename from analyse_regex. 11 * etags.c (analyze_regex): Rename from analyse_regex.
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index cae0898a2c4..13a7a05156c 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -321,7 +321,7 @@ regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
321 321
322etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h) 322etags_deps = ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
323etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@ 323etags_cflags = -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" -o $@
324etags_libs = regex.o $(LOADLIBES) $(NTLIB) 324etags_libs = regex.o $(NTLIB) $(LOADLIBES)
325 325
326etags${EXEEXT}: ${etags_deps} 326etags${EXEEXT}: ${etags_deps}
327 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs) 327 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(etags_cflags) $< $(etags_libs)
@@ -336,18 +336,18 @@ ctags${EXEEXT}: ${srcdir}/ctags.c ${etags_deps}
336ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \ 336ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
337 $(config_h) 337 $(config_h)
338 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ 338 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
339 $< $(LOADLIBES) $(NTLIB) -o $@ 339 $< $(NTLIB) $(LOADLIBES) -o $@
340 340
341profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h) 341profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
342 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \ 342 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
343 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o $@ 343 $(NTLIB) $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o $@
344 344
345make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h) 345make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
346 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(LOADLIBES) $(NTLIB) -o $@ 346 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@
347 347
348movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h) 348movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
349 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} $< pop.o \ 349 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} $< pop.o \
350 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o $@ 350 $(NTLIB) $(LOADLIBES) $(LIBS_MOVE) -o $@
351 351
352pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h) 352pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
353 $(AM_V_CC)$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} $< 353 $(AM_V_CC)$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} $<
@@ -378,7 +378,7 @@ hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
378update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h) 378update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
379 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} \ 379 $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} \
380 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ 380 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
381 $< $(LOADLIBES) $(NTLIB) -o $@ 381 $< $(NTLIB) $(LOADLIBES) -o $@
382 382
383emacsclient.res: ../nt/emacsclient.rc $(NTINC)/../icons/emacs.ico 383emacsclient.res: ../nt/emacsclient.rc $(NTINC)/../icons/emacs.ico
384 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $< 384 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o $@ $<
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4c6b23dac0b..4203e05aed8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,324 @@
12014-12-30 Paul Eggert <eggert@cs.ucla.edu>
2
3 * Makefile.in (semantic): Simplify.
4
52014-12-30 Juri Linkov <juri@linkov.net>
6
7 * net/eww.el (eww-isearch-next-buffer): New function.
8 (eww-mode): Set multi-isearch-next-buffer-function to it.
9
102014-12-30 Dmitry Gutov <dgutov@yandex.ru>
11
12 * progmodes/xref.el (xref-find-definitions): Mention "no
13 identifier at point" case in the docstring.
14
15 * menu-bar.el (menu-bar-goto-uses-etags-p): New function.
16 (menu-bar-goto-menu): Use it to show or hide the `set-tags-name'
17 and `separator-tag-file' items.
18
192014-12-29 Paul Eggert <eggert@cs.ucla.edu>
20
21 * obsolete/pc-select.el (pc-selection-mode): Use system-type.
22 This is instead of system-name, which is both wrong here and obsolete.
23
242014-12-29 Dmitry Gutov <dgutov@yandex.ru>
25
26 * menu-bar.el (menu-bar-next-tag-other-window)
27 (menu-bar-next-tag): Remove.
28
292014-12-29 K. Handa <handa@gnu.org>
30
31 * international/mule.el (make-translation-table-from-alist):
32 Accept nil or zero-length vector for FROM and TO.
33
342014-12-29 Lars Ingebrigtsen <larsi@gnus.org>
35
36 * net/eww.el (eww-mode): Truncate overlong lines for prettier
37 display when resizing.
38
39 * net/shr.el (shr-width): Default to using the window width when
40 rendering.
41
422014-12-29 Dmitry Gutov <dgutov@yandex.ru>
43
44 Unbreak jumping to an alias's definition.
45
46 * emacs-lisp/find-func.el (find-function-library): Return a pair
47 (ORIG-FUNCTION . LIBRARY) instead of just its second element.
48 (find-function-noselect): Use it.
49
50 * progmodes/elisp-mode.el (elisp--xref-identifier-file): Rename to
51 `elisp--xref-identifier-location', incorporate logic from
52 `elisp--xref-find-definitions', use the changed
53 `find-function-library' return value.
54
552014-12-29 Juri Linkov <juri@linkov.net>
56
57 * comint.el (comint-history-isearch-message): Use field-beginning
58 instead of comint-line-beginning-position - that's more fixes for
59 http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00305.html
60 (comint-history-isearch-message): Fix args of isearch-message-prefix.
61
622014-12-29 Juri Linkov <juri@linkov.net>
63
64 * vc/vc-dir.el (vc-dir-display-file): New command (bug#19450).
65 (vc-dir-mode-map): Bind it to "\C-o".
66 (vc-dir-menu-map): Add it to menu.
67
682014-12-29 Dmitry Gutov <dgutov@yandex.ru>
69
70 * progmodes/etags.el (find-tag-other-window)
71 (find-tag-other-frame, find-tag-regexp, tags-loop-continue)
72 (tags-apropos): Declare obsolete.
73
74 * menu-bar.el (menu-bar-goto-menu): Replace all but one etags item
75 with xref ones.
76
772014-12-28 Eli Zaretskii <eliz@gnu.org>
78
79 * international/mule.el (define-coding-system): Fix typos in the
80 doc string.
81
822014-12-28 Kenichi Handa <handa@gnu.org>
83
84 * international/mule.el (define-coding-system): Improve the doc
85 string.
86
872014-12-28 Ivan Shmakov <ivan@siamics.net>
88
89 * net/shr.el (shr-tag-table): Fix handling of tbody/header/footer
90 elements in tables (bug#19444).
91
92 * net/eww.el (eww-handle-link): Fix typo in "up" rel handling
93 (bug#19445).
94
952014-12-28 Juri Linkov <juri@linkov.net>
96
97 * vc/compare-w.el: Require diff-mode for diff faces.
98 (compare-windows-removed, compare-windows-added): New faces
99 inheriting from diff faces.
100 (compare-windows): Define obsolete face alias.
101 (compare-windows-highlight): Replace face `compare-windows' with
102 new faces `compare-windows-added' and `compare-windows-removed'
103 (bug#19451).
104 (compare-windows-get-recent-window): Signal an error when
105 no other window is found (bug#19170).
106
1072014-12-27 Dmitry Gutov <dgutov@yandex.ru>
108
109 * progmodes/elisp-mode.el (elisp--xref-identifier-file):
110 Skip features that have no sources.
111
112 * simple.el (execute-extended-command):
113 When `suggest-key-bindings' is nil, don't.
114
1152014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
116
117 python.el: Native readline completion.
118
119 * progmodes/python.el (python-shell-completion-native-disabled-interpreters)
120 (python-shell-completion-native-enable)
121 (python-shell-completion-native-output-timeout): New defcustoms.
122 (python-shell-completion-native-interpreter-disabled-p)
123 (python-shell-completion-native-try)
124 (python-shell-completion-native-setup)
125 (python-shell-completion-native-turn-off)
126 (python-shell-completion-native-turn-on)
127 (python-shell-completion-native-turn-on-maybe)
128 (python-shell-completion-native-turn-on-maybe-with-msg)
129 (python-shell-completion-native-toggle): New functions.
130 (python-shell-completion-native-get-completions): New function.
131 (python-shell-completion-at-point): Use it.
132
1332014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
134
135 python.el: Enhance shell user interaction and deprecate
136 python-shell-get-or-create-process.
137
138 * progmodes/python.el
139 (python-shell-get-process-or-error): New function.
140 (python-shell-with-shell-buffer): Use it.
141 (python-shell-send-string, python-shell-send-region)
142 (python-shell-send-buffer, python-shell-send-defun)
143 (python-shell-send-file, python-shell-switch-to-shell): Use it.
144 Add argument MSG to display user-friendly message when no process
145 is running.
146 (python-shell-switch-to-shell): Call pop-to-buffer with NORECORD.
147 (python-shell-make-comint): Rename argument SHOW from POP. Use
148 display-buffer instead of pop-to-buffer.
149 (run-python): Doc fix. Return process.
150 (python-shell-get-or-create-process): Make obsolete.
151
1522014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
153
154 * progmodes/python.el (python-shell-buffer-substring): Handle
155 cornercase when region sent starts at point-min.
156
1572014-12-27 Eli Zaretskii <eliz@gnu.org>
158
159 * language/misc-lang.el (composition-function-table): Add Syriac
160 characters and also ZWJ/ZWNJ. See
161 http://lists.gnu.org/archive/html/help-gnu-emacs/2014-12/msg00248.html
162 for the details.
163
1642014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
165
166 python.el: Fix message when sending region.
167
168 * progmodes/python.el (python-shell-send-region): Rename argument
169 send-main from nomain. Fix message.
170 (python-shell-send-buffer): Rename argument send-main from arg.
171
1722014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
173
174 python.el: Cleanup temp files even with eval errors.
175
176 * progmodes/python.el (python-shell-send-file): Make file-name
177 mandatory. Fix temp file removal in the majority of cases.
178
1792014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
180
181 python.el: Handle file encoding for shell.
182
183 * progmodes/python.el (python-rx-constituents): Add coding-cookie.
184 (python-shell--save-temp-file): Write file with proper encoding.
185 (python-shell-buffer-substring): Add coding cookie for detected
186 encoding to generated content. Fix blank lines when removing
187 if-name-main block.
188 (python-shell-send-file): Handle file encoding.
189 (python-info-encoding-from-cookie)
190 (python-info-encoding): New functions.
191
1922014-12-27 Michael Albinus <michael.albinus@gmx.de>
193
194 * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band):
195 Use `tramp-rsh-end-of-line', it ought to be more robust.
196
1972014-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
198
199 * progmodes/js.el (js-syntax-propertize): "return" can't be divided
200 (bug#19397).
201
2022014-12-27 Michael Albinus <michael.albinus@gmx.de>
203
204 * net/tramp.el (tramp-read-passwd): Ignore errors from `auth-source-*'.
205
206 * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Use "\n"
207 as end-of-line delimeter for passwords, when running on MS Windows.
208
2092014-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
210
211 * progmodes/sh-script.el (sh-set-shell): Don't change the global value
212 of indent-line-function (bug#19433).
213
2142014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
215
216 Fix line numbers on Python shell.
217 * progmodes/python.el (python-shell--save-temp-file): Do not
218 append coding cookie.
219 (python-shell-send-string): Generalize for
220 python-shell-send-region.
221 (python--use-fake-loc): Delete var.
222 (python-shell-buffer-substring): Cleanup fake-loc logic.
223 (python-shell-send-region): Remove fake-loc logic, simplify.
224
2252014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
226
227 * progmodes/python.el (python-indent-post-self-insert-function):
228 Make colon to re-indent only for dedenters, handling
229 multiline-statements gracefully.
230
2312014-12-27 Michael Albinus <michael.albinus@gmx.de>
232
233 * net/tramp.el (tramp-handle-insert-file-contents):
234 Set `find-file-not-found-functions' in case of errors. (Bug#18623)
235
2362014-12-27 Michael Albinus <michael.albinus@gmx.de>
237
238 * net/tramp-sh.el (tramp-send-command-and-read): New optional
239 arg MARKER.
240 (tramp-get-remote-path): Use it.
241
2422014-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
243
244 * lisp/subr.el (redisplay-dont-pause): Mark as obsolete.
245
2462014-12-27 Michael Albinus <michael.albinus@gmx.de>
247
248 * net/tramp.el (tramp-error-with-buffer): Call `message' properly.
249 (tramp-accept-process-output): Use nil as argument for
250 `accept-process-output', when there is a gateway prepended.
251
252 * net/tramp-gw.el (tramp-gw-open-connection): Suppress traces in
253 wrong debug buffer.
254 (tramp-gw-open-connection): Set process coding system 'binary.
255 (tramp-gw-open-network-stream): Handle HTTP error 403.
256
257 * net/tramp-sh.el (tramp-compute-multi-hops): Suppress traces in
258 wrong debug buffer.
259 (tramp-maybe-open-connection): Set connection property "gateway".
260
2612014-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
262
263 * subr.el (sit-for): Tweak docstring (bug#19381).
264
2652014-12-27 Dmitry Gutov <dgutov@yandex.ru>
266
267 * vc/vc-git.el (vc-git-after-dir-status-stage): Move `up-to-date'
268 stage to after `diff-index' (bug#19386).
269
2702014-12-27 João Távora <joaotavora@gmail.com>
271
272 * textmodes/tex-mode.el (tex-insert-quote): Consider and respect
273 `electric-pair-mode' (bug#19356).
274
2752014-12-27 Dmitry Gutov <dgutov@yandex.ru>
276
277 elisp-xref-find: Don't create buffers eagerly.
278
279 * progmodes/elisp-mode.el (elisp--identifier-location): Fold back
280 into `elisp--company-location'.
281 (elisp--identifier-completion-table): Rename to
282 `elisp--identifier-completion-table', and do not include just any
283 symbols with a property list.
284 (elisp-completion-at-point): Revert the 2014-12-25 change.
285 (elisp--xref-identifier-file): New function.
286 (elisp--xref-find-definitions): Use it.
287
288 * emacs-lisp/find-func.el (find-function-library): New function,
289 extracted from `find-function-noselect'.
290
291 * progmodes/xref.el (xref-elisp-location): New class.
292 (xref-make-elisp-location): New function.
293 (xref-location-marker): New implementation.
294
2952014-12-27 Juri Linkov <juri@linkov.net>
296
297 * minibuffer.el (minibuffer-completion-help):
298 Use shrink-window-if-larger-than-buffer in window-height
299 when temp-buffer-resize-mode is nil.
300
301 * window.el (with-displayed-buffer-window): Remove window-height
302 from the action alist in the temp-buffer-window-show call
303 when window-height is handled explicitly afterwards (bug#19355).
304
3052014-12-27 Juri Linkov <juri@linkov.net>
306
307 Support subdirectories when saving places in dired.
308 * saveplace.el (toggle-save-place, save-place-to-alist)
309 (save-places-to-alist, save-place-dired-hook):
310 Use dired-current-directory instead of dired-directory (bug#19436).
311 (save-place-dired-hook): Add check for alist to make the new
312 format future-proof to allow other possible formats.
313
3142014-12-26 Fabián Ezequiel Gallina <fgallina@gnu.org>
315
316 python.el: Generate clearer shell buffer names.
317
318 * progmodes/python.el (python-shell-get-process-name)
319 (python-shell-internal-get-process-name): Use `buffer-name`.
320 (python-shell-internal-get-or-create-process): Simplify.
321
12014-12-26 Dmitry Gutov <dgutov@yandex.ru> 3222014-12-26 Dmitry Gutov <dgutov@yandex.ru>
2 323
3 Add basic xref apropos implementation to elisp-mode. 324 Add basic xref apropos implementation to elisp-mode.
@@ -9,6 +330,11 @@
9 330
10 * progmodes/xref.el (xref--show-xrefs): Use `user-error'. 331 * progmodes/xref.el (xref--show-xrefs): Use `user-error'.
11 332
3332014-12-25 Filipp Gunbin <fgunbin@fastmail.fm>
334
335 * dired-aux.el (dired-maybe-insert-subdir): Make
336 dired-maybe-insert-subdir always skip trivial files.
337
122014-12-25 Helmut Eller <eller.helmut@gmail.com> 3382014-12-25 Helmut Eller <eller.helmut@gmail.com>
13 Dmitry Gutov <dgutov@yandex.ru> 339 Dmitry Gutov <dgutov@yandex.ru>
14 340
@@ -4645,12 +4971,6 @@
4645 4971
46462014-07-28 Fabián Ezequiel Gallina <fgallina@gnu.org> 49722014-07-28 Fabián Ezequiel Gallina <fgallina@gnu.org>
4647 4973
4648 Prevent Python process shell buffer to pop twice.
4649 * progmodes/python.el (python-shell-switch-to-shell): Do not call
4650 pop-to-buffer.
4651
46522014-07-28 Fabián Ezequiel Gallina <fgallina@gnu.org>
4653
4654 * progmodes/python.el 4974 * progmodes/python.el
4655 (python-shell-with-shell-buffer): New macro. 4975 (python-shell-with-shell-buffer): New macro.
4656 (python-shell-font-lock-get-or-create-buffer) 4976 (python-shell-font-lock-get-or-create-buffer)
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index f22ca69996b..ba2a2292cbd 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -325,13 +325,8 @@ compile-clean:
325leim: 325leim:
326 $(MAKE) -C ../leim all EMACS="$(EMACS)" 326 $(MAKE) -C ../leim all EMACS="$(EMACS)"
327 327
328# FIXME. Yuck.
329semantic: 328semantic:
330 case ${EMACS} in \ 329 $(MAKE) -C ../admin/grammars all EMACS="$(EMACS:.%=../.%)"
331 .*) EMACS="../${EMACS}" ;; \
332 *) EMACS="${EMACS}" ;; \
333 esac; \
334 $(MAKE) -C ../admin/grammars all EMACS="$${EMACS}"
335 330
336# Compile all Lisp files, but don't recompile those that are up to 331# Compile all Lisp files, but don't recompile those that are up to
337# date. Some .el files don't get compiled because they set the 332# date. Some .el files don't get compiled because they set the
diff --git a/lisp/comint.el b/lisp/comint.el
index 3085052087c..4acaa30db91 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1532,14 +1532,20 @@ the function `isearch-message'."
1532 ;; the initial comint prompt. 1532 ;; the initial comint prompt.
1533 (if (overlayp comint-history-isearch-message-overlay) 1533 (if (overlayp comint-history-isearch-message-overlay)
1534 (move-overlay comint-history-isearch-message-overlay 1534 (move-overlay comint-history-isearch-message-overlay
1535 (save-excursion (forward-line 0) (point)) 1535 (save-excursion
1536 (comint-line-beginning-position)) 1536 (goto-char (field-beginning))
1537 (forward-line 0)
1538 (point))
1539 (field-beginning))
1537 (setq comint-history-isearch-message-overlay 1540 (setq comint-history-isearch-message-overlay
1538 (make-overlay (save-excursion (forward-line 0) (point)) 1541 (make-overlay (save-excursion
1539 (comint-line-beginning-position))) 1542 (goto-char (field-beginning))
1543 (forward-line 0)
1544 (point))
1545 (field-beginning)))
1540 (overlay-put comint-history-isearch-message-overlay 'evaporate t)) 1546 (overlay-put comint-history-isearch-message-overlay 'evaporate t))
1541 (overlay-put comint-history-isearch-message-overlay 1547 (overlay-put comint-history-isearch-message-overlay
1542 'display (isearch-message-prefix c-q-hack ellipsis)) 1548 'display (isearch-message-prefix ellipsis isearch-nonincremental))
1543 (if (and comint-input-ring-index (not ellipsis)) 1549 (if (and comint-input-ring-index (not ellipsis))
1544 ;; Display the current history index. 1550 ;; Display the current history index.
1545 (message "History item: %d" (1+ comint-input-ring-index)) 1551 (message "History item: %d" (1+ comint-input-ring-index))
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 75bced49c2f..6ca396a1132 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -940,7 +940,7 @@ Frames with a non-nil `desktop-dont-save' parameter are not saved."
940 (and desktop-restore-frames 940 (and desktop-restore-frames
941 (frameset-save nil 941 (frameset-save nil
942 :app desktop--app-id 942 :app desktop--app-id
943 :name (concat user-login-name "@" system-name) 943 :name (concat user-login-name "@" (system-name))
944 :predicate #'desktop--check-dont-save)))) 944 :predicate #'desktop--check-dont-save))))
945 945
946;;;###autoload 946;;;###autoload
diff --git a/lisp/dired.el b/lisp/dired.el
index 909ba22985a..7f7251f29ce 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3884,7 +3884,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
3884 3884
3885;;; Start of automatically extracted autoloads. 3885;;; Start of automatically extracted autoloads.
3886 3886
3887;;;### (autoloads nil "dired-aux" "dired-aux.el" "1448837b5f3e2b9ad63f723361f1e32e") 3887;;;### (autoloads nil "dired-aux" "dired-aux.el" "73269f48e7fe2fd0ac580fd69252b33a")
3888;;; Generated autoloads from dired-aux.el 3888;;; Generated autoloads from dired-aux.el
3889 3889
3890(autoload 'dired-diff "dired-aux" "\ 3890(autoload 'dired-diff "dired-aux" "\
diff --git a/lisp/dnd.el b/lisp/dnd.el
index 73b531dfd16..3fda471497f 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -122,17 +122,18 @@ Return nil if URI is not a local file."
122 122
123 ;; The hostname may be our hostname, in that case, convert to a local 123 ;; The hostname may be our hostname, in that case, convert to a local
124 ;; file. Otherwise return nil. TODO: How about an IP-address as hostname? 124 ;; file. Otherwise return nil. TODO: How about an IP-address as hostname?
125 (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri) 125 (let ((sysname (system-name)))
126 (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri)
126 (downcase (match-string 1 uri)))) 127 (downcase (match-string 1 uri))))
127 (system-name-no-dot 128 (sysname-no-dot
128 (downcase (if (string-match "^[^\\.]+" system-name) 129 (downcase (if (string-match "^[^\\.]+" sysname)
129 (match-string 0 system-name) 130 (match-string 0 sysname)
130 system-name)))) 131 sysname))))
131 (when (and hostname 132 (when (and hostname
132 (or (string-equal "localhost" hostname) 133 (or (string-equal "localhost" hostname)
133 (string-equal (downcase system-name) hostname) 134 (string-equal (downcase sysname) hostname)
134 (string-equal system-name-no-dot hostname))) 135 (string-equal sysname-no-dot hostname)))
135 (concat "file://" (substring uri (+ 7 (length hostname))))))) 136 (concat "file://" (substring uri (+ 7 (length hostname))))))))
136 137
137(defsubst dnd-unescape-uri (uri) 138(defsubst dnd-unescape-uri (uri)
138 (replace-regexp-in-string 139 (replace-regexp-in-string
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index c372117b104..3131be09eb1 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -311,6 +311,45 @@ The search is done in the source for library LIBRARY."
311 (cons (current-buffer) (point))) 311 (cons (current-buffer) (point)))
312 (cons (current-buffer) nil)))))))) 312 (cons (current-buffer) nil))))))))
313 313
314(defun find-function-library (function &optional lisp-only verbose)
315 "Return the pair (ORIG-FUNCTION . LIBRARY) for FUNCTION.
316
317ORIG-FUNCTION is the original name, after removing all advice and
318resolving aliases. LIBRARY is an absolute file name, a relative
319file name inside the C sources directory, or a name of an
320autoloaded feature.
321
322If ORIG-FUNCTION is a built-in function and LISP-ONLY is non-nil,
323signal an error.
324
325If VERBOSE is non-nil, and FUNCTION is an alias, display a
326message about the whole chain of aliases."
327 (let ((def (symbol-function (find-function-advised-original function)))
328 aliases)
329 ;; FIXME for completeness, it might be nice to print something like:
330 ;; foo (which is advised), which is an alias for bar (which is advised).
331 (while (symbolp def)
332 (or (eq def function)
333 (not verbose)
334 (if aliases
335 (setq aliases (concat aliases
336 (format ", which is an alias for `%s'"
337 (symbol-name def))))
338 (setq aliases (format "`%s' is an alias for `%s'"
339 function (symbol-name def)))))
340 (setq function (symbol-function (find-function-advised-original function))
341 def (symbol-function (find-function-advised-original function))))
342 (if aliases
343 (message "%s" aliases))
344 (cons function
345 (cond
346 ((autoloadp def) (nth 1 def))
347 ((subrp def)
348 (if lisp-only
349 (error "%s is a built-in function" function))
350 (help-C-file-name def 'subr))
351 ((symbol-file function 'defun))))))
352
314;;;###autoload 353;;;###autoload
315(defun find-function-noselect (function &optional lisp-only) 354(defun find-function-noselect (function &optional lisp-only)
316 "Return a pair (BUFFER . POINT) pointing to the definition of FUNCTION. 355 "Return a pair (BUFFER . POINT) pointing to the definition of FUNCTION.
@@ -329,30 +368,8 @@ searched for in `find-function-source-path' if non-nil, otherwise
329in `load-path'." 368in `load-path'."
330 (if (not function) 369 (if (not function)
331 (error "You didn't specify a function")) 370 (error "You didn't specify a function"))
332 (let ((def (symbol-function (find-function-advised-original function))) 371 (let ((func-lib (find-function-library function lisp-only t)))
333 aliases) 372 (find-function-search-for-symbol (car func-lib) nil (cdr func-lib))))
334 ;; FIXME for completeness, it might be nice to print something like:
335 ;; foo (which is advised), which is an alias for bar (which is advised).
336 (while (symbolp def)
337 (or (eq def function)
338 (if aliases
339 (setq aliases (concat aliases
340 (format ", which is an alias for `%s'"
341 (symbol-name def))))
342 (setq aliases (format "`%s' is an alias for `%s'"
343 function (symbol-name def)))))
344 (setq function (symbol-function (find-function-advised-original function))
345 def (symbol-function (find-function-advised-original function))))
346 (if aliases
347 (message "%s" aliases))
348 (let ((library
349 (cond ((autoloadp def) (nth 1 def))
350 ((subrp def)
351 (if lisp-only
352 (error "%s is a built-in function" function))
353 (help-C-file-name def 'subr))
354 ((symbol-file function 'defun)))))
355 (find-function-search-for-symbol function nil library))))
356 373
357(defun find-function-read (&optional type) 374(defun find-function-read (&optional type)
358 "Read and return an interned symbol, defaulting to the one near point. 375 "Read and return an interned symbol, defaulting to the one near point.
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 6f0ea0f57de..0007b15a76a 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
12014-12-29 Lars Ingebrigtsen <larsi@gnus.org>
2
3 * mm-decode.el (mm-shr): Bind `shr-width' to `fill-column' so that
4 lines don't get overlong when responding.
5
12014-12-18 Paul Eggert <eggert@cs.ucla.edu> 62014-12-18 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 * registry.el (registry-db): Set default slot later. 8 * registry.el (registry-db): Set default slot later.
diff --git a/lisp/gnus/gnus-cloud.el b/lisp/gnus/gnus-cloud.el
index ec016eeeb77..a42bcc06e94 100644
--- a/lisp/gnus/gnus-cloud.el
+++ b/lisp/gnus/gnus-cloud.el
@@ -329,6 +329,15 @@
329(defun gnus-cloud-server-p (server) 329(defun gnus-cloud-server-p (server)
330 (member server gnus-cloud-covered-servers)) 330 (member server gnus-cloud-covered-servers))
331 331
332(defun gnus-cloud-collect-full-newsrc ()
333 (let ((infos nil))
334 (dolist (info (cdr gnus-newsrc-alist))
335 (when (gnus-cloud-server-p
336 (gnus-method-to-server
337 (gnus-find-method-for-group (gnus-info-group info))))
338 (push info infos)))
339 ))
340
332(provide 'gnus-cloud) 341(provide 'gnus-cloud)
333 342
334;;; gnus-cloud.el ends here 343;;; gnus-cloud.el ends here
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index d58a2922217..ee5d824a852 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -5849,7 +5849,7 @@ give as trustworthy answer as possible."
5849 5849
5850(defun message-make-fqdn () 5850(defun message-make-fqdn ()
5851 "Return user's fully qualified domain name." 5851 "Return user's fully qualified domain name."
5852 (let* ((system-name (system-name)) 5852 (let* ((sysname (system-name))
5853 (user-mail (message-user-mail-address)) 5853 (user-mail (message-user-mail-address))
5854 (user-domain 5854 (user-domain
5855 (if (and user-mail 5855 (if (and user-mail
@@ -5863,10 +5863,10 @@ give as trustworthy answer as possible."
5863 (not (string-match message-bogus-system-names message-user-fqdn))) 5863 (not (string-match message-bogus-system-names message-user-fqdn)))
5864 ;; `message-user-fqdn' seems to be valid 5864 ;; `message-user-fqdn' seems to be valid
5865 message-user-fqdn) 5865 message-user-fqdn)
5866 ((and (string-match message-valid-fqdn-regexp system-name) 5866 ((and (string-match message-valid-fqdn-regexp sysname)
5867 (not (string-match message-bogus-system-names system-name))) 5867 (not (string-match message-bogus-system-names sysname)))
5868 ;; `system-name' returned the right result. 5868 ;; `system-name' returned the right result.
5869 system-name) 5869 sysname)
5870 ;; Try `mail-host-address'. 5870 ;; Try `mail-host-address'.
5871 ((and (boundp 'mail-host-address) 5871 ((and (boundp 'mail-host-address)
5872 (stringp mail-host-address) 5872 (stringp mail-host-address)
@@ -5881,7 +5881,7 @@ give as trustworthy answer as possible."
5881 user-domain) 5881 user-domain)
5882 ;; Default to this bogus thing. 5882 ;; Default to this bogus thing.
5883 (t 5883 (t
5884 (concat system-name 5884 (concat sysname
5885 ".i-did-not-set--mail-host-address--so-tickle-me"))))) 5885 ".i-did-not-set--mail-host-address--so-tickle-me")))))
5886 5886
5887(defun message-make-domain () 5887(defun message-make-domain ()
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index f5b4d7cba88..3913ecc0b4e 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -1814,6 +1814,7 @@ If RECURSIVE, search recursively."
1814 ;; Require since we bind its variables. 1814 ;; Require since we bind its variables.
1815 (require 'shr) 1815 (require 'shr)
1816 (let ((article-buffer (current-buffer)) 1816 (let ((article-buffer (current-buffer))
1817 (shr-width fill-column)
1817 (shr-content-function (lambda (id) 1818 (shr-content-function (lambda (id)
1818 (let ((handle (mm-get-content-id id))) 1819 (let ((handle (mm-get-content-id id)))
1819 (when handle 1820 (when handle
diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el
index f67943a336a..61bf5560e2e 100644
--- a/lisp/gnus/nnvirtual.el
+++ b/lisp/gnus/nnvirtual.el
@@ -99,7 +99,7 @@ component group will show up when you enter the virtual group.")
99 (let ((vbuf (nnheader-set-temp-buffer 99 (let ((vbuf (nnheader-set-temp-buffer
100 (get-buffer-create " *virtual headers*"))) 100 (get-buffer-create " *virtual headers*")))
101 (carticles (nnvirtual-partition-sequence articles)) 101 (carticles (nnvirtual-partition-sequence articles))
102 (system-name (system-name)) 102 (sysname (system-name))
103 cgroup carticle article result prefix) 103 cgroup carticle article result prefix)
104 (while carticles 104 (while carticles
105 (setq cgroup (caar carticles)) 105 (setq cgroup (caar carticles))
@@ -151,7 +151,7 @@ component group will show up when you enter the virtual group.")
151 ;; and clean up the xrefs. 151 ;; and clean up the xrefs.
152 (princ article nntp-server-buffer) 152 (princ article nntp-server-buffer)
153 (nnvirtual-update-xref-header cgroup carticle 153 (nnvirtual-update-xref-header cgroup carticle
154 prefix system-name) 154 prefix sysname)
155 (forward-line 1)) 155 (forward-line 1))
156 ) 156 )
157 157
@@ -378,7 +378,7 @@ component group will show up when you enter the virtual group.")
378 (mapc 'nnheader-insert-nov headers)))) 378 (mapc 'nnheader-insert-nov headers))))
379 379
380 380
381(defun nnvirtual-update-xref-header (group article prefix system-name) 381(defun nnvirtual-update-xref-header (group article prefix sysname)
382 "Edit current NOV header in current buffer to have an xref to the component group, and also server prefix any existing xref lines." 382 "Edit current NOV header in current buffer to have an xref to the component group, and also server prefix any existing xref lines."
383 ;; Move to beginning of Xref field, creating a slot if needed. 383 ;; Move to beginning of Xref field, creating a slot if needed.
384 (beginning-of-line) 384 (beginning-of-line)
@@ -393,7 +393,7 @@ component group will show up when you enter the virtual group.")
393 (forward-char -1) 393 (forward-char -1)
394 (delete-char 1)) 394 (delete-char 1))
395 395
396 (insert "Xref: " system-name " " group ":") 396 (insert "Xref: " sysname " " group ":")
397 (princ article (current-buffer)) 397 (princ article (current-buffer))
398 (insert " ") 398 (insert " ")
399 399
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index bb8111e416f..392ecff021a 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -593,6 +593,29 @@ as the single-shift area.")
593The remaining arguments must come in pairs ATTRIBUTE VALUE. ATTRIBUTE 593The remaining arguments must come in pairs ATTRIBUTE VALUE. ATTRIBUTE
594may be any symbol. 594may be any symbol.
595 595
596A coding system specifies a rule to decode (i.e. to convert a
597byte sequence to a character sequence) and a rule to encode (the
598opposite of decoding).
599
600The decoding is done by at most 3 steps; the first is to convert
601a byte sequence to a character sequence by one of Emacs'
602internal routines specified by `:coding-type' attribute. The
603optional second step is to convert the character sequence (the
604result of the first step) by a translation table specified
605by `:decode-translation-table' attribute. The optional third step
606is to convert the above result by a Lisp function specified
607by `:post-read-conversion' attribute.
608
609The encoding is done by at most 3 steps, which are the reverse
610of the decoding steps. The optional first step converts a
611character sequence to another character sequence by a Lisp
612function specified by `:pre-write-conversion' attribute. The
613optional second step converts the above result by a translation
614table specified by `:encode-translation-table' attribute. The
615third step converts the above result to a byte sequence by one
616of the Emacs's internal routines specified by the `:coding-type'
617attribute.
618
596The following attributes have special meanings. Those labeled as 619The following attributes have special meanings. Those labeled as
597\"(required)\" should not be omitted. 620\"(required)\" should not be omitted.
598 621
@@ -602,27 +625,72 @@ VALUE is a character to display on mode line for the coding system.
602 625
603`:coding-type' (required) 626`:coding-type' (required)
604 627
605VALUE must be one of `charset', `utf-8', `utf-16', `iso-2022', 628VALUE specifies the format of byte sequence the coding system
606`emacs-mule', `shift-jis', `ccl', `raw-text', `undecided'. 629decodes and encodes to. It must be one of `charset', `utf-8',
630`utf-16', `iso-2022', `emacs-mule', `shift-jis', `ccl',
631`raw-text', `undecided'.
632
633If VALUE is `charset', the coding system is for handling a
634byte sequence in which each byte or every two- to four-byte
635sequence represents a character code of a charset specified
636by the `:charset-list' attribute.
637
638If VALUE is `utf-8', the coding system is for handling Unicode
639UTF-8 byte sequences. See also the documentation of the
640attribute `:bom'.
641
642If VALUE is `utf-16', the coding system is for handling Unicode
643UTF-16 byte sequences. See also the documentation of the
644attributes :bom and `:endian'.
645
646If VALUE is `iso-2022', the coding system is for handling byte
647sequences conforming to ISO/IEC 2022. See also the documentation
648of the attributes `:charset-list', `:flags', and `:designation'.
649
650If VALUE is `emacs-mule', the coding system is for handling
651byte sequences which Emacs 20 and 21 used for their internal
652representation of characters.
653
654If VALUE is `shift-jis', the coding system is for handling byte
655sequences of Shift_JIS format. See also the attribute `:charset-list'.
656
657If VALUE is `ccl', the coding system uses CCL programs to decode
658and encode byte sequences. The CCL programs must be
659specified by the attributes `:ccl-decoder' and `:ccl-encoder'.
660
661If VALUE is `raw-text', the coding system decodes byte sequences
662without any conversions.
607 663
608`:eol-type' 664`:eol-type'
609 665
610VALUE is the EOL (end-of-line) format of the coding system. It must be 666VALUE is the EOL (end-of-line) format of the coding system. It must be
611one of `unix', `dos', `mac'. The symbol `unix' means Unix-like EOL 667one of `unix', `dos', `mac'. The symbol `unix' means Unix-like EOL
612\(i.e. single LF), `dos' means DOS-like EOL \(i.e. sequence of CR LF), 668\(i.e. a single LF character), `dos' means DOS-like EOL \(i.e. a sequence
613and `mac' means Mac-like EOL \(i.e. single CR). If omitted, Emacs 669of CR followed by LF), and `mac' means Mac-like EOL \(i.e. a single CR).
614detects the EOL format automatically when decoding. 670If omitted, Emacs detects the EOL format automatically when decoding.
671
672`:charset-list' (required if `:coding-type' is `charset' or `shift-jis')
673
674VALUE must be a list of charsets supported by the coding system.
675
676If `coding-type:' is `charset', then on decoding and encoding by the
677coding system, if a character belongs to multiple charsets in the
678list, a charset that comes first in the list is selected.
615 679
616`:charset-list' 680If `:coding-type' is `iso-2022', VALUE may be `iso-2022', which
681indicates that the coding system supports all ISO-2022 based
682charsets.
617 683
618VALUE must be a list of charsets supported by the coding system. On 684If `:coding-type' is `shift-jis', VALUE must be a list of three
619encoding by the coding system, if a character belongs to multiple 685to four charsets supported by Shift_JIS encoding scheme. The
620charsets in the list, a charset that comes earlier in the list is 686first charset (one dimension) is for code space 0x00..0x7F, the
621selected. If `:coding-type' is `iso-2022', VALUE may be `iso-2022', 687second (one dimension) for 0xA1..0xDF, the third (two dimension)
622which indicates that the coding system supports all ISO-2022 based 688for 0x8140..0xEFFC, the optional fourth (three dimension) for
623charsets. If `:coding-type' is `emacs-mule', VALUE may be 6890xF040..0xFCFC.
624`emacs-mule', which indicates that the coding system supports all 690
625charsets that have the `:emacs-mule-id' property. 691If `:coding-type' is `emacs-mule', VALUE may be `emacs-mule',
692which indicates that the coding system supports all charsets that
693have the `:emacs-mule-id' property.
626 694
627`:ascii-compatible-p' 695`:ascii-compatible-p'
628 696
@@ -643,9 +711,9 @@ VALUE must be a translation table to use on encoding.
643VALUE must be a function to call after some text is inserted and 711VALUE must be a function to call after some text is inserted and
644decoded by the coding system itself and before any functions in 712decoded by the coding system itself and before any functions in
645`after-insert-functions' are called. This function is passed one 713`after-insert-functions' are called. This function is passed one
646argument; the number of characters in the text to convert, with 714argument: the number of characters in the text to convert, with
647point at the start of the text. The function should leave point 715point at the start of the text. The function should leave point
648the same, and return the new character count. 716unchanged, and should return the new character count.
649 717
650`:pre-write-conversion' 718`:pre-write-conversion'
651 719
@@ -674,7 +742,7 @@ to lower case.
674`:mime-text-unsuitable' 742`:mime-text-unsuitable'
675 743
676VALUE non-nil means the `:mime-charset' property names a charset which 744VALUE non-nil means the `:mime-charset' property names a charset which
677is unsuitable for the top-level media type \"text\". 745is unsuitable for the top-level media of type \"text\".
678 746
679`:flags' 747`:flags'
680 748
@@ -704,8 +772,8 @@ This attribute is meaningful only when `:coding-type' is `iso-2022'.
704 772
705`:bom' 773`:bom'
706 774
707This attributes specifies whether the coding system uses a `byte order 775This attributes specifies whether the coding system uses a \"byte order
708mark'. VALUE must be nil, t, or cons of coding systems whose 776mark\". VALUE must be nil, t, or a cons cell of coding systems whose
709`:coding-type' is `utf-16' or `utf-8'. 777`:coding-type' is `utf-16' or `utf-8'.
710 778
711If the value is nil, on decoding, don't treat the first two-byte as 779If the value is nil, on decoding, don't treat the first two-byte as
@@ -714,9 +782,9 @@ BOM, and on encoding, don't produce BOM bytes.
714If the value is t, on decoding, skip the first two-byte as BOM, and on 782If the value is t, on decoding, skip the first two-byte as BOM, and on
715encoding, produce BOM bytes according to the value of `:endian'. 783encoding, produce BOM bytes according to the value of `:endian'.
716 784
717If the value is cons, on decoding, check the first two-byte. If they 785If the value is a cons cell, on decoding, check the first two bytes.
718are 0xFE 0xFF, use the car part coding system of the value. If they 786If they are 0xFE 0xFF, use the car part coding system of the value.
719are 0xFF 0xFE, use the cdr part coding system of the value. 787If they are 0xFF 0xFE, use the cdr part coding system of the value.
720Otherwise, treat them as bytes for a normal character. On encoding, 788Otherwise, treat them as bytes for a normal character. On encoding,
721produce BOM bytes according to the value of `:endian'. 789produce BOM bytes according to the value of `:endian'.
722 790
@@ -730,17 +798,17 @@ little-endian respectively. The default value is `big'.
730 798
731This attribute is meaningful only when `:coding-type' is `utf-16'. 799This attribute is meaningful only when `:coding-type' is `utf-16'.
732 800
733`:ccl-decoder' 801`:ccl-decoder' (required if :coding-type is `ccl')
734 802
735VALUE is a symbol representing the registered CCL program used for 803VALUE is a CCL program name defined by `define-ccl-program'. The
736decoding. This attribute is meaningful only when `:coding-type' is 804CCL program reads a byte sequence and writes a character sequence
737`ccl'. 805as a decoding result.
738 806
739`:ccl-encoder' 807`:ccl-encoder' (required if :coding-type is `ccl')
740 808
741VALUE is a symbol representing the registered CCL program used for 809VALUE is a CCL program name defined by `define-ccl-program'. The
742encoding. This attribute is meaningful only when `:coding-type' is 810CCL program reads a character sequence and writes a byte sequence
743`ccl'. 811as an encoding result.
744 812
745`:inhibit-null-byte-detection' 813`:inhibit-null-byte-detection'
746 814
@@ -2249,7 +2317,13 @@ ALIST is an alist, each element has the form (FROM . TO).
2249FROM and TO are a character or a vector of characters. 2317FROM and TO are a character or a vector of characters.
2250If FROM is a character, that character is translated to TO. 2318If FROM is a character, that character is translated to TO.
2251If FROM is a vector of characters, that sequence is translated to TO. 2319If FROM is a vector of characters, that sequence is translated to TO.
2252The first extra-slot of the value is a translation table for reverse mapping." 2320The first extra-slot of the value is a translation table for reverse mapping.
2321
2322FROM and TO may be nil. If TO is nil, the translation from FROM
2323to nothing is defined in the translation table and that element
2324is ignored in the reverse map. If FROM is nil, the translation
2325from TO to nothing is defined in the reverse map only. A vector
2326of length zero has the same meaning as specifying nil."
2253 (let ((tables (vector (make-char-table 'translation-table) 2327 (let ((tables (vector (make-char-table 'translation-table)
2254 (make-char-table 'translation-table))) 2328 (make-char-table 'translation-table)))
2255 table max-lookup from to idx val) 2329 table max-lookup from to idx val)
@@ -2262,20 +2336,23 @@ The first extra-slot of the value is a translation table for reverse mapping."
2262 (setq from (cdr elt) to (car elt))) 2336 (setq from (cdr elt) to (car elt)))
2263 (if (characterp from) 2337 (if (characterp from)
2264 (setq idx from) 2338 (setq idx from)
2265 (setq idx (aref from 0) 2339 (if (= (length from) 0)
2266 max-lookup (max max-lookup (length from)))) 2340 (setq idx nil)
2267 (setq val (aref table idx)) 2341 (setq idx (aref from 0)
2268 (if val 2342 max-lookup (max max-lookup (length from)))))
2269 (progn 2343 (when idx
2270 (or (consp val) 2344 (setq val (aref table idx))
2271 (setq val (list (cons (vector idx) val)))) 2345 (if val
2272 (if (characterp from) 2346 (progn
2273 (setq from (vector from))) 2347 (or (consp val)
2274 (setq val (nconc val (list (cons from to))))) 2348 (setq val (list (cons (vector idx) val))))
2275 (if (characterp from) 2349 (if (characterp from)
2276 (setq val to) 2350 (setq from (vector from)))
2277 (setq val (list (cons from to))))) 2351 (setq val (nconc val (list (cons from to)))))
2278 (aset table idx val)) 2352 (if (characterp from)
2353 (setq val to)
2354 (setq val (list (cons from to)))))
2355 (aset table idx val)))
2279 (set-char-table-extra-slot table 1 max-lookup)) 2356 (set-char-table-extra-slot table 1 max-lookup))
2280 (set-char-table-extra-slot (aref tables 0) 0 (aref tables 1)) 2357 (set-char-table-extra-slot (aref tables 0) 0 (aref tables 1))
2281 (aref tables 0))) 2358 (aref tables 0)))
diff --git a/lisp/language/misc-lang.el b/lisp/language/misc-lang.el
index ee06e34eef4..b56d31f6e16 100644
--- a/lisp/language/misc-lang.el
+++ b/lisp/language/misc-lang.el
@@ -78,7 +78,8 @@ and Italian.")))
78(set-char-table-range 78(set-char-table-range
79 composition-function-table 79 composition-function-table
80 '(#x600 . #x6FF) 80 '(#x600 . #x6FF)
81 (list ["[\u0600-\u06FF]+" 0 font-shape-gstring])) 81 (list ["\u200D?[\u0600-\u074F]+[\u200D\u200C]*[\u0600-\u074F]+\u200D?"
82 0 font-shape-gstring]))
82 83
83(provide 'misc-lang) 84(provide 'misc-lang)
84 85
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 8f33641a746..ea5794dfd0b 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -373,35 +373,29 @@
373 373
374 (bindings--define-key menu [set-tags-name] 374 (bindings--define-key menu [set-tags-name]
375 '(menu-item "Set Tags File Name..." visit-tags-table 375 '(menu-item "Set Tags File Name..." visit-tags-table
376 :help "Tell Tags commands which tag table file to use")) 376 :visible (menu-bar-goto-uses-etags-p)
377 :help "Tell navigation commands which tag table file to use"))
377 378
378 (bindings--define-key menu [separator-tag-file] 379 (bindings--define-key menu [separator-tag-file]
379 menu-bar-separator) 380 '(menu-item "--" nil :visible (menu-bar-goto-uses-etags-p)))
381
382 (bindings--define-key menu [xref-pop]
383 '(menu-item "Back" xref-pop-marker-stack
384 :help "Back to the position of the last search"))
380 385
381 (bindings--define-key menu [apropos-tags] 386 (bindings--define-key menu [xref-apropos]
382 '(menu-item "Tags Apropos..." tags-apropos 387 '(menu-item "Find Apropos..." xref-find-apropos
383 :help "Find function/variables whose names match regexp")) 388 :help "Find function/variables whose names match regexp"))
384 (bindings--define-key menu [next-tag-otherw] 389
385 '(menu-item "Next Tag in Other Window" 390 (bindings--define-key menu [xref-find-otherw]
386 menu-bar-next-tag-other-window 391 '(menu-item "Find Definition in Other Window..."
387 :enable (and (boundp 'tags-location-ring) 392 xref-find-definitions-other-window
388 (not (ring-empty-p tags-location-ring)))
389 :help "Find next function/variable matching last tag name in another window"))
390
391 (bindings--define-key menu [next-tag]
392 '(menu-item "Find Next Tag"
393 menu-bar-next-tag
394 :enable (and (boundp 'tags-location-ring)
395 (not (ring-empty-p tags-location-ring)))
396 :help "Find next function/variable matching last tag name"))
397 (bindings--define-key menu [find-tag-otherw]
398 '(menu-item "Find Tag in Other Window..." find-tag-other-window
399 :help "Find function/variable definition in another window")) 393 :help "Find function/variable definition in another window"))
400 (bindings--define-key menu [find-tag] 394 (bindings--define-key menu [xref-find-def]
401 '(menu-item "Find Tag..." find-tag 395 '(menu-item "Find Definition..." xref-find-definitions
402 :help "Find definition of function or variable")) 396 :help "Find definition of function or variable"))
403 397
404 (bindings--define-key menu [separator-tags] 398 (bindings--define-key menu [separator-xref]
405 menu-bar-separator) 399 menu-bar-separator)
406 400
407 (bindings--define-key menu [end-of-buf] 401 (bindings--define-key menu [end-of-buf]
@@ -416,6 +410,9 @@
416 :help "Read a line number and go to that line")) 410 :help "Read a line number and go to that line"))
417 menu)) 411 menu))
418 412
413(defun menu-bar-goto-uses-etags-p ()
414 (or (not (boundp 'xref-find-function))
415 (eq xref-find-function 'etags-xref-find)))
419 416
420(defvar yank-menu (cons (purecopy "Select Yank") nil)) 417(defvar yank-menu (cons (purecopy "Select Yank") nil))
421(fset 'yank-menu (cons 'keymap yank-menu)) 418(fset 'yank-menu (cons 'keymap yank-menu))
@@ -514,16 +511,6 @@
514 511
515 menu)) 512 menu))
516 513
517(defun menu-bar-next-tag-other-window ()
518 "Find the next definition of the tag already specified."
519 (interactive)
520 (find-tag-other-window nil t))
521
522(defun menu-bar-next-tag ()
523 "Find the next definition of the tag already specified."
524 (interactive)
525 (find-tag nil t))
526
527(define-obsolete-function-alias 514(define-obsolete-function-alias
528 'menu-bar-kill-ring-save 'kill-ring-save "24.1") 515 'menu-bar-kill-ring-save 'kill-ring-save "24.1")
529 516
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index e1e6b0ee907..91989016067 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1818,8 +1818,9 @@ variables.")
1818 ,(if (eq (selected-window) (minibuffer-window)) 1818 ,(if (eq (selected-window) (minibuffer-window))
1819 'display-buffer-at-bottom 1819 'display-buffer-at-bottom
1820 'display-buffer-below-selected)) 1820 'display-buffer-below-selected))
1821 ,(when temp-buffer-resize-mode 1821 ,(if temp-buffer-resize-mode
1822 '(window-height . resize-temp-buffer-window)) 1822 '(window-height . resize-temp-buffer-window)
1823 '(window-height . shrink-window-if-larger-than-buffer))
1823 ,(when temp-buffer-resize-mode 1824 ,(when temp-buffer-resize-mode
1824 '(preserve-size . (nil . t)))) 1825 '(preserve-size . (nil . t))))
1825 nil 1826 nil
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index c6d3bbceda2..af902ded472 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -445,7 +445,7 @@ See the `eww-search-prefix' variable for the search engine used."
445 ("start" . :start) 445 ("start" . :start)
446 ("home" . :home) 446 ("home" . :home)
447 ("contents" . :contents) 447 ("contents" . :contents)
448 ("up" . up))))) 448 ("up" . :up)))))
449 (and href 449 (and href
450 where 450 where
451 (plist-put eww-data (cdr where) href)))) 451 (plist-put eww-data (cdr where) href))))
@@ -705,6 +705,9 @@ the like."
705 (setq-local tool-bar-map eww-tool-bar-map)) 705 (setq-local tool-bar-map eww-tool-bar-map))
706 ;; desktop support 706 ;; desktop support
707 (setq-local desktop-save-buffer 'eww-desktop-misc-data) 707 (setq-local desktop-save-buffer 'eww-desktop-misc-data)
708 ;; multi-page isearch support
709 (setq-local multi-isearch-next-buffer-function 'eww-isearch-next-buffer)
710 (setq truncate-lines t)
708 (buffer-disable-undo) 711 (buffer-disable-undo)
709 (setq buffer-read-only t)) 712 (setq buffer-read-only t))
710 713
@@ -1884,6 +1887,19 @@ Otherwise, the restored buffer will contain a prompt to do so by using
1884(add-to-list 'desktop-buffer-mode-handlers 1887(add-to-list 'desktop-buffer-mode-handlers
1885 '(eww-mode . eww-restore-desktop)) 1888 '(eww-mode . eww-restore-desktop))
1886 1889
1890;;; Isearch support
1891
1892(defun eww-isearch-next-buffer (&optional buffer wrap)
1893 "Go to the next page to search using `rel' attribute for navigation."
1894 (if wrap
1895 (condition-case nil
1896 (eww-top-url)
1897 (error nil))
1898 (if isearch-forward
1899 (eww-next-url)
1900 (eww-previous-url)))
1901 (current-buffer))
1902
1887(provide 'eww) 1903(provide 'eww)
1888 1904
1889;;; eww.el ends here 1905;;; eww.el ends here
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 387bb024a52..6553fd3958c 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -78,11 +78,12 @@ If nil, don't draw horizontal table lines."
78 :group 'shr 78 :group 'shr
79 :type 'character) 79 :type 'character)
80 80
81(defcustom shr-width fill-column 81(defcustom shr-width nil
82 "Frame width to use for rendering. 82 "Frame width to use for rendering.
83May either be an integer specifying a fixed width in characters, 83May either be an integer specifying a fixed width in characters,
84or nil, meaning that the full width of the window should be 84or nil, meaning that the full width of the window should be
85used." 85used."
86 :version "25.1"
86 :type '(choice (integer :tag "Fixed width in characters") 87 :type '(choice (integer :tag "Fixed width in characters")
87 (const :tag "Use the width of the window" nil)) 88 (const :tag "Use the width of the window" nil))
88 :group 'shr) 89 :group 'shr)
@@ -1439,10 +1440,11 @@ The preference is a float determined from `shr-prefer-media-type'."
1439 1440
1440(defun shr-tag-table (dom) 1441(defun shr-tag-table (dom)
1441 (shr-ensure-paragraph) 1442 (shr-ensure-paragraph)
1442 (let* ((caption (dom-child-by-tag dom 'caption)) 1443 (let* ((caption (dom-children (dom-child-by-tag dom 'caption)))
1443 (header (dom-child-by-tag dom 'thead)) 1444 (header (dom-non-text-children (dom-child-by-tag dom 'thead)))
1444 (body (or (dom-child-by-tag dom 'tbody) dom)) 1445 (body (dom-non-text-children (or (dom-child-by-tag dom 'tbody)
1445 (footer (dom-child-by-tag dom 'tfoot)) 1446 dom)))
1447 (footer (dom-non-text-children (dom-child-by-tag dom 'tfoot)))
1446 (bgcolor (dom-attr dom 'bgcolor)) 1448 (bgcolor (dom-attr dom 'bgcolor))
1447 (start (point)) 1449 (start (point))
1448 (shr-stylesheet (nconc (list (cons 'background-color bgcolor)) 1450 (shr-stylesheet (nconc (list (cons 'background-color bgcolor))
@@ -1461,42 +1463,62 @@ The preference is a float determined from `shr-prefer-media-type'."
1461 ;; It's a real table, so render it. 1463 ;; It's a real table, so render it.
1462 (shr-tag-table-1 1464 (shr-tag-table-1
1463 (nconc 1465 (nconc
1464 (if caption `((tr (td ,@caption)))) 1466 (list 'table nil)
1465 (if header 1467 (if caption `((tr nil (td nil ,@caption))))
1466 (if footer 1468 (cond (header
1467 ;; header + body + footer 1469 (if footer
1468 (if (= nheader nbody) 1470 ;; header + body + footer
1469 (if (= nbody nfooter) 1471 (if (= nheader nbody)
1470 `((tr (td (table (tbody ,@header ,@body ,@footer))))) 1472 (if (= nbody nfooter)
1471 (nconc `((tr (td (table (tbody ,@header ,@body))))) 1473 `((tr nil (td nil (table nil
1472 (if (= nfooter 1) 1474 (tbody nil ,@header
1473 footer 1475 ,@body ,@footer)))))
1474 `((tr (td (table (tbody ,@footer)))))))) 1476 (nconc `((tr nil (td nil (table nil
1475 (nconc `((tr (td (table (tbody ,@header))))) 1477 (tbody nil ,@header
1476 (if (= nbody nfooter) 1478 ,@body)))))
1477 `((tr (td (table (tbody ,@body ,@footer))))) 1479 (if (= nfooter 1)
1478 (nconc `((tr (td (table (tbody ,@body))))) 1480 footer
1479 (if (= nfooter 1) 1481 `((tr nil (td nil (table
1480 footer 1482 nil (tbody
1481 `((tr (td (table (tbody ,@footer)))))))))) 1483 nil ,@footer))))))))
1482 ;; header + body 1484 (nconc `((tr nil (td nil (table nil (tbody
1483 (if (= nheader nbody) 1485 nil ,@header)))))
1484 `((tr (td (table (tbody ,@header ,@body))))) 1486 (if (= nbody nfooter)
1485 (if (= nheader 1) 1487 `((tr nil (td nil (table
1486 `(,@header (tr (td (table (tbody ,@body))))) 1488 nil (tbody nil ,@body
1487 `((tr (td (table (tbody ,@header)))) 1489 ,@footer)))))
1488 (tr (td (table (tbody ,@body)))))))) 1490 (nconc `((tr nil (td nil (table
1489 (if footer 1491 nil (tbody nil
1490 ;; body + footer 1492 ,@body)))))
1491 (if (= nbody nfooter) 1493 (if (= nfooter 1)
1492 `((tr (td (table (tbody ,@body ,@footer))))) 1494 footer
1493 (nconc `((tr (td (table (tbody ,@body))))) 1495 `((tr nil (td nil (table
1494 (if (= nfooter 1) 1496 nil
1495 footer 1497 (tbody
1496 `((tr (td (table (tbody ,@footer)))))))) 1498 nil
1497 (if caption 1499 ,@footer))))))))))
1498 `((tr (td (table (tbody ,@body))))) 1500 ;; header + body
1499 body)))))) 1501 (if (= nheader nbody)
1502 `((tr nil (td nil (table nil (tbody nil ,@header
1503 ,@body)))))
1504 (if (= nheader 1)
1505 `(,@header (tr nil (td nil (table
1506 nil (tbody nil ,@body)))))
1507 `((tr nil (td nil (table nil (tbody nil ,@header))))
1508 (tr nil (td nil (table nil (tbody nil ,@body)))))))))
1509 (footer
1510 ;; body + footer
1511 (if (= nbody nfooter)
1512 `((tr nil (td nil (table
1513 nil (tbody nil ,@body ,@footer)))))
1514 (nconc `((tr nil (td nil (table nil (tbody nil ,@body)))))
1515 (if (= nfooter 1)
1516 footer
1517 `((tr nil (td nil (table
1518 nil (tbody nil ,@footer)))))))))
1519 (caption
1520 `((tr nil (td nil (table nil (tbody nil ,@body))))))
1521 (body)))))
1500 (when bgcolor 1522 (when bgcolor
1501 (shr-colorize-region start (point) (cdr (assq 'color shr-stylesheet)) 1523 (shr-colorize-region start (point) (cdr (assq 'color shr-stylesheet))
1502 bgcolor)) 1524 bgcolor))
diff --git a/lisp/net/tramp-gw.el b/lisp/net/tramp-gw.el
index 0decd8847cc..e21aaf78914 100644
--- a/lisp/net/tramp-gw.el
+++ b/lisp/net/tramp-gw.el
@@ -195,11 +195,12 @@ instead of the host name declared in TARGET-VEC."
195 (setq tramp-gw-gw-proc 195 (setq tramp-gw-gw-proc
196 (funcall 196 (funcall
197 socks-function 197 socks-function
198 (tramp-get-connection-name gw-vec) 198 (let ((tramp-verbose 0)) (tramp-get-connection-name gw-vec))
199 (tramp-get-connection-buffer gw-vec) 199 (let ((tramp-verbose 0)) (tramp-get-connection-buffer gw-vec))
200 (tramp-file-name-real-host target-vec) 200 (tramp-file-name-real-host target-vec)
201 (tramp-file-name-port target-vec))) 201 (tramp-file-name-port target-vec)))
202 (set-process-sentinel tramp-gw-gw-proc 'tramp-gw-gw-proc-sentinel) 202 (set-process-sentinel tramp-gw-gw-proc 'tramp-gw-gw-proc-sentinel)
203 (set-process-coding-system tramp-gw-gw-proc 'binary 'binary)
203 (tramp-compat-set-process-query-on-exit-flag tramp-gw-gw-proc nil) 204 (tramp-compat-set-process-query-on-exit-flag tramp-gw-gw-proc nil)
204 (tramp-message 205 (tramp-message
205 vec 4 "Opened %s process `%s'" 206 vec 4 "Opened %s process `%s'"
@@ -260,6 +261,10 @@ authentication is requested from proxy server, provide it."
260 (200 (setq found t)) 261 (200 (setq found t))
261 ;; We need basic authentication. 262 ;; We need basic authentication.
262 (401 (setq authentication (tramp-gw-basic-authentication nil first))) 263 (401 (setq authentication (tramp-gw-basic-authentication nil first)))
264 ;; Access forbidden.
265 (403 (tramp-error-with-buffer
266 (current-buffer) tramp-gw-vector 'file-error
267 "Connection to %s:%d forbidden." host service))
263 ;; Target host not found. 268 ;; Target host not found.
264 (404 (tramp-error-with-buffer 269 (404 (tramp-error-with-buffer
265 (current-buffer) tramp-gw-vector 'file-error 270 (current-buffer) tramp-gw-vector 'file-error
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index ba7b7d95a4b..6fc2effbe0f 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2471,8 +2471,12 @@ The method used must be an out-of-band method."
2471 (mapconcat 'identity (process-command p) " ")) 2471 (mapconcat 'identity (process-command p) " "))
2472 (tramp-set-connection-property p "vector" orig-vec) 2472 (tramp-set-connection-property p "vector" orig-vec)
2473 (tramp-compat-set-process-query-on-exit-flag p nil) 2473 (tramp-compat-set-process-query-on-exit-flag p nil)
2474 (tramp-process-actions 2474
2475 p v nil tramp-actions-copy-out-of-band) 2475 ;; We must adapt `tramp-local-end-of-line' for
2476 ;; sending the password.
2477 (let ((tramp-local-end-of-line tramp-rsh-end-of-line))
2478 (tramp-process-actions
2479 p v nil tramp-actions-copy-out-of-band))
2476 2480
2477 ;; Check the return code. 2481 ;; Check the return code.
2478 (goto-char (point-max)) 2482 (goto-char (point-max))
@@ -2883,7 +2887,7 @@ the result will be a local, non-Tramp, file name."
2883 (name1 name) 2887 (name1 name)
2884 (i 0) 2888 (i 0)
2885 ;; We do not want to raise an error when 2889 ;; We do not want to raise an error when
2886 ;; `start-file-process' has been started several time in 2890 ;; `start-file-process' has been started several times in
2887 ;; `eshell' and friends. 2891 ;; `eshell' and friends.
2888 (tramp-current-connection nil)) 2892 (tramp-current-connection nil))
2889 2893
@@ -4510,7 +4514,8 @@ Gateway hops are already opened."
4510 ;; Therefore, we must remember the gateway vector. But we 4514 ;; Therefore, we must remember the gateway vector. But we
4511 ;; cannot do it as connection property, because it shouldn't 4515 ;; cannot do it as connection property, because it shouldn't
4512 ;; be persistent. And we have no started process yet either. 4516 ;; be persistent. And we have no started process yet either.
4513 (tramp-set-file-property (car target-alist) "" "gateway" hop))) 4517 (let ((tramp-verbose 0))
4518 (tramp-set-file-property (car target-alist) "" "gateway" hop))))
4514 4519
4515 ;; Foreign and out-of-band methods are not supported for multi-hops. 4520 ;; Foreign and out-of-band methods are not supported for multi-hops.
4516 (when (cdr target-alist) 4521 (when (cdr target-alist)
@@ -4687,7 +4692,8 @@ connection if a previous connection has died for some reason."
4687 l-method 'tramp-connection-timeout)) 4692 l-method 'tramp-connection-timeout))
4688 (gw-args 4693 (gw-args
4689 (tramp-get-method-parameter l-method 'tramp-gw-args)) 4694 (tramp-get-method-parameter l-method 'tramp-gw-args))
4690 (gw (tramp-get-file-property hop "" "gateway" nil)) 4695 (gw (let ((tramp-verbose 0))
4696 (tramp-get-file-property hop "" "gateway" nil)))
4691 (g-method (and gw (tramp-file-name-method gw))) 4697 (g-method (and gw (tramp-file-name-method gw)))
4692 (g-user (and gw (tramp-file-name-user gw))) 4698 (g-user (and gw (tramp-file-name-user gw)))
4693 (g-host (and gw (tramp-file-name-real-host gw))) 4699 (g-host (and gw (tramp-file-name-real-host gw)))
@@ -4715,8 +4721,10 @@ connection if a previous connection has died for some reason."
4715 (setq login-args (append async-args login-args))) 4721 (setq login-args (append async-args login-args)))
4716 4722
4717 ;; Add gateway arguments if necessary. 4723 ;; Add gateway arguments if necessary.
4718 (when (and gw gw-args) 4724 (when gw
4719 (setq login-args (append gw-args login-args))) 4725 (tramp-set-connection-property p "gateway" t)
4726 (when gw-args
4727 (setq login-args (append gw-args login-args))))
4720 4728
4721 ;; Check for port number. Until now, there's no 4729 ;; Check for port number. Until now, there's no
4722 ;; need for handling like method, user, host. 4730 ;; need for handling like method, user, host.
@@ -4902,8 +4910,9 @@ FMT and ARGS which are passed to `error'."
4902 (or (tramp-send-command-and-check vec command) 4910 (or (tramp-send-command-and-check vec command)
4903 (apply 'tramp-error vec 'file-error fmt args))) 4911 (apply 'tramp-error vec 'file-error fmt args)))
4904 4912
4905(defun tramp-send-command-and-read (vec command &optional noerror) 4913(defun tramp-send-command-and-read (vec command &optional noerror marker)
4906 "Run COMMAND and return the output, which must be a Lisp expression. 4914 "Run COMMAND and return the output, which must be a Lisp expression.
4915If MARKER is a regexp, read the output after that string.
4907In case there is no valid Lisp expression and NOERROR is nil, it 4916In case there is no valid Lisp expression and NOERROR is nil, it
4908raises an error." 4917raises an error."
4909 (when (if noerror 4918 (when (if noerror
@@ -4911,8 +4920,17 @@ raises an error."
4911 (tramp-barf-unless-okay 4920 (tramp-barf-unless-okay
4912 vec command "`%s' returns with error" command)) 4921 vec command "`%s' returns with error" command))
4913 (with-current-buffer (tramp-get-connection-buffer vec) 4922 (with-current-buffer (tramp-get-connection-buffer vec)
4914 ;; Read the expression.
4915 (goto-char (point-min)) 4923 (goto-char (point-min))
4924 ;; Read the marker.
4925 (when (stringp marker)
4926 (condition-case nil
4927 (re-search-forward marker)
4928 (error (unless noerror
4929 (tramp-error
4930 vec 'file-error
4931 "`%s' does not return the marker `%s': `%s'"
4932 command marker (buffer-string))))))
4933 ;; Read the expression.
4916 (condition-case nil 4934 (condition-case nil
4917 (prog1 (read (current-buffer)) 4935 (prog1 (read (current-buffer))
4918 ;; Error handling. 4936 ;; Error handling.
@@ -5064,25 +5082,22 @@ Return ATTR."
5064 "/bin:/usr/bin") 5082 "/bin:/usr/bin")
5065 "/bin:/usr/bin")))) 5083 "/bin:/usr/bin"))))
5066 (own-remote-path 5084 (own-remote-path
5067 ;; We cannot apply `tramp-send-command-and-read' because 5085 ;; The login shell could return more than just the $PATH
5068 ;; the login shell could return more than just the $PATH 5086 ;; string. So we use `tramp-end-of-heredoc' as marker.
5069 ;; string. So we emulate that function.
5070 (when elt2 5087 (when elt2
5071 (tramp-send-command 5088 (tramp-send-command-and-read
5072 vec 5089 vec
5073 (format 5090 (format
5074 "%s -l %s 'echo \\\"$PATH\\\"'" 5091 "%s -l %s 'echo %s \\\"$PATH\\\"'"
5075 (tramp-get-method-parameter 5092 (tramp-get-method-parameter
5076 (tramp-file-name-method vec) 'tramp-remote-shell) 5093 (tramp-file-name-method vec) 'tramp-remote-shell)
5077 (mapconcat 5094 (mapconcat
5078 'identity 5095 'identity
5079 (tramp-get-method-parameter 5096 (tramp-get-method-parameter
5080 (tramp-file-name-method vec) 'tramp-remote-shell-args) 5097 (tramp-file-name-method vec) 'tramp-remote-shell-args)
5081 " "))) 5098 " ")
5082 (with-current-buffer (tramp-get-connection-buffer vec) 5099 (tramp-shell-quote-argument tramp-end-of-heredoc))
5083 (goto-char (point-max)) 5100 nil (regexp-quote tramp-end-of-heredoc)))))
5084 (forward-line -1)
5085 (read (current-buffer))))))
5086 5101
5087 ;; Replace place holder `tramp-default-remote-path'. 5102 ;; Replace place holder `tramp-default-remote-path'.
5088 (when elt1 5103 (when elt1
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 2cf9d45b965..3c8b5bbd60e 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1610,7 +1610,7 @@ an input event arrives. The other arguments are passed to `tramp-error'."
1610 (let ((enable-recursive-minibuffers t)) 1610 (let ((enable-recursive-minibuffers t))
1611 ;; `tramp-error' does not show messages. So we must do it 1611 ;; `tramp-error' does not show messages. So we must do it
1612 ;; ourselves. 1612 ;; ourselves.
1613 (message fmt-string arguments) 1613 (apply 'message fmt-string arguments)
1614 ;; Show buffer. 1614 ;; Show buffer.
1615 (pop-to-buffer buf) 1615 (pop-to-buffer buf)
1616 (discard-input) 1616 (discard-input)
@@ -3086,115 +3086,118 @@ User is always nil."
3086 (setq filename (expand-file-name filename)) 3086 (setq filename (expand-file-name filename))
3087 (let (result local-copy remote-copy) 3087 (let (result local-copy remote-copy)
3088 (with-parsed-tramp-file-name filename nil 3088 (with-parsed-tramp-file-name filename nil
3089 (with-tramp-progress-reporter 3089 (unwind-protect
3090 v 3 (format "Inserting `%s'" filename) 3090 (if (not (file-exists-p filename))
3091 (unwind-protect 3091 (tramp-error
3092 (if (not (file-exists-p filename)) 3092 v 'file-error "File `%s' not found on remote host" filename)
3093 (progn 3093
3094 ;; We don't raise a Tramp error, because it might be 3094 (with-tramp-progress-reporter
3095 ;; suppressed, like in `find-file-noselect-1'. 3095 v 3 (format "Inserting `%s'" filename)
3096 (tramp-message 3096 (condition-case err
3097 v 1 "File not `%s' found on remote host" filename) 3097 (if (and (tramp-local-host-p v)
3098 (signal 'file-error 3098 (let (file-name-handler-alist)
3099 (list "File not found on remote host" filename))) 3099 (file-readable-p localname)))
3100 3100 ;; Short track: if we are on the local host, we can
3101 (if (and (tramp-local-host-p v) 3101 ;; run directly.
3102 (let (file-name-handler-alist) 3102 (setq result
3103 (file-readable-p localname))) 3103 (tramp-run-real-handler
3104 ;; Short track: if we are on the local host, we can 3104 'insert-file-contents
3105 ;; run directly. 3105 (list localname visit beg end replace)))
3106 (setq result 3106
3107 (tramp-run-real-handler 3107 ;; When we shall insert only a part of the file, we
3108 'insert-file-contents 3108 ;; copy this part. This works only for the shell file
3109 (list localname visit beg end replace))) 3109 ;; name handlers.
3110 3110 (when (and (or beg end)
3111 ;; When we shall insert only a part of the file, we 3111 (tramp-get-method-parameter
3112 ;; copy this part. This works only for the shell file 3112 (tramp-file-name-method v)
3113 ;; name handlers. 3113 'tramp-login-program))
3114 (when (and (or beg end) 3114 (setq remote-copy (tramp-make-tramp-temp-file v))
3115 (tramp-get-method-parameter 3115 ;; This is defined in tramp-sh.el. Let's assume
3116 (tramp-file-name-method v) 'tramp-login-program)) 3116 ;; this is loaded already.
3117 (setq remote-copy (tramp-make-tramp-temp-file v)) 3117 (tramp-compat-funcall
3118 ;; This is defined in tramp-sh.el. Let's assume 3118 'tramp-send-command
3119 ;; this is loaded already. 3119 v
3120 (tramp-compat-funcall 3120 (cond
3121 'tramp-send-command 3121 ((and beg end)
3122 v 3122 (format "dd bs=1 skip=%d if=%s count=%d of=%s"
3123 (cond 3123 beg (tramp-shell-quote-argument localname)
3124 ((and beg end) 3124 (- end beg) remote-copy))
3125 (format "dd bs=1 skip=%d if=%s count=%d of=%s" 3125 (beg
3126 beg (tramp-shell-quote-argument localname) 3126 (format "dd bs=1 skip=%d if=%s of=%s"
3127 (- end beg) remote-copy)) 3127 beg (tramp-shell-quote-argument localname)
3128 (beg 3128 remote-copy))
3129 (format "dd bs=1 skip=%d if=%s of=%s" 3129 (end
3130 beg (tramp-shell-quote-argument localname) 3130 (format "dd bs=1 count=%d if=%s of=%s"
3131 remote-copy)) 3131 end (tramp-shell-quote-argument localname)
3132 (end 3132 remote-copy))))
3133 (format "dd bs=1 count=%d if=%s of=%s" 3133 (setq tramp-temp-buffer-file-name nil beg nil end nil))
3134 end (tramp-shell-quote-argument localname) 3134
3135 remote-copy)))) 3135 ;; `insert-file-contents-literally' takes care to
3136 (setq tramp-temp-buffer-file-name nil beg nil end nil)) 3136 ;; avoid calling jka-compr. By let-binding
3137 3137 ;; `inhibit-file-name-operation', we propagate that
3138 ;; `insert-file-contents-literally' takes care to 3138 ;; care to the `file-local-copy' operation.
3139 ;; avoid calling jka-compr. By let-binding 3139 (setq local-copy
3140 ;; `inhibit-file-name-operation', we propagate that 3140 (let ((inhibit-file-name-operation
3141 ;; care to the `file-local-copy' operation. 3141 (when (eq inhibit-file-name-operation
3142 (setq local-copy 3142 'insert-file-contents)
3143 (let ((inhibit-file-name-operation 3143 'file-local-copy)))
3144 (when (eq inhibit-file-name-operation 3144 (cond
3145 'insert-file-contents) 3145 ((stringp remote-copy)
3146 'file-local-copy))) 3146 (file-local-copy
3147 (cond 3147 (tramp-make-tramp-file-name
3148 ((stringp remote-copy) 3148 method user host remote-copy)))
3149 (file-local-copy 3149 ((stringp tramp-temp-buffer-file-name)
3150 (tramp-make-tramp-file-name 3150 (copy-file
3151 method user host remote-copy))) 3151 filename tramp-temp-buffer-file-name 'ok)
3152 ((stringp tramp-temp-buffer-file-name) 3152 tramp-temp-buffer-file-name)
3153 (copy-file filename tramp-temp-buffer-file-name 'ok) 3153 (t (file-local-copy filename)))))
3154 tramp-temp-buffer-file-name) 3154
3155 (t (file-local-copy filename))))) 3155 ;; When the file is not readable for the owner, it
3156 3156 ;; cannot be inserted, even if it is readable for the
3157 ;; When the file is not readable for the owner, it 3157 ;; group or for everybody.
3158 ;; cannot be inserted, even if it is readable for the 3158 (set-file-modes
3159 ;; group or for everybody. 3159 local-copy (tramp-compat-octal-to-decimal "0600"))
3160 (set-file-modes 3160
3161 local-copy (tramp-compat-octal-to-decimal "0600")) 3161 (when (and (null remote-copy)
3162 3162 (tramp-get-method-parameter
3163 (when (and (null remote-copy) 3163 method 'tramp-copy-keep-tmpfile))
3164 (tramp-get-method-parameter 3164 ;; We keep the local file for performance reasons,
3165 method 'tramp-copy-keep-tmpfile)) 3165 ;; useful for "rsync".
3166 ;; We keep the local file for performance reasons, 3166 (setq tramp-temp-buffer-file-name local-copy))
3167 ;; useful for "rsync". 3167
3168 (setq tramp-temp-buffer-file-name local-copy)) 3168 ;; We must ensure that `file-coding-system-alist'
3169 3169 ;; matches `local-copy'. We must also use `visit',
3170 ;; We must ensure that `file-coding-system-alist' 3170 ;; otherwise there might be an error in the
3171 ;; matches `local-copy'. We must also use `visit', 3171 ;; `revert-buffer' function under XEmacs.
3172 ;; otherwise there might be an error in the 3172 (let ((file-coding-system-alist
3173 ;; `revert-buffer' function under XEmacs. 3173 (tramp-find-file-name-coding-system-alist
3174 (let ((file-coding-system-alist 3174 filename local-copy)))
3175 (tramp-find-file-name-coding-system-alist 3175 (setq result
3176 filename local-copy))) 3176 (insert-file-contents
3177 (setq result 3177 local-copy visit beg end replace))))
3178 (insert-file-contents 3178 (error
3179 local-copy visit beg end replace))))) 3179 (add-hook 'find-file-not-found-functions
3180 3180 `(lambda () (signal ',(car err) ',(cdr err)))
3181 ;; Save exit. 3181 nil t)
3182 (progn 3182 (signal (car err) (cdr err))))))
3183 (when visit 3183
3184 (setq buffer-file-name filename) 3184 ;; Save exit.
3185 (setq buffer-read-only (not (file-writable-p filename))) 3185 (progn
3186 (set-visited-file-modtime) 3186 (when visit
3187 (set-buffer-modified-p nil)) 3187 (setq buffer-file-name filename)
3188 (when (and (stringp local-copy) 3188 (setq buffer-read-only (not (file-writable-p filename)))
3189 (or remote-copy (null tramp-temp-buffer-file-name))) 3189 (set-visited-file-modtime)
3190 (delete-file local-copy)) 3190 (set-buffer-modified-p nil))
3191 (when (stringp remote-copy) 3191 (when (and (stringp local-copy)
3192 (delete-file 3192 (or remote-copy (null tramp-temp-buffer-file-name)))
3193 (tramp-make-tramp-file-name method user host remote-copy))))))) 3193 (delete-file local-copy))
3194 3194 (when (stringp remote-copy)
3195 ;; Result. 3195 (delete-file
3196 (list (expand-file-name filename) 3196 (tramp-make-tramp-file-name method user host remote-copy)))))
3197 (cadr result)))) 3197
3198 ;; Result.
3199 (list (expand-file-name filename)
3200 (cadr result)))))
3198 3201
3199(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) 3202(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
3200 "Like `load' for Tramp files." 3203 "Like `load' for Tramp files."
@@ -3609,15 +3612,19 @@ connection buffer."
3609This is needed in order to hide `last-coding-system-used', which is set 3612This is needed in order to hide `last-coding-system-used', which is set
3610for process communication also." 3613for process communication also."
3611 (with-current-buffer (process-buffer proc) 3614 (with-current-buffer (process-buffer proc)
3612 (tramp-message proc 10 "%s %s" proc (process-status proc)) 3615 ;; FIXME: If there is a gateway process, we need communication
3613 (let (buffer-read-only last-coding-system-used) 3616 ;; between several processes. Too complicate to implement, so we
3617 ;; read output from all processes.
3618 (let ((p (if (tramp-get-connection-property proc "gateway" nil) nil proc))
3619 buffer-read-only last-coding-system-used)
3614 ;; Under Windows XP, accept-process-output doesn't return 3620 ;; Under Windows XP, accept-process-output doesn't return
3615 ;; sometimes. So we add an additional timeout. 3621 ;; sometimes. So we add an additional timeout.
3616 (with-timeout ((or timeout 1)) 3622 (with-timeout ((or timeout 1))
3617 (if (featurep 'xemacs) 3623 (if (featurep 'xemacs)
3618 (accept-process-output proc timeout timeout-msecs) 3624 (accept-process-output p timeout timeout-msecs)
3619 (accept-process-output proc timeout timeout-msecs (and proc t))))) 3625 (accept-process-output p timeout timeout-msecs (and proc t))))
3620 (tramp-message proc 10 "\n%s" (buffer-string)))) 3626 (tramp-message proc 10 "%s %s %s\n%s"
3627 proc (process-status proc) p (buffer-string)))))
3621 3628
3622(defun tramp-check-for-regexp (proc regexp) 3629(defun tramp-check-for-regexp (proc regexp)
3623 "Check, whether REGEXP is contained in process buffer of PROC. 3630 "Check, whether REGEXP is contained in process buffer of PROC.
@@ -4184,25 +4191,27 @@ Invokes `password-read' if available, `read-passwd' else."
4184 ;; it's bound. `auth-source-user-or-password' is an 4191 ;; it's bound. `auth-source-user-or-password' is an
4185 ;; obsoleted function, it has been replaced by 4192 ;; obsoleted function, it has been replaced by
4186 ;; `auth-source-search'. 4193 ;; `auth-source-search'.
4187 (and (boundp 'auth-sources) 4194 (ignore-errors
4188 (tramp-get-connection-property 4195 (and (boundp 'auth-sources)
4189 v "first-password-request" nil) 4196 (tramp-get-connection-property
4190 ;; Try with Tramp's current method. 4197 v "first-password-request" nil)
4191 (if (fboundp 'auth-source-search) 4198 ;; Try with Tramp's current method.
4192 (setq auth-info 4199 (if (fboundp 'auth-source-search)
4193 (tramp-compat-funcall 4200 (setq auth-info
4194 'auth-source-search 4201 (tramp-compat-funcall
4195 :max 1 4202 'auth-source-search
4196 :user (or tramp-current-user t) 4203 :max 1
4197 :host tramp-current-host 4204 :user (or tramp-current-user t)
4198 :port tramp-current-method) 4205 :host tramp-current-host
4199 auth-passwd (plist-get (nth 0 auth-info) :secret) 4206 :port tramp-current-method)
4200 auth-passwd (if (functionp auth-passwd) 4207 auth-passwd (plist-get
4201 (funcall auth-passwd) 4208 (nth 0 auth-info) :secret)
4202 auth-passwd)) 4209 auth-passwd (if (functionp auth-passwd)
4203 (tramp-compat-funcall 4210 (funcall auth-passwd)
4204 'auth-source-user-or-password 4211 auth-passwd))
4205 "password" tramp-current-host tramp-current-method))) 4212 (tramp-compat-funcall
4213 'auth-source-user-or-password
4214 "password" tramp-current-host tramp-current-method))))
4206 ;; Try the password cache. 4215 ;; Try the password cache.
4207 (when (functionp 'password-read) 4216 (when (functionp 'password-read)
4208 (let ((password 4217 (let ((password
diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el
index b93624a4f22..43218ec7c88 100644
--- a/lisp/nxml/rng-uri.el
+++ b/lisp/nxml/rng-uri.el
@@ -85,7 +85,7 @@ Signal an error if URI is not a valid file URL."
85 ((not (string= (downcase scheme) "file")) 85 ((not (string= (downcase scheme) "file"))
86 (rng-uri-error "URI `%s' does not use the `file:' scheme" uri))) 86 (rng-uri-error "URI `%s' does not use the `file:' scheme" uri)))
87 (when (not (member authority 87 (when (not (member authority
88 (cons system-name '(nil "" "localhost")))) 88 (cons (system-name) '(nil "" "localhost"))))
89 (rng-uri-error "URI `%s' does not start with `file:///' or `file://localhost/'" 89 (rng-uri-error "URI `%s' does not start with `file:///' or `file://localhost/'"
90 uri)) 90 uri))
91 (when query 91 (when query
diff --git a/lisp/obsolete/pc-select.el b/lisp/obsolete/pc-select.el
index 5ee0818a1e5..5404f490b88 100644
--- a/lisp/obsolete/pc-select.el
+++ b/lisp/obsolete/pc-select.el
@@ -337,7 +337,7 @@ but before calling PC Selection mode):
337 (cadr pc-select-meta-moves-sexps-key-bindings)) 337 (cadr pc-select-meta-moves-sexps-key-bindings))
338 (if (or pc-select-selection-keys-only 338 (if (or pc-select-selection-keys-only
339 (eq window-system 'x) 339 (eq window-system 'x)
340 (memq system-name '(ms-dos windows-nt))) 340 (memq system-type '(ms-dos windows-nt)))
341 nil 341 nil
342 pc-select-tty-key-bindings))) 342 pc-select-tty-key-bindings)))
343 343
@@ -346,7 +346,7 @@ but before calling PC Selection mode):
346 346
347 (unless (or pc-select-selection-keys-only 347 (unless (or pc-select-selection-keys-only
348 (eq window-system 'x) 348 (eq window-system 'x)
349 (memq system-name '(ms-dos windows-nt))) 349 (memq system-type '(ms-dos windows-nt)))
350 ;; it is not clear that we need the following line 350 ;; it is not clear that we need the following line
351 ;; I hope it doesn't do too much harm to leave it in, though... 351 ;; I hope it doesn't do too much harm to leave it in, though...
352 (setq pc-select-old-M-delete-binding 352 (setq pc-select-old-M-delete-binding
@@ -355,7 +355,7 @@ but before calling PC Selection mode):
355 355
356 (when (and (not pc-select-selection-keys-only) 356 (when (and (not pc-select-selection-keys-only)
357 (or (eq window-system 'x) 357 (or (eq window-system 'x)
358 (memq system-name '(ms-dos windows-nt))) 358 (memq system-type '(ms-dos windows-nt)))
359 (fboundp 'normal-erase-is-backspace-mode)) 359 (fboundp 'normal-erase-is-backspace-mode))
360 (pc-select-save-and-set-mode normal-erase-is-backspace-mode 1 360 (pc-select-save-and-set-mode normal-erase-is-backspace-mode 1
361 normal-erase-is-backspace)) 361 normal-erase-is-backspace))
@@ -378,13 +378,13 @@ but before calling PC Selection mode):
378 (current-global-map)) 378 (current-global-map))
379 (unless (or pc-select-selection-keys-only 379 (unless (or pc-select-selection-keys-only
380 (eq window-system 'x) 380 (eq window-system 'x)
381 (memq system-name '(ms-dos windows-nt))) 381 (memq system-type '(ms-dos windows-nt)))
382 ;; it is not clear that we need the following line 382 ;; it is not clear that we need the following line
383 ;; I hope it doesn't do too much harm to leave it in, though... 383 ;; I hope it doesn't do too much harm to leave it in, though...
384 (define-key function-key-map [M-delete] [?\M-d])) 384 (define-key function-key-map [M-delete] [?\M-d]))
385 (when (and (not pc-select-selection-keys-only) 385 (when (and (not pc-select-selection-keys-only)
386 (or (eq window-system 'x) 386 (or (eq window-system 'x)
387 (memq system-name '(ms-dos windows-nt))) 387 (memq system-type '(ms-dos windows-nt)))
388 (fboundp 'normal-erase-is-backspace-mode)) 388 (fboundp 'normal-erase-is-backspace-mode))
389 (normal-erase-is-backspace-mode 1)) 389 (normal-erase-is-backspace-mode 1))
390 (setq highlight-nonselected-windows nil) 390 (setq highlight-nonselected-windows nil)
@@ -395,7 +395,7 @@ but before calling PC Selection mode):
395 (when pc-select-key-bindings-alist 395 (when pc-select-key-bindings-alist
396 (when (and (not pc-select-selection-keys-only) 396 (when (and (not pc-select-selection-keys-only)
397 (or (eq window-system 'x) 397 (or (eq window-system 'x)
398 (memq system-name '(ms-dos windows-nt)))) 398 (memq system-type '(ms-dos windows-nt))))
399 (pc-select-restore-mode normal-erase-is-backspace-mode)) 399 (pc-select-restore-mode normal-erase-is-backspace-mode))
400 400
401 (pc-select-restore-keys 401 (pc-select-restore-keys
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 51c87892a9c..c9287586e4e 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -2811,8 +2811,8 @@ The details of what will be saved are regulated by the variable
2811 (delete-region (point-min) (point-max)) 2811 (delete-region (point-min) (point-max))
2812 ;;Store clock 2812 ;;Store clock
2813 (insert (format ";; org-persist.el - %s at %s\n" 2813 (insert (format ";; org-persist.el - %s at %s\n"
2814 system-name (format-time-string 2814 (system-name) (format-time-string
2815 (cdr org-time-stamp-formats)))) 2815 (cdr org-time-stamp-formats))))
2816 (if (and (memq org-clock-persist '(t clock)) 2816 (if (and (memq org-clock-persist '(t clock))
2817 (setq b (org-clocking-buffer)) 2817 (setq b (org-clocking-buffer))
2818 (setq b (or (buffer-base-buffer b) b)) 2818 (setq b (or (buffer-base-buffer b) b))
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
index 41775bdab6d..faf543be1b5 100644
--- a/lisp/org/org-ctags.el
+++ b/lisp/org/org-ctags.el
@@ -63,19 +63,19 @@
63;; with the same name as the link; then, if unsuccessful, ask the user if 63;; with the same name as the link; then, if unsuccessful, ask the user if
64;; he/she wants to rebuild the 'TAGS' database and try again; then ask if 64;; he/she wants to rebuild the 'TAGS' database and try again; then ask if
65;; the user wishes to append 'tag' as a new toplevel heading at the end of 65;; the user wishes to append 'tag' as a new toplevel heading at the end of
66;; the buffer; and finally, defer to org's default behaviour which is to 66;; the buffer; and finally, defer to org's default behavior which is to
67;; search the entire text of the current buffer for 'tag'. 67;; search the entire text of the current buffer for 'tag'.
68;; 68;;
69;; This behaviour can be modified by changing the value of 69;; This behavior can be modified by changing the value of
70;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my 70;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my
71;; .emacs, which describes the same behaviour as the above paragraph with 71;; .emacs, which describes the same behavior as the above paragraph with
72;; one difference: 72;; one difference:
73;; 73;;
74;; (setq org-ctags-open-link-functions 74;; (setq org-ctags-open-link-functions
75;; '(org-ctags-find-tag 75;; '(org-ctags-find-tag
76;; org-ctags-ask-rebuild-tags-file-then-find-tag 76;; org-ctags-ask-rebuild-tags-file-then-find-tag
77;; org-ctags-ask-append-topic 77;; org-ctags-ask-append-topic
78;; org-ctags-fail-silently)) ; <-- prevents org default behaviour 78;; org-ctags-fail-silently)) ; <-- prevents org default behavior
79;; 79;;
80;; 80;;
81;; Usage 81;; Usage
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el
index a3f0b501da6..c952a826db8 100644
--- a/lisp/org/ox-html.el
+++ b/lisp/org/ox-html.el
@@ -581,7 +581,7 @@ The function must accept two parameters:
581The function should return the string to be exported. 581The function should return the string to be exported.
582 582
583For example, the variable could be set to the following function 583For example, the variable could be set to the following function
584in order to mimic default behaviour: 584in order to mimic default behavior:
585 585
586The default value simply returns the value of CONTENTS." 586The default value simply returns the value of CONTENTS."
587 :group 'org-export-html 587 :group 'org-export-html
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index 2c71f7d785a..f6f3b220b43 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -589,7 +589,7 @@ The function must accept six parameters:
589The function should return the string to be exported. 589The function should return the string to be exported.
590 590
591For example, the variable could be set to the following function 591For example, the variable could be set to the following function
592in order to mimic default behaviour: 592in order to mimic default behavior:
593 593
594\(defun org-latex-format-inlinetask \(todo type priority name tags contents\) 594\(defun org-latex-format-inlinetask \(todo type priority name tags contents\)
595\"Format an inline task element for LaTeX export.\" 595\"Format an inline task element for LaTeX export.\"
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index efc70d22a83..b33ba459877 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -228,7 +228,7 @@ If you create a site-map file, adjust the sorting like this:
228 `:sitemap-sort-files' 228 `:sitemap-sort-files'
229 229
230 The site map is normally sorted alphabetically. You can 230 The site map is normally sorted alphabetically. You can
231 change this behaviour setting this to `anti-chronologically', 231 change this behavior setting this to `anti-chronologically',
232 `chronologically', or nil. 232 `chronologically', or nil.
233 233
234 `:sitemap-ignore-case' 234 `:sitemap-ignore-case'
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index 1327ae409ed..2b0978dfdf0 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -493,7 +493,7 @@ t Allow export of math snippets."
493 "The last level which is still exported as a headline. 493 "The last level which is still exported as a headline.
494 494
495Inferior levels will usually produce itemize or enumerate lists 495Inferior levels will usually produce itemize or enumerate lists
496when exported, but back-end behaviour may differ. 496when exported, but back-end behavior may differ.
497 497
498This option can also be set with the OPTIONS keyword, 498This option can also be set with the OPTIONS keyword,
499e.g. \"H:2\"." 499e.g. \"H:2\"."
@@ -1736,13 +1736,13 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
1736 (t 1736 (t
1737 ;; Options in `org-export-options-alist'. 1737 ;; Options in `org-export-options-alist'.
1738 (dolist (property (funcall find-properties key)) 1738 (dolist (property (funcall find-properties key))
1739 (let ((behaviour (nth 4 (assq property options)))) 1739 (let ((behavior (nth 4 (assq property options))))
1740 (setq plist 1740 (setq plist
1741 (plist-put 1741 (plist-put
1742 plist property 1742 plist property
1743 ;; Handle value depending on specified 1743 ;; Handle value depending on specified
1744 ;; BEHAVIOR. 1744 ;; BEHAVIOR.
1745 (case behaviour 1745 (case behavior
1746 (space 1746 (space
1747 (if (not (plist-get plist property)) 1747 (if (not (plist-get plist property))
1748 (org-trim val) 1748 (org-trim val)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index ef619f0899a..c6cab1257a5 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -418,40 +418,19 @@ It can be quoted, or be inside a quoted form."
418 (match-string 0 doc)))) 418 (match-string 0 doc))))
419 419
420(declare-function find-library-name "find-func" (library)) 420(declare-function find-library-name "find-func" (library))
421 421(declare-function find-function-library "find-func" (function &optional l-o v))
422(defvar elisp--identifier-types '(defun defvar feature defface))
423
424(defun elisp--identifier-location (type sym)
425 (pcase (cons type sym)
426 (`(defun . ,(pred fboundp))
427 (find-definition-noselect sym nil))
428 (`(defvar . ,(pred boundp))
429 (find-definition-noselect sym 'defvar))
430 (`(defface . ,(pred facep))
431 (find-definition-noselect sym 'defface))
432 (`(feature . ,(pred featurep))
433 (require 'find-func)
434 (cons (find-file-noselect (find-library-name
435 (symbol-name sym)))
436 1))))
437 422
438(defun elisp--company-location (str) 423(defun elisp--company-location (str)
439 (catch 'res 424 (let ((sym (intern-soft str)))
440 (let ((sym (intern-soft str))) 425 (cond
441 (when sym 426 ((fboundp sym) (find-definition-noselect sym nil))
442 (dolist (type elisp--identifier-types) 427 ((boundp sym) (find-definition-noselect sym 'defvar))
443 (let ((loc (elisp--identifier-location type sym))) 428 ((featurep sym)
444 (and loc (throw 'res loc)))))))) 429 (require 'find-func)
445 430 (cons (find-file-noselect (find-library-name
446(defvar elisp--identifier-completion-table 431 (symbol-name sym)))
447 (apply-partially #'completion-table-with-predicate 432 0))
448 obarray 433 ((facep sym) (find-definition-noselect sym 'defface)))))
449 (lambda (sym)
450 (or (boundp sym)
451 (fboundp sym)
452 (featurep sym)
453 (symbol-plist sym)))
454 'strict))
455 434
456(defun elisp-completion-at-point () 435(defun elisp-completion-at-point ()
457 "Function used for `completion-at-point-functions' in `emacs-lisp-mode'." 436 "Function used for `completion-at-point-functions' in `emacs-lisp-mode'."
@@ -493,8 +472,13 @@ It can be quoted, or be inside a quoted form."
493 :company-docsig #'elisp--company-doc-string 472 :company-docsig #'elisp--company-doc-string
494 :company-location #'elisp--company-location)) 473 :company-location #'elisp--company-location))
495 ((elisp--form-quoted-p beg) 474 ((elisp--form-quoted-p beg)
496 ;; Don't include all symbols (bug#16646). 475 (list nil obarray
497 (list nil elisp--identifier-completion-table 476 ;; Don't include all symbols (bug#16646).
477 :predicate (lambda (sym)
478 (or (boundp sym)
479 (fboundp sym)
480 (featurep sym)
481 (symbol-plist sym)))
498 :annotation-function 482 :annotation-function
499 (lambda (str) (if (fboundp (intern-soft str)) " <f>")) 483 (lambda (str) (if (fboundp (intern-soft str)) " <f>"))
500 :company-doc-buffer #'elisp--company-doc-buffer 484 :company-doc-buffer #'elisp--company-doc-buffer
@@ -572,11 +556,12 @@ It can be quoted, or be inside a quoted form."
572 556
573;;; Xref backend 557;;; Xref backend
574 558
575(declare-function xref-make-buffer-location "xref" (buffer position)) 559(declare-function xref-make-elisp-location "xref" (symbol type file))
576(declare-function xref-make-bogus-location "xref" (message)) 560(declare-function xref-make-bogus-location "xref" (message))
577(declare-function xref-make "xref" (description location)) 561(declare-function xref-make "xref" (description location))
578 562
579(defun elisp-xref-find (action id) 563(defun elisp-xref-find (action id)
564 (require 'find-func)
580 (pcase action 565 (pcase action
581 (`definitions 566 (`definitions
582 (let ((sym (intern-soft id))) 567 (let ((sym (intern-soft id)))
@@ -585,16 +570,34 @@ It can be quoted, or be inside a quoted form."
585 (`apropos 570 (`apropos
586 (elisp--xref-find-apropos id)))) 571 (elisp--xref-find-apropos id))))
587 572
573(defun elisp--xref-identifier-location (type sym)
574 (let ((file
575 (pcase type
576 (`defun (when (fboundp sym)
577 (let ((fun-lib
578 (find-function-library sym)))
579 (setq sym (car fun-lib))
580 (cdr fun-lib))))
581 (`defvar (when (boundp sym)
582 (or (symbol-file sym 'defvar)
583 (help-C-file-name sym 'var))))
584 (`feature (when (featurep sym)
585 (ignore-errors
586 (find-library-name (symbol-name sym)))))
587 (`defface (when (facep sym)
588 (symbol-file sym 'defface))))))
589 (when file
590 (when (string-match-p "\\.elc\\'" file)
591 (setq file (substring file 0 -1)))
592 (xref-make-elisp-location sym type file))))
593
588(defun elisp--xref-find-definitions (symbol) 594(defun elisp--xref-find-definitions (symbol)
589 (save-excursion 595 (save-excursion
590 (let (lst) 596 (let (lst)
591 (dolist (type elisp--identifier-types) 597 (dolist (type '(feature defface defvar defun))
592 (let ((loc 598 (let ((loc
593 (condition-case err 599 (condition-case err
594 (let ((buf-pos (elisp--identifier-location type symbol))) 600 (elisp--xref-identifier-location type symbol)
595 (when buf-pos
596 (xref-make-buffer-location (car buf-pos)
597 (or (cdr buf-pos) 1))))
598 (error 601 (error
599 (xref-make-bogus-location (error-message-string err)))))) 602 (xref-make-bogus-location (error-message-string err))))))
600 (when loc 603 (when loc
@@ -611,8 +614,18 @@ It can be quoted, or be inside a quoted form."
611 (push (elisp--xref-find-definitions sym) lst)) 614 (push (elisp--xref-find-definitions sym) lst))
612 (nreverse lst)))) 615 (nreverse lst))))
613 616
617(defvar elisp--xref-identifier-completion-table
618 (apply-partially #'completion-table-with-predicate
619 obarray
620 (lambda (sym)
621 (or (boundp sym)
622 (fboundp sym)
623 (featurep sym)
624 (facep sym)))
625 'strict))
626
614(defun elisp--xref-identifier-completion-table () 627(defun elisp--xref-identifier-completion-table ()
615 elisp--identifier-completion-table) 628 elisp--xref-identifier-completion-table)
616 629
617;;; Elisp Interaction mode 630;;; Elisp Interaction mode
618 631
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 0be99794356..be0dabf17b2 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -975,6 +975,7 @@ onto a ring and may be popped back to with \\[pop-tag-mark].
975Contrast this with the ring of marks gone to by the command. 975Contrast this with the ring of marks gone to by the command.
976 976
977See documentation of variable `tags-file-name'." 977See documentation of variable `tags-file-name'."
978 (declare (obsolete xref-find-definitions-other-window "25.1"))
978 (interactive (find-tag-interactive "Find tag other window: ")) 979 (interactive (find-tag-interactive "Find tag other window: "))
979 980
980 ;; This hair is to deal with the case where the tag is found in the 981 ;; This hair is to deal with the case where the tag is found in the
@@ -1015,6 +1016,7 @@ onto a ring and may be popped back to with \\[pop-tag-mark].
1015Contrast this with the ring of marks gone to by the command. 1016Contrast this with the ring of marks gone to by the command.
1016 1017
1017See documentation of variable `tags-file-name'." 1018See documentation of variable `tags-file-name'."
1019 (declare (obsolete xref-find-definitions-other-frame "25.1"))
1018 (interactive (find-tag-interactive "Find tag other frame: ")) 1020 (interactive (find-tag-interactive "Find tag other frame: "))
1019 (let ((pop-up-frames t)) 1021 (let ((pop-up-frames t))
1020 (find-tag-other-window tagname next-p))) 1022 (find-tag-other-window tagname next-p)))
@@ -1037,6 +1039,7 @@ onto a ring and may be popped back to with \\[pop-tag-mark].
1037Contrast this with the ring of marks gone to by the command. 1039Contrast this with the ring of marks gone to by the command.
1038 1040
1039See documentation of variable `tags-file-name'." 1041See documentation of variable `tags-file-name'."
1042 (declare (obsolete xref-find-apropos "25.1"))
1040 (interactive (find-tag-interactive "Find tag regexp: " t)) 1043 (interactive (find-tag-interactive "Find tag regexp: " t))
1041 ;; We go through find-tag-other-window to do all the display hair there. 1044 ;; We go through find-tag-other-window to do all the display hair there.
1042 (funcall (if other-window 'find-tag-other-window 'find-tag) 1045 (funcall (if other-window 'find-tag-other-window 'find-tag)
@@ -1786,6 +1789,7 @@ Two variables control the processing we do on each file: the value of
1786interesting (it returns non-nil if so) and `tags-loop-operate' is a form to 1789interesting (it returns non-nil if so) and `tags-loop-operate' is a form to
1787evaluate to operate on an interesting file. If the latter evaluates to 1790evaluate to operate on an interesting file. If the latter evaluates to
1788nil, we exit; otherwise we scan the next file." 1791nil, we exit; otherwise we scan the next file."
1792 (declare (obsolete "use `xref-find-definitions' interface instead." "25.1"))
1789 (interactive) 1793 (interactive)
1790 (let (new 1794 (let (new
1791 ;; Non-nil means we have finished one file 1795 ;; Non-nil means we have finished one file
@@ -1929,6 +1933,7 @@ directory specification."
1929;;;###autoload 1933;;;###autoload
1930(defun tags-apropos (regexp) 1934(defun tags-apropos (regexp)
1931 "Display list of all tags in tags table REGEXP matches." 1935 "Display list of all tags in tags table REGEXP matches."
1936 (declare (obsolete xref-find-apropos "25.1"))
1932 (interactive "sTags apropos (regexp): ") 1937 (interactive "sTags apropos (regexp): ")
1933 (with-output-to-temp-buffer "*Tags List*" 1938 (with-output-to-temp-buffer "*Tags List*"
1934 (princ "Click mouse-2 to follow tags.\n\nTags matching regexp `") 1939 (princ "Click mouse-2 to follow tags.\n\nTags matching regexp `")
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 45074d338d3..f6a9440610e 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1673,7 +1673,7 @@ This performs fontification according to `js--class-styles'."
1673 ;; We can probably just add +, -, !, <, >, %, ^, ~, |, &, ?, : at which 1673 ;; We can probably just add +, -, !, <, >, %, ^, ~, |, &, ?, : at which
1674 ;; point I think only * and / would be missing which could also be added, 1674 ;; point I think only * and / would be missing which could also be added,
1675 ;; but need care to avoid affecting the // and */ comment markers. 1675 ;; but need care to avoid affecting the // and */ comment markers.
1676 ("\\(?:^\\|[=([{,:;]\\)\\(?:[ \t]\\)*\\(/\\)[^/*]" 1676 ("\\(?:^\\|[=([{,:;]\\|\\_<return\\_>\\)\\(?:[ \t]\\)*\\(/\\)[^/*]"
1677 (1 (ignore 1677 (1 (ignore
1678 (forward-char -1) 1678 (forward-char -1)
1679 (when (or (not (memq (char-after (match-beginning 0)) '(?\s ?\t))) 1679 (when (or (not (memq (char-after (match-beginning 0)) '(?\s ?\t)))
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 35e24e14e1c..c46c5d68019 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -69,7 +69,7 @@
69;; Besides that only the standard CPython (2.x and 3.x) shell and 69;; Besides that only the standard CPython (2.x and 3.x) shell and
70;; IPython are officially supported out of the box, the interaction 70;; IPython are officially supported out of the box, the interaction
71;; should support any other readline based Python shells as well 71;; should support any other readline based Python shells as well
72;; (e.g. Jython and Pypy have been reported to work). You can change 72;; (e.g. Jython and PyPy have been reported to work). You can change
73;; your default interpreter and commandline arguments by setting the 73;; your default interpreter and commandline arguments by setting the
74;; `python-shell-interpreter' and `python-shell-interpreter-args' 74;; `python-shell-interpreter' and `python-shell-interpreter-args'
75;; variables. This example enables IPython globally: 75;; variables. This example enables IPython globally:
@@ -119,18 +119,24 @@
119;; modify its behavior. 119;; modify its behavior.
120 120
121;; Shell completion: hitting tab will try to complete the current 121;; Shell completion: hitting tab will try to complete the current
122;; word. Shell completion is implemented in such way that if you 122;; word. The two built-in mechanisms depend on Python's readline
123;; change the `python-shell-interpreter' it should be possible to 123;; module: the "native" completion is tried first and is activated
124;; integrate custom logic to calculate completions. To achieve this 124;; when `python-shell-completion-native-enable' is non-nil, the
125;; you just need to set `python-shell-completion-setup-code' and 125;; current `python-shell-interpreter' is not a member of the
126;; `python-shell-completion-string-code'. The default provided code, 126;; `python-shell-completion-native-disabled-interpreters' variable and
127;; enables autocompletion for both CPython and IPython (and ideally 127;; `python-shell-completion-native-setup' succeeds; the "fallback" or
128;; any readline based Python shell). This code depends on the 128;; "legacy" mechanism works by executing Python code in the background
129;; readline module, so if you are using some Operating System that 129;; and enables auto-completion for shells that do not support
130;; bundles Python without it (like Windows), installing pyreadline 130;; receiving escape sequences (with some limitations, i.e. completion
131;; from URL `http://ipython.scipy.org/moin/PyReadline/Intro' should 131;; in blocks does not work). The code executed for the "fallback"
132;; suffice. To troubleshoot why you are not getting any completions 132;; completion can be found in `python-shell-completion-setup-code' and
133;; you can try the following in your Python shell: 133;; `python-shell-completion-string-code' variables. Their default
134;; values enable completion for both CPython and IPython, and probably
135;; any readline based shell (it's known to work with PyPy). If your
136;; Python installation lacks readline (like CPython for Windows),
137;; installing pyreadline (URL `http://ipython.org/pyreadline.html')
138;; should suffice. To troubleshoot why you are not getting any
139;; completions, you can try the following in your Python shell:
134 140
135;; >>> import readline, rlcompleter 141;; >>> import readline, rlcompleter
136 142
@@ -256,6 +262,7 @@
256(defvar outline-heading-end-regexp) 262(defvar outline-heading-end-regexp)
257 263
258(autoload 'comint-mode "comint") 264(autoload 'comint-mode "comint")
265(autoload 'help-function-arglist "help-fns")
259 266
260;;;###autoload 267;;;###autoload
261(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) 268(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode))
@@ -395,7 +402,18 @@
395 (* ?\\ ?\\) (any ?\' ?\"))) 402 (* ?\\ ?\\) (any ?\' ?\")))
396 (* ?\\ ?\\) 403 (* ?\\ ?\\)
397 ;; Match single or triple quotes of any kind. 404 ;; Match single or triple quotes of any kind.
398 (group (or "\"" "\"\"\"" "'" "'''")))))) 405 (group (or "\"" "\"\"\"" "'" "'''")))))
406 (coding-cookie . ,(rx line-start ?# (* space)
407 (or
408 ;; # coding=<encoding name>
409 (: "coding" (or ?: ?=) (* space) (group-n 1 (+ (or word ?-))))
410 ;; # -*- coding: <encoding name> -*-
411 (: "-*-" (* space) "coding:" (* space)
412 (group-n 1 (+ (or word ?-))) (* space) "-*-")
413 ;; # vim: set fileencoding=<encoding name> :
414 (: "vim:" (* space) "set" (+ space)
415 "fileencoding" (* space) ?= (* space)
416 (group-n 1 (+ (or word ?-))) (* space) ":")))))
399 "Additional Python specific sexps for `python-rx'") 417 "Additional Python specific sexps for `python-rx'")
400 418
401 (defmacro python-rx (&rest regexps) 419 (defmacro python-rx (&rest regexps)
@@ -1206,12 +1224,18 @@ the line will be re-indented automatically if needed."
1206 (eolp) 1224 (eolp)
1207 ;; Avoid re-indenting on extra colon 1225 ;; Avoid re-indenting on extra colon
1208 (not (equal ?: (char-before (1- (point))))) 1226 (not (equal ?: (char-before (1- (point)))))
1209 (not (python-syntax-comment-or-string-p)) 1227 (not (python-syntax-comment-or-string-p)))
1210 ;; Never re-indent at beginning of defun 1228 ;; Just re-indent dedenters
1211 (not (save-excursion 1229 (let ((dedenter-pos (python-info-dedenter-statement-p))
1212 (python-nav-beginning-of-statement) 1230 (current-pos (point)))
1213 (python-info-looking-at-beginning-of-defun)))) 1231 (when dedenter-pos
1214 (python-indent-line))))) 1232 (save-excursion
1233 (goto-char dedenter-pos)
1234 (python-indent-line)
1235 (unless (= (line-number-at-pos dedenter-pos)
1236 (line-number-at-pos current-pos))
1237 ;; Reindent region if this is a multiline statement
1238 (python-indent-region dedenter-pos current-pos)))))))))
1215 1239
1216 1240
1217;;; Navigation 1241;;; Navigation
@@ -2087,36 +2111,18 @@ and `python-shell-output-prompt-regexp' using the values from
2087 2111
2088(defun python-shell-get-process-name (dedicated) 2112(defun python-shell-get-process-name (dedicated)
2089 "Calculate the appropriate process name for inferior Python process. 2113 "Calculate the appropriate process name for inferior Python process.
2090If DEDICATED is t and the variable `buffer-file-name' is non-nil 2114If DEDICATED is t returns a string with the form
2091returns a string with the form 2115`python-shell-buffer-name'[`buffer-name'] else returns the value
2092`python-shell-buffer-name'[variable `buffer-file-name'] else 2116of `python-shell-buffer-name'."
2093returns the value of `python-shell-buffer-name'." 2117 (if dedicated
2094 (let ((process-name 2118 (format "%s[%s]" python-shell-buffer-name (buffer-name))
2095 (if (and dedicated 2119 python-shell-buffer-name))
2096 buffer-file-name)
2097 (format "%s[%s]" python-shell-buffer-name buffer-file-name)
2098 (format "%s" python-shell-buffer-name))))
2099 process-name))
2100 2120
2101(defun python-shell-internal-get-process-name () 2121(defun python-shell-internal-get-process-name ()
2102 "Calculate the appropriate process name for Internal Python process. 2122 "Calculate the appropriate process name for Internal Python process.
2103The name is calculated from `python-shell-global-buffer-name' and 2123The name is calculated from `python-shell-global-buffer-name' and
2104a hash of all relevant global shell settings in order to ensure 2124the `buffer-name'."
2105uniqueness for different types of configurations." 2125 (format "%s[%s]" python-shell-internal-buffer-name (buffer-name)))
2106 (format "%s [%s]"
2107 python-shell-internal-buffer-name
2108 (md5
2109 (concat
2110 python-shell-interpreter
2111 python-shell-interpreter-args
2112 python-shell--prompt-calculated-input-regexp
2113 python-shell--prompt-calculated-output-regexp
2114 (mapconcat #'symbol-value python-shell-setup-codes "")
2115 (mapconcat #'identity python-shell-process-environment "")
2116 (mapconcat #'identity python-shell-extra-pythonpaths "")
2117 (mapconcat #'identity python-shell-exec-path "")
2118 (or python-shell-virtualenv-root "")
2119 (mapconcat #'identity python-shell-exec-path "")))))
2120 2126
2121(defun python-shell-calculate-command () 2127(defun python-shell-calculate-command ()
2122 "Calculate the string used to execute the inferior Python process." 2128 "Calculate the string used to execute the inferior Python process."
@@ -2256,11 +2262,9 @@ Avoids `recenter' calls until OUTPUT is completely sent."
2256 "Execute the forms in BODY with the shell buffer temporarily current. 2262 "Execute the forms in BODY with the shell buffer temporarily current.
2257Signals an error if no shell buffer is available for current buffer." 2263Signals an error if no shell buffer is available for current buffer."
2258 (declare (indent 0) (debug t)) 2264 (declare (indent 0) (debug t))
2259 (let ((shell-buffer (make-symbol "shell-buffer"))) 2265 (let ((shell-process (make-symbol "shell-process")))
2260 `(let ((,shell-buffer (python-shell-get-buffer))) 2266 `(let ((,shell-process (python-shell-get-process-or-error)))
2261 (when (not ,shell-buffer) 2267 (with-current-buffer (process-buffer ,shell-process)
2262 (error "No inferior Python buffer available."))
2263 (with-current-buffer ,shell-buffer
2264 ,@body)))) 2268 ,@body))))
2265 2269
2266(defvar python-shell--font-lock-buffer nil) 2270(defvar python-shell--font-lock-buffer nil)
@@ -2472,12 +2476,12 @@ variable.
2472 (python-shell-accept-process-output 2476 (python-shell-accept-process-output
2473 (get-buffer-process (current-buffer)))) 2477 (get-buffer-process (current-buffer))))
2474 2478
2475(defun python-shell-make-comint (cmd proc-name &optional pop internal) 2479(defun python-shell-make-comint (cmd proc-name &optional show internal)
2476 "Create a Python shell comint buffer. 2480 "Create a Python shell comint buffer.
2477CMD is the Python command to be executed and PROC-NAME is the 2481CMD is the Python command to be executed and PROC-NAME is the
2478process name the comint buffer will get. After the comint buffer 2482process name the comint buffer will get. After the comint buffer
2479is created the `inferior-python-mode' is activated. When 2483is created the `inferior-python-mode' is activated. When
2480optional argument POP is non-nil the buffer is shown. When 2484optional argument SHOW is non-nil the buffer is shown. When
2481optional argument INTERNAL is non-nil this process is run on a 2485optional argument INTERNAL is non-nil this process is run on a
2482buffer with a name that starts with a space, following the Emacs 2486buffer with a name that starts with a space, following the Emacs
2483convention for temporary/internal buffers, and also makes sure 2487convention for temporary/internal buffers, and also makes sure
@@ -2506,16 +2510,13 @@ killed."
2506 (mapconcat #'identity args " "))) 2510 (mapconcat #'identity args " ")))
2507 (with-current-buffer buffer 2511 (with-current-buffer buffer
2508 (inferior-python-mode)) 2512 (inferior-python-mode))
2509 (and pop (pop-to-buffer buffer t)) 2513 (when show (display-buffer buffer))
2510 (and internal (set-process-query-on-exit-flag process nil)))) 2514 (and internal (set-process-query-on-exit-flag process nil))))
2511 proc-buffer-name))) 2515 proc-buffer-name)))
2512 2516
2513;;;###autoload 2517;;;###autoload
2514(defun run-python (&optional cmd dedicated show) 2518(defun run-python (&optional cmd dedicated show)
2515 "Run an inferior Python process. 2519 "Run an inferior Python process.
2516Input and output via buffer named after
2517`python-shell-buffer-name'. If there is a process already
2518running in that buffer, just switch to it.
2519 2520
2520Argument CMD defaults to `python-shell-calculate-command' return 2521Argument CMD defaults to `python-shell-calculate-command' return
2521value. When called interactively with `prefix-arg', it allows 2522value. When called interactively with `prefix-arg', it allows
@@ -2523,6 +2524,11 @@ the user to edit such value and choose whether the interpreter
2523should be DEDICATED for the current buffer. When numeric prefix 2524should be DEDICATED for the current buffer. When numeric prefix
2524arg is other than 0 or 4 do not SHOW. 2525arg is other than 0 or 4 do not SHOW.
2525 2526
2527For a given buffer and same values of DEDICATED, if a process is
2528already running for it, it will do nothing. This means that if
2529the current buffer is using a global process, the user is still
2530able to switch it to use a dedicated one.
2531
2526Runs the hook `inferior-python-mode-hook' after 2532Runs the hook `inferior-python-mode-hook' after
2527`comint-mode-hook' is run. (Type \\[describe-mode] in the 2533`comint-mode-hook' is run. (Type \\[describe-mode] in the
2528process buffer for a list of commands.)" 2534process buffer for a list of commands.)"
@@ -2533,10 +2539,10 @@ process buffer for a list of commands.)"
2533 (y-or-n-p "Make dedicated process? ") 2539 (y-or-n-p "Make dedicated process? ")
2534 (= (prefix-numeric-value current-prefix-arg) 4)) 2540 (= (prefix-numeric-value current-prefix-arg) 4))
2535 (list (python-shell-calculate-command) nil t))) 2541 (list (python-shell-calculate-command) nil t)))
2536 (python-shell-make-comint 2542 (get-buffer-process
2537 (or cmd (python-shell-calculate-command)) 2543 (python-shell-make-comint
2538 (python-shell-get-process-name dedicated) show) 2544 (or cmd (python-shell-calculate-command))
2539 dedicated) 2545 (python-shell-get-process-name dedicated) show)))
2540 2546
2541(defun run-python-internal () 2547(defun run-python-internal ()
2542 "Run an inferior Internal Python process. 2548 "Run an inferior Internal Python process.
@@ -2579,6 +2585,21 @@ If current buffer is in `inferior-python-mode', return it."
2579 "Return inferior Python process for current buffer." 2585 "Return inferior Python process for current buffer."
2580 (get-buffer-process (python-shell-get-buffer))) 2586 (get-buffer-process (python-shell-get-buffer)))
2581 2587
2588(defun python-shell-get-process-or-error (&optional interactivep)
2589 "Return inferior Python process for current buffer or signal error.
2590When argument INTERACTIVEP is non-nil, use `user-error' instead
2591of `error' with a user-friendly message."
2592 (or (python-shell-get-process)
2593 (if interactivep
2594 (user-error
2595 "Start a Python process first with `M-x run-python' or `%s'."
2596 ;; Get the binding.
2597 (key-description
2598 (where-is-internal
2599 #'run-python overriding-local-map t)))
2600 (error
2601 "No inferior Python process running."))))
2602
2582(defun python-shell-get-or-create-process (&optional cmd dedicated show) 2603(defun python-shell-get-or-create-process (&optional cmd dedicated show)
2583 "Get or create an inferior Python process for current buffer and return it. 2604 "Get or create an inferior Python process for current buffer and return it.
2584Arguments CMD, DEDICATED and SHOW are those of `run-python' and 2605Arguments CMD, DEDICATED and SHOW are those of `run-python' and
@@ -2594,6 +2615,11 @@ be asked for their values."
2594 (run-python cmd dedicated show))) 2615 (run-python cmd dedicated show)))
2595 (or shell-process (python-shell-get-process)))) 2616 (or shell-process (python-shell-get-process))))
2596 2617
2618(make-obsolete
2619 #'python-shell-get-or-create-process
2620 "Instead call `python-shell-get-process' and create one if returns nil."
2621 "25.1")
2622
2597(defvar python-shell-internal-buffer nil 2623(defvar python-shell-internal-buffer nil
2598 "Current internal shell buffer for the current buffer. 2624 "Current internal shell buffer for the current buffer.
2599This is really not necessary at all for the code to work but it's 2625This is really not necessary at all for the code to work but it's
@@ -2606,12 +2632,10 @@ there for compatibility with CEDET.")
2606 2632
2607(defun python-shell-internal-get-or-create-process () 2633(defun python-shell-internal-get-or-create-process ()
2608 "Get or create an inferior Internal Python process." 2634 "Get or create an inferior Internal Python process."
2609 (let* ((proc-name (python-shell-internal-get-process-name)) 2635 (let ((proc-name (python-shell-internal-get-process-name)))
2610 (proc-buffer-name (format " *%s*" proc-name))) 2636 (if (process-live-p proc-name)
2611 (when (not (process-live-p proc-name)) 2637 (get-process proc-name)
2612 (run-python-internal) 2638 (run-python-internal))))
2613 (setq python-shell-internal-buffer proc-buffer-name))
2614 (get-buffer-process proc-buffer-name)))
2615 2639
2616(define-obsolete-function-alias 2640(define-obsolete-function-alias
2617 'python-proc 'python-shell-internal-get-or-create-process "24.3") 2641 'python-proc 'python-shell-internal-get-or-create-process "24.3")
@@ -2628,20 +2652,24 @@ there for compatibility with CEDET.")
2628 (concat (file-remote-p default-directory) "/tmp") 2652 (concat (file-remote-p default-directory) "/tmp")
2629 temporary-file-directory)) 2653 temporary-file-directory))
2630 (temp-file-name (make-temp-file "py")) 2654 (temp-file-name (make-temp-file "py"))
2631 (coding-system-for-write 'utf-8)) 2655 (coding-system-for-write (python-info-encoding)))
2632 (with-temp-file temp-file-name 2656 (with-temp-file temp-file-name
2633 (insert "# -*- coding: utf-8 -*-\n") ;Not needed for Python-3.
2634 (insert string) 2657 (insert string)
2635 (delete-trailing-whitespace)) 2658 (delete-trailing-whitespace))
2636 temp-file-name)) 2659 temp-file-name))
2637 2660
2638(defun python-shell-send-string (string &optional process) 2661(defun python-shell-send-string (string &optional process msg)
2639 "Send STRING to inferior Python PROCESS." 2662 "Send STRING to inferior Python PROCESS.
2640 (interactive "sPython command: ") 2663When optional argument MSG is non-nil, forces display of a
2641 (let ((process (or process (python-shell-get-or-create-process)))) 2664user-friendly message if there's no process running; defaults to
2665t when called interactively."
2666 (interactive
2667 (list (read-string "Python command: ") nil t))
2668 (let ((process (or process (python-shell-get-process-or-error msg))))
2642 (if (string-match ".\n+." string) ;Multiline. 2669 (if (string-match ".\n+." string) ;Multiline.
2643 (let* ((temp-file-name (python-shell--save-temp-file string))) 2670 (let* ((temp-file-name (python-shell--save-temp-file string))
2644 (python-shell-send-file temp-file-name process temp-file-name t)) 2671 (file-name (or (buffer-file-name) temp-file-name)))
2672 (python-shell-send-file file-name process temp-file-name t))
2645 (comint-send-string process string) 2673 (comint-send-string process string)
2646 (when (or (not (string-match "\n\\'" string)) 2674 (when (or (not (string-match "\n\\'" string))
2647 (string-match "\n[ \t].*\n?\\'" string)) 2675 (string-match "\n[ \t].*\n?\\'" string))
@@ -2680,7 +2708,7 @@ detecting a prompt at the end of the buffer."
2680(defun python-shell-send-string-no-output (string &optional process) 2708(defun python-shell-send-string-no-output (string &optional process)
2681 "Send STRING to PROCESS and inhibit output. 2709 "Send STRING to PROCESS and inhibit output.
2682Return the output." 2710Return the output."
2683 (let ((process (or process (python-shell-get-or-create-process))) 2711 (let ((process (or process (python-shell-get-process-or-error)))
2684 (comint-preoutput-filter-functions 2712 (comint-preoutput-filter-functions
2685 '(python-shell-output-filter)) 2713 '(python-shell-output-filter))
2686 (python-shell-output-filter-in-progress t) 2714 (python-shell-output-filter-in-progress t)
@@ -2717,12 +2745,6 @@ Returns the output. See `python-shell-send-string-no-output'."
2717(define-obsolete-function-alias 2745(define-obsolete-function-alias
2718 'python-send-string 'python-shell-internal-send-string "24.3") 2746 'python-send-string 'python-shell-internal-send-string "24.3")
2719 2747
2720(defvar python--use-fake-loc nil
2721 "If non-nil, use `compilation-fake-loc' to trace errors back to the buffer.
2722If nil, regions of text are prepended by the corresponding number of empty
2723lines and Python is told to output error messages referring to the whole
2724source file.")
2725
2726(defun python-shell-buffer-substring (start end &optional nomain) 2748(defun python-shell-buffer-substring (start end &optional nomain)
2727 "Send buffer substring from START to END formatted for shell. 2749 "Send buffer substring from START to END formatted for shell.
2728This is a wrapper over `buffer-substring' that takes care of 2750This is a wrapper over `buffer-substring' that takes care of
@@ -2732,27 +2754,32 @@ the python shell:
2732 \"if __name__ == '__main__'\" block will be removed. 2754 \"if __name__ == '__main__'\" block will be removed.
2733 2. When a subregion of the buffer is sent, it takes care of 2755 2. When a subregion of the buffer is sent, it takes care of
2734 appending extra empty lines so tracebacks are correct. 2756 appending extra empty lines so tracebacks are correct.
2735 3. Wraps indented regions under an \"if True:\" block so the 2757 3. When the region sent is a substring of the current buffer, a
2758 coding cookie is added.
2759 4. Wraps indented regions under an \"if True:\" block so the
2736 interpreter evaluates them correctly." 2760 interpreter evaluates them correctly."
2737 (let ((substring (buffer-substring-no-properties start end)) 2761 (let* ((substring (buffer-substring-no-properties start end))
2738 (fillstr (unless python--use-fake-loc 2762 (starts-at-point-min-p (save-restriction
2739 (make-string (1- (line-number-at-pos start)) ?\n))) 2763 (widen)
2740 (toplevel-block-p (save-excursion 2764 (= (point-min) start)))
2741 (goto-char start) 2765 (encoding (python-info-encoding))
2742 (or (zerop (line-number-at-pos start)) 2766 (fillstr (when (not starts-at-point-min-p)
2743 (progn 2767 (concat
2744 (python-util-forward-comment 1) 2768 (format "# -*- coding: %s -*-\n" encoding)
2745 (zerop (current-indentation))))))) 2769 (make-string
2770 ;; Substract 2 because of the coding cookie.
2771 (- (line-number-at-pos start) 2) ?\n))))
2772 (toplevel-block-p (save-excursion
2773 (goto-char start)
2774 (or (zerop (line-number-at-pos start))
2775 (progn
2776 (python-util-forward-comment 1)
2777 (zerop (current-indentation)))))))
2746 (with-temp-buffer 2778 (with-temp-buffer
2747 (python-mode) 2779 (python-mode)
2748 (if fillstr (insert fillstr)) 2780 (if fillstr (insert fillstr))
2749 (insert substring) 2781 (insert substring)
2750 (goto-char (point-min)) 2782 (goto-char (point-min))
2751 (unless python--use-fake-loc
2752 ;; python-shell--save-temp-file adds an extra coding line, which would
2753 ;; throw off the line-counts, so let's try to compensate here.
2754 (if (looking-at "[ \t]*[#\n]")
2755 (delete-region (point) (line-beginning-position 2))))
2756 (when (not toplevel-block-p) 2783 (when (not toplevel-block-p)
2757 (insert "if True:") 2784 (insert "if True:")
2758 (delete-region (point) (line-end-position))) 2785 (delete-region (point) (line-end-position)))
@@ -2763,53 +2790,65 @@ the python shell:
2763 (when (python-nav-if-name-main) 2790 (when (python-nav-if-name-main)
2764 (cons (point) 2791 (cons (point)
2765 (progn (python-nav-forward-sexp-safe) 2792 (progn (python-nav-forward-sexp-safe)
2793 ;; Include ending newline
2794 (forward-line 1)
2766 (point))))))) 2795 (point)))))))
2767 ;; Oh destructuring bind, how I miss you. 2796 ;; Oh destructuring bind, how I miss you.
2768 (if-name-main-start (car if-name-main-start-end)) 2797 (if-name-main-start (car if-name-main-start-end))
2769 (if-name-main-end (cdr if-name-main-start-end))) 2798 (if-name-main-end (cdr if-name-main-start-end))
2799 (fillstr (make-string
2800 (- (line-number-at-pos if-name-main-end)
2801 (line-number-at-pos if-name-main-start)) ?\n)))
2770 (when if-name-main-start-end 2802 (when if-name-main-start-end
2771 (goto-char if-name-main-start) 2803 (goto-char if-name-main-start)
2772 (delete-region if-name-main-start if-name-main-end) 2804 (delete-region if-name-main-start if-name-main-end)
2773 (insert 2805 (insert fillstr))))
2774 (make-string 2806 ;; Ensure there's only one coding cookie in the generated string.
2775 (- (line-number-at-pos if-name-main-end) 2807 (goto-char (point-min))
2776 (line-number-at-pos if-name-main-start)) ?\n))))) 2808 (when (looking-at-p (python-rx coding-cookie))
2809 (forward-line 1)
2810 (when (looking-at-p (python-rx coding-cookie))
2811 (delete-region
2812 (line-beginning-position) (line-end-position))))
2777 (buffer-substring-no-properties (point-min) (point-max))))) 2813 (buffer-substring-no-properties (point-min) (point-max)))))
2778 2814
2779(declare-function compilation-fake-loc "compile" 2815(defun python-shell-send-region (start end &optional send-main msg)
2780 (marker file &optional line col)) 2816 "Send the region delimited by START and END to inferior Python process.
2781 2817When optional argument SEND-MAIN is non-nil, allow execution of
2782(defun python-shell-send-region (start end &optional nomain) 2818code inside blocks delimited by \"if __name__== '__main__':\".
2783 "Send the region delimited by START and END to inferior Python process." 2819When called interactively SEND-MAIN defaults to nil, unless it's
2784 (interactive "r") 2820called with prefix argument. When optional argument MSG is
2785 (let* ((python--use-fake-loc 2821non-nil, forces display of a user-friendly message if there's no
2786 (or python--use-fake-loc (not buffer-file-name))) 2822process running; defaults to t when called interactively."
2787 (string (python-shell-buffer-substring start end nomain)) 2823 (interactive
2788 (process (python-shell-get-or-create-process)) 2824 (list (region-beginning) (region-end) current-prefix-arg t))
2789 (_ (string-match "\\`\n*\\(.*\\)" string))) 2825 (let* ((string (python-shell-buffer-substring start end (not send-main)))
2790 (message "Sent: %s..." (match-string 1 string)) 2826 (process (python-shell-get-process-or-error msg))
2791 (let* ((temp-file-name (python-shell--save-temp-file string)) 2827 (original-string (buffer-substring-no-properties start end))
2792 (file-name (or (buffer-file-name) temp-file-name))) 2828 (_ (string-match "\\`\n*\\(.*\\)" original-string)))
2793 (python-shell-send-file file-name process temp-file-name t) 2829 (message "Sent: %s..." (match-string 1 original-string))
2794 (unless python--use-fake-loc 2830 (python-shell-send-string string process)))
2795 (with-current-buffer (process-buffer process) 2831
2796 (compilation-fake-loc (copy-marker start) temp-file-name 2832(defun python-shell-send-buffer (&optional send-main msg)
2797 2)) ;; Not 1, because of the added coding line.
2798 ))))
2799
2800(defun python-shell-send-buffer (&optional arg)
2801 "Send the entire buffer to inferior Python process. 2833 "Send the entire buffer to inferior Python process.
2802With prefix ARG allow execution of code inside blocks delimited 2834When optional argument SEND-MAIN is non-nil, allow execution of
2803by \"if __name__== '__main__':\"." 2835code inside blocks delimited by \"if __name__== '__main__':\".
2804 (interactive "P") 2836When called interactively SEND-MAIN defaults to nil, unless it's
2837called with prefix argument. When optional argument MSG is
2838non-nil, forces display of a user-friendly message if there's no
2839process running; defaults to t when called interactively."
2840 (interactive (list current-prefix-arg t))
2805 (save-restriction 2841 (save-restriction
2806 (widen) 2842 (widen)
2807 (python-shell-send-region (point-min) (point-max) (not arg)))) 2843 (python-shell-send-region (point-min) (point-max) send-main msg)))
2808 2844
2809(defun python-shell-send-defun (arg) 2845(defun python-shell-send-defun (&optional arg msg)
2810 "Send the current defun to inferior Python process. 2846 "Send the current defun to inferior Python process.
2811When argument ARG is non-nil do not include decorators." 2847When argument ARG is non-nil do not include decorators. When
2812 (interactive "P") 2848optional argument MSG is non-nil, forces display of a
2849user-friendly message if there's no process running; defaults to
2850t when called interactively."
2851 (interactive (list current-prefix-arg t))
2813 (save-excursion 2852 (save-excursion
2814 (python-shell-send-region 2853 (python-shell-send-region
2815 (progn 2854 (progn
@@ -2825,42 +2864,60 @@ When argument ARG is non-nil do not include decorators."
2825 (progn 2864 (progn
2826 (or (python-nav-end-of-defun) 2865 (or (python-nav-end-of-defun)
2827 (end-of-line 1)) 2866 (end-of-line 1))
2828 (point-marker))))) 2867 (point-marker))
2868 nil ;; noop
2869 msg)))
2829 2870
2830(defun python-shell-send-file (file-name &optional process temp-file-name 2871(defun python-shell-send-file (file-name &optional process temp-file-name
2831 delete) 2872 delete msg)
2832 "Send FILE-NAME to inferior Python PROCESS. 2873 "Send FILE-NAME to inferior Python PROCESS.
2833If TEMP-FILE-NAME is passed then that file is used for processing 2874If TEMP-FILE-NAME is passed then that file is used for processing
2834instead, while internally the shell will continue to use FILE-NAME. 2875instead, while internally the shell will continue to use
2835If DELETE is non-nil, delete the file afterwards." 2876FILE-NAME. If TEMP-FILE-NAME and DELETE are non-nil, then
2836 (interactive "fFile to send: ") 2877TEMP-FILE-NAME is deleted after evaluation is performed. When
2837 (let* ((process (or process (python-shell-get-or-create-process))) 2878optional argument MSG is non-nil, forces display of a
2879user-friendly message if there's no process running; defaults to
2880t when called interactively."
2881 (interactive
2882 (list
2883 (read-file-name "File to send: ") ; file-name
2884 nil ; process
2885 nil ; temp-file-name
2886 nil ; delete
2887 t)) ; msg
2888 (let* ((process (or process (python-shell-get-process-or-error msg)))
2889 (encoding (with-temp-buffer
2890 (insert-file-contents
2891 (or temp-file-name file-name))
2892 (python-info-encoding)))
2893 (file-name (expand-file-name
2894 (or (file-remote-p file-name 'localname)
2895 file-name)))
2838 (temp-file-name (when temp-file-name 2896 (temp-file-name (when temp-file-name
2839 (expand-file-name 2897 (expand-file-name
2840 (or (file-remote-p temp-file-name 'localname) 2898 (or (file-remote-p temp-file-name 'localname)
2841 temp-file-name)))) 2899 temp-file-name)))))
2842 (file-name (or (when file-name
2843 (expand-file-name
2844 (or (file-remote-p file-name 'localname)
2845 file-name)))
2846 temp-file-name)))
2847 (when (not file-name)
2848 (error "If FILE-NAME is nil then TEMP-FILE-NAME must be non-nil"))
2849 (python-shell-send-string 2900 (python-shell-send-string
2850 (format 2901 (format
2851 (concat "__pyfile = open('''%s''');" 2902 (concat
2852 "exec(compile(__pyfile.read(), '''%s''', 'exec'));" 2903 "import codecs, os;"
2853 "__pyfile.close()%s") 2904 "__pyfile = codecs.open('''%s''', encoding='''%s''');"
2854 (or temp-file-name file-name) file-name 2905 "__code = __pyfile.read().encode('''%s''');"
2855 (if delete (format "; import os; os.remove('''%s''')" 2906 "__pyfile.close();"
2856 (or temp-file-name file-name)) 2907 (when (and delete temp-file-name)
2857 "")) 2908 (format "os.remove('''%s''');" temp-file-name))
2909 "exec(compile(__code, '''%s''', 'exec'));")
2910 (or temp-file-name file-name) encoding encoding file-name)
2858 process))) 2911 process)))
2859 2912
2860(defun python-shell-switch-to-shell () 2913(defun python-shell-switch-to-shell (&optional msg)
2861 "Switch to inferior Python process buffer." 2914 "Switch to inferior Python process buffer.
2862 (interactive) 2915When optional argument MSG is non-nil, forces display of a
2863 (process-buffer (python-shell-get-or-create-process)) t) 2916user-friendly message if there's no process running; defaults to
2917t when called interactively."
2918 (interactive "p")
2919 (pop-to-buffer
2920 (process-buffer (python-shell-get-process-or-error msg)) nil t))
2864 2921
2865(defun python-shell-send-setup-code () 2922(defun python-shell-send-setup-code ()
2866 "Send all setup code for shell. 2923 "Send all setup code for shell.
@@ -2947,6 +3004,194 @@ the full statement in the case of imports."
2947 "25.1" 3004 "25.1"
2948 "Completion string code must work for (i)pdb.") 3005 "Completion string code must work for (i)pdb.")
2949 3006
3007(defcustom python-shell-completion-native-disabled-interpreters
3008 ;; PyPy's readline cannot handle some escape sequences yet.
3009 (list "pypy")
3010 "List of disabled interpreters.
3011When a match is found, native completion is disabled."
3012 :type '(repeat string))
3013
3014(defcustom python-shell-completion-native-enable t
3015 "Enable readline based native completion."
3016 :type 'boolean)
3017
3018(defcustom python-shell-completion-native-output-timeout 0.01
3019 "Time in seconds to wait for completion output before giving up."
3020 :type 'float)
3021
3022(defvar python-shell-completion-native-redirect-buffer
3023 " *Python completions redirect*"
3024 "Buffer to be used to redirect output of readline commands.")
3025
3026(defun python-shell-completion-native-interpreter-disabled-p ()
3027 "Return non-nil if interpreter has native completion disabled."
3028 (when python-shell-completion-native-disabled-interpreters
3029 (string-match
3030 (regexp-opt python-shell-completion-native-disabled-interpreters)
3031 (file-name-nondirectory python-shell-interpreter))))
3032
3033(defun python-shell-completion-native-try ()
3034 "Return non-nil if can trigger native completion."
3035 (let ((python-shell-completion-native-enable t))
3036 (python-shell-completion-native-get-completions
3037 (get-buffer-process (current-buffer))
3038 nil "int")))
3039
3040(defun python-shell-completion-native-setup ()
3041 "Try to setup native completion, return non-nil on success."
3042 (let ((process (python-shell-get-process)))
3043 (python-shell-send-string
3044 (funcall
3045 'mapconcat
3046 #'identity
3047 (list
3048 "try:"
3049 " import readline, rlcompleter"
3050 ;; Remove parens on callables as it breaks completion on
3051 ;; arguments (e.g. str(Ari<tab>)).
3052 " class Completer(rlcompleter.Completer):"
3053 " def _callable_postfix(self, val, word):"
3054 " return word"
3055 " readline.set_completer(Completer().complete)"
3056 " if readline.__doc__ and 'libedit' in readline.__doc__:"
3057 " readline.parse_and_bind('bind ^I rl_complete')"
3058 " else:"
3059 " readline.parse_and_bind('tab: complete')"
3060 " print ('python.el: readline is available')"
3061 "except:"
3062 " print ('python.el: readline not available')")
3063 "\n")
3064 process)
3065 (python-shell-accept-process-output process)
3066 (when (save-excursion
3067 (re-search-backward
3068 (regexp-quote "python.el: readline is available") nil t 1))
3069 (python-shell-completion-native-try))))
3070
3071(defun python-shell-completion-native-turn-off (&optional msg)
3072 "Turn off shell native completions.
3073With argument MSG show deactivation message."
3074 (interactive "p")
3075 (python-shell-with-shell-buffer
3076 (set (make-local-variable 'python-shell-completion-native-enable) nil)
3077 (when msg
3078 (message "Shell native completion is disabled, using fallback"))))
3079
3080(defun python-shell-completion-native-turn-on (&optional msg)
3081 "Turn on shell native completions.
3082With argument MSG show deactivation message."
3083 (interactive "p")
3084 (python-shell-with-shell-buffer
3085 (set (make-local-variable 'python-shell-completion-native-enable) t)
3086 (python-shell-completion-native-turn-on-maybe msg)))
3087
3088(defun python-shell-completion-native-turn-on-maybe (&optional msg)
3089 "Turn on native completions if enabled and available.
3090With argument MSG show activation/deactivation message."
3091 (interactive "p")
3092 (python-shell-with-shell-buffer
3093 (when python-shell-completion-native-enable
3094 (cond
3095 ((python-shell-completion-native-interpreter-disabled-p)
3096 (python-shell-completion-native-turn-off msg))
3097 ((python-shell-completion-native-setup)
3098 (when msg
3099 (message "Shell native completion is enabled.")))
3100 (t (lwarn
3101 '(python python-shell-completion-native-turn-on-maybe)
3102 :warning
3103 (concat
3104 "Your `python-shell-interpreter' doesn't seem to "
3105 "support readline, yet `python-shell-completion-native' "
3106 (format "was `t' and %S is not part of the "
3107 (file-name-nondirectory python-shell-interpreter))
3108 "`python-shell-completion-native-disabled-interpreters' "
3109 "list. Native completions have been disabled locally. "))
3110 (python-shell-completion-native-turn-off msg))))))
3111
3112(defun python-shell-completion-native-turn-on-maybe-with-msg ()
3113 "Like `python-shell-completion-native-turn-on-maybe' but force messages."
3114 (python-shell-completion-native-turn-on-maybe t))
3115
3116(add-hook 'inferior-python-mode-hook
3117 #'python-shell-completion-native-turn-on-maybe-with-msg)
3118
3119(defun python-shell-completion-native-toggle (&optional msg)
3120 "Toggle shell native completion.
3121With argument MSG show activation/deactivation message."
3122 (interactive "p")
3123 (python-shell-with-shell-buffer
3124 (if python-shell-completion-native-enable
3125 (python-shell-completion-native-turn-off msg)
3126 (python-shell-completion-native-turn-on msg))
3127 python-shell-completion-native-enable))
3128
3129(defun python-shell-completion-native-get-completions (process import input)
3130 "Get completions using native readline for PROCESS.
3131When IMPORT is non-nil takes precedence over INPUT for
3132completion."
3133 (when (and python-shell-completion-native-enable
3134 (python-util-comint-last-prompt)
3135 (>= (point) (cdr (python-util-comint-last-prompt))))
3136 (let* ((input (or import input))
3137 (original-filter-fn (process-filter process))
3138 (redirect-buffer (get-buffer-create
3139 python-shell-completion-native-redirect-buffer))
3140 (separators (python-rx
3141 (or whitespace open-paren close-paren)))
3142 (trigger "\t\t\t")
3143 (new-input (concat input trigger))
3144 (input-length
3145 (save-excursion
3146 (+ (- (point-max) (comint-bol)) (length new-input))))
3147 (delete-line-command (make-string input-length ?\b))
3148 (input-to-send (concat new-input delete-line-command)))
3149 ;; Ensure restoring the process filter, even if the user quits
3150 ;; or there's some other error.
3151 (unwind-protect
3152 (with-current-buffer redirect-buffer
3153 ;; Cleanup the redirect buffer
3154 (delete-region (point-min) (point-max))
3155 ;; Mimic `comint-redirect-send-command', unfortunately it
3156 ;; can't be used here because it expects a newline in the
3157 ;; command and that's exactly what we are trying to avoid.
3158 (let ((comint-redirect-echo-input nil)
3159 (comint-redirect-verbose nil)
3160 (comint-redirect-perform-sanity-check nil)
3161 (comint-redirect-insert-matching-regexp nil)
3162 ;; Feed it some regex that will never match.
3163 (comint-redirect-finished-regexp "^\\'$")
3164 (comint-redirect-output-buffer redirect-buffer))
3165 ;; Compatibility with Emacs 24.x. Comint changed and
3166 ;; now `comint-redirect-filter' gets 3 args. This
3167 ;; checks which version of `comint-redirect-filter' is
3168 ;; in use based on its args and uses `apply-partially'
3169 ;; to make it up for the 3 args case.
3170 (if (= (length
3171 (help-function-arglist 'comint-redirect-filter)) 3)
3172 (set-process-filter
3173 process (apply-partially
3174 #'comint-redirect-filter original-filter-fn))
3175 (set-process-filter process #'comint-redirect-filter))
3176 (process-send-string process input-to-send)
3177 (accept-process-output
3178 process
3179 python-shell-completion-native-output-timeout)
3180 ;; XXX: can't use `python-shell-accept-process-output'
3181 ;; here because there are no guarantees on how output
3182 ;; ends. The workaround here is to call
3183 ;; `accept-process-output' until we don't find anything
3184 ;; else to accept.
3185 (while (accept-process-output
3186 process
3187 python-shell-completion-native-output-timeout))
3188 (cl-remove-duplicates
3189 (split-string
3190 (buffer-substring-no-properties
3191 (point-min) (point-max))
3192 separators t))))
3193 (set-process-filter process original-filter-fn)))))
3194
2950(defun python-shell-completion-get-completions (process import input) 3195(defun python-shell-completion-get-completions (process import input)
2951 "Do completion at point using PROCESS for IMPORT or INPUT. 3196 "Do completion at point using PROCESS for IMPORT or INPUT.
2952When IMPORT is non-nil takes precedence over INPUT for 3197When IMPORT is non-nil takes precedence over INPUT for
@@ -3004,11 +3249,15 @@ using that one instead of current buffer's process."
3004 last-prompt-end 3249 last-prompt-end
3005 (forward-char (length (match-string-no-properties 0))) 3250 (forward-char (length (match-string-no-properties 0)))
3006 (point)))) 3251 (point))))
3007 (end (point))) 3252 (end (point))
3253 (completion-fn
3254 (if python-shell-completion-native-enable
3255 #'python-shell-completion-native-get-completions
3256 #'python-shell-completion-get-completions)))
3008 (list start end 3257 (list start end
3009 (completion-table-dynamic 3258 (completion-table-dynamic
3010 (apply-partially 3259 (apply-partially
3011 #'python-shell-completion-get-completions 3260 completion-fn
3012 process import-statement))))) 3261 process import-statement)))))
3013 3262
3014(define-obsolete-function-alias 3263(define-obsolete-function-alias
@@ -4155,6 +4404,32 @@ operator."
4155 (* whitespace) line-end)) 4404 (* whitespace) line-end))
4156 (string-equal "" (match-string-no-properties 1)))) 4405 (string-equal "" (match-string-no-properties 1))))
4157 4406
4407(defun python-info-encoding-from-cookie ()
4408 "Detect current buffer's encoding from its coding cookie.
4409Returns the enconding as a symbol."
4410 (let ((first-two-lines
4411 (save-excursion
4412 (save-restriction
4413 (widen)
4414 (goto-char (point-min))
4415 (forward-line 2)
4416 (buffer-substring-no-properties
4417 (point)
4418 (point-min))))))
4419 (when (string-match (python-rx coding-cookie) first-two-lines)
4420 (intern (match-string-no-properties 1 first-two-lines)))))
4421
4422(defun python-info-encoding ()
4423 "Return encoding for file.
4424Try `python-info-encoding-from-cookie', if none is found then
4425default to utf-8."
4426 ;; If no enconding is defined, then it's safe to use UTF-8: Python 2
4427 ;; uses ASCII as default while Python 3 uses UTF-8. This means that
4428 ;; in the worst case escenario python.el will make things work for
4429 ;; Python 2 files with unicode data and no encoding defined.
4430 (or (python-info-encoding-from-cookie)
4431 'utf-8))
4432
4158 4433
4159;;; Utility functions 4434;;; Utility functions
4160 4435
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 524749d6266..904e9dfc289 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2374,7 +2374,7 @@ Calls the value of `sh-set-shell-hook' if set."
2374 (sh-make-vars-local)) 2374 (sh-make-vars-local))
2375 (message "Indentation setup for shell type %s" sh-shell)) 2375 (message "Indentation setup for shell type %s" sh-shell))
2376 (message "No indentation for this shell type.") 2376 (message "No indentation for this shell type.")
2377 (setq indent-line-function 'sh-basic-indent-line)) 2377 (setq-local indent-line-function 'sh-basic-indent-line))
2378 (when font-lock-mode 2378 (when font-lock-mode
2379 (setq font-lock-set-defaults nil) 2379 (setq font-lock-set-defaults nil)
2380 (font-lock-set-defaults) 2380 (font-lock-set-defaults)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 21c0d6aa6a4..f3dc4bd4cfd 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -136,6 +136,31 @@ actual location is not known.")
136 136
137(defmethod xref-location-group ((_ xref-bogus-location)) "(No location)") 137(defmethod xref-location-group ((_ xref-bogus-location)) "(No location)")
138 138
139;; This should be in elisp-mode.el, but it's preloaded, and we can't
140;; preload defclass and defmethod (at least, not yet).
141(defclass xref-elisp-location (xref-location)
142 ((symbol :type symbol :initarg :symbol)
143 (type :type symbol :initarg :type)
144 (file :type string :initarg :file
145 :reader xref-location-group))
146 :documentation "Location of an Emacs Lisp symbol definition.")
147
148(defun xref-make-elisp-location (symbol type file)
149 (make-instance 'xref-elisp-location :symbol symbol :type type :file file))
150
151(defmethod xref-location-marker ((l xref-elisp-location))
152 (with-slots (symbol type file) l
153 (let ((buffer-point
154 (pcase type
155 (`defun (find-function-search-for-symbol symbol nil file))
156 ((or `defvar `defface)
157 (find-function-search-for-symbol symbol type file))
158 (`feature
159 (cons (find-file-noselect file) 1)))))
160 (with-current-buffer (car buffer-point)
161 (goto-char (or (cdr buffer-point) (point-min)))
162 (point-marker)))))
163
139 164
140;;; Cross-reference 165;;; Cross-reference
141 166
@@ -442,7 +467,8 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
442;;;###autoload 467;;;###autoload
443(defun xref-find-definitions (identifier) 468(defun xref-find-definitions (identifier)
444 "Find the definition of the identifier at point. 469 "Find the definition of the identifier at point.
445With prefix argument, prompt for the identifier." 470With prefix argument or when there's no identifier at point,
471prompt for it."
446 (interactive (list (xref--read-identifier "Find definitions of: "))) 472 (interactive (list (xref--read-identifier "Find definitions of: ")))
447 (xref--find-definitions identifier nil)) 473 (xref--find-definitions identifier nil))
448 474
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index a25dba2e39e..985a52a0fc0 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -138,6 +138,8 @@ disabled, i.e., the position is recorded for all files."
138 :version "24.1" 138 :version "24.1"
139 :type 'regexp :group 'save-place) 139 :type 'regexp :group 'save-place)
140 140
141(declare-function dired-current-directory "dired" (&optional localp))
142
141(defun toggle-save-place (&optional parg) 143(defun toggle-save-place (&optional parg)
142 "Toggle whether to save your place in this file between sessions. 144 "Toggle whether to save your place in this file between sessions.
143If this mode is enabled, point is recorded when you kill the buffer 145If this mode is enabled, point is recorded when you kill the buffer
@@ -153,7 +155,7 @@ file:
153\(setq-default save-place t)" 155\(setq-default save-place t)"
154 (interactive "P") 156 (interactive "P")
155 (if (not (or buffer-file-name (and (derived-mode-p 'dired-mode) 157 (if (not (or buffer-file-name (and (derived-mode-p 'dired-mode)
156 dired-directory))) 158 (dired-current-directory))))
157 (message "Buffer `%s' not visiting a file or directory" (buffer-name)) 159 (message "Buffer `%s' not visiting a file or directory" (buffer-name))
158 (setq save-place (if parg 160 (setq save-place (if parg
159 (> (prefix-numeric-value parg) 0) 161 (> (prefix-numeric-value parg) 0)
@@ -172,12 +174,13 @@ file:
172 ;; file. If not, do so, then feel free to modify the alist. It 174 ;; file. If not, do so, then feel free to modify the alist. It
173 ;; will be saved again when Emacs is killed. 175 ;; will be saved again when Emacs is killed.
174 (or save-place-loaded (load-save-place-alist-from-file)) 176 (or save-place-loaded (load-save-place-alist-from-file))
175 (let ((item (or buffer-file-name 177 (let* ((directory (and (derived-mode-p 'dired-mode)
176 (and (derived-mode-p 'dired-mode) 178 (dired-current-directory)))
177 dired-directory 179 (item (or buffer-file-name
178 (expand-file-name (if (consp dired-directory) 180 (and directory
179 (car dired-directory) 181 (expand-file-name (if (consp directory)
180 dired-directory)))))) 182 (car directory)
183 directory))))))
181 (when (and item 184 (when (and item
182 (or (not save-place-ignore-files-regexp) 185 (or (not save-place-ignore-files-regexp)
183 (not (string-match save-place-ignore-files-regexp 186 (not (string-match save-place-ignore-files-regexp
@@ -186,8 +189,7 @@ file:
186 (position (cond ((eq major-mode 'hexl-mode) 189 (position (cond ((eq major-mode 'hexl-mode)
187 (with-no-warnings 190 (with-no-warnings
188 (1+ (hexl-current-address)))) 191 (1+ (hexl-current-address))))
189 ((and (derived-mode-p 'dired-mode) 192 ((and (derived-mode-p 'dired-mode) directory)
190 dired-directory)
191 (let ((filename (dired-get-filename nil t))) 193 (let ((filename (dired-get-filename nil t)))
192 (if filename 194 (if filename
193 `((dired-filename . ,filename)) 195 `((dired-filename . ,filename))
@@ -305,7 +307,7 @@ may have changed) back to `save-place-alist'."
305 ;; save-place checks buffer-file-name too, but we can avoid 307 ;; save-place checks buffer-file-name too, but we can avoid
306 ;; overhead of function call by checking here too. 308 ;; overhead of function call by checking here too.
307 (and (or buffer-file-name (and (derived-mode-p 'dired-mode) 309 (and (or buffer-file-name (and (derived-mode-p 'dired-mode)
308 dired-directory)) 310 (dired-current-directory)))
309 (save-place-to-alist)) 311 (save-place-to-alist))
310 (setq buf-list (cdr buf-list)))))) 312 (setq buf-list (cdr buf-list))))))
311 313
@@ -325,19 +327,21 @@ may have changed) back to `save-place-alist'."
325(defun save-place-dired-hook () 327(defun save-place-dired-hook ()
326 "Position the point in a Dired buffer." 328 "Position the point in a Dired buffer."
327 (or save-place-loaded (load-save-place-alist-from-file)) 329 (or save-place-loaded (load-save-place-alist-from-file))
328 (let ((cell (assoc (and (derived-mode-p 'dired-mode) 330 (let* ((directory (and (derived-mode-p 'dired-mode)
329 dired-directory 331 (dired-current-directory)))
330 (expand-file-name (if (consp dired-directory) 332 (cell (assoc (and directory
331 (car dired-directory) 333 (expand-file-name (if (consp directory)
332 dired-directory))) 334 (car directory)
333 save-place-alist))) 335 directory)))
336 save-place-alist)))
334 (if cell 337 (if cell
335 (progn 338 (progn
336 (or revert-buffer-in-progress-p 339 (or revert-buffer-in-progress-p
337 (if (integerp (cdr cell)) 340 (cond
338 (goto-char (cdr cell)) 341 ((integerp (cdr cell))
339 (and (assq 'dired-filename (cdr cell)) 342 (goto-char (cdr cell)))
340 (dired-goto-file (cdr (assq 'dired-filename (cdr cell))))))) 343 ((and (listp (cdr cell)) (assq 'dired-filename (cdr cell)))
344 (dired-goto-file (cdr (assq 'dired-filename (cdr cell)))))))
341 ;; and make sure it will be saved again for later 345 ;; and make sure it will be saved again for later
342 (setq save-place t))))) 346 (setq save-place t)))))
343 347
diff --git a/lisp/simple.el b/lisp/simple.el
index 0fcd5db45d9..b436dd7699f 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1667,7 +1667,6 @@ invoking, give a prefix argument to `execute-extended-command'."
1667 (let ((prefix-arg prefixarg)) 1667 (let ((prefix-arg prefixarg))
1668 (command-execute function 'record)) 1668 (command-execute function 'record))
1669 ;; If enabled, show which key runs this command. 1669 ;; If enabled, show which key runs this command.
1670 ;; (when binding
1671 ;; But first wait, and skip the message if there is input. 1670 ;; But first wait, and skip the message if there is input.
1672 (let* ((waited 1671 (let* ((waited
1673 ;; If this command displayed something in the echo area; 1672 ;; If this command displayed something in the echo area;
@@ -1675,10 +1674,11 @@ invoking, give a prefix argument to `execute-extended-command'."
1675 ;; FIXME: Wait *after* running post-command-hook! 1674 ;; FIXME: Wait *after* running post-command-hook!
1676 ;; FIXME: Don't wait if execute-extended-command--shorter won't 1675 ;; FIXME: Don't wait if execute-extended-command--shorter won't
1677 ;; find a better answer anyway! 1676 ;; find a better answer anyway!
1678 (sit-for (cond 1677 (when suggest-key-bindings
1679 ((zerop (length (current-message))) 0) 1678 (sit-for (cond
1680 ((numberp suggest-key-bindings) suggest-key-bindings) 1679 ((zerop (length (current-message))) 0)
1681 (t 2))))) 1680 ((numberp suggest-key-bindings) suggest-key-bindings)
1681 (t 2))))))
1682 (when (and waited (not (consp unread-command-events))) 1682 (when (and waited (not (consp unread-command-events)))
1683 (unless (or binding executing-kbd-macro (not (symbolp function)) 1683 (unless (or binding executing-kbd-macro (not (symbolp function))
1684 (<= (length (symbol-name function)) 2)) 1684 (<= (length (symbol-name function)) 2))
diff --git a/lisp/startup.el b/lisp/startup.el
index 8e981bbc64a..0c5e66a2e6e 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -358,6 +358,8 @@ this variable usefully is to set it while building and dumping Emacs."
358 :set (lambda (_variable _value) 358 :set (lambda (_variable _value)
359 (error "Customizing `site-run-file' does not work"))) 359 (error "Customizing `site-run-file' does not work")))
360 360
361(make-obsolete-variable 'system-name "use (system-name) instead" "25.1")
362
361(defcustom mail-host-address nil 363(defcustom mail-host-address nil
362 "Name of this machine, for purposes of naming users. 364 "Name of this machine, for purposes of naming users.
363If non-nil, Emacs uses this instead of `system-name' when constructing 365If non-nil, Emacs uses this instead of `system-name' when constructing
diff --git a/lisp/subr.el b/lisp/subr.el
index 6ce02b79a0a..53ad2729a10 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2166,7 +2166,7 @@ keyboard-quit events while waiting for a valid input."
2166 char)) 2166 char))
2167 2167
2168(defun sit-for (seconds &optional nodisp obsolete) 2168(defun sit-for (seconds &optional nodisp obsolete)
2169 "Perform redisplay, then wait for SECONDS seconds or until input is available. 2169 "Redisplay, then wait for SECONDS seconds. Stop when input is available.
2170SECONDS may be a floating-point value. 2170SECONDS may be a floating-point value.
2171\(On operating systems that do not support waiting for fractions of a 2171\(On operating systems that do not support waiting for fractions of a
2172second, floating-point values are rounded down to the nearest integer.) 2172second, floating-point values are rounded down to the nearest integer.)
@@ -2184,7 +2184,7 @@ floating point support."
2184 (declare (advertised-calling-convention (seconds &optional nodisp) "22.1")) 2184 (declare (advertised-calling-convention (seconds &optional nodisp) "22.1"))
2185 ;; This used to be implemented in C until the following discussion: 2185 ;; This used to be implemented in C until the following discussion:
2186 ;; http://lists.gnu.org/archive/html/emacs-devel/2006-07/msg00401.html 2186 ;; http://lists.gnu.org/archive/html/emacs-devel/2006-07/msg00401.html
2187 ;; Then it was moved to C using an implementation based on an idle timer, 2187 ;; Then it was moved here using an implementation based on an idle timer,
2188 ;; which was then replaced by the use of read-event. 2188 ;; which was then replaced by the use of read-event.
2189 (if (numberp nodisp) 2189 (if (numberp nodisp)
2190 (setq seconds (+ seconds (* 1e-3 nodisp)) 2190 (setq seconds (+ seconds (* 1e-3 nodisp))
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 1993ff104f4..12e7fda0f2c 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1300,18 +1300,48 @@ Inserts the value of `tex-open-quote' (normally ``) or `tex-close-quote'
1300\(normally '') depending on the context. With prefix argument, always 1300\(normally '') depending on the context. With prefix argument, always
1301inserts \" characters." 1301inserts \" characters."
1302 (interactive "*P") 1302 (interactive "*P")
1303 ;; Discover if we'll be inserting normal double quotes.
1304 ;;
1303 (if (or arg (memq (char-syntax (preceding-char)) '(?/ ?\\)) 1305 (if (or arg (memq (char-syntax (preceding-char)) '(?/ ?\\))
1304 (eq (get-text-property (point) 'face) 'tex-verbatim) 1306 (eq (get-text-property (point) 'face) 'tex-verbatim)
1305 (save-excursion 1307 ;; Discover if a preceding occurrence of `tex-open-quote'
1306 (backward-char (length tex-open-quote)) 1308 ;; should be morphed to a normal double quote.
1307 (when (or (looking-at (regexp-quote tex-open-quote)) 1309 ;;
1308 (looking-at (regexp-quote tex-close-quote))) 1310 (and (>= (point) (+ (point-min) (length tex-open-quote)))
1309 (delete-char (length tex-open-quote)) 1311 (save-excursion
1310 t))) 1312 (backward-char (length tex-open-quote))
1313 (when (or (looking-at (regexp-quote tex-open-quote))
1314 (looking-at (regexp-quote tex-close-quote)))
1315 (delete-char (length tex-open-quote))
1316 (when (looking-at (regexp-quote tex-close-quote))
1317 (delete-char (length tex-close-quote)))
1318 t))))
1319 ;; Insert the normal quote (eventually letting
1320 ;; `electric-pair-mode' do its thing).
1321 ;;
1311 (self-insert-command (prefix-numeric-value arg)) 1322 (self-insert-command (prefix-numeric-value arg))
1312 (insert (if (or (memq (char-syntax (preceding-char)) '(?\( ?> ?\s)) 1323 ;; We'll be inserting fancy TeX quotes, but consider and imitate
1313 (memq (preceding-char) '(?~))) 1324 ;; `electric-pair-mode''s two behaviors: pair-insertion and
1314 tex-open-quote tex-close-quote)))) 1325 ;; region wrapping.
1326 ;;
1327 (if (and electric-pair-mode (use-region-p))
1328 (let* ((saved (point-marker)))
1329 (goto-char (mark))
1330 (insert (if (> saved (mark)) tex-open-quote tex-close-quote))
1331 (goto-char saved)
1332 (insert (if (> saved (mark)) tex-close-quote tex-open-quote)))
1333 (if (or (memq (char-syntax (preceding-char)) '(?\( ?> ?\s))
1334 (memq (preceding-char) '(?~)))
1335 (if electric-pair-mode
1336 (if (looking-at (regexp-quote tex-close-quote))
1337 (forward-char (length tex-close-quote))
1338 (insert tex-open-quote)
1339 (insert tex-close-quote)
1340 (backward-char (length tex-close-quote)))
1341 (insert tex-open-quote))
1342 (if (looking-at (regexp-quote tex-close-quote))
1343 (forward-char (length tex-close-quote))
1344 (insert tex-close-quote))))))
1315 1345
1316(defun tex-validate-buffer () 1346(defun tex-validate-buffer ()
1317 "Check current buffer for paragraphs containing mismatched braces or $s. 1347 "Check current buffer for paragraphs containing mismatched braces or $s.
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el
index 3b8293cda24..454139e9025 100644
--- a/lisp/vc/compare-w.el
+++ b/lisp/vc/compare-w.el
@@ -30,6 +30,8 @@
30 30
31;;; Code: 31;;; Code:
32 32
33(require 'diff-mode) ; For diff faces.
34
33(defgroup compare-windows nil 35(defgroup compare-windows nil
34 "Compare text between windows." 36 "Compare text between windows."
35 :prefix "compare-" 37 :prefix "compare-"
@@ -128,11 +130,19 @@ out all highlighting later with the command `compare-windows-dehighlight'."
128 :group 'compare-windows 130 :group 'compare-windows
129 :version "22.1") 131 :version "22.1")
130 132
131(defface compare-windows 133(defface compare-windows-removed
132 '((t :inherit lazy-highlight)) 134 '((t :inherit diff-removed))
133 "Face for highlighting of compare-windows difference regions." 135 "Face for highlighting of compare-windows removed regions."
134 :group 'compare-windows 136 :group 'compare-windows
135 :version "22.1") 137 :version "25.1")
138
139(defface compare-windows-added
140 '((t :inherit diff-added))
141 "Face for highlighting of compare-windows added regions."
142 :group 'compare-windows
143 :version "25.1")
144
145(define-obsolete-face-alias 'compare-windows 'compare-windows-added "25.1")
136 146
137(defvar compare-windows-overlay1 nil) 147(defvar compare-windows-overlay1 nil)
138(defvar compare-windows-overlay2 nil) 148(defvar compare-windows-overlay2 nil)
@@ -158,7 +168,8 @@ then try to get a window on an iconified frame, and finally
158consider all existing frames." 168consider all existing frames."
159 (or (get-mru-window 'visible t t) 169 (or (get-mru-window 'visible t t)
160 (get-mru-window 0 t t) 170 (get-mru-window 0 t t)
161 (get-mru-window t t t))) 171 (get-mru-window t t t)
172 (error "No other window")))
162 173
163(defun compare-windows-get-next-window () 174(defun compare-windows-get-next-window ()
164 "Return the window next in the cyclic ordering of windows. 175 "Return the window next in the cyclic ordering of windows.
@@ -393,13 +404,13 @@ on third call it again advances points to the next difference and so on."
393 (if compare-windows-overlay1 404 (if compare-windows-overlay1
394 (move-overlay compare-windows-overlay1 beg1 end1 b1) 405 (move-overlay compare-windows-overlay1 beg1 end1 b1)
395 (setq compare-windows-overlay1 (make-overlay beg1 end1 b1)) 406 (setq compare-windows-overlay1 (make-overlay beg1 end1 b1))
396 (overlay-put compare-windows-overlay1 'face 'compare-windows) 407 (overlay-put compare-windows-overlay1 'face 'compare-windows-added)
397 (overlay-put compare-windows-overlay1 'priority 1000)) 408 (overlay-put compare-windows-overlay1 'priority 1000))
398 (overlay-put compare-windows-overlay1 'window w1) 409 (overlay-put compare-windows-overlay1 'window w1)
399 (if compare-windows-overlay2 410 (if compare-windows-overlay2
400 (move-overlay compare-windows-overlay2 beg2 end2 b2) 411 (move-overlay compare-windows-overlay2 beg2 end2 b2)
401 (setq compare-windows-overlay2 (make-overlay beg2 end2 b2)) 412 (setq compare-windows-overlay2 (make-overlay beg2 end2 b2))
402 (overlay-put compare-windows-overlay2 'face 'compare-windows) 413 (overlay-put compare-windows-overlay2 'face 'compare-windows-removed)
403 (overlay-put compare-windows-overlay2 'priority 1000)) 414 (overlay-put compare-windows-overlay2 'priority 1000))
404 (overlay-put compare-windows-overlay2 'window w2) 415 (overlay-put compare-windows-overlay2 'window w2)
405 (if (not (eq compare-windows-highlight 'persistent)) 416 (if (not (eq compare-windows-highlight 'persistent))
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 4955c5abf93..08eb778f804 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -169,6 +169,9 @@ See `run-hooks'."
169 (define-key map [ise] 169 (define-key map [ise]
170 '(menu-item "Isearch Files..." vc-dir-isearch 170 '(menu-item "Isearch Files..." vc-dir-isearch
171 :help "Incremental search a string in the marked files")) 171 :help "Incremental search a string in the marked files"))
172 (define-key map [display]
173 '(menu-item "Display in Other Window" vc-dir-display-file
174 :help "Display the file on the current line, in another window"))
172 (define-key map [open-other] 175 (define-key map [open-other]
173 '(menu-item "Open in Other Window" vc-dir-find-file-other-window 176 '(menu-item "Open in Other Window" vc-dir-find-file-other-window
174 :help "Find the file on the current line, in another window")) 177 :help "Find the file on the current line, in another window"))
@@ -273,6 +276,7 @@ See `run-hooks'."
273 (define-key map "e" 'vc-dir-find-file) ; dired-mode compatibility 276 (define-key map "e" 'vc-dir-find-file) ; dired-mode compatibility
274 (define-key map "\C-m" 'vc-dir-find-file) 277 (define-key map "\C-m" 'vc-dir-find-file)
275 (define-key map "o" 'vc-dir-find-file-other-window) 278 (define-key map "o" 'vc-dir-find-file-other-window)
279 (define-key map "\C-o" 'vc-dir-display-file)
276 (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process) 280 (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process)
277 (define-key map [down-mouse-3] 'vc-dir-menu) 281 (define-key map [down-mouse-3] 'vc-dir-menu)
278 (define-key map [mouse-2] 'vc-dir-toggle-mark) 282 (define-key map [mouse-2] 'vc-dir-toggle-mark)
@@ -755,6 +759,13 @@ that share the same state."
755 (if event (posn-set-point (event-end event))) 759 (if event (posn-set-point (event-end event)))
756 (find-file-other-window (vc-dir-current-file))) 760 (find-file-other-window (vc-dir-current-file)))
757 761
762(defun vc-dir-display-file (&optional event)
763 "Display the file on the current line, in another window."
764 (interactive (list last-nonmenu-event))
765 (if event (posn-set-point (event-end event)))
766 (display-buffer (find-file-noselect (vc-dir-current-file))
767 t))
768
758(defun vc-dir-isearch () 769(defun vc-dir-isearch ()
759 "Search for a string through all marked buffers using Isearch." 770 "Search for a string through all marked buffers using Isearch."
760 (interactive) 771 (interactive)
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 65f683c7808..1700bef10b0 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -371,8 +371,7 @@ or an empty string if none."
371 (goto-char (point-min)) 371 (goto-char (point-min))
372 (pcase stage 372 (pcase stage
373 (`update-index 373 (`update-index
374 (setq next-stage (if (vc-git--empty-db-p) 'ls-files-added 374 (setq next-stage (if (vc-git--empty-db-p) 'ls-files-added 'diff-index)))
375 (if files 'ls-files-up-to-date 'diff-index))))
376 (`ls-files-added 375 (`ls-files-added
377 (setq next-stage 'ls-files-unknown) 376 (setq next-stage 'ls-files-unknown)
378 (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) 377 (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t)
@@ -381,7 +380,7 @@ or an empty string if none."
381 (push (list name 'added (vc-git-create-extra-fileinfo 0 new-perm)) 380 (push (list name 'added (vc-git-create-extra-fileinfo 0 new-perm))
382 result)))) 381 result))))
383 (`ls-files-up-to-date 382 (`ls-files-up-to-date
384 (setq next-stage 'diff-index) 383 (setq next-stage 'ls-files-unknown)
385 (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) 384 (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t)
386 (let ((perm (string-to-number (match-string 1) 8)) 385 (let ((perm (string-to-number (match-string 1) 8))
387 (name (match-string 2))) 386 (name (match-string 2)))
@@ -400,7 +399,7 @@ or an empty string if none."
400 (vc-git-create-extra-fileinfo 0 0)) 399 (vc-git-create-extra-fileinfo 0 0))
401 result))) 400 result)))
402 (`diff-index 401 (`diff-index
403 (setq next-stage 'ls-files-unknown) 402 (setq next-stage (if files 'ls-files-up-to-date 'ls-files-unknown))
404 (while (re-search-forward 403 (while (re-search-forward
405 ":\\([0-7]\\{6\\}\\) \\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\(\\([ADMUT]\\)\0\\([^\0]+\\)\\|\\([CR]\\)[0-9]*\0\\([^\0]+\\)\0\\([^\0]+\\)\\)\0" 404 ":\\([0-7]\\{6\\}\\) \\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\(\\([ADMUT]\\)\0\\([^\0]+\\)\\|\\([CR]\\)[0-9]*\0\\([^\0]+\\)\0\\([^\0]+\\)\\)\0"
406 nil t 1) 405 nil t 1)
diff --git a/lisp/window.el b/lisp/window.el
index 2b593c35a54..21bd2c5829b 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -237,7 +237,12 @@ displays the buffer specified by BUFFER-OR-NAME before running BODY."
237 (standard-output ,buffer) 237 (standard-output ,buffer)
238 ,window ,value) 238 ,window ,value)
239 (with-current-buffer ,buffer 239 (with-current-buffer ,buffer
240 (setq ,window (temp-buffer-window-show ,buffer ,vaction))) 240 (setq ,window (temp-buffer-window-show
241 ,buffer
242 ;; Remove window-height when it's handled below.
243 (if (functionp (cdr (assq 'window-height (cdr ,vaction))))
244 (assq-delete-all 'window-height (copy-sequence ,vaction))
245 ,vaction))))
241 246
242 (let ((inhibit-read-only t) 247 (let ((inhibit-read-only t)
243 (inhibit-modification-hooks t)) 248 (inhibit-modification-hooks t))
diff --git a/src/ChangeLog b/src/ChangeLog
index 72601fe7c58..85eb113db82 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,121 @@
12014-12-31 Paul Eggert <eggert@cs.ucla.edu>
2
3 Simplify setfattr use by assuming GNU make
4 * Makefile.in (PAXCTL_if_present, SETFATTR_if_present): New macros.
5 (emacs$(EXEEXT), temacs$(EXEEXT), bootstrap-emacs$(EXEEXT)): Use them.
6 Simplify by using GNU make rather than shell conditionals,
7 by using ln -f rather than rm -f followed by ln,
8 and by preferring $@ to spelling out the destination.
9
102014-12-29 Eli Zaretskii <eliz@gnu.org>
11
12 * sysdep.c [WINDOWSNT]: Include sys/socket.h, without which this
13 file doesn't compile on MS-Windows.
14
152014-12-28 Paul Eggert <eggert@cs.ucla.edu>
16
17 Fix produce_composite_width typo
18 * term.c (produce_composite_glyph):
19 Fix typo that confused number of columns for pixel width.
20
212014-12-28 Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
22
23 Wrap dll functions more simply
24 * decompress.c, gnutls.c, image.c, xml.c:
25 If WINDOWSNT, use '#define FOO fn_FOO' to wrap dll functions,
26 rather than the inverse when not WINDOWSNT. This isolates the
27 fn_* business into the WINDOWSNT-specific section of the code,
28 which makes it easier to maintain the generic code.
29 * decompress.c (DEF_ZLIB_FN, LOAD_ZLIB_FN):
30 * gnutls.c (DEF_GNUTLS_FN, LOAD_GNUTLS_FN):
31 * image.c (DEF_IMGLIB_FN, LOAD_IMGLIB_FN):
32 * xml.c (DEF_XML2_FN, LOAD_XML2_FN):
33 Remove. All uses replaced by DEF_DLL_FN.
34 * decompress.c (inflateInit2): Remove; no longer needed.
35 * w32.h (DEF_DLL_FN, LOAD_DLL_FN): New macros.
36
37 Port memory-full checking to GnuTLS 3.3
38 Instead of using gnutls_global_set_mem_functions, check every call
39 to a GnuTLS function that might return an indication of memory
40 exhaustion. Suggested by Dmitry Antipov in:
41 http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg02056.html
42 * gnutls.c (gnutls_global_set_mem_functions) [WINDOWSNT]: Remove.
43 (init_gnutls_functions): Do not load gnutls_global_set_mem_functions.
44 (fn_gnutls_global_set_mem_functions) [!WINDOWSNT]: Remove.
45 All uses removed.
46 (check_memory_full): New function.
47 (emacs_gnutls_handshake, emacs_gnutls_handle_error)
48 (gnutls_make_error, gnutls_certificate_details, Fgnutls_peer_status)
49 (Fgnutls_boot): Use it.
50 (emacs_gnutls_global_init): Avoid gnutls_global_set_mem_functions.
51
522014-12-27 Paul Eggert <eggert@cs.ucla.edu>
53
54 Fix parse_settings to match internal documentation
55 * xsettings.c (parse_settings): Return the number of settings seen.
56 Count the settings changes accurately.
57 (read_settings): Don't confuse number of settings changes with
58 the return code from XGetWindowProperty.
59
602014-12-27 Eli Zaretskii <eliz@gnu.org>
61
62 * xdisp.c (set_iterator_to_next) <GET_FROM_STRING>: Limit search in
63 composition_compute_stop_pos to the number of characters in the
64 string. (Bug#19435)
65 <GET_FROM_BUFFER, GET_FROM_STRING>: Simplify code.
66
67 * composite.c (composition_compute_stop_pos): If no composition
68 was found in a string before ENDPOS, and ENDPOS is the string end,
69 no need to back up to a safe point.
70
71 * dispextern.h (struct it) <end_charpos>: Improve commentary.
72
732014-12-27 Jan Djärv <jan.h.d@swipnet.se>
74
75 * nsimage.m (allocInitFromFile:): Initialize bmRep.
76 (dealloc): Release bmRep.
77 (setPixmapData): Make bmRep local so class member is not
78 set (Bug#19133).
79 (setPixmapData): Rename local variable bmRep to avoid compiler
80 warning.
81
822014-12-27 Jan Djärv <jan.h.d@swipnet.se>
83
84 * xterm.c (do_ewmh_fullscreen): Don't remove maximized_horz/vert
85 when going to fullscreen (Bug#0x180004f).
86
872014-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
88
89 * buffer.c (syms_of_buffer) <Vafter_change_functions>: fix docstring.
90
912014-12-27 Eli Zaretskii <eliz@gnu.org>
92
93 * gnutls.c (gnutls_init): Fix deprecation warning from GCC.
94
952014-12-26 Paul Eggert <eggert@cs.ucla.edu>
96
97 Use bool for boolean in xselect.c, xsettings.c
98 * xselect.c (x_get_local_selection, struct selection_data)
99 (x_selection_request_lisp_error, struct prop_location)
100 (x_handle_selection_request, x_convert_selection)
101 (waiting_for_other_props_on_window, expect_property_change)
102 (wait_for_property_change, x_handle_property_notify)
103 (x_get_foreign_selection, x_get_window_property)
104 (receive_incremental_selection)
105 (x_get_window_property_as_lisp_data)
106 (lisp_data_to_selection_data, Fx_get_selection_internal)
107 (x_send_client_event):
108 * xselect.c, xterm.h (x_handle_dnd_message):
109 * xsettings.c (dpyinfo_valid, parse_settings, read_settings)
110 (apply_xft_settings, read_and_apply_settings)
111 (xft_settings_event, init_gsettings, init_xsettings)
112 (syms_of_xsettings):
113 Use bool for boolean.
114 * xselect.c (x_get_window_property): Omit last arg, which was an
115 unused boolean.
116 * xsettings.c (apply_xft_settings): Remove 2nd arg, which was
117 always true. All callers changed.
118
12014-12-26 Eli Zaretskii <eliz@gnu.org> 1192014-12-26 Eli Zaretskii <eliz@gnu.org>
2 120
3 * w32proc.c (sys_spawnve, get_lcid_callback): Use strcpy instead 121 * w32proc.c (sys_spawnve, get_lcid_callback): Use strcpy instead
@@ -894,6 +1012,8 @@
894 * fileio.c (Fexpand_file_name): Use make_unibyte_string, not 1012 * fileio.c (Fexpand_file_name): Use make_unibyte_string, not
895 build_string, when importing a home directory. (Bug#18873) 1013 build_string, when importing a home directory. (Bug#18873)
896 1014
10152014-12-27 Eli Zaretskii <eliz@gnu.org>
1016
897 * dispnew.c (buffer_posn_from_coords): 1017 * dispnew.c (buffer_posn_from_coords):
898 Use WINDOW_WANTS_HEADER_LINE_P, not WINDOW_WANTS_MODELINE_P, to 1018 Use WINDOW_WANTS_HEADER_LINE_P, not WINDOW_WANTS_MODELINE_P, to
899 account for the header-line height. (Bug#18839) 1019 account for the header-line height. (Bug#18839)
diff --git a/src/Makefile.in b/src/Makefile.in
index 930cca3566c..0ea453005ff 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -114,6 +114,8 @@ TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_TEMACS)
114## around this, newer ones setfattr. See Bug#11398 and Bug#16343. 114## around this, newer ones setfattr. See Bug#11398 and Bug#16343.
115PAXCTL = @PAXCTL@ 115PAXCTL = @PAXCTL@
116SETFATTR = @SETFATTR@ 116SETFATTR = @SETFATTR@
117PAXCTL_if_present = $(or $(PAXCTL),: paxctl)
118SETFATTR_if_present = $(or $(SETFATTR),: setfattr)
117 119
118## Some systems define this to request special libraries. 120## Some systems define this to request special libraries.
119LIBS_SYSTEM=@LIBS_SYSTEM@ 121LIBS_SYSTEM=@LIBS_SYSTEM@
@@ -459,17 +461,13 @@ $(srcdir)/macuvs.h $(lispsource)/international/charprop.el: \
459emacs$(EXEEXT): temacs$(EXEEXT) \ 461emacs$(EXEEXT): temacs$(EXEEXT) \
460 $(etc)/DOC $(lisp) $(leimdir)/leim-list.el \ 462 $(etc)/DOC $(lisp) $(leimdir)/leim-list.el \
461 $(lispsource)/international/charprop.el 463 $(lispsource)/international/charprop.el
462 if test "$(CANNOT_DUMP)" = "yes"; then \ 464ifeq ($(CANNOT_DUMP),yes)
463 rm -f emacs$(EXEEXT); \ 465 ln -f temacs$(EXEEXT) $@
464 ln temacs$(EXEEXT) emacs$(EXEEXT); \ 466else
465 else \ 467 LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump
466 LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \ 468 $(PAXCTL_if_present) -zex $@
467 test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \ 469 ln -f $@ bootstrap-emacs$(EXEEXT)
468 while test -f bootstrap-emacs$(EXEEXT); do \ 470endif
469 rm -f bootstrap-emacs$(EXEEXT); \
470 done; \
471 ln emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
472 fi
473 471
474## We run make-docfile twice because the command line may get too long 472## We run make-docfile twice because the command line may get too long
475## on some systems. The sed command operating on lisp.mk also reduces 473## on some systems. The sed command operating on lisp.mk also reduces
@@ -527,10 +525,10 @@ temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) \
527 $(AM_V_CCLD)$(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \ 525 $(AM_V_CCLD)$(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
528 -o temacs $(ALLOBJS) $(lib)/libgnu.a $(W32_RES_LINK) $(LIBES) 526 -o temacs $(ALLOBJS) $(lib)/libgnu.a $(W32_RES_LINK) $(LIBES)
529 $(MKDIR_P) $(etc) 527 $(MKDIR_P) $(etc)
530 test "$(CANNOT_DUMP)" = "yes" || \ 528ifneq ($(CANNOT_DUMP),yes)
531 test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT) 529 $(PAXCTL_if_present) -r $@
532 test "$(CANNOT_DUMP)" = "yes" || test -z "$(SETFATTR)" || \ 530 $(SETFATTR_if_present) -n user.pax.flags -v er $@
533 $(SETFATTR) -n user.pax.flags -v er $@ 531endif
534 532
535## The following oldxmenu-related rules are only (possibly) used if 533## The following oldxmenu-related rules are only (possibly) used if
536## HAVE_X11 && !USE_GTK, but there is no harm in always defining them. 534## HAVE_X11 && !USE_GTK, but there is no harm in always defining them.
@@ -662,14 +660,13 @@ $(lispsource)/loaddefs.el: $(VCSWITNESS) | bootstrap-emacs$(EXEEXT)
662## files from loadup.el in source form. 660## files from loadup.el in source form.
663bootstrap-emacs$(EXEEXT): temacs$(EXEEXT) 661bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
664 $(MAKE) -C ../lisp update-subdirs 662 $(MAKE) -C ../lisp update-subdirs
665 if test "$(CANNOT_DUMP)" = "yes"; then \ 663ifeq ($(CANNOT_DUMP),yes)
666 rm -f bootstrap-emacs$(EXEEXT); \ 664 ln -f temacs$(EXEEXT) $@
667 ln temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ 665else
668 else \ 666 $(RUN_TEMACS) --batch --load loadup bootstrap
669 $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \ 667 $(PAXCTL_if_present) -zex emacs$(EXEEXT)
670 test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \ 668 mv -f emacs$(EXEEXT) $@
671 mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ 669endif
672 fi
673 @: Compile some files earlier to speed up further compilation. 670 @: Compile some files earlier to speed up further compilation.
674 $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" 671 $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
675 672
diff --git a/src/buffer.c b/src/buffer.c
index 7e424bb3178..4e746903efc 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -6074,9 +6074,9 @@ from happening repeatedly and making Emacs nonfunctional. */);
6074 doc: /* List of functions to call after each text change. 6074 doc: /* List of functions to call after each text change.
6075Three arguments are passed to each function: the positions of 6075Three arguments are passed to each function: the positions of
6076the beginning and end of the range of changed text, 6076the beginning and end of the range of changed text,
6077and the length in bytes of the pre-change text replaced by that range. 6077and the length in chars of the pre-change text replaced by that range.
6078\(For an insertion, the pre-change length is zero; 6078\(For an insertion, the pre-change length is zero;
6079for a deletion, that length is the number of bytes deleted, 6079for a deletion, that length is the number of chars deleted,
6080and the post-change beginning and end are at the same place.) 6080and the post-change beginning and end are at the same place.)
6081 6081
6082Buffer changes made while executing the `after-change-functions' 6082Buffer changes made while executing the `after-change-functions'
diff --git a/src/composite.c b/src/composite.c
index 8982c904096..0b52a9fcd2b 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1032,7 +1032,8 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1032 } 1032 }
1033 } 1033 }
1034 } 1034 }
1035 if (charpos == endpos) 1035 if (charpos == endpos
1036 && !(STRINGP (string) && endpos == SCHARS (string)))
1036 { 1037 {
1037 /* We couldn't find a composition point before ENDPOS. But, 1038 /* We couldn't find a composition point before ENDPOS. But,
1038 some character after ENDPOS may be composed with 1039 some character after ENDPOS may be composed with
diff --git a/src/decompress.c b/src/decompress.c
index 24ce852245c..f86aa6facbf 100644
--- a/src/decompress.c
+++ b/src/decompress.c
@@ -31,26 +31,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31static Lisp_Object Qzlib_dll; 31static Lisp_Object Qzlib_dll;
32 32
33#ifdef WINDOWSNT 33#ifdef WINDOWSNT
34#include <windows.h> 34# include <windows.h>
35#include "w32.h" 35# include "w32.h"
36 36
37/* Macro for defining functions that will be loaded from the zlib DLL. */ 37DEF_DLL_FN (int, inflateInit2_,
38#define DEF_ZLIB_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args 38 (z_streamp strm, int windowBits, const char *version,
39 39 int stream_size));
40/* Macro for loading zlib functions from the library. */ 40DEF_DLL_FN (int, inflate, (z_streamp strm, int flush));
41#define LOAD_ZLIB_FN(lib,func) { \ 41DEF_DLL_FN (int, inflateEnd, (z_streamp strm));
42 fn_##func = (void *) GetProcAddress (lib, #func); \
43 if (!fn_##func) return false; \
44 }
45
46DEF_ZLIB_FN (int, inflateInit2_,
47 (z_streamp strm, int windowBits, const char *version, int stream_size));
48
49DEF_ZLIB_FN (int, inflate,
50 (z_streamp strm, int flush));
51
52DEF_ZLIB_FN (int, inflateEnd,
53 (z_streamp strm));
54 42
55static bool zlib_initialized; 43static bool zlib_initialized;
56 44
@@ -62,20 +50,19 @@ init_zlib_functions (void)
62 if (!library) 50 if (!library)
63 return false; 51 return false;
64 52
65 LOAD_ZLIB_FN (library, inflateInit2_); 53 LOAD_DLL_FN (library, inflateInit2_);
66 LOAD_ZLIB_FN (library, inflate); 54 LOAD_DLL_FN (library, inflate);
67 LOAD_ZLIB_FN (library, inflateEnd); 55 LOAD_DLL_FN (library, inflateEnd);
68 return true; 56 return true;
69} 57}
70 58
71#define fn_inflateInit2(strm, windowBits) \ 59# undef inflate
72 fn_inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) 60# undef inflateEnd
73 61# undef inflateInit2_
74#else /* !WINDOWSNT */
75 62
76#define fn_inflateInit2 inflateInit2 63# define inflate fn_inflate
77#define fn_inflate inflate 64# define inflateEnd fn_inflateEnd
78#define fn_inflateEnd inflateEnd 65# define inflateInit2_ fn_inflateInit2_
79 66
80#endif /* WINDOWSNT */ 67#endif /* WINDOWSNT */
81 68
@@ -90,7 +77,7 @@ static void
90unwind_decompress (void *ddata) 77unwind_decompress (void *ddata)
91{ 78{
92 struct decompress_unwind_data *data = ddata; 79 struct decompress_unwind_data *data = ddata;
93 fn_inflateEnd (data->stream); 80 inflateEnd (data->stream);
94 81
95 /* Delete any uncompressed data already inserted on error. */ 82 /* Delete any uncompressed data already inserted on error. */
96 if (data->start) 83 if (data->start)
@@ -167,7 +154,7 @@ This function can be called only in unibyte buffers. */)
167 154
168 /* The magic number 32 apparently means "autodetect both the gzip and 155 /* The magic number 32 apparently means "autodetect both the gzip and
169 zlib formats" according to zlib.h. */ 156 zlib formats" according to zlib.h. */
170 if (fn_inflateInit2 (&stream, MAX_WBITS + 32) != Z_OK) 157 if (inflateInit2 (&stream, MAX_WBITS + 32) != Z_OK)
171 return Qnil; 158 return Qnil;
172 159
173 unwind_data.start = iend; 160 unwind_data.start = iend;
@@ -197,7 +184,7 @@ This function can be called only in unibyte buffers. */)
197 stream.avail_in = avail_in; 184 stream.avail_in = avail_in;
198 stream.next_out = GPT_ADDR; 185 stream.next_out = GPT_ADDR;
199 stream.avail_out = avail_out; 186 stream.avail_out = avail_out;
200 inflate_status = fn_inflate (&stream, Z_NO_FLUSH); 187 inflate_status = inflate (&stream, Z_NO_FLUSH);
201 pos_byte += avail_in - stream.avail_in; 188 pos_byte += avail_in - stream.avail_in;
202 decompressed = avail_out - stream.avail_out; 189 decompressed = avail_out - stream.avail_out;
203 insert_from_gap (decompressed, decompressed, 0); 190 insert_from_gap (decompressed, decompressed, 0);
diff --git a/src/dispextern.h b/src/dispextern.h
index 10a567ea485..908b62b5995 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2252,7 +2252,10 @@ struct it
2252 ptrdiff_t base_level_stop; 2252 ptrdiff_t base_level_stop;
2253 2253
2254 /* Maximum string or buffer position + 1. ZV when iterating over 2254 /* Maximum string or buffer position + 1. ZV when iterating over
2255 current_buffer. */ 2255 current_buffer. When iterating over a string in display_string,
2256 this can be smaller or greater than the number of string
2257 characters, depending on the values of PRECISION and FIELD_WIDTH
2258 with which display_string was called. */
2256 ptrdiff_t end_charpos; 2259 ptrdiff_t end_charpos;
2257 2260
2258 /* C string to iterate over. Non-null means get characters from 2261 /* C string to iterate over. Non-null means get characters from
diff --git a/src/editfns.c b/src/editfns.c
index 430c4c91fb3..2a7dd9209ae 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -93,6 +93,17 @@ static char const *initial_tz;
93 It is OK (though a bit slower) if the user chooses this value. */ 93 It is OK (though a bit slower) if the user chooses this value. */
94static char dump_tz_string[] = "TZ=UtC0"; 94static char dump_tz_string[] = "TZ=UtC0";
95 95
96/* The cached value of Vsystem_name. This is used only to compare it
97 to Vsystem_name, so it need not be visible to the GC. */
98static Lisp_Object cached_system_name;
99
100static void
101init_and_cache_system_name (void)
102{
103 init_system_name ();
104 cached_system_name = Vsystem_name;
105}
106
96void 107void
97init_editfns (void) 108init_editfns (void)
98{ 109{
@@ -102,7 +113,7 @@ init_editfns (void)
102 Lisp_Object tem; 113 Lisp_Object tem;
103 114
104 /* Set up system_name even when dumping. */ 115 /* Set up system_name even when dumping. */
105 init_system_name (); 116 init_and_cache_system_name ();
106 117
107#ifndef CANNOT_DUMP 118#ifndef CANNOT_DUMP
108 /* When just dumping out, set the time zone to a known unlikely value 119 /* When just dumping out, set the time zone to a known unlikely value
@@ -1365,6 +1376,8 @@ DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0,
1365 doc: /* Return the host name of the machine you are running on, as a string. */) 1376 doc: /* Return the host name of the machine you are running on, as a string. */)
1366 (void) 1377 (void)
1367{ 1378{
1379 if (EQ (Vsystem_name, cached_system_name))
1380 init_and_cache_system_name ();
1368 return Vsystem_name; 1381 return Vsystem_name;
1369} 1382}
1370 1383
@@ -4965,6 +4978,7 @@ functions if all the text being accessed has this property. */);
4965 4978
4966 DEFVAR_LISP ("system-name", Vsystem_name, 4979 DEFVAR_LISP ("system-name", Vsystem_name,
4967 doc: /* The host name of the machine Emacs is running on. */); 4980 doc: /* The host name of the machine Emacs is running on. */);
4981 Vsystem_name = cached_system_name = Qnil;
4968 4982
4969 DEFVAR_LISP ("user-full-name", Vuser_full_name, 4983 DEFVAR_LISP ("user-full-name", Vuser_full_name,
4970 doc: /* The full name of the user logged in. */); 4984 doc: /* The full name of the user logged in. */);
diff --git a/src/filelock.c b/src/filelock.c
index f857c488143..99215f215e7 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -592,9 +592,10 @@ current_lock_owner (lock_info_type *owner, char *lfname)
592 return -1; 592 return -1;
593 593
594 /* On current host? */ 594 /* On current host? */
595 if (STRINGP (Vsystem_name) 595 Lisp_Object system_name = Fsystem_name ();
596 && dot - (at + 1) == SBYTES (Vsystem_name) 596 if (STRINGP (system_name)
597 && memcmp (at + 1, SSDATA (Vsystem_name), SBYTES (Vsystem_name)) == 0) 597 && dot - (at + 1) == SBYTES (system_name)
598 && memcmp (at + 1, SSDATA (system_name), SBYTES (system_name)) == 0)
598 { 599 {
599 if (pid == getpid ()) 600 if (pid == getpid ())
600 ret = 2; /* We own it. */ 601 ret = 2; /* We own it. */
diff --git a/src/frame.c b/src/frame.c
index 2ad1c1b52b7..82a85bc48e6 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -5057,7 +5057,7 @@ keep it unchanged if this option is either `t' or a list containing
5057`vertical-scroll-bars'. 5057`vertical-scroll-bars'.
5058 5058
5059The default value is '(tool-bar-lines) on Lucid, Motif and Windows 5059The default value is '(tool-bar-lines) on Lucid, Motif and Windows
5060(which means that adding/removing a tool bar does not change the frame 5060\(which means that adding/removing a tool bar does not change the frame
5061height), nil on all other window systems including GTK+ (which means 5061height), nil on all other window systems including GTK+ (which means
5062that changing any of the parameters listed above may change the size of 5062that changing any of the parameters listed above may change the size of
5063the frame), and `t' otherwise (which means the frame size never changes 5063the frame), and `t' otherwise (which means the frame size never changes
diff --git a/src/gnutls.c b/src/gnutls.c
index bf9f1323546..f945778cc91 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -71,142 +71,129 @@ enum extra_peer_verification
71 71
72#ifdef WINDOWSNT 72#ifdef WINDOWSNT
73 73
74/* Macro for defining functions that will be loaded from the GnuTLS DLL. */ 74DEF_DLL_FN (gnutls_alert_description_t, gnutls_alert_get,
75#define DEF_GNUTLS_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args 75 (gnutls_session_t));
76 76DEF_DLL_FN (const char *, gnutls_alert_get_name,
77/* Macro for loading GnuTLS functions from the library. */ 77 (gnutls_alert_description_t));
78#define LOAD_GNUTLS_FN(lib,func) { \ 78DEF_DLL_FN (int, gnutls_alert_send_appropriate, (gnutls_session_t, int));
79 fn_##func = (void *) GetProcAddress (lib, #func); \ 79DEF_DLL_FN (int, gnutls_anon_allocate_client_credentials,
80 if (!fn_##func) return 0; \ 80 (gnutls_anon_client_credentials_t *));
81 } 81DEF_DLL_FN (void, gnutls_anon_free_client_credentials,
82 82 (gnutls_anon_client_credentials_t));
83DEF_GNUTLS_FN (gnutls_alert_description_t, gnutls_alert_get, 83DEF_DLL_FN (int, gnutls_bye, (gnutls_session_t, gnutls_close_request_t));
84 (gnutls_session_t)); 84DEF_DLL_FN (int, gnutls_certificate_allocate_credentials,
85DEF_GNUTLS_FN (const char *, gnutls_alert_get_name, 85 (gnutls_certificate_credentials_t *));
86 (gnutls_alert_description_t)); 86DEF_DLL_FN (void, gnutls_certificate_free_credentials,
87DEF_GNUTLS_FN (int, gnutls_alert_send_appropriate, (gnutls_session_t, int)); 87 (gnutls_certificate_credentials_t));
88DEF_GNUTLS_FN (int, gnutls_anon_allocate_client_credentials, 88DEF_DLL_FN (const gnutls_datum_t *, gnutls_certificate_get_peers,
89 (gnutls_anon_client_credentials_t *)); 89 (gnutls_session_t, unsigned int *));
90DEF_GNUTLS_FN (void, gnutls_anon_free_client_credentials, 90DEF_DLL_FN (void, gnutls_certificate_set_verify_flags,
91 (gnutls_anon_client_credentials_t)); 91 (gnutls_certificate_credentials_t, unsigned int));
92DEF_GNUTLS_FN (int, gnutls_bye, (gnutls_session_t, gnutls_close_request_t)); 92DEF_DLL_FN (int, gnutls_certificate_set_x509_crl_file,
93DEF_GNUTLS_FN (int, gnutls_certificate_allocate_credentials, 93 (gnutls_certificate_credentials_t, const char *,
94 (gnutls_certificate_credentials_t *)); 94 gnutls_x509_crt_fmt_t));
95DEF_GNUTLS_FN (void, gnutls_certificate_free_credentials, 95DEF_DLL_FN (int, gnutls_certificate_set_x509_key_file,
96 (gnutls_certificate_credentials_t)); 96 (gnutls_certificate_credentials_t, const char *, const char *,
97DEF_GNUTLS_FN (const gnutls_datum_t *, gnutls_certificate_get_peers, 97 gnutls_x509_crt_fmt_t));
98 (gnutls_session_t, unsigned int *)); 98# if ((GNUTLS_VERSION_MAJOR \
99DEF_GNUTLS_FN (void, gnutls_certificate_set_verify_flags, 99 + (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20)) \
100 (gnutls_certificate_credentials_t, unsigned int)); 100 > 3)
101DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_crl_file, 101DEF_DLL_FN (int, gnutls_certificate_set_x509_system_trust,
102 (gnutls_certificate_credentials_t, const char *, 102 (gnutls_certificate_credentials_t));
103 gnutls_x509_crt_fmt_t)); 103# endif
104DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_key_file, 104DEF_DLL_FN (int, gnutls_certificate_set_x509_trust_file,
105 (gnutls_certificate_credentials_t, const char *, const char *, 105 (gnutls_certificate_credentials_t, const char *,
106 gnutls_x509_crt_fmt_t)); 106 gnutls_x509_crt_fmt_t));
107#if GNUTLS_VERSION_MAJOR + \ 107DEF_DLL_FN (gnutls_certificate_type_t, gnutls_certificate_type_get,
108 (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20) > 3 108 (gnutls_session_t));
109DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_system_trust, 109DEF_DLL_FN (int, gnutls_certificate_verify_peers2,
110 (gnutls_certificate_credentials_t)); 110 (gnutls_session_t, unsigned int *));
111#endif 111DEF_DLL_FN (int, gnutls_credentials_set,
112DEF_GNUTLS_FN (int, gnutls_certificate_set_x509_trust_file, 112 (gnutls_session_t, gnutls_credentials_type_t, void *));
113 (gnutls_certificate_credentials_t, const char *, 113DEF_DLL_FN (void, gnutls_deinit, (gnutls_session_t));
114 gnutls_x509_crt_fmt_t)); 114DEF_DLL_FN (void, gnutls_dh_set_prime_bits,
115DEF_GNUTLS_FN (gnutls_certificate_type_t, gnutls_certificate_type_get, 115 (gnutls_session_t, unsigned int));
116 (gnutls_session_t)); 116DEF_DLL_FN (int, gnutls_dh_get_prime_bits, (gnutls_session_t));
117DEF_GNUTLS_FN (int, gnutls_certificate_verify_peers2, 117DEF_DLL_FN (int, gnutls_error_is_fatal, (int));
118 (gnutls_session_t, unsigned int *)); 118DEF_DLL_FN (int, gnutls_global_init, (void));
119DEF_GNUTLS_FN (int, gnutls_credentials_set, 119DEF_DLL_FN (void, gnutls_global_set_log_function, (gnutls_log_func));
120 (gnutls_session_t, gnutls_credentials_type_t, void *)); 120# ifdef HAVE_GNUTLS3
121DEF_GNUTLS_FN (void, gnutls_deinit, (gnutls_session_t)); 121DEF_DLL_FN (void, gnutls_global_set_audit_log_function, (gnutls_audit_log_func));
122DEF_GNUTLS_FN (void, gnutls_dh_set_prime_bits, 122# endif
123 (gnutls_session_t, unsigned int)); 123DEF_DLL_FN (void, gnutls_global_set_log_level, (int));
124DEF_GNUTLS_FN (int, gnutls_dh_get_prime_bits, (gnutls_session_t)); 124DEF_DLL_FN (int, gnutls_handshake, (gnutls_session_t));
125DEF_GNUTLS_FN (int, gnutls_error_is_fatal, (int)); 125DEF_DLL_FN (int, gnutls_init, (gnutls_session_t *, unsigned int));
126DEF_GNUTLS_FN (int, gnutls_global_init, (void)); 126DEF_DLL_FN (int, gnutls_priority_set_direct,
127DEF_GNUTLS_FN (void, gnutls_global_set_log_function, (gnutls_log_func)); 127 (gnutls_session_t, const char *, const char **));
128#ifdef HAVE_GNUTLS3 128DEF_DLL_FN (size_t, gnutls_record_check_pending, (gnutls_session_t));
129DEF_GNUTLS_FN (void, gnutls_global_set_audit_log_function, (gnutls_audit_log_func)); 129DEF_DLL_FN (ssize_t, gnutls_record_recv, (gnutls_session_t, void *, size_t));
130#endif 130DEF_DLL_FN (ssize_t, gnutls_record_send,
131DEF_GNUTLS_FN (void, gnutls_global_set_log_level, (int)); 131 (gnutls_session_t, const void *, size_t));
132DEF_GNUTLS_FN (void, gnutls_global_set_mem_functions, 132DEF_DLL_FN (const char *, gnutls_strerror, (int));
133 (gnutls_alloc_function, gnutls_alloc_function, 133DEF_DLL_FN (void, gnutls_transport_set_errno, (gnutls_session_t, int));
134 gnutls_is_secure_function, gnutls_realloc_function, 134DEF_DLL_FN (const char *, gnutls_check_version, (const char *));
135 gnutls_free_function)); 135DEF_DLL_FN (void, gnutls_transport_set_lowat, (gnutls_session_t, int));
136DEF_GNUTLS_FN (int, gnutls_handshake, (gnutls_session_t)); 136DEF_DLL_FN (void, gnutls_transport_set_ptr2,
137DEF_GNUTLS_FN (int, gnutls_init, (gnutls_session_t *, gnutls_connection_end_t)); 137 (gnutls_session_t, gnutls_transport_ptr_t,
138DEF_GNUTLS_FN (int, gnutls_priority_set_direct, 138 gnutls_transport_ptr_t));
139 (gnutls_session_t, const char *, const char **)); 139DEF_DLL_FN (void, gnutls_transport_set_pull_function,
140DEF_GNUTLS_FN (size_t, gnutls_record_check_pending, (gnutls_session_t)); 140 (gnutls_session_t, gnutls_pull_func));
141DEF_GNUTLS_FN (ssize_t, gnutls_record_recv, (gnutls_session_t, void *, size_t)); 141DEF_DLL_FN (void, gnutls_transport_set_push_function,
142DEF_GNUTLS_FN (ssize_t, gnutls_record_send, 142 (gnutls_session_t, gnutls_push_func));
143 (gnutls_session_t, const void *, size_t)); 143DEF_DLL_FN (int, gnutls_x509_crt_check_hostname,
144DEF_GNUTLS_FN (const char *, gnutls_strerror, (int)); 144 (gnutls_x509_crt_t, const char *));
145DEF_GNUTLS_FN (void, gnutls_transport_set_errno, (gnutls_session_t, int)); 145DEF_DLL_FN (void, gnutls_x509_crt_deinit, (gnutls_x509_crt_t));
146DEF_GNUTLS_FN (const char *, gnutls_check_version, (const char *)); 146DEF_DLL_FN (int, gnutls_x509_crt_import,
147DEF_GNUTLS_FN (void, gnutls_transport_set_lowat, (gnutls_session_t, int)); 147 (gnutls_x509_crt_t, const gnutls_datum_t *,
148DEF_GNUTLS_FN (void, gnutls_transport_set_ptr2, 148 gnutls_x509_crt_fmt_t));
149 (gnutls_session_t, gnutls_transport_ptr_t, 149DEF_DLL_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *));
150 gnutls_transport_ptr_t)); 150DEF_DLL_FN (int, gnutls_x509_crt_get_fingerprint,
151DEF_GNUTLS_FN (void, gnutls_transport_set_pull_function, 151 (gnutls_x509_crt_t,
152 (gnutls_session_t, gnutls_pull_func)); 152 gnutls_digest_algorithm_t, void *, size_t *));
153DEF_GNUTLS_FN (void, gnutls_transport_set_push_function, 153DEF_DLL_FN (int, gnutls_x509_crt_get_version,
154 (gnutls_session_t, gnutls_push_func)); 154 (gnutls_x509_crt_t));
155DEF_GNUTLS_FN (int, gnutls_x509_crt_check_hostname, 155DEF_DLL_FN (int, gnutls_x509_crt_get_serial,
156 (gnutls_x509_crt_t, const char *)); 156 (gnutls_x509_crt_t, void *, size_t *));
157DEF_GNUTLS_FN (void, gnutls_x509_crt_deinit, (gnutls_x509_crt_t)); 157DEF_DLL_FN (int, gnutls_x509_crt_get_issuer_dn,
158DEF_GNUTLS_FN (int, gnutls_x509_crt_import, 158 (gnutls_x509_crt_t, char *, size_t *));
159 (gnutls_x509_crt_t, const gnutls_datum_t *, 159DEF_DLL_FN (time_t, gnutls_x509_crt_get_activation_time,
160 gnutls_x509_crt_fmt_t)); 160 (gnutls_x509_crt_t));
161DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); 161DEF_DLL_FN (time_t, gnutls_x509_crt_get_expiration_time,
162DEF_GNUTLS_FN (int, gnutls_x509_crt_get_fingerprint, 162 (gnutls_x509_crt_t));
163 (gnutls_x509_crt_t, 163DEF_DLL_FN (int, gnutls_x509_crt_get_dn,
164 gnutls_digest_algorithm_t, void *, size_t *)); 164 (gnutls_x509_crt_t, char *, size_t *));
165DEF_GNUTLS_FN (int, gnutls_x509_crt_get_version, 165DEF_DLL_FN (int, gnutls_x509_crt_get_pk_algorithm,
166 (gnutls_x509_crt_t)); 166 (gnutls_x509_crt_t, unsigned int *));
167DEF_GNUTLS_FN (int, gnutls_x509_crt_get_serial, 167DEF_DLL_FN (const char*, gnutls_pk_algorithm_get_name,
168 (gnutls_x509_crt_t, void *, size_t *)); 168 (gnutls_pk_algorithm_t));
169DEF_GNUTLS_FN (int, gnutls_x509_crt_get_issuer_dn, 169DEF_DLL_FN (int, gnutls_pk_bits_to_sec_param,
170 (gnutls_x509_crt_t, char *, size_t *)); 170 (gnutls_pk_algorithm_t, unsigned int));
171DEF_GNUTLS_FN (time_t, gnutls_x509_crt_get_activation_time, 171DEF_DLL_FN (int, gnutls_x509_crt_get_issuer_unique_id,
172 (gnutls_x509_crt_t)); 172 (gnutls_x509_crt_t, char *, size_t *));
173DEF_GNUTLS_FN (time_t, gnutls_x509_crt_get_expiration_time, 173DEF_DLL_FN (int, gnutls_x509_crt_get_subject_unique_id,
174 (gnutls_x509_crt_t)); 174 (gnutls_x509_crt_t, char *, size_t *));
175DEF_GNUTLS_FN (int, gnutls_x509_crt_get_dn, 175DEF_DLL_FN (int, gnutls_x509_crt_get_signature_algorithm,
176 (gnutls_x509_crt_t, char *, size_t *)); 176 (gnutls_x509_crt_t));
177DEF_GNUTLS_FN (int, gnutls_x509_crt_get_pk_algorithm, 177DEF_DLL_FN (int, gnutls_x509_crt_get_signature,
178 (gnutls_x509_crt_t, unsigned int *)); 178 (gnutls_x509_crt_t, char *, size_t *));
179DEF_GNUTLS_FN (const char*, gnutls_pk_algorithm_get_name, 179DEF_DLL_FN (int, gnutls_x509_crt_get_key_id,
180 (gnutls_pk_algorithm_t)); 180 (gnutls_x509_crt_t, unsigned int, unsigned char *, size_t *_size));
181DEF_GNUTLS_FN (int, gnutls_pk_bits_to_sec_param, 181DEF_DLL_FN (const char*, gnutls_sec_param_get_name, (gnutls_sec_param_t));
182 (gnutls_pk_algorithm_t, unsigned int)); 182DEF_DLL_FN (const char*, gnutls_sign_get_name, (gnutls_sign_algorithm_t));
183DEF_GNUTLS_FN (int, gnutls_x509_crt_get_issuer_unique_id, 183DEF_DLL_FN (int, gnutls_server_name_set,
184 (gnutls_x509_crt_t, char *, size_t *)); 184 (gnutls_session_t, gnutls_server_name_type_t,
185DEF_GNUTLS_FN (int, gnutls_x509_crt_get_subject_unique_id, 185 const void *, size_t));
186 (gnutls_x509_crt_t, char *, size_t *)); 186DEF_DLL_FN (gnutls_kx_algorithm_t, gnutls_kx_get, (gnutls_session_t));
187DEF_GNUTLS_FN (int, gnutls_x509_crt_get_signature_algorithm, 187DEF_DLL_FN (const char*, gnutls_kx_get_name, (gnutls_kx_algorithm_t));
188 (gnutls_x509_crt_t)); 188DEF_DLL_FN (gnutls_protocol_t, gnutls_protocol_get_version,
189DEF_GNUTLS_FN (int, gnutls_x509_crt_get_signature, 189 (gnutls_session_t));
190 (gnutls_x509_crt_t, char *, size_t *)); 190DEF_DLL_FN (const char*, gnutls_protocol_get_name, (gnutls_protocol_t));
191DEF_GNUTLS_FN (int, gnutls_x509_crt_get_key_id, 191DEF_DLL_FN (gnutls_cipher_algorithm_t, gnutls_cipher_get,
192 (gnutls_x509_crt_t, unsigned int, 192 (gnutls_session_t));
193 unsigned char *, size_t *_size)); 193DEF_DLL_FN (const char*, gnutls_cipher_get_name,
194DEF_GNUTLS_FN (const char*, gnutls_sec_param_get_name, (gnutls_sec_param_t)); 194 (gnutls_cipher_algorithm_t));
195DEF_GNUTLS_FN (const char*, gnutls_sign_get_name, (gnutls_sign_algorithm_t)); 195DEF_DLL_FN (gnutls_mac_algorithm_t, gnutls_mac_get, (gnutls_session_t));
196DEF_GNUTLS_FN (int, gnutls_server_name_set, (gnutls_session_t, 196DEF_DLL_FN (const char*, gnutls_mac_get_name, (gnutls_mac_algorithm_t));
197 gnutls_server_name_type_t,
198 const void *, size_t));
199DEF_GNUTLS_FN (gnutls_kx_algorithm_t, gnutls_kx_get, (gnutls_session_t));
200DEF_GNUTLS_FN (const char*, gnutls_kx_get_name, (gnutls_kx_algorithm_t));
201DEF_GNUTLS_FN (gnutls_protocol_t, gnutls_protocol_get_version,
202 (gnutls_session_t));
203DEF_GNUTLS_FN (const char*, gnutls_protocol_get_name, (gnutls_protocol_t));
204DEF_GNUTLS_FN (gnutls_cipher_algorithm_t, gnutls_cipher_get,
205 (gnutls_session_t));
206DEF_GNUTLS_FN (const char*, gnutls_cipher_get_name,
207 (gnutls_cipher_algorithm_t));
208DEF_GNUTLS_FN (gnutls_mac_algorithm_t, gnutls_mac_get, (gnutls_session_t));
209DEF_GNUTLS_FN (const char*, gnutls_mac_get_name, (gnutls_mac_algorithm_t));
210 197
211 198
212static bool 199static bool
@@ -221,83 +208,83 @@ init_gnutls_functions (void)
221 return 0; 208 return 0;
222 } 209 }
223 210
224 LOAD_GNUTLS_FN (library, gnutls_alert_get); 211 LOAD_DLL_FN (library, gnutls_alert_get);
225 LOAD_GNUTLS_FN (library, gnutls_alert_get_name); 212 LOAD_DLL_FN (library, gnutls_alert_get_name);
226 LOAD_GNUTLS_FN (library, gnutls_alert_send_appropriate); 213 LOAD_DLL_FN (library, gnutls_alert_send_appropriate);
227 LOAD_GNUTLS_FN (library, gnutls_anon_allocate_client_credentials); 214 LOAD_DLL_FN (library, gnutls_anon_allocate_client_credentials);
228 LOAD_GNUTLS_FN (library, gnutls_anon_free_client_credentials); 215 LOAD_DLL_FN (library, gnutls_anon_free_client_credentials);
229 LOAD_GNUTLS_FN (library, gnutls_bye); 216 LOAD_DLL_FN (library, gnutls_bye);
230 LOAD_GNUTLS_FN (library, gnutls_certificate_allocate_credentials); 217 LOAD_DLL_FN (library, gnutls_certificate_allocate_credentials);
231 LOAD_GNUTLS_FN (library, gnutls_certificate_free_credentials); 218 LOAD_DLL_FN (library, gnutls_certificate_free_credentials);
232 LOAD_GNUTLS_FN (library, gnutls_certificate_get_peers); 219 LOAD_DLL_FN (library, gnutls_certificate_get_peers);
233 LOAD_GNUTLS_FN (library, gnutls_certificate_set_verify_flags); 220 LOAD_DLL_FN (library, gnutls_certificate_set_verify_flags);
234 LOAD_GNUTLS_FN (library, gnutls_certificate_set_x509_crl_file); 221 LOAD_DLL_FN (library, gnutls_certificate_set_x509_crl_file);
235 LOAD_GNUTLS_FN (library, gnutls_certificate_set_x509_key_file); 222 LOAD_DLL_FN (library, gnutls_certificate_set_x509_key_file);
236#if GNUTLS_VERSION_MAJOR + \ 223# if ((GNUTLS_VERSION_MAJOR \
237 (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20) > 3 224 + (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20)) \
238 LOAD_GNUTLS_FN (library, gnutls_certificate_set_x509_system_trust); 225 > 3)
239#endif 226 LOAD_DLL_FN (library, gnutls_certificate_set_x509_system_trust);
240 LOAD_GNUTLS_FN (library, gnutls_certificate_set_x509_trust_file); 227# endif
241 LOAD_GNUTLS_FN (library, gnutls_certificate_type_get); 228 LOAD_DLL_FN (library, gnutls_certificate_set_x509_trust_file);
242 LOAD_GNUTLS_FN (library, gnutls_certificate_verify_peers2); 229 LOAD_DLL_FN (library, gnutls_certificate_type_get);
243 LOAD_GNUTLS_FN (library, gnutls_credentials_set); 230 LOAD_DLL_FN (library, gnutls_certificate_verify_peers2);
244 LOAD_GNUTLS_FN (library, gnutls_deinit); 231 LOAD_DLL_FN (library, gnutls_credentials_set);
245 LOAD_GNUTLS_FN (library, gnutls_dh_set_prime_bits); 232 LOAD_DLL_FN (library, gnutls_deinit);
246 LOAD_GNUTLS_FN (library, gnutls_dh_get_prime_bits); 233 LOAD_DLL_FN (library, gnutls_dh_set_prime_bits);
247 LOAD_GNUTLS_FN (library, gnutls_error_is_fatal); 234 LOAD_DLL_FN (library, gnutls_dh_get_prime_bits);
248 LOAD_GNUTLS_FN (library, gnutls_global_init); 235 LOAD_DLL_FN (library, gnutls_error_is_fatal);
249 LOAD_GNUTLS_FN (library, gnutls_global_set_log_function); 236 LOAD_DLL_FN (library, gnutls_global_init);
250#ifdef HAVE_GNUTLS3 237 LOAD_DLL_FN (library, gnutls_global_set_log_function);
251 LOAD_GNUTLS_FN (library, gnutls_global_set_audit_log_function); 238# ifdef HAVE_GNUTLS3
252#endif 239 LOAD_DLL_FN (library, gnutls_global_set_audit_log_function);
253 LOAD_GNUTLS_FN (library, gnutls_global_set_log_level); 240# endif
254 LOAD_GNUTLS_FN (library, gnutls_global_set_mem_functions); 241 LOAD_DLL_FN (library, gnutls_global_set_log_level);
255 LOAD_GNUTLS_FN (library, gnutls_handshake); 242 LOAD_DLL_FN (library, gnutls_handshake);
256 LOAD_GNUTLS_FN (library, gnutls_init); 243 LOAD_DLL_FN (library, gnutls_init);
257 LOAD_GNUTLS_FN (library, gnutls_priority_set_direct); 244 LOAD_DLL_FN (library, gnutls_priority_set_direct);
258 LOAD_GNUTLS_FN (library, gnutls_record_check_pending); 245 LOAD_DLL_FN (library, gnutls_record_check_pending);
259 LOAD_GNUTLS_FN (library, gnutls_record_recv); 246 LOAD_DLL_FN (library, gnutls_record_recv);
260 LOAD_GNUTLS_FN (library, gnutls_record_send); 247 LOAD_DLL_FN (library, gnutls_record_send);
261 LOAD_GNUTLS_FN (library, gnutls_strerror); 248 LOAD_DLL_FN (library, gnutls_strerror);
262 LOAD_GNUTLS_FN (library, gnutls_transport_set_errno); 249 LOAD_DLL_FN (library, gnutls_transport_set_errno);
263 LOAD_GNUTLS_FN (library, gnutls_check_version); 250 LOAD_DLL_FN (library, gnutls_check_version);
264 /* We don't need to call gnutls_transport_set_lowat in GnuTLS 2.11.1 251 /* We don't need to call gnutls_transport_set_lowat in GnuTLS 2.11.1
265 and later, and the function was removed entirely in 3.0.0. */ 252 and later, and the function was removed entirely in 3.0.0. */
266 if (!fn_gnutls_check_version ("2.11.1")) 253 if (!fn_gnutls_check_version ("2.11.1"))
267 LOAD_GNUTLS_FN (library, gnutls_transport_set_lowat); 254 LOAD_DLL_FN (library, gnutls_transport_set_lowat);
268 LOAD_GNUTLS_FN (library, gnutls_transport_set_ptr2); 255 LOAD_DLL_FN (library, gnutls_transport_set_ptr2);
269 LOAD_GNUTLS_FN (library, gnutls_transport_set_pull_function); 256 LOAD_DLL_FN (library, gnutls_transport_set_pull_function);
270 LOAD_GNUTLS_FN (library, gnutls_transport_set_push_function); 257 LOAD_DLL_FN (library, gnutls_transport_set_push_function);
271 LOAD_GNUTLS_FN (library, gnutls_x509_crt_check_hostname); 258 LOAD_DLL_FN (library, gnutls_x509_crt_check_hostname);
272 LOAD_GNUTLS_FN (library, gnutls_x509_crt_deinit); 259 LOAD_DLL_FN (library, gnutls_x509_crt_deinit);
273 LOAD_GNUTLS_FN (library, gnutls_x509_crt_import); 260 LOAD_DLL_FN (library, gnutls_x509_crt_import);
274 LOAD_GNUTLS_FN (library, gnutls_x509_crt_init); 261 LOAD_DLL_FN (library, gnutls_x509_crt_init);
275 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_fingerprint); 262 LOAD_DLL_FN (library, gnutls_x509_crt_get_fingerprint);
276 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_version); 263 LOAD_DLL_FN (library, gnutls_x509_crt_get_version);
277 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_serial); 264 LOAD_DLL_FN (library, gnutls_x509_crt_get_serial);
278 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_issuer_dn); 265 LOAD_DLL_FN (library, gnutls_x509_crt_get_issuer_dn);
279 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_activation_time); 266 LOAD_DLL_FN (library, gnutls_x509_crt_get_activation_time);
280 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_expiration_time); 267 LOAD_DLL_FN (library, gnutls_x509_crt_get_expiration_time);
281 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_dn); 268 LOAD_DLL_FN (library, gnutls_x509_crt_get_dn);
282 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_pk_algorithm); 269 LOAD_DLL_FN (library, gnutls_x509_crt_get_pk_algorithm);
283 LOAD_GNUTLS_FN (library, gnutls_pk_algorithm_get_name); 270 LOAD_DLL_FN (library, gnutls_pk_algorithm_get_name);
284 LOAD_GNUTLS_FN (library, gnutls_pk_bits_to_sec_param); 271 LOAD_DLL_FN (library, gnutls_pk_bits_to_sec_param);
285 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_issuer_unique_id); 272 LOAD_DLL_FN (library, gnutls_x509_crt_get_issuer_unique_id);
286 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_subject_unique_id); 273 LOAD_DLL_FN (library, gnutls_x509_crt_get_subject_unique_id);
287 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_signature_algorithm); 274 LOAD_DLL_FN (library, gnutls_x509_crt_get_signature_algorithm);
288 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_signature); 275 LOAD_DLL_FN (library, gnutls_x509_crt_get_signature);
289 LOAD_GNUTLS_FN (library, gnutls_x509_crt_get_key_id); 276 LOAD_DLL_FN (library, gnutls_x509_crt_get_key_id);
290 LOAD_GNUTLS_FN (library, gnutls_sec_param_get_name); 277 LOAD_DLL_FN (library, gnutls_sec_param_get_name);
291 LOAD_GNUTLS_FN (library, gnutls_sign_get_name); 278 LOAD_DLL_FN (library, gnutls_sign_get_name);
292 LOAD_GNUTLS_FN (library, gnutls_server_name_set); 279 LOAD_DLL_FN (library, gnutls_server_name_set);
293 LOAD_GNUTLS_FN (library, gnutls_kx_get); 280 LOAD_DLL_FN (library, gnutls_kx_get);
294 LOAD_GNUTLS_FN (library, gnutls_kx_get_name); 281 LOAD_DLL_FN (library, gnutls_kx_get_name);
295 LOAD_GNUTLS_FN (library, gnutls_protocol_get_version); 282 LOAD_DLL_FN (library, gnutls_protocol_get_version);
296 LOAD_GNUTLS_FN (library, gnutls_protocol_get_name); 283 LOAD_DLL_FN (library, gnutls_protocol_get_name);
297 LOAD_GNUTLS_FN (library, gnutls_cipher_get); 284 LOAD_DLL_FN (library, gnutls_cipher_get);
298 LOAD_GNUTLS_FN (library, gnutls_cipher_get_name); 285 LOAD_DLL_FN (library, gnutls_cipher_get_name);
299 LOAD_GNUTLS_FN (library, gnutls_mac_get); 286 LOAD_DLL_FN (library, gnutls_mac_get);
300 LOAD_GNUTLS_FN (library, gnutls_mac_get_name); 287 LOAD_DLL_FN (library, gnutls_mac_get_name);
301 288
302 max_log_level = global_gnutls_log_level; 289 max_log_level = global_gnutls_log_level;
303 290
@@ -310,80 +297,89 @@ init_gnutls_functions (void)
310 return 1; 297 return 1;
311} 298}
312 299
313#else /* !WINDOWSNT */ 300# define gnutls_alert_get fn_gnutls_alert_get
314 301# define gnutls_alert_get_name fn_gnutls_alert_get_name
315#define fn_gnutls_alert_get gnutls_alert_get 302# define gnutls_alert_send_appropriate fn_gnutls_alert_send_appropriate
316#define fn_gnutls_alert_get_name gnutls_alert_get_name 303# define gnutls_anon_allocate_client_credentials fn_gnutls_anon_allocate_client_credentials
317#define fn_gnutls_alert_send_appropriate gnutls_alert_send_appropriate 304# define gnutls_anon_free_client_credentials fn_gnutls_anon_free_client_credentials
318#define fn_gnutls_anon_allocate_client_credentials gnutls_anon_allocate_client_credentials 305# define gnutls_bye fn_gnutls_bye
319#define fn_gnutls_anon_free_client_credentials gnutls_anon_free_client_credentials 306# define gnutls_certificate_allocate_credentials fn_gnutls_certificate_allocate_credentials
320#define fn_gnutls_bye gnutls_bye 307# define gnutls_certificate_free_credentials fn_gnutls_certificate_free_credentials
321#define fn_gnutls_certificate_allocate_credentials gnutls_certificate_allocate_credentials 308# define gnutls_certificate_get_peers fn_gnutls_certificate_get_peers
322#define fn_gnutls_certificate_free_credentials gnutls_certificate_free_credentials 309# define gnutls_certificate_set_verify_flags fn_gnutls_certificate_set_verify_flags
323#define fn_gnutls_certificate_get_peers gnutls_certificate_get_peers 310# define gnutls_certificate_set_x509_crl_file fn_gnutls_certificate_set_x509_crl_file
324#define fn_gnutls_certificate_set_verify_flags gnutls_certificate_set_verify_flags 311# define gnutls_certificate_set_x509_key_file fn_gnutls_certificate_set_x509_key_file
325#define fn_gnutls_certificate_set_x509_crl_file gnutls_certificate_set_x509_crl_file 312# define gnutls_certificate_set_x509_system_trust fn_gnutls_certificate_set_x509_system_trust
326#define fn_gnutls_certificate_set_x509_key_file gnutls_certificate_set_x509_key_file 313# define gnutls_certificate_set_x509_trust_file fn_gnutls_certificate_set_x509_trust_file
327#if GNUTLS_VERSION_MAJOR + \ 314# define gnutls_certificate_type_get fn_gnutls_certificate_type_get
328 (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20) > 3 315# define gnutls_certificate_verify_peers2 fn_gnutls_certificate_verify_peers2
329#define fn_gnutls_certificate_set_x509_system_trust gnutls_certificate_set_x509_system_trust 316# define gnutls_check_version fn_gnutls_check_version
330#endif 317# define gnutls_cipher_get fn_gnutls_cipher_get
331#define fn_gnutls_certificate_set_x509_trust_file gnutls_certificate_set_x509_trust_file 318# define gnutls_cipher_get_name fn_gnutls_cipher_get_name
332#define fn_gnutls_certificate_type_get gnutls_certificate_type_get 319# define gnutls_credentials_set fn_gnutls_credentials_set
333#define fn_gnutls_certificate_verify_peers2 gnutls_certificate_verify_peers2 320# define gnutls_deinit fn_gnutls_deinit
334#define fn_gnutls_cipher_get gnutls_cipher_get 321# define gnutls_dh_get_prime_bits fn_gnutls_dh_get_prime_bits
335#define fn_gnutls_cipher_get_name gnutls_cipher_get_name 322# define gnutls_dh_set_prime_bits fn_gnutls_dh_set_prime_bits
336#define fn_gnutls_credentials_set gnutls_credentials_set 323# define gnutls_error_is_fatal fn_gnutls_error_is_fatal
337#define fn_gnutls_deinit gnutls_deinit 324# define gnutls_global_init fn_gnutls_global_init
338#define fn_gnutls_dh_get_prime_bits gnutls_dh_get_prime_bits 325# define gnutls_global_set_audit_log_function fn_gnutls_global_set_audit_log_function
339#define fn_gnutls_dh_set_prime_bits gnutls_dh_set_prime_bits 326# define gnutls_global_set_log_function fn_gnutls_global_set_log_function
340#define fn_gnutls_error_is_fatal gnutls_error_is_fatal 327# define gnutls_global_set_log_level fn_gnutls_global_set_log_level
341#define fn_gnutls_global_init gnutls_global_init 328# define gnutls_handshake fn_gnutls_handshake
342#ifdef HAVE_GNUTLS3 329# define gnutls_init fn_gnutls_init
343#define fn_gnutls_global_set_audit_log_function gnutls_global_set_audit_log_function 330# define gnutls_kx_get fn_gnutls_kx_get
331# define gnutls_kx_get_name fn_gnutls_kx_get_name
332# define gnutls_mac_get fn_gnutls_mac_get
333# define gnutls_mac_get_name fn_gnutls_mac_get_name
334# define gnutls_pk_algorithm_get_name fn_gnutls_pk_algorithm_get_name
335# define gnutls_pk_bits_to_sec_param fn_gnutls_pk_bits_to_sec_param
336# define gnutls_priority_set_direct fn_gnutls_priority_set_direct
337# define gnutls_protocol_get_name fn_gnutls_protocol_get_name
338# define gnutls_protocol_get_version fn_gnutls_protocol_get_version
339# define gnutls_record_check_pending fn_gnutls_record_check_pending
340# define gnutls_record_recv fn_gnutls_record_recv
341# define gnutls_record_send fn_gnutls_record_send
342# define gnutls_sec_param_get_name fn_gnutls_sec_param_get_name
343# define gnutls_server_name_set fn_gnutls_server_name_set
344# define gnutls_sign_get_name fn_gnutls_sign_get_name
345# define gnutls_strerror fn_gnutls_strerror
346# define gnutls_transport_set_errno fn_gnutls_transport_set_errno
347# define gnutls_transport_set_lowat fn_gnutls_transport_set_lowat
348# define gnutls_transport_set_ptr2 fn_gnutls_transport_set_ptr2
349# define gnutls_transport_set_pull_function fn_gnutls_transport_set_pull_function
350# define gnutls_transport_set_push_function fn_gnutls_transport_set_push_function
351# define gnutls_x509_crt_check_hostname fn_gnutls_x509_crt_check_hostname
352# define gnutls_x509_crt_deinit fn_gnutls_x509_crt_deinit
353# define gnutls_x509_crt_get_activation_time fn_gnutls_x509_crt_get_activation_time
354# define gnutls_x509_crt_get_dn fn_gnutls_x509_crt_get_dn
355# define gnutls_x509_crt_get_expiration_time fn_gnutls_x509_crt_get_expiration_time
356# define gnutls_x509_crt_get_fingerprint fn_gnutls_x509_crt_get_fingerprint
357# define gnutls_x509_crt_get_issuer_dn fn_gnutls_x509_crt_get_issuer_dn
358# define gnutls_x509_crt_get_issuer_unique_id fn_gnutls_x509_crt_get_issuer_unique_id
359# define gnutls_x509_crt_get_key_id fn_gnutls_x509_crt_get_key_id
360# define gnutls_x509_crt_get_pk_algorithm fn_gnutls_x509_crt_get_pk_algorithm
361# define gnutls_x509_crt_get_serial fn_gnutls_x509_crt_get_serial
362# define gnutls_x509_crt_get_signature fn_gnutls_x509_crt_get_signature
363# define gnutls_x509_crt_get_signature_algorithm fn_gnutls_x509_crt_get_signature_algorithm
364# define gnutls_x509_crt_get_subject_unique_id fn_gnutls_x509_crt_get_subject_unique_id
365# define gnutls_x509_crt_get_version fn_gnutls_x509_crt_get_version
366# define gnutls_x509_crt_import fn_gnutls_x509_crt_import
367# define gnutls_x509_crt_init fn_gnutls_x509_crt_init
368
344#endif 369#endif
345#define fn_gnutls_global_set_log_function gnutls_global_set_log_function
346#define fn_gnutls_global_set_log_level gnutls_global_set_log_level
347#define fn_gnutls_global_set_mem_functions gnutls_global_set_mem_functions
348#define fn_gnutls_handshake gnutls_handshake
349#define fn_gnutls_init gnutls_init
350#define fn_gnutls_kx_get gnutls_kx_get
351#define fn_gnutls_kx_get_name gnutls_kx_get_name
352#define fn_gnutls_mac_get gnutls_mac_get
353#define fn_gnutls_mac_get_name gnutls_mac_get_name
354#define fn_gnutls_pk_algorithm_get_name gnutls_pk_algorithm_get_name
355#define fn_gnutls_pk_bits_to_sec_param gnutls_pk_bits_to_sec_param
356#define fn_gnutls_priority_set_direct gnutls_priority_set_direct
357#define fn_gnutls_protocol_get_name gnutls_protocol_get_name
358#define fn_gnutls_protocol_get_version gnutls_protocol_get_version
359#define fn_gnutls_record_check_pending gnutls_record_check_pending
360#define fn_gnutls_record_recv gnutls_record_recv
361#define fn_gnutls_record_send gnutls_record_send
362#define fn_gnutls_sec_param_get_name gnutls_sec_param_get_name
363#define fn_gnutls_server_name_set gnutls_server_name_set
364#define fn_gnutls_sign_get_name gnutls_sign_get_name
365#define fn_gnutls_strerror gnutls_strerror
366#define fn_gnutls_transport_set_ptr2 gnutls_transport_set_ptr2
367#define fn_gnutls_x509_crt_check_hostname gnutls_x509_crt_check_hostname
368#define fn_gnutls_x509_crt_deinit gnutls_x509_crt_deinit
369#define fn_gnutls_x509_crt_get_activation_time gnutls_x509_crt_get_activation_time
370#define fn_gnutls_x509_crt_get_dn gnutls_x509_crt_get_dn
371#define fn_gnutls_x509_crt_get_expiration_time gnutls_x509_crt_get_expiration_time
372#define fn_gnutls_x509_crt_get_fingerprint gnutls_x509_crt_get_fingerprint
373#define fn_gnutls_x509_crt_get_issuer_dn gnutls_x509_crt_get_issuer_dn
374#define fn_gnutls_x509_crt_get_issuer_unique_id gnutls_x509_crt_get_issuer_unique_id
375#define fn_gnutls_x509_crt_get_key_id gnutls_x509_crt_get_key_id
376#define fn_gnutls_x509_crt_get_pk_algorithm gnutls_x509_crt_get_pk_algorithm
377#define fn_gnutls_x509_crt_get_serial gnutls_x509_crt_get_serial
378#define fn_gnutls_x509_crt_get_signature_algorithm gnutls_x509_crt_get_signature_algorithm
379#define fn_gnutls_x509_crt_get_subject_unique_id gnutls_x509_crt_get_subject_unique_id
380#define fn_gnutls_x509_crt_get_version gnutls_x509_crt_get_version
381#define fn_gnutls_x509_crt_import gnutls_x509_crt_import
382#define fn_gnutls_x509_crt_init gnutls_x509_crt_init
383
384#endif /* !WINDOWSNT */
385 370
386 371
372/* Report memory exhaustion if ERR is an out-of-memory indication. */
373static void
374check_memory_full (int err)
375{
376 /* When GnuTLS exhausts memory, it doesn't say how much memory it
377 asked for, so tell the Emacs allocator that GnuTLS asked for no
378 bytes. This isn't accurate, but it's good enough. */
379 if (err == GNUTLS_E_MEMORY_ERROR)
380 memory_full (0);
381}
382
387#ifdef HAVE_GNUTLS3 383#ifdef HAVE_GNUTLS3
388/* Log a simple audit message. */ 384/* Log a simple audit message. */
389static void 385static void
@@ -432,11 +428,11 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
432 /* On W32 we cannot transfer socket handles between different runtime 428 /* On W32 we cannot transfer socket handles between different runtime
433 libraries, so we tell GnuTLS to use our special push/pull 429 libraries, so we tell GnuTLS to use our special push/pull
434 functions. */ 430 functions. */
435 fn_gnutls_transport_set_ptr2 (state, 431 gnutls_transport_set_ptr2 (state,
436 (gnutls_transport_ptr_t) proc, 432 (gnutls_transport_ptr_t) proc,
437 (gnutls_transport_ptr_t) proc); 433 (gnutls_transport_ptr_t) proc);
438 fn_gnutls_transport_set_push_function (state, &emacs_gnutls_push); 434 gnutls_transport_set_push_function (state, &emacs_gnutls_push);
439 fn_gnutls_transport_set_pull_function (state, &emacs_gnutls_pull); 435 gnutls_transport_set_pull_function (state, &emacs_gnutls_pull);
440 436
441 /* For non blocking sockets or other custom made pull/push 437 /* For non blocking sockets or other custom made pull/push
442 functions the gnutls_transport_set_lowat must be called, with 438 functions the gnutls_transport_set_lowat must be called, with
@@ -449,15 +445,15 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
449 zero by default in version 2.11.1, and the function 445 zero by default in version 2.11.1, and the function
450 gnutls_transport_set_lowat was removed from the library in 446 gnutls_transport_set_lowat was removed from the library in
451 version 2.99.0. */ 447 version 2.99.0. */
452 if (!fn_gnutls_check_version ("2.11.1")) 448 if (!gnutls_check_version ("2.11.1"))
453 fn_gnutls_transport_set_lowat (state, 0); 449 gnutls_transport_set_lowat (state, 0);
454#else 450#else
455 /* This is how GnuTLS takes sockets: as file descriptors passed 451 /* This is how GnuTLS takes sockets: as file descriptors passed
456 in. For an Emacs process socket, infd and outfd are the 452 in. For an Emacs process socket, infd and outfd are the
457 same but we use this two-argument version for clarity. */ 453 same but we use this two-argument version for clarity. */
458 fn_gnutls_transport_set_ptr2 (state, 454 gnutls_transport_set_ptr2 (state,
459 (void *) (intptr_t) proc->infd, 455 (void *) (intptr_t) proc->infd,
460 (void *) (intptr_t) proc->outfd); 456 (void *) (intptr_t) proc->outfd);
461#endif 457#endif
462 458
463 proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET; 459 proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET;
@@ -465,11 +461,11 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
465 461
466 do 462 do
467 { 463 {
468 ret = fn_gnutls_handshake (state); 464 ret = gnutls_handshake (state);
469 emacs_gnutls_handle_error (state, ret); 465 emacs_gnutls_handle_error (state, ret);
470 QUIT; 466 QUIT;
471 } 467 }
472 while (ret < 0 && fn_gnutls_error_is_fatal (ret) == 0); 468 while (ret < 0 && gnutls_error_is_fatal (ret) == 0);
473 469
474 proc->gnutls_initstage = GNUTLS_STAGE_HANDSHAKE_TRIED; 470 proc->gnutls_initstage = GNUTLS_STAGE_HANDSHAKE_TRIED;
475 471
@@ -480,7 +476,7 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
480 } 476 }
481 else 477 else
482 { 478 {
483 fn_gnutls_alert_send_appropriate (state, ret); 479 check_memory_full (gnutls_alert_send_appropriate (state, ret));
484 } 480 }
485 return ret; 481 return ret;
486} 482}
@@ -488,14 +484,14 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
488ptrdiff_t 484ptrdiff_t
489emacs_gnutls_record_check_pending (gnutls_session_t state) 485emacs_gnutls_record_check_pending (gnutls_session_t state)
490{ 486{
491 return fn_gnutls_record_check_pending (state); 487 return gnutls_record_check_pending (state);
492} 488}
493 489
494#ifdef WINDOWSNT 490#ifdef WINDOWSNT
495void 491void
496emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) 492emacs_gnutls_transport_set_errno (gnutls_session_t state, int err)
497{ 493{
498 fn_gnutls_transport_set_errno (state, err); 494 gnutls_transport_set_errno (state, err);
499} 495}
500#endif 496#endif
501 497
@@ -516,7 +512,7 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte)
516 512
517 while (nbyte > 0) 513 while (nbyte > 0)
518 { 514 {
519 rtnval = fn_gnutls_record_send (state, buf, nbyte); 515 rtnval = gnutls_record_send (state, buf, nbyte);
520 516
521 if (rtnval < 0) 517 if (rtnval < 0)
522 { 518 {
@@ -568,7 +564,7 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
568 proc->gnutls_handshakes_tried = 0; 564 proc->gnutls_handshakes_tried = 0;
569 return 0; 565 return 0;
570 } 566 }
571 rtnval = fn_gnutls_record_recv (state, buf, nbyte); 567 rtnval = gnutls_record_recv (state, buf, nbyte);
572 if (rtnval >= 0) 568 if (rtnval >= 0)
573 return rtnval; 569 return rtnval;
574 else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH) 570 else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH)
@@ -597,15 +593,17 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
597 if (err >= 0) 593 if (err >= 0)
598 return 1; 594 return 1;
599 595
596 check_memory_full (err);
597
600 max_log_level = global_gnutls_log_level; 598 max_log_level = global_gnutls_log_level;
601 599
602 /* TODO: use gnutls-error-fatalp and gnutls-error-string. */ 600 /* TODO: use gnutls-error-fatalp and gnutls-error-string. */
603 601
604 str = fn_gnutls_strerror (err); 602 str = gnutls_strerror (err);
605 if (!str) 603 if (!str)
606 str = "unknown"; 604 str = "unknown";
607 605
608 if (fn_gnutls_error_is_fatal (err)) 606 if (gnutls_error_is_fatal (err))
609 { 607 {
610 ret = 0; 608 ret = 0;
611 GNUTLS_LOG2 (1, max_log_level, "fatal error:", str); 609 GNUTLS_LOG2 (1, max_log_level, "fatal error:", str);
@@ -632,9 +630,9 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
632 if (err == GNUTLS_E_WARNING_ALERT_RECEIVED 630 if (err == GNUTLS_E_WARNING_ALERT_RECEIVED
633 || err == GNUTLS_E_FATAL_ALERT_RECEIVED) 631 || err == GNUTLS_E_FATAL_ALERT_RECEIVED)
634 { 632 {
635 int alert = fn_gnutls_alert_get (session); 633 int alert = gnutls_alert_get (session);
636 int level = (err == GNUTLS_E_FATAL_ALERT_RECEIVED) ? 0 : 1; 634 int level = (err == GNUTLS_E_FATAL_ALERT_RECEIVED) ? 0 : 1;
637 str = fn_gnutls_alert_get_name (alert); 635 str = gnutls_alert_get_name (alert);
638 if (!str) 636 if (!str)
639 str = "unknown"; 637 str = "unknown";
640 638
@@ -662,6 +660,7 @@ gnutls_make_error (int err)
662 return Qgnutls_e_invalid_session; 660 return Qgnutls_e_invalid_session;
663 } 661 }
664 662
663 check_memory_full (err);
665 return make_number (err); 664 return make_number (err);
666} 665}
667 666
@@ -680,20 +679,20 @@ emacs_gnutls_deinit (Lisp_Object proc)
680 if (XPROCESS (proc)->gnutls_x509_cred) 679 if (XPROCESS (proc)->gnutls_x509_cred)
681 { 680 {
682 GNUTLS_LOG (2, log_level, "Deallocating x509 credentials"); 681 GNUTLS_LOG (2, log_level, "Deallocating x509 credentials");
683 fn_gnutls_certificate_free_credentials (XPROCESS (proc)->gnutls_x509_cred); 682 gnutls_certificate_free_credentials (XPROCESS (proc)->gnutls_x509_cred);
684 XPROCESS (proc)->gnutls_x509_cred = NULL; 683 XPROCESS (proc)->gnutls_x509_cred = NULL;
685 } 684 }
686 685
687 if (XPROCESS (proc)->gnutls_anon_cred) 686 if (XPROCESS (proc)->gnutls_anon_cred)
688 { 687 {
689 GNUTLS_LOG (2, log_level, "Deallocating anon credentials"); 688 GNUTLS_LOG (2, log_level, "Deallocating anon credentials");
690 fn_gnutls_anon_free_client_credentials (XPROCESS (proc)->gnutls_anon_cred); 689 gnutls_anon_free_client_credentials (XPROCESS (proc)->gnutls_anon_cred);
691 XPROCESS (proc)->gnutls_anon_cred = NULL; 690 XPROCESS (proc)->gnutls_anon_cred = NULL;
692 } 691 }
693 692
694 if (XPROCESS (proc)->gnutls_state) 693 if (XPROCESS (proc)->gnutls_state)
695 { 694 {
696 fn_gnutls_deinit (XPROCESS (proc)->gnutls_state); 695 gnutls_deinit (XPROCESS (proc)->gnutls_state);
697 XPROCESS (proc)->gnutls_state = NULL; 696 XPROCESS (proc)->gnutls_state = NULL;
698 if (GNUTLS_INITSTAGE (proc) >= GNUTLS_STAGE_INIT) 697 if (GNUTLS_INITSTAGE (proc) >= GNUTLS_STAGE_INIT)
699 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_INIT - 1; 698 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_INIT - 1;
@@ -750,7 +749,7 @@ Usage: (gnutls-error-fatalp ERROR) */)
750 if (! TYPE_RANGED_INTEGERP (int, err)) 749 if (! TYPE_RANGED_INTEGERP (int, err))
751 error ("Not an error symbol or code"); 750 error ("Not an error symbol or code");
752 751
753 if (0 == fn_gnutls_error_is_fatal (XINT (err))) 752 if (0 == gnutls_error_is_fatal (XINT (err)))
754 return Qnil; 753 return Qnil;
755 754
756 return Qt; 755 return Qt;
@@ -782,7 +781,7 @@ usage: (gnutls-error-string ERROR) */)
782 if (! TYPE_RANGED_INTEGERP (int, err)) 781 if (! TYPE_RANGED_INTEGERP (int, err))
783 return build_string ("Not an error symbol or code"); 782 return build_string ("Not an error symbol or code");
784 783
785 return build_string (fn_gnutls_strerror (XINT (err))); 784 return build_string (gnutls_strerror (XINT (err)));
786} 785}
787 786
788DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0, 787DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0,
@@ -821,7 +820,8 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
821 820
822 /* Version. */ 821 /* Version. */
823 { 822 {
824 int version = fn_gnutls_x509_crt_get_version (cert); 823 int version = gnutls_x509_crt_get_version (cert);
824 check_memory_full (version);
825 if (version >= GNUTLS_E_SUCCESS) 825 if (version >= GNUTLS_E_SUCCESS)
826 res = nconc2 (res, list2 (intern (":version"), 826 res = nconc2 (res, list2 (intern (":version"),
827 make_number (version))); 827 make_number (version)));
@@ -829,11 +829,13 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
829 829
830 /* Serial. */ 830 /* Serial. */
831 buf_size = 0; 831 buf_size = 0;
832 err = fn_gnutls_x509_crt_get_serial (cert, NULL, &buf_size); 832 err = gnutls_x509_crt_get_serial (cert, NULL, &buf_size);
833 check_memory_full (err);
833 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) 834 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER)
834 { 835 {
835 void *serial = xmalloc (buf_size); 836 void *serial = xmalloc (buf_size);
836 err = fn_gnutls_x509_crt_get_serial (cert, serial, &buf_size); 837 err = gnutls_x509_crt_get_serial (cert, serial, &buf_size);
838 check_memory_full (err);
837 if (err >= GNUTLS_E_SUCCESS) 839 if (err >= GNUTLS_E_SUCCESS)
838 res = nconc2 (res, list2 (intern (":serial-number"), 840 res = nconc2 (res, list2 (intern (":serial-number"),
839 gnutls_hex_string (serial, buf_size, ""))); 841 gnutls_hex_string (serial, buf_size, "")));
@@ -842,11 +844,13 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
842 844
843 /* Issuer. */ 845 /* Issuer. */
844 buf_size = 0; 846 buf_size = 0;
845 err = fn_gnutls_x509_crt_get_issuer_dn (cert, NULL, &buf_size); 847 err = gnutls_x509_crt_get_issuer_dn (cert, NULL, &buf_size);
848 check_memory_full (err);
846 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) 849 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER)
847 { 850 {
848 char *dn = xmalloc (buf_size); 851 char *dn = xmalloc (buf_size);
849 err = fn_gnutls_x509_crt_get_issuer_dn (cert, dn, &buf_size); 852 err = gnutls_x509_crt_get_issuer_dn (cert, dn, &buf_size);
853 check_memory_full (err);
850 if (err >= GNUTLS_E_SUCCESS) 854 if (err >= GNUTLS_E_SUCCESS)
851 res = nconc2 (res, list2 (intern (":issuer"), 855 res = nconc2 (res, list2 (intern (":issuer"),
852 make_string (dn, buf_size))); 856 make_string (dn, buf_size)));
@@ -859,23 +863,25 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
859 that might add 1 to the year length. */ 863 that might add 1 to the year length. */
860 char buf[INT_STRLEN_BOUND (int) + 1 + sizeof "-12-31"]; 864 char buf[INT_STRLEN_BOUND (int) + 1 + sizeof "-12-31"];
861 struct tm t; 865 struct tm t;
862 time_t tim = fn_gnutls_x509_crt_get_activation_time (cert); 866 time_t tim = gnutls_x509_crt_get_activation_time (cert);
863 867
864 if (gmtime_r (&tim, &t) && strftime (buf, sizeof buf, "%Y-%m-%d", &t)) 868 if (gmtime_r (&tim, &t) && strftime (buf, sizeof buf, "%Y-%m-%d", &t))
865 res = nconc2 (res, list2 (intern (":valid-from"), build_string (buf))); 869 res = nconc2 (res, list2 (intern (":valid-from"), build_string (buf)));
866 870
867 tim = fn_gnutls_x509_crt_get_expiration_time (cert); 871 tim = gnutls_x509_crt_get_expiration_time (cert);
868 if (gmtime_r (&tim, &t) && strftime (buf, sizeof buf, "%Y-%m-%d", &t)) 872 if (gmtime_r (&tim, &t) && strftime (buf, sizeof buf, "%Y-%m-%d", &t))
869 res = nconc2 (res, list2 (intern (":valid-to"), build_string (buf))); 873 res = nconc2 (res, list2 (intern (":valid-to"), build_string (buf)));
870 } 874 }
871 875
872 /* Subject. */ 876 /* Subject. */
873 buf_size = 0; 877 buf_size = 0;
874 err = fn_gnutls_x509_crt_get_dn (cert, NULL, &buf_size); 878 err = gnutls_x509_crt_get_dn (cert, NULL, &buf_size);
879 check_memory_full (err);
875 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) 880 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER)
876 { 881 {
877 char *dn = xmalloc (buf_size); 882 char *dn = xmalloc (buf_size);
878 err = fn_gnutls_x509_crt_get_dn (cert, dn, &buf_size); 883 err = gnutls_x509_crt_get_dn (cert, dn, &buf_size);
884 check_memory_full (err);
879 if (err >= GNUTLS_E_SUCCESS) 885 if (err >= GNUTLS_E_SUCCESS)
880 res = nconc2 (res, list2 (intern (":subject"), 886 res = nconc2 (res, list2 (intern (":subject"),
881 make_string (dn, buf_size))); 887 make_string (dn, buf_size)));
@@ -888,16 +894,17 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
888 { 894 {
889 unsigned int bits; 895 unsigned int bits;
890 896
891 err = fn_gnutls_x509_crt_get_pk_algorithm (cert, &bits); 897 err = gnutls_x509_crt_get_pk_algorithm (cert, &bits);
898 check_memory_full (err);
892 if (err >= GNUTLS_E_SUCCESS) 899 if (err >= GNUTLS_E_SUCCESS)
893 { 900 {
894 const char *name = fn_gnutls_pk_algorithm_get_name (err); 901 const char *name = gnutls_pk_algorithm_get_name (err);
895 if (name) 902 if (name)
896 res = nconc2 (res, list2 (intern (":public-key-algorithm"), 903 res = nconc2 (res, list2 (intern (":public-key-algorithm"),
897 build_string (name))); 904 build_string (name)));
898 905
899 name = fn_gnutls_sec_param_get_name (fn_gnutls_pk_bits_to_sec_param 906 name = gnutls_sec_param_get_name (gnutls_pk_bits_to_sec_param
900 (err, bits)); 907 (err, bits));
901 res = nconc2 (res, list2 (intern (":certificate-security-level"), 908 res = nconc2 (res, list2 (intern (":certificate-security-level"),
902 build_string (name))); 909 build_string (name)));
903 } 910 }
@@ -905,11 +912,13 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
905 912
906 /* Unique IDs. */ 913 /* Unique IDs. */
907 buf_size = 0; 914 buf_size = 0;
908 err = fn_gnutls_x509_crt_get_issuer_unique_id (cert, NULL, &buf_size); 915 err = gnutls_x509_crt_get_issuer_unique_id (cert, NULL, &buf_size);
916 check_memory_full (err);
909 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) 917 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER)
910 { 918 {
911 char *buf = xmalloc (buf_size); 919 char *buf = xmalloc (buf_size);
912 err = fn_gnutls_x509_crt_get_issuer_unique_id (cert, buf, &buf_size); 920 err = gnutls_x509_crt_get_issuer_unique_id (cert, buf, &buf_size);
921 check_memory_full (err);
913 if (err >= GNUTLS_E_SUCCESS) 922 if (err >= GNUTLS_E_SUCCESS)
914 res = nconc2 (res, list2 (intern (":issuer-unique-id"), 923 res = nconc2 (res, list2 (intern (":issuer-unique-id"),
915 make_string (buf, buf_size))); 924 make_string (buf, buf_size)));
@@ -917,11 +926,13 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
917 } 926 }
918 927
919 buf_size = 0; 928 buf_size = 0;
920 err = fn_gnutls_x509_crt_get_subject_unique_id (cert, NULL, &buf_size); 929 err = gnutls_x509_crt_get_subject_unique_id (cert, NULL, &buf_size);
930 check_memory_full (err);
921 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) 931 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER)
922 { 932 {
923 char *buf = xmalloc (buf_size); 933 char *buf = xmalloc (buf_size);
924 err = fn_gnutls_x509_crt_get_subject_unique_id (cert, buf, &buf_size); 934 err = gnutls_x509_crt_get_subject_unique_id (cert, buf, &buf_size);
935 check_memory_full (err);
925 if (err >= GNUTLS_E_SUCCESS) 936 if (err >= GNUTLS_E_SUCCESS)
926 res = nconc2 (res, list2 (intern (":subject-unique-id"), 937 res = nconc2 (res, list2 (intern (":subject-unique-id"),
927 make_string (buf, buf_size))); 938 make_string (buf, buf_size)));
@@ -930,10 +941,11 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
930#endif 941#endif
931 942
932 /* Signature. */ 943 /* Signature. */
933 err = fn_gnutls_x509_crt_get_signature_algorithm (cert); 944 err = gnutls_x509_crt_get_signature_algorithm (cert);
945 check_memory_full (err);
934 if (err >= GNUTLS_E_SUCCESS) 946 if (err >= GNUTLS_E_SUCCESS)
935 { 947 {
936 const char *name = fn_gnutls_sign_get_name (err); 948 const char *name = gnutls_sign_get_name (err);
937 if (name) 949 if (name)
938 res = nconc2 (res, list2 (intern (":signature-algorithm"), 950 res = nconc2 (res, list2 (intern (":signature-algorithm"),
939 build_string (name))); 951 build_string (name)));
@@ -941,11 +953,13 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
941 953
942 /* Public key ID. */ 954 /* Public key ID. */
943 buf_size = 0; 955 buf_size = 0;
944 err = fn_gnutls_x509_crt_get_key_id (cert, 0, NULL, &buf_size); 956 err = gnutls_x509_crt_get_key_id (cert, 0, NULL, &buf_size);
957 check_memory_full (err);
945 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) 958 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER)
946 { 959 {
947 void *buf = xmalloc (buf_size); 960 void *buf = xmalloc (buf_size);
948 err = fn_gnutls_x509_crt_get_key_id (cert, 0, buf, &buf_size); 961 err = gnutls_x509_crt_get_key_id (cert, 0, buf, &buf_size);
962 check_memory_full (err);
949 if (err >= GNUTLS_E_SUCCESS) 963 if (err >= GNUTLS_E_SUCCESS)
950 res = nconc2 (res, list2 (intern (":public-key-id"), 964 res = nconc2 (res, list2 (intern (":public-key-id"),
951 gnutls_hex_string (buf, buf_size, "sha1:"))); 965 gnutls_hex_string (buf, buf_size, "sha1:")));
@@ -954,13 +968,15 @@ gnutls_certificate_details (gnutls_x509_crt_t cert)
954 968
955 /* Certificate fingerprint. */ 969 /* Certificate fingerprint. */
956 buf_size = 0; 970 buf_size = 0;
957 err = fn_gnutls_x509_crt_get_fingerprint (cert, GNUTLS_DIG_SHA1, 971 err = gnutls_x509_crt_get_fingerprint (cert, GNUTLS_DIG_SHA1,
958 NULL, &buf_size); 972 NULL, &buf_size);
973 check_memory_full (err);
959 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER) 974 if (err == GNUTLS_E_SHORT_MEMORY_BUFFER)
960 { 975 {
961 void *buf = xmalloc (buf_size); 976 void *buf = xmalloc (buf_size);
962 err = fn_gnutls_x509_crt_get_fingerprint (cert, GNUTLS_DIG_SHA1, 977 err = gnutls_x509_crt_get_fingerprint (cert, GNUTLS_DIG_SHA1,
963 buf, &buf_size); 978 buf, &buf_size);
979 check_memory_full (err);
964 if (err >= GNUTLS_E_SUCCESS) 980 if (err >= GNUTLS_E_SUCCESS)
965 res = nconc2 (res, list2 (intern (":certificate-id"), 981 res = nconc2 (res, list2 (intern (":certificate-id"),
966 gnutls_hex_string (buf, buf_size, "sha1:"))); 982 gnutls_hex_string (buf, buf_size, "sha1:")));
@@ -1061,7 +1077,8 @@ The return value is a property list with top-level keys :warnings and
1061 1077
1062 /* Diffie-Hellman prime bits. */ 1078 /* Diffie-Hellman prime bits. */
1063 { 1079 {
1064 int bits = fn_gnutls_dh_get_prime_bits (state); 1080 int bits = gnutls_dh_get_prime_bits (state);
1081 check_memory_full (bits);
1065 if (bits > 0) 1082 if (bits > 0)
1066 result = nconc2 (result, list2 (intern (":diffie-hellman-prime-bits"), 1083 result = nconc2 (result, list2 (intern (":diffie-hellman-prime-bits"),
1067 make_number (bits))); 1084 make_number (bits)));
@@ -1070,26 +1087,26 @@ The return value is a property list with top-level keys :warnings and
1070 /* Key exchange. */ 1087 /* Key exchange. */
1071 result = nconc2 1088 result = nconc2
1072 (result, list2 (intern (":key-exchange"), 1089 (result, list2 (intern (":key-exchange"),
1073 build_string (fn_gnutls_kx_get_name 1090 build_string (gnutls_kx_get_name
1074 (fn_gnutls_kx_get (state))))); 1091 (gnutls_kx_get (state)))));
1075 1092
1076 /* Protocol name. */ 1093 /* Protocol name. */
1077 result = nconc2 1094 result = nconc2
1078 (result, list2 (intern (":protocol"), 1095 (result, list2 (intern (":protocol"),
1079 build_string (fn_gnutls_protocol_get_name 1096 build_string (gnutls_protocol_get_name
1080 (fn_gnutls_protocol_get_version (state))))); 1097 (gnutls_protocol_get_version (state)))));
1081 1098
1082 /* Cipher name. */ 1099 /* Cipher name. */
1083 result = nconc2 1100 result = nconc2
1084 (result, list2 (intern (":cipher"), 1101 (result, list2 (intern (":cipher"),
1085 build_string (fn_gnutls_cipher_get_name 1102 build_string (gnutls_cipher_get_name
1086 (fn_gnutls_cipher_get (state))))); 1103 (gnutls_cipher_get (state)))));
1087 1104
1088 /* MAC name. */ 1105 /* MAC name. */
1089 result = nconc2 1106 result = nconc2
1090 (result, list2 (intern (":mac"), 1107 (result, list2 (intern (":mac"),
1091 build_string (fn_gnutls_mac_get_name 1108 build_string (gnutls_mac_get_name
1092 (fn_gnutls_mac_get (state))))); 1109 (gnutls_mac_get (state)))));
1093 1110
1094 1111
1095 return result; 1112 return result;
@@ -1104,11 +1121,8 @@ emacs_gnutls_global_init (void)
1104 int ret = GNUTLS_E_SUCCESS; 1121 int ret = GNUTLS_E_SUCCESS;
1105 1122
1106 if (!gnutls_global_initialized) 1123 if (!gnutls_global_initialized)
1107 { 1124 ret = gnutls_global_init ();
1108 fn_gnutls_global_set_mem_functions (xmalloc, xmalloc, NULL, 1125
1109 xrealloc, xfree);
1110 ret = fn_gnutls_global_init ();
1111 }
1112 gnutls_global_initialized = 1; 1126 gnutls_global_initialized = 1;
1113 1127
1114 return gnutls_make_error (ret); 1128 return gnutls_make_error (ret);
@@ -1257,11 +1271,11 @@ one trustfile (usually a CA bundle). */)
1257 1271
1258 if (TYPE_RANGED_INTEGERP (int, loglevel)) 1272 if (TYPE_RANGED_INTEGERP (int, loglevel))
1259 { 1273 {
1260 fn_gnutls_global_set_log_function (gnutls_log_function); 1274 gnutls_global_set_log_function (gnutls_log_function);
1261#ifdef HAVE_GNUTLS3 1275#ifdef HAVE_GNUTLS3
1262 fn_gnutls_global_set_audit_log_function (gnutls_audit_log_function); 1276 gnutls_global_set_audit_log_function (gnutls_audit_log_function);
1263#endif 1277#endif
1264 fn_gnutls_global_set_log_level (XINT (loglevel)); 1278 gnutls_global_set_log_level (XINT (loglevel));
1265 max_log_level = XINT (loglevel); 1279 max_log_level = XINT (loglevel);
1266 XPROCESS (proc)->gnutls_log_level = max_log_level; 1280 XPROCESS (proc)->gnutls_log_level = max_log_level;
1267 } 1281 }
@@ -1291,7 +1305,7 @@ one trustfile (usually a CA bundle). */)
1291 unsigned int gnutls_verify_flags = GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT; 1305 unsigned int gnutls_verify_flags = GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT;
1292 1306
1293 GNUTLS_LOG (2, max_log_level, "allocating x509 credentials"); 1307 GNUTLS_LOG (2, max_log_level, "allocating x509 credentials");
1294 fn_gnutls_certificate_allocate_credentials (&x509_cred); 1308 check_memory_full (gnutls_certificate_allocate_credentials (&x509_cred));
1295 XPROCESS (proc)->gnutls_x509_cred = x509_cred; 1309 XPROCESS (proc)->gnutls_x509_cred = x509_cred;
1296 1310
1297 verify_flags = Fplist_get (proplist, QCgnutls_bootprop_verify_flags); 1311 verify_flags = Fplist_get (proplist, QCgnutls_bootprop_verify_flags);
@@ -1305,12 +1319,12 @@ one trustfile (usually a CA bundle). */)
1305 else 1319 else
1306 GNUTLS_LOG (2, max_log_level, "ignoring invalid verify-flags"); 1320 GNUTLS_LOG (2, max_log_level, "ignoring invalid verify-flags");
1307 1321
1308 fn_gnutls_certificate_set_verify_flags (x509_cred, gnutls_verify_flags); 1322 gnutls_certificate_set_verify_flags (x509_cred, gnutls_verify_flags);
1309 } 1323 }
1310 else /* Qgnutls_anon: */ 1324 else /* Qgnutls_anon: */
1311 { 1325 {
1312 GNUTLS_LOG (2, max_log_level, "allocating anon credentials"); 1326 GNUTLS_LOG (2, max_log_level, "allocating anon credentials");
1313 fn_gnutls_anon_allocate_client_credentials (&anon_cred); 1327 check_memory_full (gnutls_anon_allocate_client_credentials (&anon_cred));
1314 XPROCESS (proc)->gnutls_anon_cred = anon_cred; 1328 XPROCESS (proc)->gnutls_anon_cred = anon_cred;
1315 } 1329 }
1316 1330
@@ -1324,10 +1338,13 @@ one trustfile (usually a CA bundle). */)
1324 1338
1325#if GNUTLS_VERSION_MAJOR + \ 1339#if GNUTLS_VERSION_MAJOR + \
1326 (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20) > 3 1340 (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20) > 3
1327 ret = fn_gnutls_certificate_set_x509_system_trust (x509_cred); 1341 ret = gnutls_certificate_set_x509_system_trust (x509_cred);
1328 if (ret < GNUTLS_E_SUCCESS) 1342 if (ret < GNUTLS_E_SUCCESS)
1329 GNUTLS_LOG2i (4, max_log_level, 1343 {
1330 "setting system trust failed with code ", ret); 1344 check_memory_full (ret);
1345 GNUTLS_LOG2i (4, max_log_level,
1346 "setting system trust failed with code ", ret);
1347 }
1331#endif 1348#endif
1332 1349
1333 for (tail = trustfiles; CONSP (tail); tail = XCDR (tail)) 1350 for (tail = trustfiles; CONSP (tail); tail = XCDR (tail))
@@ -1344,7 +1361,7 @@ one trustfile (usually a CA bundle). */)
1344 name using the current ANSI codepage. */ 1361 name using the current ANSI codepage. */
1345 trustfile = ansi_encode_filename (trustfile); 1362 trustfile = ansi_encode_filename (trustfile);
1346#endif 1363#endif
1347 ret = fn_gnutls_certificate_set_x509_trust_file 1364 ret = gnutls_certificate_set_x509_trust_file
1348 (x509_cred, 1365 (x509_cred,
1349 SSDATA (trustfile), 1366 SSDATA (trustfile),
1350 file_format); 1367 file_format);
@@ -1370,7 +1387,7 @@ one trustfile (usually a CA bundle). */)
1370#ifdef WINDOWSNT 1387#ifdef WINDOWSNT
1371 crlfile = ansi_encode_filename (crlfile); 1388 crlfile = ansi_encode_filename (crlfile);
1372#endif 1389#endif
1373 ret = fn_gnutls_certificate_set_x509_crl_file 1390 ret = gnutls_certificate_set_x509_crl_file
1374 (x509_cred, SSDATA (crlfile), file_format); 1391 (x509_cred, SSDATA (crlfile), file_format);
1375 1392
1376 if (ret < GNUTLS_E_SUCCESS) 1393 if (ret < GNUTLS_E_SUCCESS)
@@ -1399,7 +1416,7 @@ one trustfile (usually a CA bundle). */)
1399 keyfile = ansi_encode_filename (keyfile); 1416 keyfile = ansi_encode_filename (keyfile);
1400 certfile = ansi_encode_filename (certfile); 1417 certfile = ansi_encode_filename (certfile);
1401#endif 1418#endif
1402 ret = fn_gnutls_certificate_set_x509_key_file 1419 ret = gnutls_certificate_set_x509_key_file
1403 (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format); 1420 (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format);
1404 1421
1405 if (ret < GNUTLS_E_SUCCESS) 1422 if (ret < GNUTLS_E_SUCCESS)
@@ -1421,7 +1438,7 @@ one trustfile (usually a CA bundle). */)
1421 /* Call gnutls_init here: */ 1438 /* Call gnutls_init here: */
1422 1439
1423 GNUTLS_LOG (1, max_log_level, "gnutls_init"); 1440 GNUTLS_LOG (1, max_log_level, "gnutls_init");
1424 ret = fn_gnutls_init (&state, GNUTLS_CLIENT); 1441 ret = gnutls_init (&state, GNUTLS_CLIENT);
1425 XPROCESS (proc)->gnutls_state = state; 1442 XPROCESS (proc)->gnutls_state = state;
1426 if (ret < GNUTLS_E_SUCCESS) 1443 if (ret < GNUTLS_E_SUCCESS)
1427 return gnutls_make_error (ret); 1444 return gnutls_make_error (ret);
@@ -1440,27 +1457,25 @@ one trustfile (usually a CA bundle). */)
1440 } 1457 }
1441 1458
1442 GNUTLS_LOG (1, max_log_level, "setting the priority string"); 1459 GNUTLS_LOG (1, max_log_level, "setting the priority string");
1443 ret = fn_gnutls_priority_set_direct (state, 1460 ret = gnutls_priority_set_direct (state, priority_string_ptr, NULL);
1444 priority_string_ptr,
1445 NULL);
1446 if (ret < GNUTLS_E_SUCCESS) 1461 if (ret < GNUTLS_E_SUCCESS)
1447 return gnutls_make_error (ret); 1462 return gnutls_make_error (ret);
1448 1463
1449 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_PRIORITY; 1464 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_PRIORITY;
1450 1465
1451 if (INTEGERP (prime_bits)) 1466 if (INTEGERP (prime_bits))
1452 fn_gnutls_dh_set_prime_bits (state, XUINT (prime_bits)); 1467 gnutls_dh_set_prime_bits (state, XUINT (prime_bits));
1453 1468
1454 ret = EQ (type, Qgnutls_x509pki) 1469 ret = EQ (type, Qgnutls_x509pki)
1455 ? fn_gnutls_credentials_set (state, GNUTLS_CRD_CERTIFICATE, x509_cred) 1470 ? gnutls_credentials_set (state, GNUTLS_CRD_CERTIFICATE, x509_cred)
1456 : fn_gnutls_credentials_set (state, GNUTLS_CRD_ANON, anon_cred); 1471 : gnutls_credentials_set (state, GNUTLS_CRD_ANON, anon_cred);
1457 if (ret < GNUTLS_E_SUCCESS) 1472 if (ret < GNUTLS_E_SUCCESS)
1458 return gnutls_make_error (ret); 1473 return gnutls_make_error (ret);
1459 1474
1460 if (!gnutls_ip_address_p (c_hostname)) 1475 if (!gnutls_ip_address_p (c_hostname))
1461 { 1476 {
1462 ret = fn_gnutls_server_name_set (state, GNUTLS_NAME_DNS, c_hostname, 1477 ret = gnutls_server_name_set (state, GNUTLS_NAME_DNS, c_hostname,
1463 strlen (c_hostname)); 1478 strlen (c_hostname));
1464 if (ret < GNUTLS_E_SUCCESS) 1479 if (ret < GNUTLS_E_SUCCESS)
1465 return gnutls_make_error (ret); 1480 return gnutls_make_error (ret);
1466 } 1481 }
@@ -1476,7 +1491,7 @@ one trustfile (usually a CA bundle). */)
1476 check of the certificate's hostname with 1491 check of the certificate's hostname with
1477 gnutls_x509_crt_check_hostname against :hostname. */ 1492 gnutls_x509_crt_check_hostname against :hostname. */
1478 1493
1479 ret = fn_gnutls_certificate_verify_peers2 (state, &peer_verification); 1494 ret = gnutls_certificate_verify_peers2 (state, &peer_verification);
1480 if (ret < GNUTLS_E_SUCCESS) 1495 if (ret < GNUTLS_E_SUCCESS)
1481 return gnutls_make_error (ret); 1496 return gnutls_make_error (ret);
1482 1497
@@ -1514,47 +1529,50 @@ one trustfile (usually a CA bundle). */)
1514 /* Up to here the process is the same for X.509 certificates and 1529 /* Up to here the process is the same for X.509 certificates and
1515 OpenPGP keys. From now on X.509 certificates are assumed. This 1530 OpenPGP keys. From now on X.509 certificates are assumed. This
1516 can be easily extended to work with openpgp keys as well. */ 1531 can be easily extended to work with openpgp keys as well. */
1517 if (fn_gnutls_certificate_type_get (state) == GNUTLS_CRT_X509) 1532 if (gnutls_certificate_type_get (state) == GNUTLS_CRT_X509)
1518 { 1533 {
1519 gnutls_x509_crt_t gnutls_verify_cert; 1534 gnutls_x509_crt_t gnutls_verify_cert;
1520 const gnutls_datum_t *gnutls_verify_cert_list; 1535 const gnutls_datum_t *gnutls_verify_cert_list;
1521 unsigned int gnutls_verify_cert_list_size; 1536 unsigned int gnutls_verify_cert_list_size;
1522 1537
1523 ret = fn_gnutls_x509_crt_init (&gnutls_verify_cert); 1538 ret = gnutls_x509_crt_init (&gnutls_verify_cert);
1524 if (ret < GNUTLS_E_SUCCESS) 1539 if (ret < GNUTLS_E_SUCCESS)
1525 return gnutls_make_error (ret); 1540 return gnutls_make_error (ret);
1526 1541
1527 gnutls_verify_cert_list = 1542 gnutls_verify_cert_list =
1528 fn_gnutls_certificate_get_peers (state, &gnutls_verify_cert_list_size); 1543 gnutls_certificate_get_peers (state, &gnutls_verify_cert_list_size);
1529 1544
1530 if (gnutls_verify_cert_list == NULL) 1545 if (gnutls_verify_cert_list == NULL)
1531 { 1546 {
1532 fn_gnutls_x509_crt_deinit (gnutls_verify_cert); 1547 gnutls_x509_crt_deinit (gnutls_verify_cert);
1533 emacs_gnutls_deinit (proc); 1548 emacs_gnutls_deinit (proc);
1534 error ("No x509 certificate was found\n"); 1549 error ("No x509 certificate was found\n");
1535 } 1550 }
1536 1551
1537 /* We only check the first certificate in the given chain. */ 1552 /* We only check the first certificate in the given chain. */
1538 ret = fn_gnutls_x509_crt_import (gnutls_verify_cert, 1553 ret = gnutls_x509_crt_import (gnutls_verify_cert,
1539 &gnutls_verify_cert_list[0], 1554 &gnutls_verify_cert_list[0],
1540 GNUTLS_X509_FMT_DER); 1555 GNUTLS_X509_FMT_DER);
1541 1556
1542 if (ret < GNUTLS_E_SUCCESS) 1557 if (ret < GNUTLS_E_SUCCESS)
1543 { 1558 {
1544 fn_gnutls_x509_crt_deinit (gnutls_verify_cert); 1559 gnutls_x509_crt_deinit (gnutls_verify_cert);
1545 return gnutls_make_error (ret); 1560 return gnutls_make_error (ret);
1546 } 1561 }
1547 1562
1548 XPROCESS (proc)->gnutls_certificate = gnutls_verify_cert; 1563 XPROCESS (proc)->gnutls_certificate = gnutls_verify_cert;
1549 1564
1550 if (!fn_gnutls_x509_crt_check_hostname (gnutls_verify_cert, c_hostname)) 1565 int err = gnutls_x509_crt_check_hostname (gnutls_verify_cert,
1566 c_hostname);
1567 check_memory_full (err);
1568 if (!err)
1551 { 1569 {
1552 XPROCESS (proc)->gnutls_extra_peer_verification |= 1570 XPROCESS (proc)->gnutls_extra_peer_verification |=
1553 CERTIFICATE_NOT_MATCHING; 1571 CERTIFICATE_NOT_MATCHING;
1554 if (verify_error_all 1572 if (verify_error_all
1555 || !NILP (Fmember (QCgnutls_bootprop_hostname, verify_error))) 1573 || !NILP (Fmember (QCgnutls_bootprop_hostname, verify_error)))
1556 { 1574 {
1557 fn_gnutls_x509_crt_deinit (gnutls_verify_cert); 1575 gnutls_x509_crt_deinit (gnutls_verify_cert);
1558 emacs_gnutls_deinit (proc); 1576 emacs_gnutls_deinit (proc);
1559 error ("The x509 certificate does not match \"%s\"", c_hostname); 1577 error ("The x509 certificate does not match \"%s\"", c_hostname);
1560 } 1578 }
@@ -1595,10 +1613,9 @@ This function may also return `gnutls-e-again', or
1595 1613
1596 state = XPROCESS (proc)->gnutls_state; 1614 state = XPROCESS (proc)->gnutls_state;
1597 1615
1598 fn_gnutls_x509_crt_deinit (XPROCESS (proc)->gnutls_certificate); 1616 gnutls_x509_crt_deinit (XPROCESS (proc)->gnutls_certificate);
1599 1617
1600 ret = fn_gnutls_bye (state, 1618 ret = gnutls_bye (state, NILP (cont) ? GNUTLS_SHUT_RDWR : GNUTLS_SHUT_WR);
1601 NILP (cont) ? GNUTLS_SHUT_RDWR : GNUTLS_SHUT_WR);
1602 1619
1603 return gnutls_make_error (ret); 1620 return gnutls_make_error (ret);
1604} 1621}
diff --git a/src/image.c b/src/image.c
index a73a7251753..4cba8863b88 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1859,19 +1859,6 @@ mark_image_cache (struct image_cache *c)
1859 X / NS / W32 support code 1859 X / NS / W32 support code
1860 ***********************************************************************/ 1860 ***********************************************************************/
1861 1861
1862#ifdef WINDOWSNT
1863
1864/* Macro for defining functions that will be loaded from image DLLs. */
1865#define DEF_IMGLIB_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args
1866
1867/* Macro for loading those image functions from the library. */
1868#define LOAD_IMGLIB_FN(lib,func) { \
1869 fn_##func = (void *) GetProcAddress (lib, #func); \
1870 if (!fn_##func) return 0; \
1871 }
1872
1873#endif /* WINDOWSNT */
1874
1875/* Return true if XIMG's size WIDTH x HEIGHT doesn't break the 1862/* Return true if XIMG's size WIDTH x HEIGHT doesn't break the
1876 windowing system. 1863 windowing system.
1877 WIDTH and HEIGHT must both be positive. 1864 WIDTH and HEIGHT must both be positive.
@@ -3377,12 +3364,14 @@ xpm_free_colors (Display *dpy, Colormap cmap, Pixel *pixels, int npixels, void *
3377 3364
3378/* XPM library details. */ 3365/* XPM library details. */
3379 3366
3380DEF_IMGLIB_FN (void, XpmFreeAttributes, (XpmAttributes *)); 3367DEF_DLL_FN (void, XpmFreeAttributes, (XpmAttributes *));
3381DEF_IMGLIB_FN (int, XpmCreateImageFromBuffer, (Display *, char *, xpm_XImage **, 3368DEF_DLL_FN (int, XpmCreateImageFromBuffer,
3382 xpm_XImage **, XpmAttributes *)); 3369 (Display *, char *, xpm_XImage **,
3383DEF_IMGLIB_FN (int, XpmReadFileToImage, (Display *, char *, xpm_XImage **, 3370 xpm_XImage **, XpmAttributes *));
3384 xpm_XImage **, XpmAttributes *)); 3371DEF_DLL_FN (int, XpmReadFileToImage,
3385DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *)); 3372 (Display *, char *, xpm_XImage **,
3373 xpm_XImage **, XpmAttributes *));
3374DEF_DLL_FN (void, XImageFree, (xpm_XImage *));
3386 3375
3387static bool 3376static bool
3388init_xpm_functions (void) 3377init_xpm_functions (void)
@@ -3392,22 +3381,24 @@ init_xpm_functions (void)
3392 if (!(library = w32_delayed_load (Qxpm))) 3381 if (!(library = w32_delayed_load (Qxpm)))
3393 return 0; 3382 return 0;
3394 3383
3395 LOAD_IMGLIB_FN (library, XpmFreeAttributes); 3384 LOAD_DLL_FN (library, XpmFreeAttributes);
3396 LOAD_IMGLIB_FN (library, XpmCreateImageFromBuffer); 3385 LOAD_DLL_FN (library, XpmCreateImageFromBuffer);
3397 LOAD_IMGLIB_FN (library, XpmReadFileToImage); 3386 LOAD_DLL_FN (library, XpmReadFileToImage);
3398 LOAD_IMGLIB_FN (library, XImageFree); 3387 LOAD_DLL_FN (library, XImageFree);
3399 return 1; 3388 return 1;
3400} 3389}
3401 3390
3402#endif /* WINDOWSNT */ 3391# undef XImageFree
3392# undef XpmCreateImageFromBuffer
3393# undef XpmFreeAttributes
3394# undef XpmReadFileToImage
3403 3395
3404#if defined HAVE_NTGUI && !defined WINDOWSNT 3396# define XImageFree fn_XImageFree
3405/* Glue for code below */ 3397# define XpmCreateImageFromBuffer fn_XpmCreateImageFromBuffer
3406#define fn_XpmReadFileToImage XpmReadFileToImage 3398# define XpmFreeAttributes fn_XpmFreeAttributes
3407#define fn_XpmCreateImageFromBuffer XpmCreateImageFromBuffer 3399# define XpmReadFileToImage fn_XpmReadFileToImage
3408#define fn_XImageFree XImageFree 3400
3409#define fn_XpmFreeAttributes XpmFreeAttributes 3401#endif /* WINDOWSNT */
3410#endif /* HAVE_NTGUI && !WINDOWSNT */
3411 3402
3412/* Value is true if COLOR_SYMBOLS is a valid color symbols list 3403/* Value is true if COLOR_SYMBOLS is a valid color symbols list
3413 for XPM images. Such a list must consist of conses whose car and 3404 for XPM images. Such a list must consist of conses whose car and
@@ -3624,9 +3615,9 @@ xpm_load (struct frame *f, struct image *img)
3624#endif 3615#endif
3625 /* XpmReadFileToPixmap is not available in the Windows port of 3616 /* XpmReadFileToPixmap is not available in the Windows port of
3626 libxpm. But XpmReadFileToImage almost does what we want. */ 3617 libxpm. But XpmReadFileToImage almost does what we want. */
3627 rc = fn_XpmReadFileToImage (&hdc, SDATA (file), 3618 rc = XpmReadFileToImage (&hdc, SDATA (file),
3628 &xpm_image, &xpm_mask, 3619 &xpm_image, &xpm_mask,
3629 &attrs); 3620 &attrs);
3630#else 3621#else
3631 rc = XpmReadFileToImage (FRAME_X_DISPLAY (f), SSDATA (file), 3622 rc = XpmReadFileToImage (FRAME_X_DISPLAY (f), SSDATA (file),
3632 &img->ximg, &img->mask_img, 3623 &img->ximg, &img->mask_img,
@@ -3648,9 +3639,9 @@ xpm_load (struct frame *f, struct image *img)
3648#ifdef HAVE_NTGUI 3639#ifdef HAVE_NTGUI
3649 /* XpmCreatePixmapFromBuffer is not available in the Windows port 3640 /* XpmCreatePixmapFromBuffer is not available in the Windows port
3650 of libxpm. But XpmCreateImageFromBuffer almost does what we want. */ 3641 of libxpm. But XpmCreateImageFromBuffer almost does what we want. */
3651 rc = fn_XpmCreateImageFromBuffer (&hdc, SDATA (buffer), 3642 rc = XpmCreateImageFromBuffer (&hdc, SDATA (buffer),
3652 &xpm_image, &xpm_mask, 3643 &xpm_image, &xpm_mask,
3653 &attrs); 3644 &attrs);
3654#else 3645#else
3655 rc = XpmCreateImageFromBuffer (FRAME_X_DISPLAY (f), SSDATA (buffer), 3646 rc = XpmCreateImageFromBuffer (FRAME_X_DISPLAY (f), SSDATA (buffer),
3656 &img->ximg, &img->mask_img, 3647 &img->ximg, &img->mask_img,
@@ -3699,7 +3690,7 @@ xpm_load (struct frame *f, struct image *img)
3699 img->pixmap = xpm_image->bitmap; 3690 img->pixmap = xpm_image->bitmap;
3700 /* XImageFree in libXpm frees XImage struct without destroying 3691 /* XImageFree in libXpm frees XImage struct without destroying
3701 the bitmap, which is what we want. */ 3692 the bitmap, which is what we want. */
3702 fn_XImageFree (xpm_image); 3693 XImageFree (xpm_image);
3703 } 3694 }
3704 if (xpm_mask && xpm_mask->bitmap) 3695 if (xpm_mask && xpm_mask->bitmap)
3705 { 3696 {
@@ -3713,7 +3704,7 @@ xpm_load (struct frame *f, struct image *img)
3713 SelectObject (hdc, old_obj); 3704 SelectObject (hdc, old_obj);
3714 3705
3715 img->mask = xpm_mask->bitmap; 3706 img->mask = xpm_mask->bitmap;
3716 fn_XImageFree (xpm_mask); 3707 XImageFree (xpm_mask);
3717 DeleteDC (hdc); 3708 DeleteDC (hdc);
3718 } 3709 }
3719 3710
@@ -3737,11 +3728,7 @@ xpm_load (struct frame *f, struct image *img)
3737 eassert (img->width > 0 && img->height > 0); 3728 eassert (img->width > 0 && img->height > 0);
3738 3729
3739 /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */ 3730 /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */
3740#ifdef HAVE_NTGUI
3741 fn_XpmFreeAttributes (&attrs);
3742#else
3743 XpmFreeAttributes (&attrs); 3731 XpmFreeAttributes (&attrs);
3744#endif /* HAVE_NTGUI */
3745 3732
3746#ifdef HAVE_X_WINDOWS 3733#ifdef HAVE_X_WINDOWS
3747 /* Maybe fill in the background field while we have ximg handy. */ 3734 /* Maybe fill in the background field while we have ximg handy. */
@@ -5535,39 +5522,42 @@ png_image_p (Lisp_Object object)
5535 5522
5536#if defined HAVE_PNG && !defined HAVE_NS 5523#if defined HAVE_PNG && !defined HAVE_NS
5537 5524
5538#ifdef WINDOWSNT 5525# ifdef WINDOWSNT
5539/* PNG library details. */ 5526/* PNG library details. */
5540 5527
5541DEF_IMGLIB_FN (png_voidp, png_get_io_ptr, (png_structp)); 5528DEF_DLL_FN (png_voidp, png_get_io_ptr, (png_structp));
5542DEF_IMGLIB_FN (int, png_sig_cmp, (png_bytep, png_size_t, png_size_t)); 5529DEF_DLL_FN (int, png_sig_cmp, (png_bytep, png_size_t, png_size_t));
5543DEF_IMGLIB_FN (png_structp, png_create_read_struct, (png_const_charp, png_voidp, 5530DEF_DLL_FN (png_structp, png_create_read_struct,
5544 png_error_ptr, png_error_ptr)); 5531 (png_const_charp, png_voidp, png_error_ptr, png_error_ptr));
5545DEF_IMGLIB_FN (png_infop, png_create_info_struct, (png_structp)); 5532DEF_DLL_FN (png_infop, png_create_info_struct, (png_structp));
5546DEF_IMGLIB_FN (void, png_destroy_read_struct, (png_structpp, png_infopp, png_infopp)); 5533DEF_DLL_FN (void, png_destroy_read_struct,
5547DEF_IMGLIB_FN (void, png_set_read_fn, (png_structp, png_voidp, png_rw_ptr)); 5534 (png_structpp, png_infopp, png_infopp));
5548DEF_IMGLIB_FN (void, png_set_sig_bytes, (png_structp, int)); 5535DEF_DLL_FN (void, png_set_read_fn, (png_structp, png_voidp, png_rw_ptr));
5549DEF_IMGLIB_FN (void, png_read_info, (png_structp, png_infop)); 5536DEF_DLL_FN (void, png_set_sig_bytes, (png_structp, int));
5550DEF_IMGLIB_FN (png_uint_32, png_get_IHDR, (png_structp, png_infop, 5537DEF_DLL_FN (void, png_read_info, (png_structp, png_infop));
5551 png_uint_32 *, png_uint_32 *, 5538DEF_DLL_FN (png_uint_32, png_get_IHDR,
5552 int *, int *, int *, int *, int *)); 5539 (png_structp, png_infop, png_uint_32 *, png_uint_32 *,
5553DEF_IMGLIB_FN (png_uint_32, png_get_valid, (png_structp, png_infop, png_uint_32)); 5540 int *, int *, int *, int *, int *));
5554DEF_IMGLIB_FN (void, png_set_strip_16, (png_structp)); 5541DEF_DLL_FN (png_uint_32, png_get_valid, (png_structp, png_infop, png_uint_32));
5555DEF_IMGLIB_FN (void, png_set_expand, (png_structp)); 5542DEF_DLL_FN (void, png_set_strip_16, (png_structp));
5556DEF_IMGLIB_FN (void, png_set_gray_to_rgb, (png_structp)); 5543DEF_DLL_FN (void, png_set_expand, (png_structp));
5557DEF_IMGLIB_FN (void, png_set_background, (png_structp, png_color_16p, 5544DEF_DLL_FN (void, png_set_gray_to_rgb, (png_structp));
5558 int, int, double)); 5545DEF_DLL_FN (void, png_set_background,
5559DEF_IMGLIB_FN (png_uint_32, png_get_bKGD, (png_structp, png_infop, png_color_16p *)); 5546 (png_structp, png_color_16p, int, int, double));
5560DEF_IMGLIB_FN (void, png_read_update_info, (png_structp, png_infop)); 5547DEF_DLL_FN (png_uint_32, png_get_bKGD,
5561DEF_IMGLIB_FN (png_byte, png_get_channels, (png_structp, png_infop)); 5548 (png_structp, png_infop, png_color_16p *));
5562DEF_IMGLIB_FN (png_size_t, png_get_rowbytes, (png_structp, png_infop)); 5549DEF_DLL_FN (void, png_read_update_info, (png_structp, png_infop));
5563DEF_IMGLIB_FN (void, png_read_image, (png_structp, png_bytepp)); 5550DEF_DLL_FN (png_byte, png_get_channels, (png_structp, png_infop));
5564DEF_IMGLIB_FN (void, png_read_end, (png_structp, png_infop)); 5551DEF_DLL_FN (png_size_t, png_get_rowbytes, (png_structp, png_infop));
5565DEF_IMGLIB_FN (void, png_error, (png_structp, png_const_charp)); 5552DEF_DLL_FN (void, png_read_image, (png_structp, png_bytepp));
5566 5553DEF_DLL_FN (void, png_read_end, (png_structp, png_infop));
5567#if (PNG_LIBPNG_VER >= 10500) 5554DEF_DLL_FN (void, png_error, (png_structp, png_const_charp));
5568DEF_IMGLIB_FN (void, png_longjmp, (png_structp, int)) PNG_NORETURN; 5555
5569DEF_IMGLIB_FN (jmp_buf *, png_set_longjmp_fn, (png_structp, png_longjmp_ptr, size_t)); 5556# if (PNG_LIBPNG_VER >= 10500)
5570#endif /* libpng version >= 1.5 */ 5557DEF_DLL_FN (void, png_longjmp, (png_structp, int)) PNG_NORETURN;
5558DEF_DLL_FN (jmp_buf *, png_set_longjmp_fn,
5559 (png_structp, png_longjmp_ptr, size_t));
5560# endif /* libpng version >= 1.5 */
5571 5561
5572static bool 5562static bool
5573init_png_functions (void) 5563init_png_functions (void)
@@ -5577,87 +5567,107 @@ init_png_functions (void)
5577 if (!(library = w32_delayed_load (Qpng))) 5567 if (!(library = w32_delayed_load (Qpng)))
5578 return 0; 5568 return 0;
5579 5569
5580 LOAD_IMGLIB_FN (library, png_get_io_ptr); 5570 LOAD_DLL_FN (library, png_get_io_ptr);
5581 LOAD_IMGLIB_FN (library, png_sig_cmp); 5571 LOAD_DLL_FN (library, png_sig_cmp);
5582 LOAD_IMGLIB_FN (library, png_create_read_struct); 5572 LOAD_DLL_FN (library, png_create_read_struct);
5583 LOAD_IMGLIB_FN (library, png_create_info_struct); 5573 LOAD_DLL_FN (library, png_create_info_struct);
5584 LOAD_IMGLIB_FN (library, png_destroy_read_struct); 5574 LOAD_DLL_FN (library, png_destroy_read_struct);
5585 LOAD_IMGLIB_FN (library, png_set_read_fn); 5575 LOAD_DLL_FN (library, png_set_read_fn);
5586 LOAD_IMGLIB_FN (library, png_set_sig_bytes); 5576 LOAD_DLL_FN (library, png_set_sig_bytes);
5587 LOAD_IMGLIB_FN (library, png_read_info); 5577 LOAD_DLL_FN (library, png_read_info);
5588 LOAD_IMGLIB_FN (library, png_get_IHDR); 5578 LOAD_DLL_FN (library, png_get_IHDR);
5589 LOAD_IMGLIB_FN (library, png_get_valid); 5579 LOAD_DLL_FN (library, png_get_valid);
5590 LOAD_IMGLIB_FN (library, png_set_strip_16); 5580 LOAD_DLL_FN (library, png_set_strip_16);
5591 LOAD_IMGLIB_FN (library, png_set_expand); 5581 LOAD_DLL_FN (library, png_set_expand);
5592 LOAD_IMGLIB_FN (library, png_set_gray_to_rgb); 5582 LOAD_DLL_FN (library, png_set_gray_to_rgb);
5593 LOAD_IMGLIB_FN (library, png_set_background); 5583 LOAD_DLL_FN (library, png_set_background);
5594 LOAD_IMGLIB_FN (library, png_get_bKGD); 5584 LOAD_DLL_FN (library, png_get_bKGD);
5595 LOAD_IMGLIB_FN (library, png_read_update_info); 5585 LOAD_DLL_FN (library, png_read_update_info);
5596 LOAD_IMGLIB_FN (library, png_get_channels); 5586 LOAD_DLL_FN (library, png_get_channels);
5597 LOAD_IMGLIB_FN (library, png_get_rowbytes); 5587 LOAD_DLL_FN (library, png_get_rowbytes);
5598 LOAD_IMGLIB_FN (library, png_read_image); 5588 LOAD_DLL_FN (library, png_read_image);
5599 LOAD_IMGLIB_FN (library, png_read_end); 5589 LOAD_DLL_FN (library, png_read_end);
5600 LOAD_IMGLIB_FN (library, png_error); 5590 LOAD_DLL_FN (library, png_error);
5601 5591
5602#if (PNG_LIBPNG_VER >= 10500) 5592# if (PNG_LIBPNG_VER >= 10500)
5603 LOAD_IMGLIB_FN (library, png_longjmp); 5593 LOAD_DLL_FN (library, png_longjmp);
5604 LOAD_IMGLIB_FN (library, png_set_longjmp_fn); 5594 LOAD_DLL_FN (library, png_set_longjmp_fn);
5605#endif /* libpng version >= 1.5 */ 5595# endif /* libpng version >= 1.5 */
5606 5596
5607 return 1; 5597 return 1;
5608} 5598}
5609#else
5610
5611#define fn_png_get_io_ptr png_get_io_ptr
5612#define fn_png_sig_cmp png_sig_cmp
5613#define fn_png_create_read_struct png_create_read_struct
5614#define fn_png_create_info_struct png_create_info_struct
5615#define fn_png_destroy_read_struct png_destroy_read_struct
5616#define fn_png_set_read_fn png_set_read_fn
5617#define fn_png_set_sig_bytes png_set_sig_bytes
5618#define fn_png_read_info png_read_info
5619#define fn_png_get_IHDR png_get_IHDR
5620#define fn_png_get_valid png_get_valid
5621#define fn_png_set_strip_16 png_set_strip_16
5622#define fn_png_set_expand png_set_expand
5623#define fn_png_set_gray_to_rgb png_set_gray_to_rgb
5624#define fn_png_set_background png_set_background
5625#define fn_png_get_bKGD png_get_bKGD
5626#define fn_png_read_update_info png_read_update_info
5627#define fn_png_get_channels png_get_channels
5628#define fn_png_get_rowbytes png_get_rowbytes
5629#define fn_png_read_image png_read_image
5630#define fn_png_read_end png_read_end
5631#define fn_png_error png_error
5632
5633#if (PNG_LIBPNG_VER >= 10500)
5634#define fn_png_longjmp png_longjmp
5635#define fn_png_set_longjmp_fn png_set_longjmp_fn
5636#endif /* libpng version >= 1.5 */
5637 5599
5638#endif /* WINDOWSNT */ 5600# undef png_create_info_struct
5601# undef png_create_read_struct
5602# undef png_destroy_read_struct
5603# undef png_error
5604# undef png_get_bKGD
5605# undef png_get_channels
5606# undef png_get_IHDR
5607# undef png_get_io_ptr
5608# undef png_get_rowbytes
5609# undef png_get_valid
5610# undef png_longjmp
5611# undef png_read_end
5612# undef png_read_image
5613# undef png_read_info
5614# undef png_read_update_info
5615# undef png_set_background
5616# undef png_set_expand
5617# undef png_set_gray_to_rgb
5618# undef png_set_longjmp_fn
5619# undef png_set_read_fn
5620# undef png_set_sig_bytes
5621# undef png_set_strip_16
5622# undef png_sig_cmp
5623
5624# define png_create_info_struct fn_png_create_info_struct
5625# define png_create_read_struct fn_png_create_read_struct
5626# define png_destroy_read_struct fn_png_destroy_read_struct
5627# define png_error fn_png_error
5628# define png_get_bKGD fn_png_get_bKGD
5629# define png_get_channels fn_png_get_channels
5630# define png_get_IHDR fn_png_get_IHDR
5631# define png_get_io_ptr fn_png_get_io_ptr
5632# define png_get_rowbytes fn_png_get_rowbytes
5633# define png_get_valid fn_png_get_valid
5634# define png_longjmp fn_png_longjmp
5635# define png_read_end fn_png_read_end
5636# define png_read_image fn_png_read_image
5637# define png_read_info fn_png_read_info
5638# define png_read_update_info fn_png_read_update_info
5639# define png_set_background fn_png_set_background
5640# define png_set_expand fn_png_set_expand
5641# define png_set_gray_to_rgb fn_png_set_gray_to_rgb
5642# define png_set_longjmp_fn fn_png_set_longjmp_fn
5643# define png_set_read_fn fn_png_set_read_fn
5644# define png_set_sig_bytes fn_png_set_sig_bytes
5645# define png_set_strip_16 fn_png_set_strip_16
5646# define png_sig_cmp fn_png_sig_cmp
5647
5648# endif /* WINDOWSNT */
5639 5649
5640/* Fast implementations of setjmp and longjmp. Although setjmp and longjmp 5650/* Fast implementations of setjmp and longjmp. Although setjmp and longjmp
5641 will do, POSIX _setjmp and _longjmp (if available) are often faster. 5651 will do, POSIX _setjmp and _longjmp (if available) are often faster.
5642 Do not use sys_setjmp, as PNG supports only jmp_buf. 5652 Do not use sys_setjmp, as PNG supports only jmp_buf.
5643 It's OK if the longjmp substitute restores the signal mask. */ 5653 It's OK if the longjmp substitute restores the signal mask. */
5644#ifdef HAVE__SETJMP 5654# ifdef HAVE__SETJMP
5645# define FAST_SETJMP(j) _setjmp (j) 5655# define FAST_SETJMP(j) _setjmp (j)
5646# define FAST_LONGJMP _longjmp 5656# define FAST_LONGJMP _longjmp
5647#else 5657# else
5648# define FAST_SETJMP(j) setjmp (j) 5658# define FAST_SETJMP(j) setjmp (j)
5649# define FAST_LONGJMP longjmp 5659# define FAST_LONGJMP longjmp
5650#endif 5660# endif
5651 5661
5652#if PNG_LIBPNG_VER < 10500 5662# if PNG_LIBPNG_VER < 10500
5653#define PNG_LONGJMP(ptr) FAST_LONGJMP ((ptr)->jmpbuf, 1) 5663# define PNG_LONGJMP(ptr) FAST_LONGJMP ((ptr)->jmpbuf, 1)
5654#define PNG_JMPBUF(ptr) ((ptr)->jmpbuf) 5664# define PNG_JMPBUF(ptr) ((ptr)->jmpbuf)
5655#else 5665# else
5656/* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */ 5666/* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */
5657#define PNG_LONGJMP(ptr) fn_png_longjmp (ptr, 1) 5667# define PNG_LONGJMP(ptr) png_longjmp (ptr, 1)
5658#define PNG_JMPBUF(ptr) \ 5668# define PNG_JMPBUF(ptr) \
5659 (*fn_png_set_longjmp_fn (ptr, FAST_LONGJMP, sizeof (jmp_buf))) 5669 (*png_set_longjmp_fn (ptr, FAST_LONGJMP, sizeof (jmp_buf)))
5660#endif 5670# endif
5661 5671
5662/* Error and warning handlers installed when the PNG library 5672/* Error and warning handlers installed when the PNG library
5663 is initialized. */ 5673 is initialized. */
@@ -5697,10 +5707,10 @@ struct png_memory_storage
5697static void 5707static void
5698png_read_from_memory (png_structp png_ptr, png_bytep data, png_size_t length) 5708png_read_from_memory (png_structp png_ptr, png_bytep data, png_size_t length)
5699{ 5709{
5700 struct png_memory_storage *tbr = fn_png_get_io_ptr (png_ptr); 5710 struct png_memory_storage *tbr = png_get_io_ptr (png_ptr);
5701 5711
5702 if (length > tbr->len - tbr->index) 5712 if (length > tbr->len - tbr->index)
5703 fn_png_error (png_ptr, "Read error"); 5713 png_error (png_ptr, "Read error");
5704 5714
5705 memcpy (data, tbr->bytes + tbr->index, length); 5715 memcpy (data, tbr->bytes + tbr->index, length);
5706 tbr->index = tbr->index + length; 5716 tbr->index = tbr->index + length;
@@ -5714,10 +5724,10 @@ png_read_from_memory (png_structp png_ptr, png_bytep data, png_size_t length)
5714static void 5724static void
5715png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length) 5725png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length)
5716{ 5726{
5717 FILE *fp = fn_png_get_io_ptr (png_ptr); 5727 FILE *fp = png_get_io_ptr (png_ptr);
5718 5728
5719 if (fread (data, 1, length, fp) < length) 5729 if (fread (data, 1, length, fp) < length)
5720 fn_png_error (png_ptr, "Read error"); 5730 png_error (png_ptr, "Read error");
5721} 5731}
5722 5732
5723 5733
@@ -5779,7 +5789,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5779 5789
5780 /* Check PNG signature. */ 5790 /* Check PNG signature. */
5781 if (fread (sig, 1, sizeof sig, fp) != sizeof sig 5791 if (fread (sig, 1, sizeof sig, fp) != sizeof sig
5782 || fn_png_sig_cmp (sig, 0, sizeof sig)) 5792 || png_sig_cmp (sig, 0, sizeof sig))
5783 { 5793 {
5784 fclose (fp); 5794 fclose (fp);
5785 image_error ("Not a PNG file: `%s'", file, Qnil); 5795 image_error ("Not a PNG file: `%s'", file, Qnil);
@@ -5801,7 +5811,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5801 5811
5802 /* Check PNG signature. */ 5812 /* Check PNG signature. */
5803 if (tbr.len < sizeof sig 5813 if (tbr.len < sizeof sig
5804 || fn_png_sig_cmp (tbr.bytes, 0, sizeof sig)) 5814 || png_sig_cmp (tbr.bytes, 0, sizeof sig))
5805 { 5815 {
5806 image_error ("Not a PNG image: `%s'", img->spec, Qnil); 5816 image_error ("Not a PNG image: `%s'", img->spec, Qnil);
5807 return 0; 5817 return 0;
@@ -5812,13 +5822,13 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5812 } 5822 }
5813 5823
5814 /* Initialize read and info structs for PNG lib. */ 5824 /* Initialize read and info structs for PNG lib. */
5815 png_ptr = fn_png_create_read_struct (PNG_LIBPNG_VER_STRING, 5825 png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,
5816 NULL, my_png_error, 5826 NULL, my_png_error,
5817 my_png_warning); 5827 my_png_warning);
5818 if (png_ptr) 5828 if (png_ptr)
5819 { 5829 {
5820 info_ptr = fn_png_create_info_struct (png_ptr); 5830 info_ptr = png_create_info_struct (png_ptr);
5821 end_info = fn_png_create_info_struct (png_ptr); 5831 end_info = png_create_info_struct (png_ptr);
5822 } 5832 }
5823 5833
5824 c->png_ptr = png_ptr; 5834 c->png_ptr = png_ptr;
@@ -5830,7 +5840,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5830 5840
5831 if (! (info_ptr && end_info)) 5841 if (! (info_ptr && end_info))
5832 { 5842 {
5833 fn_png_destroy_read_struct (&c->png_ptr, &c->info_ptr, &c->end_info); 5843 png_destroy_read_struct (&c->png_ptr, &c->info_ptr, &c->end_info);
5834 png_ptr = 0; 5844 png_ptr = 0;
5835 } 5845 }
5836 if (! png_ptr) 5846 if (! png_ptr)
@@ -5845,7 +5855,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5845 { 5855 {
5846 error: 5856 error:
5847 if (c->png_ptr) 5857 if (c->png_ptr)
5848 fn_png_destroy_read_struct (&c->png_ptr, &c->info_ptr, &c->end_info); 5858 png_destroy_read_struct (&c->png_ptr, &c->info_ptr, &c->end_info);
5849 xfree (c->pixels); 5859 xfree (c->pixels);
5850 xfree (c->rows); 5860 xfree (c->rows);
5851 if (c->fp) 5861 if (c->fp)
@@ -5858,14 +5868,14 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5858 5868
5859 /* Read image info. */ 5869 /* Read image info. */
5860 if (!NILP (specified_data)) 5870 if (!NILP (specified_data))
5861 fn_png_set_read_fn (png_ptr, &tbr, png_read_from_memory); 5871 png_set_read_fn (png_ptr, &tbr, png_read_from_memory);
5862 else 5872 else
5863 fn_png_set_read_fn (png_ptr, fp, png_read_from_file); 5873 png_set_read_fn (png_ptr, fp, png_read_from_file);
5864 5874
5865 fn_png_set_sig_bytes (png_ptr, sizeof sig); 5875 png_set_sig_bytes (png_ptr, sizeof sig);
5866 fn_png_read_info (png_ptr, info_ptr); 5876 png_read_info (png_ptr, info_ptr);
5867 fn_png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 5877 png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
5868 &interlace_type, NULL, NULL); 5878 &interlace_type, NULL, NULL);
5869 5879
5870 if (! (width <= INT_MAX && height <= INT_MAX 5880 if (! (width <= INT_MAX && height <= INT_MAX
5871 && check_image_size (f, width, height))) 5881 && check_image_size (f, width, height)))
@@ -5881,7 +5891,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5881 5891
5882 /* If image contains simply transparency data, we prefer to 5892 /* If image contains simply transparency data, we prefer to
5883 construct a clipping mask. */ 5893 construct a clipping mask. */
5884 if (fn_png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) 5894 if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
5885 transparent_p = 1; 5895 transparent_p = 1;
5886 else 5896 else
5887 transparent_p = 0; 5897 transparent_p = 0;
@@ -5892,16 +5902,16 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5892 5902
5893 /* Strip more than 8 bits per channel. */ 5903 /* Strip more than 8 bits per channel. */
5894 if (bit_depth == 16) 5904 if (bit_depth == 16)
5895 fn_png_set_strip_16 (png_ptr); 5905 png_set_strip_16 (png_ptr);
5896 5906
5897 /* Expand data to 24 bit RGB, or 8 bit grayscale, with alpha channel 5907 /* Expand data to 24 bit RGB, or 8 bit grayscale, with alpha channel
5898 if available. */ 5908 if available. */
5899 fn_png_set_expand (png_ptr); 5909 png_set_expand (png_ptr);
5900 5910
5901 /* Convert grayscale images to RGB. */ 5911 /* Convert grayscale images to RGB. */
5902 if (color_type == PNG_COLOR_TYPE_GRAY 5912 if (color_type == PNG_COLOR_TYPE_GRAY
5903 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) 5913 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
5904 fn_png_set_gray_to_rgb (png_ptr); 5914 png_set_gray_to_rgb (png_ptr);
5905 5915
5906 /* Handle alpha channel by combining the image with a background 5916 /* Handle alpha channel by combining the image with a background
5907 color. Do this only if a real alpha channel is supplied. For 5917 color. Do this only if a real alpha channel is supplied. For
@@ -5927,24 +5937,24 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5927 bg.green = color.green >> shift; 5937 bg.green = color.green >> shift;
5928 bg.blue = color.blue >> shift; 5938 bg.blue = color.blue >> shift;
5929 5939
5930 fn_png_set_background (png_ptr, &bg, 5940 png_set_background (png_ptr, &bg,
5931 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); 5941 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
5932 } 5942 }
5933 } 5943 }
5934 5944
5935 /* Update info structure. */ 5945 /* Update info structure. */
5936 fn_png_read_update_info (png_ptr, info_ptr); 5946 png_read_update_info (png_ptr, info_ptr);
5937 5947
5938 /* Get number of channels. Valid values are 1 for grayscale images 5948 /* Get number of channels. Valid values are 1 for grayscale images
5939 and images with a palette, 2 for grayscale images with transparency 5949 and images with a palette, 2 for grayscale images with transparency
5940 information (alpha channel), 3 for RGB images, and 4 for RGB 5950 information (alpha channel), 3 for RGB images, and 4 for RGB
5941 images with alpha channel, i.e. RGBA. If conversions above were 5951 images with alpha channel, i.e. RGBA. If conversions above were
5942 sufficient we should only have 3 or 4 channels here. */ 5952 sufficient we should only have 3 or 4 channels here. */
5943 channels = fn_png_get_channels (png_ptr, info_ptr); 5953 channels = png_get_channels (png_ptr, info_ptr);
5944 eassert (channels == 3 || channels == 4); 5954 eassert (channels == 3 || channels == 4);
5945 5955
5946 /* Number of bytes needed for one row of the image. */ 5956 /* Number of bytes needed for one row of the image. */
5947 row_bytes = fn_png_get_rowbytes (png_ptr, info_ptr); 5957 row_bytes = png_get_rowbytes (png_ptr, info_ptr);
5948 5958
5949 /* Allocate memory for the image. */ 5959 /* Allocate memory for the image. */
5950 if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *rows < height 5960 if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *rows < height
@@ -5956,8 +5966,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5956 rows[i] = pixels + i * row_bytes; 5966 rows[i] = pixels + i * row_bytes;
5957 5967
5958 /* Read the entire image. */ 5968 /* Read the entire image. */
5959 fn_png_read_image (png_ptr, rows); 5969 png_read_image (png_ptr, rows);
5960 fn_png_read_end (png_ptr, info_ptr); 5970 png_read_end (png_ptr, info_ptr);
5961 if (fp) 5971 if (fp)
5962 { 5972 {
5963 fclose (fp); 5973 fclose (fp);
@@ -6021,21 +6031,21 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
6021 overrode it. */ 6031 overrode it. */
6022 { 6032 {
6023 png_color_16 *bg; 6033 png_color_16 *bg;
6024 if (fn_png_get_bKGD (png_ptr, info_ptr, &bg)) 6034 if (png_get_bKGD (png_ptr, info_ptr, &bg))
6025 { 6035 {
6026 img->background = lookup_rgb_color (f, bg->red, bg->green, bg->blue); 6036 img->background = lookup_rgb_color (f, bg->red, bg->green, bg->blue);
6027 img->background_valid = 1; 6037 img->background_valid = 1;
6028 } 6038 }
6029 } 6039 }
6030 6040
6031#ifdef COLOR_TABLE_SUPPORT 6041# ifdef COLOR_TABLE_SUPPORT
6032 /* Remember colors allocated for this image. */ 6042 /* Remember colors allocated for this image. */
6033 img->colors = colors_in_color_table (&img->ncolors); 6043 img->colors = colors_in_color_table (&img->ncolors);
6034 free_color_table (); 6044 free_color_table ();
6035#endif /* COLOR_TABLE_SUPPORT */ 6045# endif /* COLOR_TABLE_SUPPORT */
6036 6046
6037 /* Clean up. */ 6047 /* Clean up. */
6038 fn_png_destroy_read_struct (&c->png_ptr, &c->info_ptr, &c->end_info); 6048 png_destroy_read_struct (&c->png_ptr, &c->info_ptr, &c->end_info);
6039 xfree (rows); 6049 xfree (rows);
6040 xfree (pixels); 6050 xfree (pixels);
6041 6051
@@ -6170,15 +6180,15 @@ jpeg_image_p (Lisp_Object object)
6170 6180
6171/* Work around a warning about HAVE_STDLIB_H being redefined in 6181/* Work around a warning about HAVE_STDLIB_H being redefined in
6172 jconfig.h. */ 6182 jconfig.h. */
6173#ifdef HAVE_STDLIB_H 6183# ifdef HAVE_STDLIB_H
6174#undef HAVE_STDLIB_H 6184# undef HAVE_STDLIB_H
6175#endif /* HAVE_STLIB_H */ 6185# endif
6176 6186
6177#if defined (HAVE_NTGUI) && !defined (__WIN32__) 6187# if defined (HAVE_NTGUI) && !defined (__WIN32__)
6178/* In older releases of the jpeg library, jpeglib.h will define boolean 6188/* In older releases of the jpeg library, jpeglib.h will define boolean
6179 differently depending on __WIN32__, so make sure it is defined. */ 6189 differently depending on __WIN32__, so make sure it is defined. */
6180#define __WIN32__ 1 6190# define __WIN32__ 1
6181#endif 6191# endif
6182 6192
6183/* rpcndr.h (via windows.h) and jpeglib.h both define boolean types. 6193/* rpcndr.h (via windows.h) and jpeglib.h both define boolean types.
6184 Some versions of jpeglib try to detect whether rpcndr.h is loaded, 6194 Some versions of jpeglib try to detect whether rpcndr.h is loaded,
@@ -6194,23 +6204,25 @@ jpeg_image_p (Lisp_Object object)
6194 different name. This name, jpeg_boolean, remains in effect through 6204 different name. This name, jpeg_boolean, remains in effect through
6195 the rest of image.c. 6205 the rest of image.c.
6196*/ 6206*/
6197#if defined CYGWIN && defined HAVE_NTGUI 6207# if defined CYGWIN && defined HAVE_NTGUI
6198#define boolean jpeg_boolean 6208# define boolean jpeg_boolean
6199#endif 6209# endif
6200#include <jpeglib.h> 6210# include <jpeglib.h>
6201#include <jerror.h> 6211# include <jerror.h>
6202 6212
6203#ifdef WINDOWSNT 6213# ifdef WINDOWSNT
6204 6214
6205/* JPEG library details. */ 6215/* JPEG library details. */
6206DEF_IMGLIB_FN (void, jpeg_CreateDecompress, (j_decompress_ptr, int, size_t)); 6216DEF_DLL_FN (void, jpeg_CreateDecompress, (j_decompress_ptr, int, size_t));
6207DEF_IMGLIB_FN (boolean, jpeg_start_decompress, (j_decompress_ptr)); 6217DEF_DLL_FN (boolean, jpeg_start_decompress, (j_decompress_ptr));
6208DEF_IMGLIB_FN (boolean, jpeg_finish_decompress, (j_decompress_ptr)); 6218DEF_DLL_FN (boolean, jpeg_finish_decompress, (j_decompress_ptr));
6209DEF_IMGLIB_FN (void, jpeg_destroy_decompress, (j_decompress_ptr)); 6219DEF_DLL_FN (void, jpeg_destroy_decompress, (j_decompress_ptr));
6210DEF_IMGLIB_FN (int, jpeg_read_header, (j_decompress_ptr, boolean)); 6220DEF_DLL_FN (int, jpeg_read_header, (j_decompress_ptr, boolean));
6211DEF_IMGLIB_FN (JDIMENSION, jpeg_read_scanlines, (j_decompress_ptr, JSAMPARRAY, JDIMENSION)); 6221DEF_DLL_FN (JDIMENSION, jpeg_read_scanlines,
6212DEF_IMGLIB_FN (struct jpeg_error_mgr *, jpeg_std_error, (struct jpeg_error_mgr *)); 6222 (j_decompress_ptr, JSAMPARRAY, JDIMENSION));
6213DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int)); 6223DEF_DLL_FN (struct jpeg_error_mgr *, jpeg_std_error,
6224 (struct jpeg_error_mgr *));
6225DEF_DLL_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int));
6214 6226
6215static bool 6227static bool
6216init_jpeg_functions (void) 6228init_jpeg_functions (void)
@@ -6220,37 +6232,46 @@ init_jpeg_functions (void)
6220 if (!(library = w32_delayed_load (Qjpeg))) 6232 if (!(library = w32_delayed_load (Qjpeg)))
6221 return 0; 6233 return 0;
6222 6234
6223 LOAD_IMGLIB_FN (library, jpeg_finish_decompress); 6235 LOAD_DLL_FN (library, jpeg_finish_decompress);
6224 LOAD_IMGLIB_FN (library, jpeg_read_scanlines); 6236 LOAD_DLL_FN (library, jpeg_read_scanlines);
6225 LOAD_IMGLIB_FN (library, jpeg_start_decompress); 6237 LOAD_DLL_FN (library, jpeg_start_decompress);
6226 LOAD_IMGLIB_FN (library, jpeg_read_header); 6238 LOAD_DLL_FN (library, jpeg_read_header);
6227 LOAD_IMGLIB_FN (library, jpeg_CreateDecompress); 6239 LOAD_DLL_FN (library, jpeg_CreateDecompress);
6228 LOAD_IMGLIB_FN (library, jpeg_destroy_decompress); 6240 LOAD_DLL_FN (library, jpeg_destroy_decompress);
6229 LOAD_IMGLIB_FN (library, jpeg_std_error); 6241 LOAD_DLL_FN (library, jpeg_std_error);
6230 LOAD_IMGLIB_FN (library, jpeg_resync_to_restart); 6242 LOAD_DLL_FN (library, jpeg_resync_to_restart);
6231 return 1; 6243 return 1;
6232} 6244}
6233 6245
6246# undef jpeg_CreateDecompress
6247# undef jpeg_destroy_decompress
6248# undef jpeg_finish_decompress
6249# undef jpeg_read_header
6250# undef jpeg_read_scanlines
6251# undef jpeg_resync_to_restart
6252# undef jpeg_start_decompress
6253# undef jpeg_std_error
6254
6255# define jpeg_CreateDecompress fn_jpeg_CreateDecompress
6256# define jpeg_destroy_decompress fn_jpeg_destroy_decompress
6257# define jpeg_finish_decompress fn_jpeg_finish_decompress
6258# define jpeg_read_header fn_jpeg_read_header
6259# define jpeg_read_scanlines fn_jpeg_read_scanlines
6260# define jpeg_resync_to_restart fn_jpeg_resync_to_restart
6261# define jpeg_start_decompress fn_jpeg_start_decompress
6262# define jpeg_std_error fn_jpeg_std_error
6263
6234/* Wrapper since we can't directly assign the function pointer 6264/* Wrapper since we can't directly assign the function pointer
6235 to another function pointer that was declared more completely easily. */ 6265 to another function pointer that was declared more completely easily. */
6236static boolean 6266static boolean
6237jpeg_resync_to_restart_wrapper (j_decompress_ptr cinfo, int desired) 6267jpeg_resync_to_restart_wrapper (j_decompress_ptr cinfo, int desired)
6238{ 6268{
6239 return fn_jpeg_resync_to_restart (cinfo, desired); 6269 return jpeg_resync_to_restart (cinfo, desired);
6240} 6270}
6271# undef jpeg_resync_to_restart
6272# define jpeg_resync_to_restart jpeg_resync_to_restart_wrapper
6241 6273
6242#else 6274# endif /* WINDOWSNT */
6243
6244#define fn_jpeg_CreateDecompress(a,b,c) jpeg_create_decompress (a)
6245#define fn_jpeg_start_decompress jpeg_start_decompress
6246#define fn_jpeg_finish_decompress jpeg_finish_decompress
6247#define fn_jpeg_destroy_decompress jpeg_destroy_decompress
6248#define fn_jpeg_read_header jpeg_read_header
6249#define fn_jpeg_read_scanlines jpeg_read_scanlines
6250#define fn_jpeg_std_error jpeg_std_error
6251#define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart
6252
6253#endif /* WINDOWSNT */
6254 6275
6255struct my_jpeg_error_mgr 6276struct my_jpeg_error_mgr
6256{ 6277{
@@ -6358,7 +6379,7 @@ jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, ptrdiff_t len)
6358 src->init_source = our_common_init_source; 6379 src->init_source = our_common_init_source;
6359 src->fill_input_buffer = our_memory_fill_input_buffer; 6380 src->fill_input_buffer = our_memory_fill_input_buffer;
6360 src->skip_input_data = our_memory_skip_input_data; 6381 src->skip_input_data = our_memory_skip_input_data;
6361 src->resync_to_restart = jpeg_resync_to_restart_wrapper; /* Use default method. */ 6382 src->resync_to_restart = jpeg_resync_to_restart; /* Use default method. */
6362 src->term_source = our_common_term_source; 6383 src->term_source = our_common_term_source;
6363 src->bytes_in_buffer = len; 6384 src->bytes_in_buffer = len;
6364 src->next_input_byte = data; 6385 src->next_input_byte = data;
@@ -6464,7 +6485,7 @@ jpeg_file_src (j_decompress_ptr cinfo, FILE *fp)
6464 src->mgr.init_source = our_common_init_source; 6485 src->mgr.init_source = our_common_init_source;
6465 src->mgr.fill_input_buffer = our_stdio_fill_input_buffer; 6486 src->mgr.fill_input_buffer = our_stdio_fill_input_buffer;
6466 src->mgr.skip_input_data = our_stdio_skip_input_data; 6487 src->mgr.skip_input_data = our_stdio_skip_input_data;
6467 src->mgr.resync_to_restart = jpeg_resync_to_restart_wrapper; /* Use default method. */ 6488 src->mgr.resync_to_restart = jpeg_resync_to_restart; /* Use default. */
6468 src->mgr.term_source = our_common_term_source; 6489 src->mgr.term_source = our_common_term_source;
6469 src->mgr.bytes_in_buffer = 0; 6490 src->mgr.bytes_in_buffer = 0;
6470 src->mgr.next_input_byte = NULL; 6491 src->mgr.next_input_byte = NULL;
@@ -6515,7 +6536,7 @@ jpeg_load_body (struct frame *f, struct image *img,
6515 6536
6516 /* Customize libjpeg's error handling to call my_error_exit when an 6537 /* Customize libjpeg's error handling to call my_error_exit when an
6517 error is detected. This function will perform a longjmp. */ 6538 error is detected. This function will perform a longjmp. */
6518 mgr->cinfo.err = fn_jpeg_std_error (&mgr->pub); 6539 mgr->cinfo.err = jpeg_std_error (&mgr->pub);
6519 mgr->pub.error_exit = my_error_exit; 6540 mgr->pub.error_exit = my_error_exit;
6520 if (sys_setjmp (mgr->setjmp_buffer)) 6541 if (sys_setjmp (mgr->setjmp_buffer))
6521 { 6542 {
@@ -6541,7 +6562,7 @@ jpeg_load_body (struct frame *f, struct image *img,
6541 /* Close the input file and destroy the JPEG object. */ 6562 /* Close the input file and destroy the JPEG object. */
6542 if (fp) 6563 if (fp)
6543 fclose (fp); 6564 fclose (fp);
6544 fn_jpeg_destroy_decompress (&mgr->cinfo); 6565 jpeg_destroy_decompress (&mgr->cinfo);
6545 6566
6546 /* If we already have an XImage, free that. */ 6567 /* If we already have an XImage, free that. */
6547 x_destroy_x_image (ximg); 6568 x_destroy_x_image (ximg);
@@ -6553,7 +6574,7 @@ jpeg_load_body (struct frame *f, struct image *img,
6553 6574
6554 /* Create the JPEG decompression object. Let it read from fp. 6575 /* Create the JPEG decompression object. Let it read from fp.
6555 Read the JPEG image header. */ 6576 Read the JPEG image header. */
6556 fn_jpeg_CreateDecompress (&mgr->cinfo, JPEG_LIB_VERSION, sizeof *&mgr->cinfo); 6577 jpeg_CreateDecompress (&mgr->cinfo, JPEG_LIB_VERSION, sizeof *&mgr->cinfo);
6557 6578
6558 if (NILP (specified_data)) 6579 if (NILP (specified_data))
6559 jpeg_file_src (&mgr->cinfo, fp); 6580 jpeg_file_src (&mgr->cinfo, fp);
@@ -6561,12 +6582,12 @@ jpeg_load_body (struct frame *f, struct image *img,
6561 jpeg_memory_src (&mgr->cinfo, SDATA (specified_data), 6582 jpeg_memory_src (&mgr->cinfo, SDATA (specified_data),
6562 SBYTES (specified_data)); 6583 SBYTES (specified_data));
6563 6584
6564 fn_jpeg_read_header (&mgr->cinfo, 1); 6585 jpeg_read_header (&mgr->cinfo, 1);
6565 6586
6566 /* Customize decompression so that color quantization will be used. 6587 /* Customize decompression so that color quantization will be used.
6567 Start decompression. */ 6588 Start decompression. */
6568 mgr->cinfo.quantize_colors = 1; 6589 mgr->cinfo.quantize_colors = 1;
6569 fn_jpeg_start_decompress (&mgr->cinfo); 6590 jpeg_start_decompress (&mgr->cinfo);
6570 width = img->width = mgr->cinfo.output_width; 6591 width = img->width = mgr->cinfo.output_width;
6571 height = img->height = mgr->cinfo.output_height; 6592 height = img->height = mgr->cinfo.output_height;
6572 6593
@@ -6629,14 +6650,14 @@ jpeg_load_body (struct frame *f, struct image *img,
6629 JPOOL_IMAGE, row_stride, 1); 6650 JPOOL_IMAGE, row_stride, 1);
6630 for (y = 0; y < height; ++y) 6651 for (y = 0; y < height; ++y)
6631 { 6652 {
6632 fn_jpeg_read_scanlines (&mgr->cinfo, buffer, 1); 6653 jpeg_read_scanlines (&mgr->cinfo, buffer, 1);
6633 for (x = 0; x < mgr->cinfo.output_width; ++x) 6654 for (x = 0; x < mgr->cinfo.output_width; ++x)
6634 XPutPixel (ximg, x, y, colors[buffer[0][x]]); 6655 XPutPixel (ximg, x, y, colors[buffer[0][x]]);
6635 } 6656 }
6636 6657
6637 /* Clean up. */ 6658 /* Clean up. */
6638 fn_jpeg_finish_decompress (&mgr->cinfo); 6659 jpeg_finish_decompress (&mgr->cinfo);
6639 fn_jpeg_destroy_decompress (&mgr->cinfo); 6660 jpeg_destroy_decompress (&mgr->cinfo);
6640 if (fp) 6661 if (fp)
6641 fclose (fp); 6662 fclose (fp);
6642 6663
@@ -6760,22 +6781,22 @@ tiff_image_p (Lisp_Object object)
6760 6781
6761#ifdef HAVE_TIFF 6782#ifdef HAVE_TIFF
6762 6783
6763#include <tiffio.h> 6784# include <tiffio.h>
6764 6785
6765#ifdef WINDOWSNT 6786# ifdef WINDOWSNT
6766 6787
6767/* TIFF library details. */ 6788/* TIFF library details. */
6768DEF_IMGLIB_FN (TIFFErrorHandler, TIFFSetErrorHandler, (TIFFErrorHandler)); 6789DEF_DLL_FN (TIFFErrorHandler, TIFFSetErrorHandler, (TIFFErrorHandler));
6769DEF_IMGLIB_FN (TIFFErrorHandler, TIFFSetWarningHandler, (TIFFErrorHandler)); 6790DEF_DLL_FN (TIFFErrorHandler, TIFFSetWarningHandler, (TIFFErrorHandler));
6770DEF_IMGLIB_FN (TIFF *, TIFFOpen, (const char *, const char *)); 6791DEF_DLL_FN (TIFF *, TIFFOpen, (const char *, const char *));
6771DEF_IMGLIB_FN (TIFF *, TIFFClientOpen, (const char *, const char *, thandle_t, 6792DEF_DLL_FN (TIFF *, TIFFClientOpen,
6772 TIFFReadWriteProc, TIFFReadWriteProc, 6793 (const char *, const char *, thandle_t, TIFFReadWriteProc,
6773 TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, 6794 TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc,
6774 TIFFMapFileProc, TIFFUnmapFileProc)); 6795 TIFFMapFileProc, TIFFUnmapFileProc));
6775DEF_IMGLIB_FN (int, TIFFGetField, (TIFF *, ttag_t, ...)); 6796DEF_DLL_FN (int, TIFFGetField, (TIFF *, ttag_t, ...));
6776DEF_IMGLIB_FN (int, TIFFReadRGBAImage, (TIFF *, uint32, uint32, uint32 *, int)); 6797DEF_DLL_FN (int, TIFFReadRGBAImage, (TIFF *, uint32, uint32, uint32 *, int));
6777DEF_IMGLIB_FN (void, TIFFClose, (TIFF *)); 6798DEF_DLL_FN (void, TIFFClose, (TIFF *));
6778DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t)); 6799DEF_DLL_FN (int, TIFFSetDirectory, (TIFF *, tdir_t));
6779 6800
6780static bool 6801static bool
6781init_tiff_functions (void) 6802init_tiff_functions (void)
@@ -6785,28 +6806,36 @@ init_tiff_functions (void)
6785 if (!(library = w32_delayed_load (Qtiff))) 6806 if (!(library = w32_delayed_load (Qtiff)))
6786 return 0; 6807 return 0;
6787 6808
6788 LOAD_IMGLIB_FN (library, TIFFSetErrorHandler); 6809 LOAD_DLL_FN (library, TIFFSetErrorHandler);
6789 LOAD_IMGLIB_FN (library, TIFFSetWarningHandler); 6810 LOAD_DLL_FN (library, TIFFSetWarningHandler);
6790 LOAD_IMGLIB_FN (library, TIFFOpen); 6811 LOAD_DLL_FN (library, TIFFOpen);
6791 LOAD_IMGLIB_FN (library, TIFFClientOpen); 6812 LOAD_DLL_FN (library, TIFFClientOpen);
6792 LOAD_IMGLIB_FN (library, TIFFGetField); 6813 LOAD_DLL_FN (library, TIFFGetField);
6793 LOAD_IMGLIB_FN (library, TIFFReadRGBAImage); 6814 LOAD_DLL_FN (library, TIFFReadRGBAImage);
6794 LOAD_IMGLIB_FN (library, TIFFClose); 6815 LOAD_DLL_FN (library, TIFFClose);
6795 LOAD_IMGLIB_FN (library, TIFFSetDirectory); 6816 LOAD_DLL_FN (library, TIFFSetDirectory);
6796 return 1; 6817 return 1;
6797} 6818}
6798 6819
6799#else 6820# undef TIFFClientOpen
6821# undef TIFFClose
6822# undef TIFFGetField
6823# undef TIFFOpen
6824# undef TIFFReadRGBAImage
6825# undef TIFFSetDirectory
6826# undef TIFFSetErrorHandler
6827# undef TIFFSetWarningHandler
6800 6828
6801#define fn_TIFFSetErrorHandler TIFFSetErrorHandler 6829# define TIFFClientOpen fn_TIFFClientOpen
6802#define fn_TIFFSetWarningHandler TIFFSetWarningHandler 6830# define TIFFClose fn_TIFFClose
6803#define fn_TIFFOpen TIFFOpen 6831# define TIFFGetField fn_TIFFGetField
6804#define fn_TIFFClientOpen TIFFClientOpen 6832# define TIFFOpen fn_TIFFOpen
6805#define fn_TIFFGetField TIFFGetField 6833# define TIFFReadRGBAImage fn_TIFFReadRGBAImage
6806#define fn_TIFFReadRGBAImage TIFFReadRGBAImage 6834# define TIFFSetDirectory fn_TIFFSetDirectory
6807#define fn_TIFFClose TIFFClose 6835# define TIFFSetErrorHandler fn_TIFFSetErrorHandler
6808#define fn_TIFFSetDirectory TIFFSetDirectory 6836# define TIFFSetWarningHandler fn_TIFFSetWarningHandler
6809#endif /* WINDOWSNT */ 6837
6838# endif /* WINDOWSNT */
6810 6839
6811 6840
6812/* Reading from a memory buffer for TIFF images Based on the PNG 6841/* Reading from a memory buffer for TIFF images Based on the PNG
@@ -6904,11 +6933,11 @@ tiff_size_of_memory (thandle_t data)
6904 compiler error compiling tiff_handler, see Bugzilla bug #17406 6933 compiler error compiling tiff_handler, see Bugzilla bug #17406
6905 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17406). Declaring 6934 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17406). Declaring
6906 this function as external works around that problem. */ 6935 this function as external works around that problem. */
6907#if defined (__MINGW32__) && __GNUC__ == 3 6936# if defined (__MINGW32__) && __GNUC__ == 3
6908# define MINGW_STATIC 6937# define MINGW_STATIC
6909#else 6938# else
6910# define MINGW_STATIC static 6939# define MINGW_STATIC static
6911#endif 6940# endif
6912 6941
6913MINGW_STATIC void 6942MINGW_STATIC void
6914tiff_handler (const char *, const char *, const char *, va_list) 6943tiff_handler (const char *, const char *, const char *, va_list)
@@ -6927,7 +6956,7 @@ tiff_handler (const char *log_format, const char *title,
6927 add_to_log (log_format, build_string (title), 6956 add_to_log (log_format, build_string (title),
6928 make_string (buf, max (0, min (len, sizeof buf - 1)))); 6957 make_string (buf, max (0, min (len, sizeof buf - 1))));
6929} 6958}
6930#undef MINGW_STATIC 6959# undef MINGW_STATIC
6931 6960
6932static void tiff_error_handler (const char *, const char *, va_list) 6961static void tiff_error_handler (const char *, const char *, va_list)
6933 ATTRIBUTE_FORMAT_PRINTF (2, 0); 6962 ATTRIBUTE_FORMAT_PRINTF (2, 0);
@@ -6966,8 +6995,8 @@ tiff_load (struct frame *f, struct image *img)
6966 specified_file = image_spec_value (img->spec, QCfile, NULL); 6995 specified_file = image_spec_value (img->spec, QCfile, NULL);
6967 specified_data = image_spec_value (img->spec, QCdata, NULL); 6996 specified_data = image_spec_value (img->spec, QCdata, NULL);
6968 6997
6969 fn_TIFFSetErrorHandler ((TIFFErrorHandler) tiff_error_handler); 6998 TIFFSetErrorHandler ((TIFFErrorHandler) tiff_error_handler);
6970 fn_TIFFSetWarningHandler ((TIFFErrorHandler) tiff_warning_handler); 6999 TIFFSetWarningHandler ((TIFFErrorHandler) tiff_warning_handler);
6971 7000
6972 if (NILP (specified_data)) 7001 if (NILP (specified_data))
6973 { 7002 {
@@ -6978,12 +7007,12 @@ tiff_load (struct frame *f, struct image *img)
6978 image_error ("Cannot find image file `%s'", specified_file, Qnil); 7007 image_error ("Cannot find image file `%s'", specified_file, Qnil);
6979 return 0; 7008 return 0;
6980 } 7009 }
6981#ifdef WINDOWSNT 7010# ifdef WINDOWSNT
6982 file = ansi_encode_filename (file); 7011 file = ansi_encode_filename (file);
6983#endif 7012# endif
6984 7013
6985 /* Try to open the image file. */ 7014 /* Try to open the image file. */
6986 tiff = fn_TIFFOpen (SSDATA (file), "r"); 7015 tiff = TIFFOpen (SSDATA (file), "r");
6987 if (tiff == NULL) 7016 if (tiff == NULL)
6988 { 7017 {
6989 image_error ("Cannot open `%s'", file, Qnil); 7018 image_error ("Cannot open `%s'", file, Qnil);
@@ -7003,14 +7032,14 @@ tiff_load (struct frame *f, struct image *img)
7003 memsrc.len = SBYTES (specified_data); 7032 memsrc.len = SBYTES (specified_data);
7004 memsrc.index = 0; 7033 memsrc.index = 0;
7005 7034
7006 tiff = fn_TIFFClientOpen ("memory_source", "r", (thandle_t)&memsrc, 7035 tiff = TIFFClientOpen ("memory_source", "r", (thandle_t)&memsrc,
7007 tiff_read_from_memory, 7036 tiff_read_from_memory,
7008 tiff_write_from_memory, 7037 tiff_write_from_memory,
7009 tiff_seek_in_memory, 7038 tiff_seek_in_memory,
7010 tiff_close_memory, 7039 tiff_close_memory,
7011 tiff_size_of_memory, 7040 tiff_size_of_memory,
7012 tiff_mmap_memory, 7041 tiff_mmap_memory,
7013 tiff_unmap_memory); 7042 tiff_unmap_memory);
7014 7043
7015 if (!tiff) 7044 if (!tiff)
7016 { 7045 {
@@ -7024,24 +7053,24 @@ tiff_load (struct frame *f, struct image *img)
7024 { 7053 {
7025 EMACS_INT ino = XFASTINT (image); 7054 EMACS_INT ino = XFASTINT (image);
7026 if (! (TYPE_MINIMUM (tdir_t) <= ino && ino <= TYPE_MAXIMUM (tdir_t) 7055 if (! (TYPE_MINIMUM (tdir_t) <= ino && ino <= TYPE_MAXIMUM (tdir_t)
7027 && fn_TIFFSetDirectory (tiff, ino))) 7056 && TIFFSetDirectory (tiff, ino)))
7028 { 7057 {
7029 image_error ("Invalid image number `%s' in image `%s'", 7058 image_error ("Invalid image number `%s' in image `%s'",
7030 image, img->spec); 7059 image, img->spec);
7031 fn_TIFFClose (tiff); 7060 TIFFClose (tiff);
7032 return 0; 7061 return 0;
7033 } 7062 }
7034 } 7063 }
7035 7064
7036 /* Get width and height of the image, and allocate a raster buffer 7065 /* Get width and height of the image, and allocate a raster buffer
7037 of width x height 32-bit values. */ 7066 of width x height 32-bit values. */
7038 fn_TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width); 7067 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width);
7039 fn_TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height); 7068 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height);
7040 7069
7041 if (!check_image_size (f, width, height)) 7070 if (!check_image_size (f, width, height))
7042 { 7071 {
7043 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); 7072 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
7044 fn_TIFFClose (tiff); 7073 TIFFClose (tiff);
7045 return 0; 7074 return 0;
7046 } 7075 }
7047 7076
@@ -7050,16 +7079,16 @@ tiff_load (struct frame *f, struct image *img)
7050 && image_create_x_image_and_pixmap (f, img, width, height, 0, 7079 && image_create_x_image_and_pixmap (f, img, width, height, 0,
7051 &ximg, 0))) 7080 &ximg, 0)))
7052 { 7081 {
7053 fn_TIFFClose (tiff); 7082 TIFFClose (tiff);
7054 return 0; 7083 return 0;
7055 } 7084 }
7056 7085
7057 buf = xmalloc (sizeof *buf * width * height); 7086 buf = xmalloc (sizeof *buf * width * height);
7058 7087
7059 rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0); 7088 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0);
7060 7089
7061 /* Count the number of images in the file. */ 7090 /* Count the number of images in the file. */
7062 for (count = 1; fn_TIFFSetDirectory (tiff, count); count++) 7091 for (count = 1; TIFFSetDirectory (tiff, count); count++)
7063 continue; 7092 continue;
7064 7093
7065 if (count > 1) 7094 if (count > 1)
@@ -7067,7 +7096,7 @@ tiff_load (struct frame *f, struct image *img)
7067 Fcons (make_number (count), 7096 Fcons (make_number (count),
7068 img->lisp_data)); 7097 img->lisp_data));
7069 7098
7070 fn_TIFFClose (tiff); 7099 TIFFClose (tiff);
7071 if (!rc) 7100 if (!rc)
7072 { 7101 {
7073 image_error ("Error reading TIFF image `%s'", img->spec, Qnil); 7102 image_error ("Error reading TIFF image `%s'", img->spec, Qnil);
@@ -7093,11 +7122,11 @@ tiff_load (struct frame *f, struct image *img)
7093 } 7122 }
7094 } 7123 }
7095 7124
7096#ifdef COLOR_TABLE_SUPPORT 7125# ifdef COLOR_TABLE_SUPPORT
7097 /* Remember the colors allocated for the image. Free the color table. */ 7126 /* Remember the colors allocated for the image. Free the color table. */
7098 img->colors = colors_in_color_table (&img->ncolors); 7127 img->colors = colors_in_color_table (&img->ncolors);
7099 free_color_table (); 7128 free_color_table ();
7100#endif /* COLOR_TABLE_SUPPORT */ 7129# endif /* COLOR_TABLE_SUPPORT */
7101 7130
7102 img->width = width; 7131 img->width = width;
7103 img->height = height; 7132 img->height = height;
@@ -7114,9 +7143,8 @@ tiff_load (struct frame *f, struct image *img)
7114 return 1; 7143 return 1;
7115} 7144}
7116 7145
7117#else /* HAVE_TIFF */ 7146#elif defined HAVE_NS
7118 7147
7119#ifdef HAVE_NS
7120static bool 7148static bool
7121tiff_load (struct frame *f, struct image *img) 7149tiff_load (struct frame *f, struct image *img)
7122{ 7150{
@@ -7124,9 +7152,8 @@ tiff_load (struct frame *f, struct image *img)
7124 image_spec_value (img->spec, QCfile, NULL), 7152 image_spec_value (img->spec, QCfile, NULL),
7125 image_spec_value (img->spec, QCdata, NULL)); 7153 image_spec_value (img->spec, QCdata, NULL));
7126} 7154}
7127#endif /* HAVE_NS */
7128 7155
7129#endif /* !HAVE_TIFF */ 7156#endif
7130 7157
7131 7158
7132 7159
@@ -7226,54 +7253,54 @@ gif_image_p (Lisp_Object object)
7226 7253
7227#ifdef HAVE_GIF 7254#ifdef HAVE_GIF
7228 7255
7229#if defined (HAVE_NTGUI) 7256# ifdef HAVE_NTGUI
7230 7257
7231/* winuser.h might define DrawText to DrawTextA or DrawTextW. 7258/* winuser.h might define DrawText to DrawTextA or DrawTextW.
7232 Undefine before redefining to avoid a preprocessor warning. */ 7259 Undefine before redefining to avoid a preprocessor warning. */
7233#ifdef DrawText 7260# ifdef DrawText
7234#undef DrawText 7261# undef DrawText
7235#endif 7262# endif
7236/* avoid conflict with QuickdrawText.h */ 7263/* avoid conflict with QuickdrawText.h */
7237#define DrawText gif_DrawText 7264# define DrawText gif_DrawText
7238#include <gif_lib.h> 7265# include <gif_lib.h>
7239#undef DrawText 7266# undef DrawText
7240 7267
7241/* Giflib before 5.0 didn't define these macros (used only if HAVE_NTGUI). */ 7268/* Giflib before 5.0 didn't define these macros (used only if HAVE_NTGUI). */
7242#ifndef GIFLIB_MINOR 7269# ifndef GIFLIB_MINOR
7243#define GIFLIB_MINOR 0 7270# define GIFLIB_MINOR 0
7244#endif 7271# endif
7245#ifndef GIFLIB_RELEASE 7272# ifndef GIFLIB_RELEASE
7246#define GIFLIB_RELEASE 0 7273# define GIFLIB_RELEASE 0
7247#endif 7274# endif
7248 7275
7249#else /* HAVE_NTGUI */ 7276# else /* HAVE_NTGUI */
7250 7277
7251#include <gif_lib.h> 7278# include <gif_lib.h>
7252 7279
7253#endif /* HAVE_NTGUI */ 7280# endif /* HAVE_NTGUI */
7254 7281
7255/* Giflib before 5.0 didn't define these macros. */ 7282/* Giflib before 5.0 didn't define these macros. */
7256#ifndef GIFLIB_MAJOR 7283# ifndef GIFLIB_MAJOR
7257#define GIFLIB_MAJOR 4 7284# define GIFLIB_MAJOR 4
7258#endif 7285# endif
7259 7286
7260#ifdef WINDOWSNT 7287# ifdef WINDOWSNT
7261 7288
7262/* GIF library details. */ 7289/* GIF library details. */
7263#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR) 7290# if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)
7264DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *, int *)); 7291DEF_DLL_FN (int, DGifCloseFile, (GifFileType *, int *));
7265#else 7292# else
7266DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); 7293DEF_DLL_FN (int, DGifCloseFile, (GifFileType *));
7267#endif 7294# endif
7268DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *)); 7295DEF_DLL_FN (int, DGifSlurp, (GifFileType *));
7269#if GIFLIB_MAJOR < 5 7296# if GIFLIB_MAJOR < 5
7270DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc)); 7297DEF_DLL_FN (GifFileType *, DGifOpen, (void *, InputFunc));
7271DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *)); 7298DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *));
7272#else 7299# else
7273DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *)); 7300DEF_DLL_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *));
7274DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *)); 7301DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *, int *));
7275DEF_IMGLIB_FN (char *, GifErrorString, (int)); 7302DEF_DLL_FN (char *, GifErrorString, (int));
7276#endif 7303# endif
7277 7304
7278static bool 7305static bool
7279init_gif_functions (void) 7306init_gif_functions (void)
@@ -7283,27 +7310,29 @@ init_gif_functions (void)
7283 if (!(library = w32_delayed_load (Qgif))) 7310 if (!(library = w32_delayed_load (Qgif)))
7284 return 0; 7311 return 0;
7285 7312
7286 LOAD_IMGLIB_FN (library, DGifCloseFile); 7313 LOAD_DLL_FN (library, DGifCloseFile);
7287 LOAD_IMGLIB_FN (library, DGifSlurp); 7314 LOAD_DLL_FN (library, DGifSlurp);
7288 LOAD_IMGLIB_FN (library, DGifOpen); 7315 LOAD_DLL_FN (library, DGifOpen);
7289 LOAD_IMGLIB_FN (library, DGifOpenFileName); 7316 LOAD_DLL_FN (library, DGifOpenFileName);
7290#if GIFLIB_MAJOR >= 5 7317# if GIFLIB_MAJOR >= 5
7291 LOAD_IMGLIB_FN (library, GifErrorString); 7318 LOAD_DLL_FN (library, GifErrorString);
7292#endif 7319# endif
7293 return 1; 7320 return 1;
7294} 7321}
7295 7322
7296#else 7323# undef DGifCloseFile
7324# undef DGifOpen
7325# undef DGifOpenFileName
7326# undef DGifSlurp
7327# undef GifErrorString
7297 7328
7298#define fn_DGifCloseFile DGifCloseFile 7329# define DGifCloseFile fn_DGifCloseFile
7299#define fn_DGifSlurp DGifSlurp 7330# define DGifOpen fn_DGifOpen
7300#define fn_DGifOpen DGifOpen 7331# define DGifOpenFileName fn_DGifOpenFileName
7301#define fn_DGifOpenFileName DGifOpenFileName 7332# define DGifSlurp fn_DGifSlurp
7302#if 5 <= GIFLIB_MAJOR 7333# define GifErrorString fn_GifErrorString
7303# define fn_GifErrorString GifErrorString
7304#endif
7305 7334
7306#endif /* WINDOWSNT */ 7335# endif /* WINDOWSNT */
7307 7336
7308/* Reading a GIF image from memory 7337/* Reading a GIF image from memory
7309 Based on the PNG memory stuff to a certain extent. */ 7338 Based on the PNG memory stuff to a certain extent. */
@@ -7340,9 +7369,9 @@ gif_close (GifFileType *gif, int *err)
7340 int retval; 7369 int retval;
7341 7370
7342#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR) 7371#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)
7343 retval = fn_DGifCloseFile (gif, err); 7372 retval = DGifCloseFile (gif, err);
7344#else 7373#else
7345 retval = fn_DGifCloseFile (gif); 7374 retval = DGifCloseFile (gif);
7346#if GIFLIB_MAJOR >= 5 7375#if GIFLIB_MAJOR >= 5
7347 if (err) 7376 if (err)
7348 *err = gif->Error; 7377 *err = gif->Error;
@@ -7390,18 +7419,18 @@ gif_load (struct frame *f, struct image *img)
7390 7419
7391 /* Open the GIF file. */ 7420 /* Open the GIF file. */
7392#if GIFLIB_MAJOR < 5 7421#if GIFLIB_MAJOR < 5
7393 gif = fn_DGifOpenFileName (SSDATA (file)); 7422 gif = DGifOpenFileName (SSDATA (file));
7394 if (gif == NULL) 7423 if (gif == NULL)
7395 { 7424 {
7396 image_error ("Cannot open `%s'", file, Qnil); 7425 image_error ("Cannot open `%s'", file, Qnil);
7397 return 0; 7426 return 0;
7398 } 7427 }
7399#else 7428#else
7400 gif = fn_DGifOpenFileName (SSDATA (file), &gif_err); 7429 gif = DGifOpenFileName (SSDATA (file), &gif_err);
7401 if (gif == NULL) 7430 if (gif == NULL)
7402 { 7431 {
7403 image_error ("Cannot open `%s': %s", 7432 image_error ("Cannot open `%s': %s",
7404 file, build_string (fn_GifErrorString (gif_err))); 7433 file, build_string (GifErrorString (gif_err)));
7405 return 0; 7434 return 0;
7406 } 7435 }
7407#endif 7436#endif
@@ -7421,18 +7450,18 @@ gif_load (struct frame *f, struct image *img)
7421 memsrc.index = 0; 7450 memsrc.index = 0;
7422 7451
7423#if GIFLIB_MAJOR < 5 7452#if GIFLIB_MAJOR < 5
7424 gif = fn_DGifOpen (&memsrc, gif_read_from_memory); 7453 gif = DGifOpen (&memsrc, gif_read_from_memory);
7425 if (!gif) 7454 if (!gif)
7426 { 7455 {
7427 image_error ("Cannot open memory source `%s'", img->spec, Qnil); 7456 image_error ("Cannot open memory source `%s'", img->spec, Qnil);
7428 return 0; 7457 return 0;
7429 } 7458 }
7430#else 7459#else
7431 gif = fn_DGifOpen (&memsrc, gif_read_from_memory, &gif_err); 7460 gif = DGifOpen (&memsrc, gif_read_from_memory, &gif_err);
7432 if (!gif) 7461 if (!gif)
7433 { 7462 {
7434 image_error ("Cannot open memory source `%s': %s", 7463 image_error ("Cannot open memory source `%s': %s",
7435 img->spec, build_string (fn_GifErrorString (gif_err))); 7464 img->spec, build_string (GifErrorString (gif_err)));
7436 return 0; 7465 return 0;
7437 } 7466 }
7438#endif 7467#endif
@@ -7447,7 +7476,7 @@ gif_load (struct frame *f, struct image *img)
7447 } 7476 }
7448 7477
7449 /* Read entire contents. */ 7478 /* Read entire contents. */
7450 rc = fn_DGifSlurp (gif); 7479 rc = DGifSlurp (gif);
7451 if (rc == GIF_ERROR || gif->ImageCount <= 0) 7480 if (rc == GIF_ERROR || gif->ImageCount <= 0)
7452 { 7481 {
7453 image_error ("Error reading `%s'", img->spec, Qnil); 7482 image_error ("Error reading `%s'", img->spec, Qnil);
@@ -7681,7 +7710,7 @@ gif_load (struct frame *f, struct image *img)
7681 if (gif_close (gif, &gif_err) == GIF_ERROR) 7710 if (gif_close (gif, &gif_err) == GIF_ERROR)
7682 { 7711 {
7683#if 5 <= GIFLIB_MAJOR 7712#if 5 <= GIFLIB_MAJOR
7684 char *error_text = fn_GifErrorString (gif_err); 7713 char *error_text = GifErrorString (gif_err);
7685 7714
7686 if (error_text) 7715 if (error_text)
7687 image_error ("Error closing `%s': %s", 7716 image_error ("Error closing `%s': %s",
@@ -8593,7 +8622,7 @@ and `imagemagick-types-inhibit'. */)
8593 SVG 8622 SVG
8594 ***********************************************************************/ 8623 ***********************************************************************/
8595 8624
8596#if defined (HAVE_RSVG) 8625#ifdef HAVE_RSVG
8597 8626
8598/* Function prototypes. */ 8627/* Function prototypes. */
8599 8628
@@ -8641,11 +8670,11 @@ static const struct image_keyword svg_format[SVG_LAST] =
8641 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} 8670 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
8642}; 8671};
8643 8672
8644#if defined HAVE_NTGUI && defined WINDOWSNT 8673# if defined HAVE_NTGUI && defined WINDOWSNT
8645static bool init_svg_functions (void); 8674static bool init_svg_functions (void);
8646#else 8675# else
8647#define init_svg_functions NULL 8676#define init_svg_functions NULL
8648#endif 8677# endif
8649 8678
8650/* Structure describing the image type `svg'. Its the same type of 8679/* Structure describing the image type `svg'. Its the same type of
8651 structure defined for all image formats, handled by emacs image 8680 structure defined for all image formats, handled by emacs image
@@ -8679,32 +8708,34 @@ svg_image_p (Lisp_Object object)
8679 return fmt[SVG_FILE].count + fmt[SVG_DATA].count == 1; 8708 return fmt[SVG_FILE].count + fmt[SVG_DATA].count == 1;
8680} 8709}
8681 8710
8682#include <librsvg/rsvg.h> 8711# include <librsvg/rsvg.h>
8683 8712
8684#ifdef WINDOWSNT 8713# ifdef WINDOWSNT
8685 8714
8686/* SVG library functions. */ 8715/* SVG library functions. */
8687DEF_IMGLIB_FN (RsvgHandle *, rsvg_handle_new, (void)); 8716DEF_DLL_FN (RsvgHandle *, rsvg_handle_new, (void));
8688DEF_IMGLIB_FN (void, rsvg_handle_get_dimensions, (RsvgHandle *, RsvgDimensionData *)); 8717DEF_DLL_FN (void, rsvg_handle_get_dimensions,
8689DEF_IMGLIB_FN (gboolean, rsvg_handle_write, (RsvgHandle *, const guchar *, gsize, GError **)); 8718 (RsvgHandle *, RsvgDimensionData *));
8690DEF_IMGLIB_FN (gboolean, rsvg_handle_close, (RsvgHandle *, GError **)); 8719DEF_DLL_FN (gboolean, rsvg_handle_write,
8691DEF_IMGLIB_FN (GdkPixbuf *, rsvg_handle_get_pixbuf, (RsvgHandle *)); 8720 (RsvgHandle *, const guchar *, gsize, GError **));
8692DEF_IMGLIB_FN (void, rsvg_handle_set_base_uri, (RsvgHandle *, const char *)); 8721DEF_DLL_FN (gboolean, rsvg_handle_close, (RsvgHandle *, GError **));
8693 8722DEF_DLL_FN (GdkPixbuf *, rsvg_handle_get_pixbuf, (RsvgHandle *));
8694DEF_IMGLIB_FN (int, gdk_pixbuf_get_width, (const GdkPixbuf *)); 8723DEF_DLL_FN (void, rsvg_handle_set_base_uri, (RsvgHandle *, const char *));
8695DEF_IMGLIB_FN (int, gdk_pixbuf_get_height, (const GdkPixbuf *)); 8724
8696DEF_IMGLIB_FN (guchar *, gdk_pixbuf_get_pixels, (const GdkPixbuf *)); 8725DEF_DLL_FN (int, gdk_pixbuf_get_width, (const GdkPixbuf *));
8697DEF_IMGLIB_FN (int, gdk_pixbuf_get_rowstride, (const GdkPixbuf *)); 8726DEF_DLL_FN (int, gdk_pixbuf_get_height, (const GdkPixbuf *));
8698DEF_IMGLIB_FN (GdkColorspace, gdk_pixbuf_get_colorspace, (const GdkPixbuf *)); 8727DEF_DLL_FN (guchar *, gdk_pixbuf_get_pixels, (const GdkPixbuf *));
8699DEF_IMGLIB_FN (int, gdk_pixbuf_get_n_channels, (const GdkPixbuf *)); 8728DEF_DLL_FN (int, gdk_pixbuf_get_rowstride, (const GdkPixbuf *));
8700DEF_IMGLIB_FN (gboolean, gdk_pixbuf_get_has_alpha, (const GdkPixbuf *)); 8729DEF_DLL_FN (GdkColorspace, gdk_pixbuf_get_colorspace, (const GdkPixbuf *));
8701DEF_IMGLIB_FN (int, gdk_pixbuf_get_bits_per_sample, (const GdkPixbuf *)); 8730DEF_DLL_FN (int, gdk_pixbuf_get_n_channels, (const GdkPixbuf *));
8702 8731DEF_DLL_FN (gboolean, gdk_pixbuf_get_has_alpha, (const GdkPixbuf *));
8703#if ! GLIB_CHECK_VERSION (2, 36, 0) 8732DEF_DLL_FN (int, gdk_pixbuf_get_bits_per_sample, (const GdkPixbuf *));
8704DEF_IMGLIB_FN (void, g_type_init, (void)); 8733
8705#endif 8734# if ! GLIB_CHECK_VERSION (2, 36, 0)
8706DEF_IMGLIB_FN (void, g_object_unref, (gpointer)); 8735DEF_DLL_FN (void, g_type_init, (void));
8707DEF_IMGLIB_FN (void, g_error_free, (GError *)); 8736# endif
8737DEF_DLL_FN (void, g_object_unref, (gpointer));
8738DEF_DLL_FN (void, g_error_free, (GError *));
8708 8739
8709Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; 8740Lisp_Object Qgdk_pixbuf, Qglib, Qgobject;
8710 8741
@@ -8724,56 +8755,71 @@ init_svg_functions (void)
8724 return 0; 8755 return 0;
8725 } 8756 }
8726 8757
8727 LOAD_IMGLIB_FN (library, rsvg_handle_new); 8758 LOAD_DLL_FN (library, rsvg_handle_new);
8728 LOAD_IMGLIB_FN (library, rsvg_handle_get_dimensions); 8759 LOAD_DLL_FN (library, rsvg_handle_get_dimensions);
8729 LOAD_IMGLIB_FN (library, rsvg_handle_write); 8760 LOAD_DLL_FN (library, rsvg_handle_write);
8730 LOAD_IMGLIB_FN (library, rsvg_handle_close); 8761 LOAD_DLL_FN (library, rsvg_handle_close);
8731 LOAD_IMGLIB_FN (library, rsvg_handle_get_pixbuf); 8762 LOAD_DLL_FN (library, rsvg_handle_get_pixbuf);
8732 LOAD_IMGLIB_FN (library, rsvg_handle_set_base_uri); 8763 LOAD_DLL_FN (library, rsvg_handle_set_base_uri);
8733 8764
8734 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_width); 8765 LOAD_DLL_FN (gdklib, gdk_pixbuf_get_width);
8735 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_height); 8766 LOAD_DLL_FN (gdklib, gdk_pixbuf_get_height);
8736 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_pixels); 8767 LOAD_DLL_FN (gdklib, gdk_pixbuf_get_pixels);
8737 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_rowstride); 8768 LOAD_DLL_FN (gdklib, gdk_pixbuf_get_rowstride);
8738 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_colorspace); 8769 LOAD_DLL_FN (gdklib, gdk_pixbuf_get_colorspace);
8739 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_n_channels); 8770 LOAD_DLL_FN (gdklib, gdk_pixbuf_get_n_channels);
8740 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_has_alpha); 8771 LOAD_DLL_FN (gdklib, gdk_pixbuf_get_has_alpha);
8741 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_bits_per_sample); 8772 LOAD_DLL_FN (gdklib, gdk_pixbuf_get_bits_per_sample);
8742 8773
8743#if ! GLIB_CHECK_VERSION (2, 36, 0) 8774# if ! GLIB_CHECK_VERSION (2, 36, 0)
8744 LOAD_IMGLIB_FN (gobject, g_type_init); 8775 LOAD_DLL_FN (gobject, g_type_init);
8745#endif 8776# endif
8746 LOAD_IMGLIB_FN (gobject, g_object_unref); 8777 LOAD_DLL_FN (gobject, g_object_unref);
8747 LOAD_IMGLIB_FN (glib, g_error_free); 8778 LOAD_DLL_FN (glib, g_error_free);
8748 8779
8749 return 1; 8780 return 1;
8750} 8781}
8751 8782
8752#else
8753/* The following aliases for library functions allow dynamic loading 8783/* The following aliases for library functions allow dynamic loading
8754 to be used on some platforms. */ 8784 to be used on some platforms. */
8755#define fn_rsvg_handle_new rsvg_handle_new
8756#define fn_rsvg_handle_get_dimensions rsvg_handle_get_dimensions
8757#define fn_rsvg_handle_write rsvg_handle_write
8758#define fn_rsvg_handle_close rsvg_handle_close
8759#define fn_rsvg_handle_get_pixbuf rsvg_handle_get_pixbuf
8760#define fn_rsvg_handle_set_base_uri rsvg_handle_set_base_uri
8761
8762#define fn_gdk_pixbuf_get_width gdk_pixbuf_get_width
8763#define fn_gdk_pixbuf_get_height gdk_pixbuf_get_height
8764#define fn_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels
8765#define fn_gdk_pixbuf_get_rowstride gdk_pixbuf_get_rowstride
8766#define fn_gdk_pixbuf_get_colorspace gdk_pixbuf_get_colorspace
8767#define fn_gdk_pixbuf_get_n_channels gdk_pixbuf_get_n_channels
8768#define fn_gdk_pixbuf_get_has_alpha gdk_pixbuf_get_has_alpha
8769#define fn_gdk_pixbuf_get_bits_per_sample gdk_pixbuf_get_bits_per_sample
8770 8785
8771#if ! GLIB_CHECK_VERSION (2, 36, 0) 8786# undef gdk_pixbuf_get_bits_per_sample
8772#define fn_g_type_init g_type_init 8787# undef gdk_pixbuf_get_colorspace
8773#endif 8788# undef gdk_pixbuf_get_has_alpha
8774#define fn_g_object_unref g_object_unref 8789# undef gdk_pixbuf_get_height
8775#define fn_g_error_free g_error_free 8790# undef gdk_pixbuf_get_n_channels
8776#endif /* !WINDOWSNT */ 8791# undef gdk_pixbuf_get_pixels
8792# undef gdk_pixbuf_get_rowstride
8793# undef gdk_pixbuf_get_width
8794# undef g_error_free
8795# undef g_object_unref
8796# undef g_type_init
8797# undef rsvg_handle_close
8798# undef rsvg_handle_get_dimensions
8799# undef rsvg_handle_get_pixbuf
8800# undef rsvg_handle_new
8801# undef rsvg_handle_set_base_uri
8802# undef rsvg_handle_write
8803
8804# define gdk_pixbuf_get_bits_per_sample fn_gdk_pixbuf_get_bits_per_sample
8805# define gdk_pixbuf_get_colorspace fn_gdk_pixbuf_get_colorspace
8806# define gdk_pixbuf_get_has_alpha fn_gdk_pixbuf_get_has_alpha
8807# define gdk_pixbuf_get_height fn_gdk_pixbuf_get_height
8808# define gdk_pixbuf_get_n_channels fn_gdk_pixbuf_get_n_channels
8809# define gdk_pixbuf_get_pixels fn_gdk_pixbuf_get_pixels
8810# define gdk_pixbuf_get_rowstride fn_gdk_pixbuf_get_rowstride
8811# define gdk_pixbuf_get_width fn_gdk_pixbuf_get_width
8812# define g_error_free fn_g_error_free
8813# define g_object_unref fn_g_object_unref
8814# define g_type_init fn_g_type_init
8815# define rsvg_handle_close fn_rsvg_handle_close
8816# define rsvg_handle_get_dimensions fn_rsvg_handle_get_dimensions
8817# define rsvg_handle_get_pixbuf fn_rsvg_handle_get_pixbuf
8818# define rsvg_handle_new fn_rsvg_handle_new
8819# define rsvg_handle_set_base_uri fn_rsvg_handle_set_base_uri
8820# define rsvg_handle_write fn_rsvg_handle_write
8821
8822# endif /* !WINDOWSNT */
8777 8823
8778/* Load SVG image IMG for use on frame F. Value is true if 8824/* Load SVG image IMG for use on frame F. Value is true if
8779 successful. */ 8825 successful. */
@@ -8862,28 +8908,28 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8862#if ! GLIB_CHECK_VERSION (2, 36, 0) 8908#if ! GLIB_CHECK_VERSION (2, 36, 0)
8863 /* g_type_init is a glib function that must be called prior to 8909 /* g_type_init is a glib function that must be called prior to
8864 using gnome type library functions (obsolete since 2.36.0). */ 8910 using gnome type library functions (obsolete since 2.36.0). */
8865 fn_g_type_init (); 8911 g_type_init ();
8866#endif 8912#endif
8867 8913
8868 /* Make a handle to a new rsvg object. */ 8914 /* Make a handle to a new rsvg object. */
8869 rsvg_handle = fn_rsvg_handle_new (); 8915 rsvg_handle = rsvg_handle_new ();
8870 8916
8871 /* Set base_uri for properly handling referenced images (via 'href'). 8917 /* Set base_uri for properly handling referenced images (via 'href').
8872 See rsvg bug 596114 - "image refs are relative to curdir, not .svg file" 8918 See rsvg bug 596114 - "image refs are relative to curdir, not .svg file"
8873 (https://bugzilla.gnome.org/show_bug.cgi?id=596114). */ 8919 (https://bugzilla.gnome.org/show_bug.cgi?id=596114). */
8874 if (filename) 8920 if (filename)
8875 fn_rsvg_handle_set_base_uri(rsvg_handle, filename); 8921 rsvg_handle_set_base_uri(rsvg_handle, filename);
8876 8922
8877 /* Parse the contents argument and fill in the rsvg_handle. */ 8923 /* Parse the contents argument and fill in the rsvg_handle. */
8878 fn_rsvg_handle_write (rsvg_handle, contents, size, &err); 8924 rsvg_handle_write (rsvg_handle, contents, size, &err);
8879 if (err) goto rsvg_error; 8925 if (err) goto rsvg_error;
8880 8926
8881 /* The parsing is complete, rsvg_handle is ready to used, close it 8927 /* The parsing is complete, rsvg_handle is ready to used, close it
8882 for further writes. */ 8928 for further writes. */
8883 fn_rsvg_handle_close (rsvg_handle, &err); 8929 rsvg_handle_close (rsvg_handle, &err);
8884 if (err) goto rsvg_error; 8930 if (err) goto rsvg_error;
8885 8931
8886 fn_rsvg_handle_get_dimensions (rsvg_handle, &dimension_data); 8932 rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
8887 if (! check_image_size (f, dimension_data.width, dimension_data.height)) 8933 if (! check_image_size (f, dimension_data.width, dimension_data.height))
8888 { 8934 {
8889 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); 8935 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
@@ -8892,26 +8938,26 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8892 8938
8893 /* We can now get a valid pixel buffer from the svg file, if all 8939 /* We can now get a valid pixel buffer from the svg file, if all
8894 went ok. */ 8940 went ok. */
8895 pixbuf = fn_rsvg_handle_get_pixbuf (rsvg_handle); 8941 pixbuf = rsvg_handle_get_pixbuf (rsvg_handle);
8896 if (!pixbuf) goto rsvg_error; 8942 if (!pixbuf) goto rsvg_error;
8897 fn_g_object_unref (rsvg_handle); 8943 g_object_unref (rsvg_handle);
8898 8944
8899 /* Extract some meta data from the svg handle. */ 8945 /* Extract some meta data from the svg handle. */
8900 width = fn_gdk_pixbuf_get_width (pixbuf); 8946 width = gdk_pixbuf_get_width (pixbuf);
8901 height = fn_gdk_pixbuf_get_height (pixbuf); 8947 height = gdk_pixbuf_get_height (pixbuf);
8902 pixels = fn_gdk_pixbuf_get_pixels (pixbuf); 8948 pixels = gdk_pixbuf_get_pixels (pixbuf);
8903 rowstride = fn_gdk_pixbuf_get_rowstride (pixbuf); 8949 rowstride = gdk_pixbuf_get_rowstride (pixbuf);
8904 8950
8905 /* Validate the svg meta data. */ 8951 /* Validate the svg meta data. */
8906 eassert (fn_gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB); 8952 eassert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
8907 eassert (fn_gdk_pixbuf_get_n_channels (pixbuf) == 4); 8953 eassert (gdk_pixbuf_get_n_channels (pixbuf) == 4);
8908 eassert (fn_gdk_pixbuf_get_has_alpha (pixbuf)); 8954 eassert (gdk_pixbuf_get_has_alpha (pixbuf));
8909 eassert (fn_gdk_pixbuf_get_bits_per_sample (pixbuf) == 8); 8955 eassert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
8910 8956
8911 /* Try to create a x pixmap to hold the svg pixmap. */ 8957 /* Try to create a x pixmap to hold the svg pixmap. */
8912 if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) 8958 if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
8913 { 8959 {
8914 fn_g_object_unref (pixbuf); 8960 g_object_unref (pixbuf);
8915 return 0; 8961 return 0;
8916 } 8962 }
8917 8963
@@ -8968,7 +9014,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8968 free_color_table (); 9014 free_color_table ();
8969#endif /* COLOR_TABLE_SUPPORT */ 9015#endif /* COLOR_TABLE_SUPPORT */
8970 9016
8971 fn_g_object_unref (pixbuf); 9017 g_object_unref (pixbuf);
8972 9018
8973 img->width = width; 9019 img->width = width;
8974 img->height = height; 9020 img->height = height;
@@ -8983,11 +9029,11 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8983 return 1; 9029 return 1;
8984 9030
8985 rsvg_error: 9031 rsvg_error:
8986 fn_g_object_unref (rsvg_handle); 9032 g_object_unref (rsvg_handle);
8987 /* FIXME: Use error->message so the user knows what is the actual 9033 /* FIXME: Use error->message so the user knows what is the actual
8988 problem with the image. */ 9034 problem with the image. */
8989 image_error ("Error parsing SVG image `%s'", img->spec, Qnil); 9035 image_error ("Error parsing SVG image `%s'", img->spec, Qnil);
8990 fn_g_error_free (err); 9036 g_error_free (err);
8991 return 0; 9037 return 0;
8992} 9038}
8993 9039
diff --git a/src/nsimage.m b/src/nsimage.m
index 640dfcbc113..d5c06477f8b 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -351,15 +351,15 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
351 { 351 {
352 if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)]) 352 if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)])
353 { 353 {
354 NSBitmapImageRep *bmRep = (NSBitmapImageRep *) rep; 354 NSBitmapImageRep *bmr = (NSBitmapImageRep *) rep;
355 355
356 if ([bmRep numberOfPlanes] >= 3) 356 if ([bmr numberOfPlanes] >= 3)
357 [bmRep getBitmapDataPlanes: pixmapData]; 357 [bmr getBitmapDataPlanes: pixmapData];
358 358
359 /* The next two lines cause the DPI of the image to be ignored. 359 /* The next two lines cause the DPI of the image to be ignored.
360 This seems to be the behavior users expect. */ 360 This seems to be the behavior users expect. */
361 [self setScalesWhenResized: YES]; 361 [self setScalesWhenResized: YES];
362 [self setSize: NSMakeSize([bmRep pixelsWide], [bmRep pixelsHigh])]; 362 [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])];
363 363
364 break; 364 break;
365 } 365 }
diff --git a/src/sysdep.c b/src/sysdep.c
index 24cc5cb0b40..7158f38dba2 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -110,6 +110,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
110#define _P_WAIT 0 110#define _P_WAIT 0
111int _cdecl _spawnlp (int, const char *, const char *, ...); 111int _cdecl _spawnlp (int, const char *, const char *, ...);
112int _cdecl _getpid (void); 112int _cdecl _getpid (void);
113/* The following is needed for O_CLOEXEC, F_SETFD, FD_CLOEXEC, and
114 several prototypes of functions called below. */
115#include <sys/socket.h>
113#endif 116#endif
114 117
115#include "syssignal.h" 118#include "syssignal.h"
@@ -1406,29 +1409,19 @@ setup_pty (int fd)
1406} 1409}
1407#endif /* HAVE_PTYS */ 1410#endif /* HAVE_PTYS */
1408 1411
1409#ifdef HAVE_SOCKETS
1410#include <sys/socket.h>
1411#include <netdb.h>
1412#endif /* HAVE_SOCKETS */
1413
1414#ifdef TRY_AGAIN
1415#ifndef HAVE_H_ERRNO
1416extern int h_errno;
1417#endif
1418#endif /* TRY_AGAIN */
1419
1420void 1412void
1421init_system_name (void) 1413init_system_name (void)
1422{ 1414{
1415 char *hostname_alloc = NULL;
1416 char *hostname;
1423#ifndef HAVE_GETHOSTNAME 1417#ifndef HAVE_GETHOSTNAME
1424 struct utsname uts; 1418 struct utsname uts;
1425 uname (&uts); 1419 uname (&uts);
1426 Vsystem_name = build_string (uts.nodename); 1420 hostname = uts.nodename;
1427#else /* HAVE_GETHOSTNAME */ 1421#else /* HAVE_GETHOSTNAME */
1428 char *hostname_alloc = NULL;
1429 char hostname_buf[256]; 1422 char hostname_buf[256];
1430 ptrdiff_t hostname_size = sizeof hostname_buf; 1423 ptrdiff_t hostname_size = sizeof hostname_buf;
1431 char *hostname = hostname_buf; 1424 hostname = hostname_buf;
1432 1425
1433 /* Try to get the host name; if the buffer is too short, try 1426 /* Try to get the host name; if the buffer is too short, try
1434 again. Apparently, the only indication gethostname gives of 1427 again. Apparently, the only indication gethostname gives of
@@ -1446,110 +1439,15 @@ init_system_name (void)
1446 hostname = hostname_alloc = xpalloc (hostname_alloc, &hostname_size, 1, 1439 hostname = hostname_alloc = xpalloc (hostname_alloc, &hostname_size, 1,
1447 min (PTRDIFF_MAX, SIZE_MAX), 1); 1440 min (PTRDIFF_MAX, SIZE_MAX), 1);
1448 } 1441 }
1449#ifdef HAVE_SOCKETS
1450 /* Turn the hostname into the official, fully-qualified hostname.
1451 Don't do this if we're going to dump; this can confuse system
1452 libraries on some machines and make the dumped emacs core dump. */
1453#ifndef CANNOT_DUMP
1454 if (initialized)
1455#endif /* not CANNOT_DUMP */
1456 if (! strchr (hostname, '.'))
1457 {
1458 int count;
1459#ifdef HAVE_GETADDRINFO
1460 struct addrinfo *res;
1461 struct addrinfo hints;
1462 int ret;
1463
1464 memset (&hints, 0, sizeof (hints));
1465 hints.ai_socktype = SOCK_STREAM;
1466 hints.ai_flags = AI_CANONNAME;
1467
1468 for (count = 0;; count++)
1469 {
1470 if ((ret = getaddrinfo (hostname, NULL, &hints, &res)) == 0
1471 || ret != EAI_AGAIN)
1472 break;
1473
1474 if (count >= 5)
1475 break;
1476 Fsleep_for (make_number (1), Qnil);
1477 }
1478
1479 if (ret == 0)
1480 {
1481 struct addrinfo *it = res;
1482 while (it)
1483 {
1484 char *fqdn = it->ai_canonname;
1485 if (fqdn && strchr (fqdn, '.')
1486 && strcmp (fqdn, "localhost.localdomain") != 0)
1487 break;
1488 it = it->ai_next;
1489 }
1490 if (it)
1491 {
1492 ptrdiff_t len = strlen (it->ai_canonname);
1493 if (hostname_size <= len)
1494 {
1495 hostname_size = len + 1;
1496 hostname = hostname_alloc = xrealloc (hostname_alloc,
1497 hostname_size);
1498 }
1499 strcpy (hostname, it->ai_canonname);
1500 }
1501 freeaddrinfo (res);
1502 }
1503#else /* !HAVE_GETADDRINFO */
1504 struct hostent *hp;
1505 for (count = 0;; count++)
1506 {
1507
1508#ifdef TRY_AGAIN
1509 h_errno = 0;
1510#endif
1511 hp = gethostbyname (hostname);
1512#ifdef TRY_AGAIN
1513 if (! (hp == 0 && h_errno == TRY_AGAIN))
1514#endif
1515
1516 break;
1517
1518 if (count >= 5)
1519 break;
1520 Fsleep_for (make_number (1), Qnil);
1521 }
1522
1523 if (hp)
1524 {
1525 char *fqdn = (char *) hp->h_name;
1526
1527 if (!strchr (fqdn, '.'))
1528 {
1529 /* We still don't have a fully qualified domain name.
1530 Try to find one in the list of alternate names */
1531 char **alias = hp->h_aliases;
1532 while (*alias
1533 && (!strchr (*alias, '.')
1534 || !strcmp (*alias, "localhost.localdomain")))
1535 alias++;
1536 if (*alias)
1537 fqdn = *alias;
1538 }
1539 hostname = fqdn;
1540 }
1541#endif /* !HAVE_GETADDRINFO */
1542 }
1543#endif /* HAVE_SOCKETS */
1544 Vsystem_name = build_string (hostname);
1545 xfree (hostname_alloc);
1546#endif /* HAVE_GETHOSTNAME */ 1442#endif /* HAVE_GETHOSTNAME */
1547 { 1443 char *p;
1548 char *p; 1444 for (p = hostname; *p; p++)
1549 for (p = SSDATA (Vsystem_name); *p; p++) 1445 if (*p == ' ' || *p == '\t')
1550 if (*p == ' ' || *p == '\t') 1446 *p = '-';
1551 *p = '-'; 1447 if (! (STRINGP (Vsystem_name) && SBYTES (Vsystem_name) == p - hostname
1552 } 1448 && strcmp (SSDATA (Vsystem_name), hostname) == 0))
1449 Vsystem_name = build_string (hostname);
1450 xfree (hostname_alloc);
1553} 1451}
1554 1452
1555sigset_t empty_mask; 1453sigset_t empty_mask;
diff --git a/src/term.c b/src/term.c
index 04f6e3318a0..bcb83e5891d 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1736,7 +1736,7 @@ produce_composite_glyph (struct it *it)
1736 { 1736 {
1737 struct composition *cmp = composition_table[it->cmp_it.id]; 1737 struct composition *cmp = composition_table[it->cmp_it.id];
1738 1738
1739 it->pixel_width = cmp->width; 1739 it->pixel_width = cmp->pixel_width;
1740 } 1740 }
1741 else 1741 else
1742 { 1742 {
diff --git a/src/w32.h b/src/w32.h
index e0aedcbffa2..18e12b2458c 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -225,4 +225,17 @@ extern ssize_t emacs_gnutls_push (gnutls_transport_ptr_t p,
225 const void* buf, size_t sz); 225 const void* buf, size_t sz);
226#endif /* HAVE_GNUTLS */ 226#endif /* HAVE_GNUTLS */
227 227
228/* Definine a function that will be loaded from a DLL. */
229#define DEF_DLL_FN(type, func, args) static type (FAR CDECL *fn_##func) args
230
231/* Load a function from the DLL. */
232#define LOAD_DLL_FN(lib, func) \
233 do \
234 { \
235 fn_##func = (void *) GetProcAddress (lib, #func); \
236 if (!fn_##func) \
237 return false; \
238 } \
239 while (false)
240
228#endif /* EMACS_W32_H */ 241#endif /* EMACS_W32_H */
diff --git a/src/xdisp.c b/src/xdisp.c
index 707418218f0..c87862d1b6d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7372,27 +7372,15 @@ set_iterator_to_next (struct it *it, int reseat_p)
7372 else if (it->cmp_it.id >= 0) 7372 else if (it->cmp_it.id >= 0)
7373 { 7373 {
7374 /* We are currently getting glyphs from a composition. */ 7374 /* We are currently getting glyphs from a composition. */
7375 int i;
7376
7377 if (! it->bidi_p) 7375 if (! it->bidi_p)
7378 { 7376 {
7379 IT_CHARPOS (*it) += it->cmp_it.nchars; 7377 IT_CHARPOS (*it) += it->cmp_it.nchars;
7380 IT_BYTEPOS (*it) += it->cmp_it.nbytes; 7378 IT_BYTEPOS (*it) += it->cmp_it.nbytes;
7381 if (it->cmp_it.to < it->cmp_it.nglyphs)
7382 {
7383 it->cmp_it.from = it->cmp_it.to;
7384 }
7385 else
7386 {
7387 it->cmp_it.id = -1;
7388 composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it),
7389 IT_BYTEPOS (*it),
7390 it->end_charpos, Qnil);
7391 }
7392 } 7379 }
7393 else if (! it->cmp_it.reversed_p) 7380 else
7394 { 7381 {
7395 /* Composition created while scanning forward. */ 7382 int i;
7383
7396 /* Update IT's char/byte positions to point to the first 7384 /* Update IT's char/byte positions to point to the first
7397 character of the next grapheme cluster, or to the 7385 character of the next grapheme cluster, or to the
7398 character visually after the current composition. */ 7386 character visually after the current composition. */
@@ -7400,52 +7388,34 @@ set_iterator_to_next (struct it *it, int reseat_p)
7400 bidi_move_to_visually_next (&it->bidi_it); 7388 bidi_move_to_visually_next (&it->bidi_it);
7401 IT_BYTEPOS (*it) = it->bidi_it.bytepos; 7389 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
7402 IT_CHARPOS (*it) = it->bidi_it.charpos; 7390 IT_CHARPOS (*it) = it->bidi_it.charpos;
7391 }
7403 7392
7404 if (it->cmp_it.to < it->cmp_it.nglyphs) 7393 if ((! it->bidi_p || ! it->cmp_it.reversed_p)
7405 { 7394 && it->cmp_it.to < it->cmp_it.nglyphs)
7406 /* Proceed to the next grapheme cluster. */ 7395 {
7407 it->cmp_it.from = it->cmp_it.to; 7396 /* Composition created while scanning forward. Proceed
7408 } 7397 to the next grapheme cluster. */
7409 else 7398 it->cmp_it.from = it->cmp_it.to;
7410 { 7399 }
7411 /* No more grapheme clusters in this composition. 7400 else if ((it->bidi_p && it->cmp_it.reversed_p)
7412 Find the next stop position. */ 7401 && it->cmp_it.from > 0)
7413 ptrdiff_t stop = it->end_charpos; 7402 {
7414 if (it->bidi_it.scan_dir < 0) 7403 /* Composition created while scanning backward. Proceed
7415 /* Now we are scanning backward and don't know 7404 to the previous grapheme cluster. */
7416 where to stop. */ 7405 it->cmp_it.to = it->cmp_it.from;
7417 stop = -1;
7418 composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it),
7419 IT_BYTEPOS (*it), stop, Qnil);
7420 }
7421 } 7406 }
7422 else 7407 else
7423 { 7408 {
7424 /* Composition created while scanning backward. */ 7409 /* No more grapheme clusters in this composition.
7425 /* Update IT's char/byte positions to point to the last 7410 Find the next stop position. */
7426 character of the previous grapheme cluster, or the 7411 ptrdiff_t stop = it->end_charpos;
7427 character visually after the current composition. */ 7412
7428 for (i = 0; i < it->cmp_it.nchars; i++) 7413 if (it->bidi_it.scan_dir < 0)
7429 bidi_move_to_visually_next (&it->bidi_it); 7414 /* Now we are scanning backward and don't know
7430 IT_BYTEPOS (*it) = it->bidi_it.bytepos; 7415 where to stop. */
7431 IT_CHARPOS (*it) = it->bidi_it.charpos; 7416 stop = -1;
7432 if (it->cmp_it.from > 0) 7417 composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it),
7433 { 7418 IT_BYTEPOS (*it), stop, Qnil);
7434 /* Proceed to the previous grapheme cluster. */
7435 it->cmp_it.to = it->cmp_it.from;
7436 }
7437 else
7438 {
7439 /* No more grapheme clusters in this composition.
7440 Find the next stop position. */
7441 ptrdiff_t stop = it->end_charpos;
7442 if (it->bidi_it.scan_dir < 0)
7443 /* Now we are scanning backward and don't know
7444 where to stop. */
7445 stop = -1;
7446 composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it),
7447 IT_BYTEPOS (*it), stop, Qnil);
7448 }
7449 } 7419 }
7450 } 7420 }
7451 else 7421 else
@@ -7574,61 +7544,63 @@ set_iterator_to_next (struct it *it, int reseat_p)
7574 } 7544 }
7575 if (it->cmp_it.id >= 0) 7545 if (it->cmp_it.id >= 0)
7576 { 7546 {
7577 int i; 7547 /* We are delivering display elements from a composition.
7578 7548 Update the string position past the grapheme cluster
7549 we've just processed. */
7579 if (! it->bidi_p) 7550 if (! it->bidi_p)
7580 { 7551 {
7581 IT_STRING_CHARPOS (*it) += it->cmp_it.nchars; 7552 IT_STRING_CHARPOS (*it) += it->cmp_it.nchars;
7582 IT_STRING_BYTEPOS (*it) += it->cmp_it.nbytes; 7553 IT_STRING_BYTEPOS (*it) += it->cmp_it.nbytes;
7583 if (it->cmp_it.to < it->cmp_it.nglyphs)
7584 it->cmp_it.from = it->cmp_it.to;
7585 else
7586 {
7587 it->cmp_it.id = -1;
7588 composition_compute_stop_pos (&it->cmp_it,
7589 IT_STRING_CHARPOS (*it),
7590 IT_STRING_BYTEPOS (*it),
7591 it->end_charpos, it->string);
7592 }
7593 } 7554 }
7594 else if (! it->cmp_it.reversed_p) 7555 else
7595 { 7556 {
7557 int i;
7558
7596 for (i = 0; i < it->cmp_it.nchars; i++) 7559 for (i = 0; i < it->cmp_it.nchars; i++)
7597 bidi_move_to_visually_next (&it->bidi_it); 7560 bidi_move_to_visually_next (&it->bidi_it);
7598 IT_STRING_BYTEPOS (*it) = it->bidi_it.bytepos; 7561 IT_STRING_BYTEPOS (*it) = it->bidi_it.bytepos;
7599 IT_STRING_CHARPOS (*it) = it->bidi_it.charpos; 7562 IT_STRING_CHARPOS (*it) = it->bidi_it.charpos;
7563 }
7600 7564
7601 if (it->cmp_it.to < it->cmp_it.nglyphs) 7565 /* Did we exhaust all the grapheme clusters of this
7602 it->cmp_it.from = it->cmp_it.to; 7566 composition? */
7603 else 7567 if ((! it->bidi_p || ! it->cmp_it.reversed_p)
7604 { 7568 && (it->cmp_it.to < it->cmp_it.nglyphs))
7605 ptrdiff_t stop = it->end_charpos; 7569 {
7606 if (it->bidi_it.scan_dir < 0) 7570 /* Not all the grapheme clusters were processed yet;
7607 stop = -1; 7571 advance to the next cluster. */
7608 composition_compute_stop_pos (&it->cmp_it, 7572 it->cmp_it.from = it->cmp_it.to;
7609 IT_STRING_CHARPOS (*it), 7573 }
7610 IT_STRING_BYTEPOS (*it), stop, 7574 else if ((it->bidi_p && it->cmp_it.reversed_p)
7611 it->string); 7575 && it->cmp_it.from > 0)
7612 } 7576 {
7577 /* Likewise: advance to the next cluster, but going in
7578 the reverse direction. */
7579 it->cmp_it.to = it->cmp_it.from;
7613 } 7580 }
7614 else 7581 else
7615 { 7582 {
7616 for (i = 0; i < it->cmp_it.nchars; i++) 7583 /* This composition was fully processed; find the next
7617 bidi_move_to_visually_next (&it->bidi_it); 7584 candidate place for checking for composed
7618 IT_STRING_BYTEPOS (*it) = it->bidi_it.bytepos; 7585 characters. */
7619 IT_STRING_CHARPOS (*it) = it->bidi_it.charpos; 7586 /* Always limit string searches to the string length;
7620 if (it->cmp_it.from > 0) 7587 any padding spaces are not part of the string, and
7621 it->cmp_it.to = it->cmp_it.from; 7588 there cannot be any compositions in that padding. */
7622 else 7589 ptrdiff_t stop = SCHARS (it->string);
7590
7591 if (it->bidi_p && it->bidi_it.scan_dir < 0)
7592 stop = -1;
7593 else if (it->end_charpos < stop)
7623 { 7594 {
7624 ptrdiff_t stop = it->end_charpos; 7595 /* Cf. PRECISION in reseat_to_string: we might be
7625 if (it->bidi_it.scan_dir < 0) 7596 limited in how many of the string characters we
7626 stop = -1; 7597 need to deliver. */
7627 composition_compute_stop_pos (&it->cmp_it, 7598 stop = it->end_charpos;
7628 IT_STRING_CHARPOS (*it),
7629 IT_STRING_BYTEPOS (*it), stop,
7630 it->string);
7631 } 7599 }
7600 composition_compute_stop_pos (&it->cmp_it,
7601 IT_STRING_CHARPOS (*it),
7602 IT_STRING_BYTEPOS (*it), stop,
7603 it->string);
7632 } 7604 }
7633 } 7605 }
7634 else 7606 else
@@ -7651,12 +7623,17 @@ set_iterator_to_next (struct it *it, int reseat_p)
7651 bidi_move_to_visually_next (&it->bidi_it); 7623 bidi_move_to_visually_next (&it->bidi_it);
7652 IT_STRING_BYTEPOS (*it) = it->bidi_it.bytepos; 7624 IT_STRING_BYTEPOS (*it) = it->bidi_it.bytepos;
7653 IT_STRING_CHARPOS (*it) = it->bidi_it.charpos; 7625 IT_STRING_CHARPOS (*it) = it->bidi_it.charpos;
7626 /* If the scan direction changes, we may need to update
7627 the place where to check for composed characters. */
7654 if (prev_scan_dir != it->bidi_it.scan_dir) 7628 if (prev_scan_dir != it->bidi_it.scan_dir)
7655 { 7629 {
7656 ptrdiff_t stop = it->end_charpos; 7630 ptrdiff_t stop = SCHARS (it->string);
7657 7631
7658 if (it->bidi_it.scan_dir < 0) 7632 if (it->bidi_it.scan_dir < 0)
7659 stop = -1; 7633 stop = -1;
7634 else if (it->end_charpos < stop)
7635 stop = it->end_charpos;
7636
7660 composition_compute_stop_pos (&it->cmp_it, 7637 composition_compute_stop_pos (&it->cmp_it,
7661 IT_STRING_CHARPOS (*it), 7638 IT_STRING_CHARPOS (*it),
7662 IT_STRING_BYTEPOS (*it), stop, 7639 IT_STRING_BYTEPOS (*it), stop,
diff --git a/src/xml.c b/src/xml.c
index d418202182b..6be3bc74e97 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -33,26 +33,17 @@ static Lisp_Object Qlibxml2_dll;
33 33
34#ifdef WINDOWSNT 34#ifdef WINDOWSNT
35 35
36#include <windows.h> 36# include <windows.h>
37#include "w32.h" 37# include "w32.h"
38 38
39/* Macro for defining functions that will be loaded from the libxml2 DLL. */ 39DEF_DLL_FN (htmlDocPtr, htmlReadMemory,
40#define DEF_XML2_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args
41
42/* Macro for loading libxml2 functions from the library. */
43#define LOAD_XML2_FN(lib,func) { \
44 fn_##func = (void *) GetProcAddress (lib, #func); \
45 if (!fn_##func) goto bad_library; \
46 }
47
48DEF_XML2_FN (htmlDocPtr, htmlReadMemory,
49 (const char *, int, const char *, const char *, int)); 40 (const char *, int, const char *, const char *, int));
50DEF_XML2_FN (xmlDocPtr, xmlReadMemory, 41DEF_DLL_FN (xmlDocPtr, xmlReadMemory,
51 (const char *, int, const char *, const char *, int)); 42 (const char *, int, const char *, const char *, int));
52DEF_XML2_FN (xmlNodePtr, xmlDocGetRootElement, (xmlDocPtr)); 43DEF_DLL_FN (xmlNodePtr, xmlDocGetRootElement, (xmlDocPtr));
53DEF_XML2_FN (void, xmlFreeDoc, (xmlDocPtr)); 44DEF_DLL_FN (void, xmlFreeDoc, (xmlDocPtr));
54DEF_XML2_FN (void, xmlCleanupParser, (void)); 45DEF_DLL_FN (void, xmlCleanupParser, (void));
55DEF_XML2_FN (void, xmlCheckVersion, (int)); 46DEF_DLL_FN (void, xmlCheckVersion, (int));
56 47
57static int 48static int
58libxml2_loaded_p (void) 49libxml2_loaded_p (void)
@@ -64,14 +55,33 @@ libxml2_loaded_p (void)
64 return 0; 55 return 0;
65} 56}
66 57
67#else /* !WINDOWSNT */ 58# undef htmlReadMemory
59# undef xmlCheckVersion
60# undef xmlCleanupParser
61# undef xmlDocGetRootElement
62# undef xmlFreeDoc
63# undef xmlReadMemory
64
65# define htmlReadMemory fn_htmlReadMemory
66# define xmlCheckVersion fn_xmlCheckVersion
67# define xmlCleanupParser fn_xmlCleanupParser
68# define xmlDocGetRootElement fn_xmlDocGetRootElement
69# define xmlFreeDoc fn_xmlFreeDoc
70# define xmlReadMemory fn_xmlReadMemory
71
72static bool
73load_dll_functions (HMODULE library)
74{
75 LOAD_DLL_FN (library, htmlReadMemory);
76 LOAD_DLL_FN (library, xmlReadMemory);
77 LOAD_DLL_FN (library, xmlDocGetRootElement);
78 LOAD_DLL_FN (library, xmlFreeDoc);
79 LOAD_DLL_FN (library, xmlCleanupParser);
80 LOAD_DLL_FN (library, xmlCheckVersion);
81 return true;
82}
68 83
69#define fn_htmlReadMemory htmlReadMemory 84#else /* !WINDOWSNT */
70#define fn_xmlReadMemory xmlReadMemory
71#define fn_xmlDocGetRootElement xmlDocGetRootElement
72#define fn_xmlFreeDoc xmlFreeDoc
73#define fn_xmlCleanupParser xmlCleanupParser
74#define fn_xmlCheckVersion xmlCheckVersion
75 85
76static int 86static int
77libxml2_loaded_p (void) 87libxml2_loaded_p (void)
@@ -97,14 +107,8 @@ init_libxml2_functions (void)
97 return 0; 107 return 0;
98 } 108 }
99 109
100 /* LOAD_XML2_FN jumps to bad_library if it fails to find the 110 if (! load_dll_functions (library))
101 named function. */ 111 goto bad_library;
102 LOAD_XML2_FN (library, htmlReadMemory);
103 LOAD_XML2_FN (library, xmlReadMemory);
104 LOAD_XML2_FN (library, xmlDocGetRootElement);
105 LOAD_XML2_FN (library, xmlFreeDoc);
106 LOAD_XML2_FN (library, xmlCleanupParser);
107 LOAD_XML2_FN (library, xmlCheckVersion);
108 112
109 Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qt), Vlibrary_cache); 113 Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qt), Vlibrary_cache);
110 return 1; 114 return 1;
@@ -182,7 +186,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Obj
182 const char *burl = ""; 186 const char *burl = "";
183 ptrdiff_t istart, iend, istart_byte, iend_byte; 187 ptrdiff_t istart, iend, istart_byte, iend_byte;
184 188
185 fn_xmlCheckVersion (LIBXML_VERSION); 189 xmlCheckVersion (LIBXML_VERSION);
186 190
187 validate_region (&start, &end); 191 validate_region (&start, &end);
188 192
@@ -201,16 +205,16 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Obj
201 } 205 }
202 206
203 if (htmlp) 207 if (htmlp)
204 doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte), 208 doc = htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
205 iend_byte - istart_byte, burl, "utf-8", 209 iend_byte - istart_byte, burl, "utf-8",
206 HTML_PARSE_RECOVER|HTML_PARSE_NONET| 210 HTML_PARSE_RECOVER|HTML_PARSE_NONET|
207 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR| 211 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
208 HTML_PARSE_NOBLANKS); 212 HTML_PARSE_NOBLANKS);
209 else 213 else
210 doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte), 214 doc = xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
211 iend_byte - istart_byte, burl, "utf-8", 215 iend_byte - istart_byte, burl, "utf-8",
212 XML_PARSE_NONET|XML_PARSE_NOWARNING| 216 XML_PARSE_NONET|XML_PARSE_NOWARNING|
213 XML_PARSE_NOBLANKS |XML_PARSE_NOERROR); 217 XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
214 218
215 if (doc != NULL) 219 if (doc != NULL)
216 { 220 {
@@ -232,14 +236,14 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, Lisp_Obj
232 if (NILP (result)) { 236 if (NILP (result)) {
233 /* The document doesn't have toplevel comments or we discarded 237 /* The document doesn't have toplevel comments or we discarded
234 them. Get the tree the proper way. */ 238 them. Get the tree the proper way. */
235 xmlNode *node = fn_xmlDocGetRootElement (doc); 239 xmlNode *node = xmlDocGetRootElement (doc);
236 if (node != NULL) 240 if (node != NULL)
237 result = make_dom (node); 241 result = make_dom (node);
238 } else 242 } else
239 result = Fcons (intern ("top"), 243 result = Fcons (intern ("top"),
240 Fcons (Qnil, Fnreverse (Fcons (r, result)))); 244 Fcons (Qnil, Fnreverse (Fcons (r, result))));
241 245
242 fn_xmlFreeDoc (doc); 246 xmlFreeDoc (doc);
243 } 247 }
244 248
245 return result; 249 return result;
@@ -249,7 +253,7 @@ void
249xml_cleanup_parser (void) 253xml_cleanup_parser (void)
250{ 254{
251 if (libxml2_loaded_p ()) 255 if (libxml2_loaded_p ())
252 fn_xmlCleanupParser (); 256 xmlCleanupParser ();
253} 257}
254 258
255DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region, 259DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region,
diff --git a/src/xrdb.c b/src/xrdb.c
index e21206d0800..8500fb1095b 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -385,10 +385,11 @@ get_environ_db (void)
385 { 385 {
386 char *home = gethomedir (); 386 char *home = gethomedir ();
387 ptrdiff_t homelen = strlen (home); 387 ptrdiff_t homelen = strlen (home);
388 Lisp_Object system_name = Fsystem_name ();
388 ptrdiff_t filenamesize = (homelen + sizeof xdefaults 389 ptrdiff_t filenamesize = (homelen + sizeof xdefaults
389 + SBYTES (Vsystem_name)); 390 + SBYTES (system_name));
390 p = filename = xrealloc (home, filenamesize); 391 p = filename = xrealloc (home, filenamesize);
391 lispstpcpy (stpcpy (filename + homelen, xdefaults), Vsystem_name); 392 lispstpcpy (stpcpy (filename + homelen, xdefaults), system_name);
392 } 393 }
393 394
394 db = XrmGetFileDatabase (p); 395 db = XrmGetFileDatabase (p);
diff --git a/src/xselect.c b/src/xselect.c
index 92e89822293..3f8a1321954 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -46,9 +46,10 @@ struct prop_location;
46struct selection_data; 46struct selection_data;
47 47
48static void x_decline_selection_request (struct input_event *); 48static void x_decline_selection_request (struct input_event *);
49static int x_convert_selection (struct input_event *, Lisp_Object, Lisp_Object, 49static bool x_convert_selection (struct input_event *, Lisp_Object,
50 Atom, int, struct x_display_info *); 50 Lisp_Object, Atom, bool,
51static int waiting_for_other_props_on_window (Display *, Window); 51 struct x_display_info *);
52static bool waiting_for_other_props_on_window (Display *, Window);
52static struct prop_location *expect_property_change (Display *, Window, 53static struct prop_location *expect_property_change (Display *, Window,
53 Atom, int); 54 Atom, int);
54static void unexpect_property_change (struct prop_location *); 55static void unexpect_property_change (struct prop_location *);
@@ -360,7 +361,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
360 361
361static Lisp_Object 362static Lisp_Object
362x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, 363x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
363 int local_request, struct x_display_info *dpyinfo) 364 bool local_request, struct x_display_info *dpyinfo)
364{ 365{
365 Lisp_Object local_value; 366 Lisp_Object local_value;
366 Lisp_Object handler_fn, value, check; 367 Lisp_Object handler_fn, value, check;
@@ -470,7 +471,7 @@ struct selection_data
470 ptrdiff_t size; 471 ptrdiff_t size;
471 int format; 472 int format;
472 Atom type; 473 Atom type;
473 int nofree; 474 bool nofree;
474 Atom property; 475 Atom property;
475 /* This can be set to non-NULL during x_reply_selection_request, if 476 /* This can be set to non-NULL during x_reply_selection_request, if
476 the selection is waiting for an INCR transfer to complete. Don't 477 the selection is waiting for an INCR transfer to complete. Don't
@@ -498,7 +499,7 @@ x_selection_request_lisp_error (void)
498 for (cs = converted_selections; cs; cs = next) 499 for (cs = converted_selections; cs; cs = next)
499 { 500 {
500 next = cs->next; 501 next = cs->next;
501 if (cs->nofree == 0 && cs->data) 502 if (! cs->nofree && cs->data)
502 xfree (cs->data); 503 xfree (cs->data);
503 xfree (cs); 504 xfree (cs);
504 } 505 }
@@ -531,7 +532,7 @@ struct prop_location
531 Window window; 532 Window window;
532 Atom property; 533 Atom property;
533 int desired_state; 534 int desired_state;
534 int arrived; 535 bool arrived;
535 struct prop_location *next; 536 struct prop_location *next;
536}; 537};
537 538
@@ -747,7 +748,7 @@ x_handle_selection_request (struct input_event *event)
747 Lisp_Object target_symbol = x_atom_to_symbol (dpyinfo, target); 748 Lisp_Object target_symbol = x_atom_to_symbol (dpyinfo, target);
748 Atom property = SELECTION_EVENT_PROPERTY (event); 749 Atom property = SELECTION_EVENT_PROPERTY (event);
749 Lisp_Object local_selection_data; 750 Lisp_Object local_selection_data;
750 int success = 0; 751 bool success = false;
751 ptrdiff_t count = SPECPDL_INDEX (); 752 ptrdiff_t count = SPECPDL_INDEX ();
752 GCPRO2 (local_selection_data, target_symbol); 753 GCPRO2 (local_selection_data, target_symbol);
753 754
@@ -805,9 +806,9 @@ x_handle_selection_request (struct input_event *event)
805 806
806 if (subproperty != None) 807 if (subproperty != None)
807 x_convert_selection (event, selection_symbol, subtarget, 808 x_convert_selection (event, selection_symbol, subtarget,
808 subproperty, 1, dpyinfo); 809 subproperty, true, dpyinfo);
809 } 810 }
810 success = 1; 811 success = true;
811 } 812 }
812 else 813 else
813 { 814 {
@@ -815,7 +816,7 @@ x_handle_selection_request (struct input_event *event)
815 property = SELECTION_EVENT_TARGET (event); 816 property = SELECTION_EVENT_TARGET (event);
816 success = x_convert_selection (event, selection_symbol, 817 success = x_convert_selection (event, selection_symbol,
817 target_symbol, property, 818 target_symbol, property,
818 0, dpyinfo); 819 false, dpyinfo);
819 } 820 }
820 821
821 DONE: 822 DONE:
@@ -844,15 +845,15 @@ x_handle_selection_request (struct input_event *event)
844 845
845/* Perform the requested selection conversion, and write the data to 846/* Perform the requested selection conversion, and write the data to
846 the converted_selections linked list, where it can be accessed by 847 the converted_selections linked list, where it can be accessed by
847 x_reply_selection_request. If FOR_MULTIPLE is non-zero, write out 848 x_reply_selection_request. If FOR_MULTIPLE, write out
848 the data even if conversion fails, using conversion_fail_tag. 849 the data even if conversion fails, using conversion_fail_tag.
849 850
850 Return 0 if the selection failed to convert, 1 otherwise. */ 851 Return true iff successful. */
851 852
852static int 853static bool
853x_convert_selection (struct input_event *event, Lisp_Object selection_symbol, 854x_convert_selection (struct input_event *event, Lisp_Object selection_symbol,
854 Lisp_Object target_symbol, Atom property, 855 Lisp_Object target_symbol, Atom property,
855 int for_multiple, struct x_display_info *dpyinfo) 856 bool for_multiple, struct x_display_info *dpyinfo)
856{ 857{
857 struct gcpro gcpro1; 858 struct gcpro gcpro1;
858 Lisp_Object lisp_selection; 859 Lisp_Object lisp_selection;
@@ -861,7 +862,7 @@ x_convert_selection (struct input_event *event, Lisp_Object selection_symbol,
861 862
862 lisp_selection 863 lisp_selection
863 = x_get_local_selection (selection_symbol, target_symbol, 864 = x_get_local_selection (selection_symbol, target_symbol,
864 0, dpyinfo); 865 false, dpyinfo);
865 866
866 /* A nil return value means we can't perform the conversion. */ 867 /* A nil return value means we can't perform the conversion. */
867 if (NILP (lisp_selection) 868 if (NILP (lisp_selection)
@@ -874,7 +875,7 @@ x_convert_selection (struct input_event *event, Lisp_Object selection_symbol,
874 cs->size = 1; 875 cs->size = 1;
875 cs->format = 32; 876 cs->format = 32;
876 cs->type = XA_ATOM; 877 cs->type = XA_ATOM;
877 cs->nofree = 1; 878 cs->nofree = true;
878 cs->property = property; 879 cs->property = property;
879 cs->wait_object = NULL; 880 cs->wait_object = NULL;
880 cs->next = converted_selections; 881 cs->next = converted_selections;
@@ -882,20 +883,20 @@ x_convert_selection (struct input_event *event, Lisp_Object selection_symbol,
882 } 883 }
883 884
884 UNGCPRO; 885 UNGCPRO;
885 return 0; 886 return false;
886 } 887 }
887 888
888 /* Otherwise, record the converted selection to binary. */ 889 /* Otherwise, record the converted selection to binary. */
889 cs = xmalloc (sizeof *cs); 890 cs = xmalloc (sizeof *cs);
890 cs->data = NULL; 891 cs->data = NULL;
891 cs->nofree = 1; 892 cs->nofree = true;
892 cs->property = property; 893 cs->property = property;
893 cs->wait_object = NULL; 894 cs->wait_object = NULL;
894 cs->next = converted_selections; 895 cs->next = converted_selections;
895 converted_selections = cs; 896 converted_selections = cs;
896 lisp_data_to_selection_data (dpyinfo, lisp_selection, cs); 897 lisp_data_to_selection_data (dpyinfo, lisp_selection, cs);
897 UNGCPRO; 898 UNGCPRO;
898 return 1; 899 return true;
899} 900}
900 901
901/* Handle a SelectionClear event EVENT, which indicates that some 902/* Handle a SelectionClear event EVENT, which indicates that some
@@ -1012,19 +1013,16 @@ x_clear_frame_selections (struct frame *f)
1012 } 1013 }
1013} 1014}
1014 1015
1015/* Nonzero if any properties for DISPLAY and WINDOW 1016/* True if any properties for DISPLAY and WINDOW
1016 are on the list of what we are waiting for. */ 1017 are on the list of what we are waiting for. */
1017 1018
1018static int 1019static bool
1019waiting_for_other_props_on_window (Display *display, Window window) 1020waiting_for_other_props_on_window (Display *display, Window window)
1020{ 1021{
1021 struct prop_location *rest = property_change_wait_list; 1022 for (struct prop_location *p = property_change_wait_list; p; p = p->next)
1022 while (rest) 1023 if (p->display == display && p->window == window)
1023 if (rest->display == display && rest->window == window) 1024 return true;
1024 return 1; 1025 return false;
1025 else
1026 rest = rest->next;
1027 return 0;
1028} 1026}
1029 1027
1030/* Add an entry to the list of property changes we are waiting for. 1028/* Add an entry to the list of property changes we are waiting for.
@@ -1043,7 +1041,7 @@ expect_property_change (Display *display, Window window,
1043 pl->property = property; 1041 pl->property = property;
1044 pl->desired_state = state; 1042 pl->desired_state = state;
1045 pl->next = property_change_wait_list; 1043 pl->next = property_change_wait_list;
1046 pl->arrived = 0; 1044 pl->arrived = false;
1047 property_change_wait_list = pl; 1045 property_change_wait_list = pl;
1048 return pl; 1046 return pl;
1049} 1047}
@@ -1106,7 +1104,7 @@ wait_for_property_change (struct prop_location *location)
1106 EMACS_INT secs = timeout / 1000; 1104 EMACS_INT secs = timeout / 1000;
1107 int nsecs = (timeout % 1000) * 1000000; 1105 int nsecs = (timeout % 1000) * 1000000;
1108 TRACE2 (" Waiting %"pI"d secs, %d nsecs", secs, nsecs); 1106 TRACE2 (" Waiting %"pI"d secs, %d nsecs", secs, nsecs);
1109 wait_reading_process_output (secs, nsecs, 0, 0, 1107 wait_reading_process_output (secs, nsecs, 0, false,
1110 property_change_reply, NULL, 0); 1108 property_change_reply, NULL, 0);
1111 1109
1112 if (NILP (XCAR (property_change_reply))) 1110 if (NILP (XCAR (property_change_reply)))
@@ -1138,7 +1136,7 @@ x_handle_property_notify (const XPropertyEvent *event)
1138 (event->state == PropertyDelete ? "deletion" : "change"), 1136 (event->state == PropertyDelete ? "deletion" : "change"),
1139 XGetAtomName (event->display, event->atom)); 1137 XGetAtomName (event->display, event->atom));
1140 1138
1141 rest->arrived = 1; 1139 rest->arrived = true;
1142 1140
1143 /* If this is the one wait_for_property_change is waiting for, 1141 /* If this is the one wait_for_property_change is waiting for,
1144 tell it to wake up. */ 1142 tell it to wake up. */
@@ -1204,7 +1202,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
1204 during this time. In fact, the SAVE_TARGETS mechanism requires 1202 during this time. In fact, the SAVE_TARGETS mechanism requires
1205 us to handle a clipboard manager's requests before it returns 1203 us to handle a clipboard manager's requests before it returns
1206 SelectionNotify. */ 1204 SelectionNotify. */
1207#if 0 1205#if false
1208 x_start_queuing_selection_requests (); 1206 x_start_queuing_selection_requests ();
1209 record_unwind_protect_void (x_stop_queuing_selection_requests); 1207 record_unwind_protect_void (x_stop_queuing_selection_requests);
1210#endif 1208#endif
@@ -1216,7 +1214,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
1216 secs = timeout / 1000; 1214 secs = timeout / 1000;
1217 nsecs = (timeout % 1000) * 1000000; 1215 nsecs = (timeout % 1000) * 1000000;
1218 TRACE1 (" Start waiting %"pI"d secs for SelectionNotify", secs); 1216 TRACE1 (" Start waiting %"pI"d secs for SelectionNotify", secs);
1219 wait_reading_process_output (secs, nsecs, 0, 0, 1217 wait_reading_process_output (secs, nsecs, 0, false,
1220 reading_selection_reply, NULL, 0); 1218 reading_selection_reply, NULL, 0);
1221 TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); 1219 TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply)));
1222 1220
@@ -1240,7 +1238,7 @@ static void
1240x_get_window_property (Display *display, Window window, Atom property, 1238x_get_window_property (Display *display, Window window, Atom property,
1241 unsigned char **data_ret, ptrdiff_t *bytes_ret, 1239 unsigned char **data_ret, ptrdiff_t *bytes_ret,
1242 Atom *actual_type_ret, int *actual_format_ret, 1240 Atom *actual_type_ret, int *actual_format_ret,
1243 unsigned long *actual_size_ret, int delete_p) 1241 unsigned long *actual_size_ret)
1244{ 1242{
1245 ptrdiff_t total_size; 1243 ptrdiff_t total_size;
1246 unsigned long bytes_remaining; 1244 unsigned long bytes_remaining;
@@ -1413,7 +1411,7 @@ receive_incremental_selection (struct x_display_info *dpyinfo,
1413 XFlush (display); 1411 XFlush (display);
1414 unblock_input (); 1412 unblock_input ();
1415 1413
1416 while (1) 1414 while (true)
1417 { 1415 {
1418 unsigned char *tmp_data; 1416 unsigned char *tmp_data;
1419 ptrdiff_t tmp_size_bytes; 1417 ptrdiff_t tmp_size_bytes;
@@ -1427,7 +1425,7 @@ receive_incremental_selection (struct x_display_info *dpyinfo,
1427 TRACE0 (" Get property value"); 1425 TRACE0 (" Get property value");
1428 x_get_window_property (display, window, property, 1426 x_get_window_property (display, window, property,
1429 &tmp_data, &tmp_size_bytes, 1427 &tmp_data, &tmp_size_bytes,
1430 type_ret, format_ret, size_ret, 1); 1428 type_ret, format_ret, size_ret);
1431 1429
1432 TRACE1 (" Read increment of %"pD"d bytes", tmp_size_bytes); 1430 TRACE1 (" Read increment of %"pD"d bytes", tmp_size_bytes);
1433 1431
@@ -1488,13 +1486,12 @@ x_get_window_property_as_lisp_data (struct x_display_info *dpyinfo,
1488 TRACE0 ("Reading selection data"); 1486 TRACE0 ("Reading selection data");
1489 1487
1490 x_get_window_property (display, window, property, &data, &bytes, 1488 x_get_window_property (display, window, property, &data, &bytes,
1491 &actual_type, &actual_format, &actual_size, 1); 1489 &actual_type, &actual_format, &actual_size);
1492 if (! data) 1490 if (! data)
1493 { 1491 {
1494 int there_is_a_selection_owner;
1495 block_input (); 1492 block_input ();
1496 there_is_a_selection_owner 1493 bool there_is_a_selection_owner
1497 = XGetSelectionOwner (display, selection_atom); 1494 = XGetSelectionOwner (display, selection_atom) != 0;
1498 unblock_input (); 1495 unblock_input ();
1499 if (there_is_a_selection_owner) 1496 if (there_is_a_selection_owner)
1500 signal_error ("Selection owner couldn't convert", 1497 signal_error ("Selection owner couldn't convert",
@@ -1687,7 +1684,7 @@ lisp_data_to_selection_data (struct x_display_info *dpyinfo,
1687 Lisp_Object type = Qnil; 1684 Lisp_Object type = Qnil;
1688 1685
1689 eassert (cs != NULL); 1686 eassert (cs != NULL);
1690 cs->nofree = 0; 1687 cs->nofree = false;
1691 1688
1692 if (CONSP (obj) && SYMBOLP (XCAR (obj))) 1689 if (CONSP (obj) && SYMBOLP (XCAR (obj)))
1693 { 1690 {
@@ -1714,7 +1711,7 @@ lisp_data_to_selection_data (struct x_display_info *dpyinfo,
1714 cs->format = 8; 1711 cs->format = 8;
1715 cs->size = SBYTES (obj); 1712 cs->size = SBYTES (obj);
1716 cs->data = SDATA (obj); 1713 cs->data = SDATA (obj);
1717 cs->nofree = 1; 1714 cs->nofree = true;
1718 } 1715 }
1719 else if (SYMBOLP (obj)) 1716 else if (SYMBOLP (obj))
1720 { 1717 {
@@ -1981,7 +1978,7 @@ On Nextstep, TIME-STAMP and TERMINAL are unused. */)
1981 if (!f) 1978 if (!f)
1982 error ("X selection unavailable for this frame"); 1979 error ("X selection unavailable for this frame");
1983 1980
1984 val = x_get_local_selection (selection_symbol, target_type, 1, 1981 val = x_get_local_selection (selection_symbol, target_type, true,
1985 FRAME_DISPLAY_INFO (f)); 1982 FRAME_DISPLAY_INFO (f));
1986 1983
1987 if (NILP (val) && FRAME_LIVE_P (f)) 1984 if (NILP (val) && FRAME_LIVE_P (f))
@@ -2432,7 +2429,7 @@ FRAME is on. If FRAME is nil, the selected frame is used. */)
2432 2429
2433/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */ 2430/* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */
2434 2431
2435int 2432bool
2436x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event, 2433x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event,
2437 struct x_display_info *dpyinfo, struct input_event *bufp) 2434 struct x_display_info *dpyinfo, struct input_event *bufp)
2438{ 2435{
@@ -2448,7 +2445,7 @@ x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event,
2448 for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) 2445 for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i)
2449 if (dpyinfo->x_dnd_atoms[i] == event->message_type) break; 2446 if (dpyinfo->x_dnd_atoms[i] == event->message_type) break;
2450 2447
2451 if (i == dpyinfo->x_dnd_atoms_length) return 0; 2448 if (i == dpyinfo->x_dnd_atoms_length) return false;
2452 2449
2453 XSETFRAME (frame, f); 2450 XSETFRAME (frame, f);
2454 2451
@@ -2484,7 +2481,7 @@ x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event,
2484 bufp->arg = vec; 2481 bufp->arg = vec;
2485 bufp->modifiers = 0; 2482 bufp->modifiers = 0;
2486 2483
2487 return 1; 2484 return true;
2488} 2485}
2489 2486
2490DEFUN ("x-send-client-message", Fx_send_client_message, 2487DEFUN ("x-send-client-message", Fx_send_client_message,
@@ -2535,7 +2532,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
2535 Window wdest; 2532 Window wdest;
2536 XEvent event; 2533 XEvent event;
2537 struct frame *f = decode_window_system_frame (from); 2534 struct frame *f = decode_window_system_frame (from);
2538 int to_root; 2535 bool to_root;
2539 2536
2540 CHECK_NUMBER (format); 2537 CHECK_NUMBER (format);
2541 CHECK_CONS (values); 2538 CHECK_CONS (values);
@@ -2592,7 +2589,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
2592 event then goes to clients selecting for events on the root window. */ 2589 event then goes to clients selecting for events on the root window. */
2593 x_catch_errors (dpyinfo->display); 2590 x_catch_errors (dpyinfo->display);
2594 { 2591 {
2595 int propagate = to_root ? False : True; 2592 bool propagate = !to_root;
2596 long mask = to_root ? 0xffffff : 0; 2593 long mask = to_root ? 0xffffff : 0;
2597 2594
2598 XSendEvent (dpyinfo->display, wdest, propagate, mask, &event); 2595 XSendEvent (dpyinfo->display, wdest, propagate, mask, &event);
diff --git a/src/xsettings.c b/src/xsettings.c
index 5f4275df545..066f426d241 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -68,11 +68,11 @@ store_config_changed_event (Lisp_Object arg, Lisp_Object display_name)
68 kbd_buffer_store_event (&event); 68 kbd_buffer_store_event (&event);
69} 69}
70 70
71/* Return non-zero if DPYINFO is still valid. */ 71/* Return true if DPYINFO is still valid. */
72static int 72static bool
73dpyinfo_valid (struct x_display_info *dpyinfo) 73dpyinfo_valid (struct x_display_info *dpyinfo)
74{ 74{
75 int found = 0; 75 bool found = false;
76 if (dpyinfo != NULL) 76 if (dpyinfo != NULL)
77 { 77 {
78 struct x_display_info *d; 78 struct x_display_info *d;
@@ -404,7 +404,7 @@ parse_settings (unsigned char *prop,
404 404
405 /* First 4 bytes is a serial number, skip that. */ 405 /* First 4 bytes is a serial number, skip that. */
406 406
407 if (bytes < 12) return BadLength; 407 if (bytes < 12) return settings_seen;
408 memcpy (&n_settings, prop+8, 4); 408 memcpy (&n_settings, prop+8, 4);
409 if (my_bo != that_bo) n_settings = bswap_32 (n_settings); 409 if (my_bo != that_bo) n_settings = bswap_32 (n_settings);
410 bytes_parsed = 12; 410 bytes_parsed = 12;
@@ -419,7 +419,7 @@ parse_settings (unsigned char *prop,
419 CARD32 vlen, ival = 0; 419 CARD32 vlen, ival = 0;
420 char name[128]; /* The names we are looking for are not this long. */ 420 char name[128]; /* The names we are looking for are not this long. */
421 char sval[128]; /* The values we are looking for are not this long. */ 421 char sval[128]; /* The values we are looking for are not this long. */
422 int want_this; 422 bool want_this;
423 int to_cpy; 423 int to_cpy;
424 424
425 sval[0] = '\0'; 425 sval[0] = '\0';
@@ -429,8 +429,8 @@ parse_settings (unsigned char *prop,
429 memcpy (&nlen, prop+bytes_parsed, 2); 429 memcpy (&nlen, prop+bytes_parsed, 2);
430 bytes_parsed += 2; 430 bytes_parsed += 2;
431 if (my_bo != that_bo) nlen = bswap_16 (nlen); 431 if (my_bo != that_bo) nlen = bswap_16 (nlen);
432 if (bytes_parsed+nlen > bytes) return BadLength; 432 if (bytes_parsed + nlen > bytes) return settings_seen;
433 to_cpy = nlen > 127 ? 127 : nlen; 433 to_cpy = min (nlen, sizeof name - 1);
434 memcpy (name, prop+bytes_parsed, to_cpy); 434 memcpy (name, prop+bytes_parsed, to_cpy);
435 name[to_cpy] = '\0'; 435 name[to_cpy] = '\0';
436 436
@@ -438,20 +438,19 @@ parse_settings (unsigned char *prop,
438 bytes_parsed = PAD (bytes_parsed); 438 bytes_parsed = PAD (bytes_parsed);
439 439
440 bytes_parsed += 4; /* Skip serial for this value */ 440 bytes_parsed += 4; /* Skip serial for this value */
441 if (bytes_parsed > bytes) return BadLength; 441 if (bytes_parsed > bytes) return settings_seen;
442 442
443 want_this = 443 want_this = strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0;
444#ifdef HAVE_XFT 444#ifdef HAVE_XFT
445 (nlen > 6 && strncmp (name, "Xft/", 4) == 0) 445 if ((nlen > 6 && memcmp (name, "Xft/", 4) == 0)
446 || strcmp (XSETTINGS_FONT_NAME, name) == 0 446 || strcmp (XSETTINGS_FONT_NAME, name) == 0)
447 || 447 want_this = true;
448#endif 448#endif
449 strcmp (XSETTINGS_TOOL_BAR_STYLE, name) == 0;
450 449
451 switch (type) 450 switch (type)
452 { 451 {
453 case 0: /* Integer */ 452 case 0: /* Integer */
454 if (bytes_parsed+4 > bytes) return BadLength; 453 if (bytes_parsed + 4 > bytes) return settings_seen;
455 if (want_this) 454 if (want_this)
456 { 455 {
457 memcpy (&ival, prop+bytes_parsed, 4); 456 memcpy (&ival, prop+bytes_parsed, 4);
@@ -461,13 +460,13 @@ parse_settings (unsigned char *prop,
461 break; 460 break;
462 461
463 case 1: /* String */ 462 case 1: /* String */
464 if (bytes_parsed+4 > bytes) return BadLength; 463 if (bytes_parsed + 4 > bytes) return settings_seen;
465 memcpy (&vlen, prop+bytes_parsed, 4); 464 memcpy (&vlen, prop+bytes_parsed, 4);
466 bytes_parsed += 4; 465 bytes_parsed += 4;
467 if (my_bo != that_bo) vlen = bswap_32 (vlen); 466 if (my_bo != that_bo) vlen = bswap_32 (vlen);
468 if (want_this) 467 if (want_this)
469 { 468 {
470 to_cpy = vlen > 127 ? 127 : vlen; 469 to_cpy = min (vlen, sizeof sval - 1);
471 memcpy (sval, prop+bytes_parsed, to_cpy); 470 memcpy (sval, prop+bytes_parsed, to_cpy);
472 sval[to_cpy] = '\0'; 471 sval[to_cpy] = '\0';
473 } 472 }
@@ -477,17 +476,16 @@ parse_settings (unsigned char *prop,
477 476
478 case 2: /* RGB value */ 477 case 2: /* RGB value */
479 /* No need to parse this */ 478 /* No need to parse this */
480 if (bytes_parsed+8 > bytes) return BadLength; 479 if (bytes_parsed + 8 > bytes) return settings_seen;
481 bytes_parsed += 8; /* 4 values (r, b, g, alpha), 2 bytes each. */ 480 bytes_parsed += 8; /* 4 values (r, b, g, alpha), 2 bytes each. */
482 break; 481 break;
483 482
484 default: /* Parse Error */ 483 default: /* Parse Error */
485 return BadValue; 484 return settings_seen;
486 } 485 }
487 486
488 if (want_this) 487 if (want_this)
489 { 488 {
490 ++settings_seen;
491 if (strcmp (name, XSETTINGS_TOOL_BAR_STYLE) == 0) 489 if (strcmp (name, XSETTINGS_TOOL_BAR_STYLE) == 0)
492 { 490 {
493 dupstring (&settings->tb_style, sval); 491 dupstring (&settings->tb_style, sval);
@@ -557,6 +555,9 @@ parse_settings (unsigned char *prop,
557 settings->seen &= ~SEEN_LCDFILTER; 555 settings->seen &= ~SEEN_LCDFILTER;
558 } 556 }
559#endif /* HAVE_XFT */ 557#endif /* HAVE_XFT */
558 else
559 want_this = false;
560 settings_seen += want_this;
560 } 561 }
561 } 562 }
562 563
@@ -565,9 +566,9 @@ parse_settings (unsigned char *prop,
565 566
566/* Read settings from the XSettings property window on display for DPYINFO. 567/* Read settings from the XSettings property window on display for DPYINFO.
567 Store settings read in SETTINGS. 568 Store settings read in SETTINGS.
568 Return non-zero if successful, zero if not. */ 569 Return true iff successful. */
569 570
570static int 571static bool
571read_settings (struct x_display_info *dpyinfo, struct xsettings *settings) 572read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
572{ 573{
573 Atom act_type; 574 Atom act_type;
@@ -576,6 +577,7 @@ read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
576 unsigned char *prop = NULL; 577 unsigned char *prop = NULL;
577 Display *dpy = dpyinfo->display; 578 Display *dpy = dpyinfo->display;
578 int rc; 579 int rc;
580 bool got_settings = false;
579 581
580 x_catch_errors (dpy); 582 x_catch_errors (dpy);
581 rc = XGetWindowProperty (dpy, 583 rc = XGetWindowProperty (dpy,
@@ -587,27 +589,26 @@ read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
587 589
588 if (rc == Success && prop != NULL && act_form == 8 && nitems > 0 590 if (rc == Success && prop != NULL && act_form == 8 && nitems > 0
589 && act_type == dpyinfo->Xatom_xsettings_prop) 591 && act_type == dpyinfo->Xatom_xsettings_prop)
590 rc = parse_settings (prop, nitems, settings); 592 got_settings = parse_settings (prop, nitems, settings) != 0;
591 593
592 XFree (prop); 594 XFree (prop);
593 595
594 x_uncatch_errors (); 596 x_uncatch_errors ();
595 597
596 return rc != 0; 598 return got_settings;
597} 599}
598 600
599/* Apply Xft settings in SETTINGS to the Xft library. 601/* Apply Xft settings in SETTINGS to the Xft library.
600 If SEND_EVENT_P is non-zero store a Lisp event that Xft settings changed. */ 602 Store a Lisp event that Xft settings changed. */
601 603
602static void 604static void
603apply_xft_settings (struct x_display_info *dpyinfo, 605apply_xft_settings (struct x_display_info *dpyinfo,
604 int send_event_p,
605 struct xsettings *settings) 606 struct xsettings *settings)
606{ 607{
607#ifdef HAVE_XFT 608#ifdef HAVE_XFT
608 FcPattern *pat; 609 FcPattern *pat;
609 struct xsettings oldsettings; 610 struct xsettings oldsettings;
610 int changed = 0; 611 bool changed = false;
611 612
612 memset (&oldsettings, 0, sizeof (oldsettings)); 613 memset (&oldsettings, 0, sizeof (oldsettings));
613 pat = FcPatternCreate (); 614 pat = FcPatternCreate ();
@@ -627,7 +628,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
627 { 628 {
628 FcPatternDel (pat, FC_ANTIALIAS); 629 FcPatternDel (pat, FC_ANTIALIAS);
629 FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa); 630 FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa);
630 ++changed; 631 changed = true;
631 oldsettings.aa = settings->aa; 632 oldsettings.aa = settings->aa;
632 } 633 }
633 634
@@ -636,7 +637,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
636 { 637 {
637 FcPatternDel (pat, FC_HINTING); 638 FcPatternDel (pat, FC_HINTING);
638 FcPatternAddBool (pat, FC_HINTING, settings->hinting); 639 FcPatternAddBool (pat, FC_HINTING, settings->hinting);
639 ++changed; 640 changed = true;
640 oldsettings.hinting = settings->hinting; 641 oldsettings.hinting = settings->hinting;
641 } 642 }
642 if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba) 643 if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba)
@@ -644,7 +645,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
644 FcPatternDel (pat, FC_RGBA); 645 FcPatternDel (pat, FC_RGBA);
645 FcPatternAddInteger (pat, FC_RGBA, settings->rgba); 646 FcPatternAddInteger (pat, FC_RGBA, settings->rgba);
646 oldsettings.rgba = settings->rgba; 647 oldsettings.rgba = settings->rgba;
647 ++changed; 648 changed = true;
648 } 649 }
649 650
650 /* Older fontconfig versions don't have FC_LCD_FILTER. */ 651 /* Older fontconfig versions don't have FC_LCD_FILTER. */
@@ -653,7 +654,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
653 { 654 {
654 FcPatternDel (pat, FC_LCD_FILTER); 655 FcPatternDel (pat, FC_LCD_FILTER);
655 FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter); 656 FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter);
656 ++changed; 657 changed = true;
657 oldsettings.lcdfilter = settings->lcdfilter; 658 oldsettings.lcdfilter = settings->lcdfilter;
658 } 659 }
659 660
@@ -663,7 +664,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
663 { 664 {
664 FcPatternDel (pat, FC_HINT_STYLE); 665 FcPatternDel (pat, FC_HINT_STYLE);
665 FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle); 666 FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle);
666 ++changed; 667 changed = true;
667 oldsettings.hintstyle = settings->hintstyle; 668 oldsettings.hintstyle = settings->hintstyle;
668 } 669 }
669#endif 670#endif
@@ -673,7 +674,7 @@ apply_xft_settings (struct x_display_info *dpyinfo,
673 { 674 {
674 FcPatternDel (pat, FC_DPI); 675 FcPatternDel (pat, FC_DPI);
675 FcPatternAddDouble (pat, FC_DPI, settings->dpi); 676 FcPatternAddDouble (pat, FC_DPI, settings->dpi);
676 ++changed; 677 changed = true;
677 oldsettings.dpi = settings->dpi; 678 oldsettings.dpi = settings->dpi;
678 679
679 /* Changing the DPI on this display affects all frames on it. 680 /* Changing the DPI on this display affects all frames on it.
@@ -699,9 +700,8 @@ apply_xft_settings (struct x_display_info *dpyinfo,
699 char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth]; 700 char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth];
700 701
701 XftDefaultSet (dpyinfo->display, pat); 702 XftDefaultSet (dpyinfo->display, pat);
702 if (send_event_p) 703 store_config_changed_event (Qfont_render,
703 store_config_changed_event (Qfont_render, 704 XCAR (dpyinfo->name_list_element));
704 XCAR (dpyinfo->name_list_element));
705 Vxft_settings 705 Vxft_settings
706 = make_formatted_string (buf, format, 706 = make_formatted_string (buf, format,
707 oldsettings.aa, oldsettings.hinting, 707 oldsettings.aa, oldsettings.hinting,
@@ -715,17 +715,17 @@ apply_xft_settings (struct x_display_info *dpyinfo,
715} 715}
716 716
717/* Read XSettings from the display for DPYINFO. 717/* Read XSettings from the display for DPYINFO.
718 If SEND_EVENT_P is non-zero store a Lisp event settings that changed. */ 718 If SEND_EVENT_P store a Lisp event settings that changed. */
719 719
720static void 720static void
721read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) 721read_and_apply_settings (struct x_display_info *dpyinfo, bool send_event_p)
722{ 722{
723 struct xsettings settings; 723 struct xsettings settings;
724 724
725 if (!read_settings (dpyinfo, &settings)) 725 if (!read_settings (dpyinfo, &settings))
726 return; 726 return;
727 727
728 apply_xft_settings (dpyinfo, True, &settings); 728 apply_xft_settings (dpyinfo, &settings);
729 if (settings.seen & SEEN_TB_STYLE) 729 if (settings.seen & SEEN_TB_STYLE)
730 { 730 {
731 if (send_event_p) 731 if (send_event_p)
@@ -751,27 +751,27 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p)
751void 751void
752xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event) 752xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event)
753{ 753{
754 bool check_window_p = 0, apply_settings_p = 0; 754 bool check_window_p = false, apply_settings_p = false;
755 755
756 switch (event->type) 756 switch (event->type)
757 { 757 {
758 case DestroyNotify: 758 case DestroyNotify:
759 if (dpyinfo->xsettings_window == event->xany.window) 759 if (dpyinfo->xsettings_window == event->xany.window)
760 check_window_p = 1; 760 check_window_p = true;
761 break; 761 break;
762 762
763 case ClientMessage: 763 case ClientMessage:
764 if (event->xclient.message_type == dpyinfo->Xatom_xsettings_mgr 764 if (event->xclient.message_type == dpyinfo->Xatom_xsettings_mgr
765 && event->xclient.data.l[1] == dpyinfo->Xatom_xsettings_sel 765 && event->xclient.data.l[1] == dpyinfo->Xatom_xsettings_sel
766 && event->xclient.window == dpyinfo->root_window) 766 && event->xclient.window == dpyinfo->root_window)
767 check_window_p = 1; 767 check_window_p = true;
768 break; 768 break;
769 769
770 case PropertyNotify: 770 case PropertyNotify:
771 if (event->xproperty.window == dpyinfo->xsettings_window 771 if (event->xproperty.window == dpyinfo->xsettings_window
772 && event->xproperty.state == PropertyNewValue 772 && event->xproperty.state == PropertyNewValue
773 && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop) 773 && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop)
774 apply_settings_p = 1; 774 apply_settings_p = true;
775 break; 775 break;
776 } 776 }
777 777
@@ -781,11 +781,11 @@ xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event)
781 dpyinfo->xsettings_window = None; 781 dpyinfo->xsettings_window = None;
782 get_prop_window (dpyinfo); 782 get_prop_window (dpyinfo);
783 if (dpyinfo->xsettings_window != None) 783 if (dpyinfo->xsettings_window != None)
784 apply_settings_p = 1; 784 apply_settings_p = true;
785 } 785 }
786 786
787 if (apply_settings_p) 787 if (apply_settings_p)
788 read_and_apply_settings (dpyinfo, True); 788 read_and_apply_settings (dpyinfo, true);
789} 789}
790 790
791/* Initialize GSettings and read startup values. */ 791/* Initialize GSettings and read startup values. */
@@ -795,7 +795,7 @@ init_gsettings (void)
795{ 795{
796#ifdef HAVE_GSETTINGS 796#ifdef HAVE_GSETTINGS
797 GVariant *val; 797 GVariant *val;
798 int schema_found = 0; 798 bool schema_found = false;
799 799
800#if ! GLIB_CHECK_VERSION (2, 36, 0) 800#if ! GLIB_CHECK_VERSION (2, 36, 0)
801 g_type_init (); 801 g_type_init ();
@@ -937,7 +937,7 @@ init_xsettings (struct x_display_info *dpyinfo)
937 937
938 get_prop_window (dpyinfo); 938 get_prop_window (dpyinfo);
939 if (dpyinfo->xsettings_window != None) 939 if (dpyinfo->xsettings_window != None)
940 read_and_apply_settings (dpyinfo, False); 940 read_and_apply_settings (dpyinfo, false);
941 941
942 unblock_input (); 942 unblock_input ();
943} 943}
@@ -1030,7 +1030,7 @@ syms_of_xsettings (void)
1030When this is non-nil and the system defined fixed width font changes, we 1030When this is non-nil and the system defined fixed width font changes, we
1031update frames dynamically. 1031update frames dynamically.
1032If this variable is nil, Emacs ignores system font changes. */); 1032If this variable is nil, Emacs ignores system font changes. */);
1033 use_system_font = 0; 1033 use_system_font = false;
1034 1034
1035 DEFVAR_LISP ("xft-settings", Vxft_settings, 1035 DEFVAR_LISP ("xft-settings", Vxft_settings,
1036 doc: /* Font settings applied to Xft. */); 1036 doc: /* Font settings applied to Xft. */);
diff --git a/src/xterm.c b/src/xterm.c
index f3b9cbe9a0f..c9b9e84b5e8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9244,13 +9244,9 @@ do_ewmh_fullscreen (struct frame *f)
9244 switch (f->want_fullscreen) 9244 switch (f->want_fullscreen)
9245 { 9245 {
9246 case FULLSCREEN_BOTH: 9246 case FULLSCREEN_BOTH:
9247 if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED 9247 if (cur != FULLSCREEN_BOTH)
9248 || cur == FULLSCREEN_HEIGHT) 9248 set_wm_state (frame, true, dpyinfo->Xatom_net_wm_state_fullscreen,
9249 set_wm_state (frame, false, 9249 None);
9250 dpyinfo->Xatom_net_wm_state_maximized_horz,
9251 dpyinfo->Xatom_net_wm_state_maximized_vert);
9252 set_wm_state (frame, true,
9253 dpyinfo->Xatom_net_wm_state_fullscreen, None);
9254 break; 9250 break;
9255 case FULLSCREEN_WIDTH: 9251 case FULLSCREEN_WIDTH:
9256 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT 9252 if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT
@@ -10515,8 +10511,9 @@ static bool
10515same_x_server (const char *name1, const char *name2) 10511same_x_server (const char *name1, const char *name2)
10516{ 10512{
10517 bool seen_colon = false; 10513 bool seen_colon = false;
10518 const char *system_name = SSDATA (Vsystem_name); 10514 Lisp_Object sysname = Fsystem_name ();
10519 ptrdiff_t system_name_length = SBYTES (Vsystem_name); 10515 const char *system_name = SSDATA (sysname);
10516 ptrdiff_t system_name_length = SBYTES (sysname);
10520 ptrdiff_t length_until_period = 0; 10517 ptrdiff_t length_until_period = 0;
10521 10518
10522 while (system_name[length_until_period] != 0 10519 while (system_name[length_until_period] != 0
@@ -10912,14 +10909,15 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10912#endif 10909#endif
10913 10910
10914 lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@"; 10911 lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@";
10915 if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name)) 10912 Lisp_Object system_name = Fsystem_name ();
10913 if (lim - SBYTES (Vinvocation_name) < SBYTES (system_name))
10916 memory_full (SIZE_MAX); 10914 memory_full (SIZE_MAX);
10917 dpyinfo->x_id = ++x_display_id; 10915 dpyinfo->x_id = ++x_display_id;
10918 dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name) 10916 dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name)
10919 + SBYTES (Vsystem_name) + 2); 10917 + SBYTES (system_name) + 2);
10920 char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name); 10918 char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name);
10921 *nametail++ = '@'; 10919 *nametail++ = '@';
10922 lispstpcpy (nametail, Vsystem_name); 10920 lispstpcpy (nametail, system_name);
10923 10921
10924 /* Figure out which modifier bits mean what. */ 10922 /* Figure out which modifier bits mean what. */
10925 x_find_modifier_meanings (dpyinfo); 10923 x_find_modifier_meanings (dpyinfo);
diff --git a/src/xterm.h b/src/xterm.h
index 84bb58c7232..13877d33935 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1049,10 +1049,10 @@ extern void x_send_client_event (Lisp_Object display,
1049 Lisp_Object format, 1049 Lisp_Object format,
1050 Lisp_Object values); 1050 Lisp_Object values);
1051 1051
1052extern int x_handle_dnd_message (struct frame *, 1052extern bool x_handle_dnd_message (struct frame *,
1053 const XClientMessageEvent *, 1053 const XClientMessageEvent *,
1054 struct x_display_info *, 1054 struct x_display_info *,
1055 struct input_event *); 1055 struct input_event *);
1056extern int x_check_property_data (Lisp_Object); 1056extern int x_check_property_data (Lisp_Object);
1057extern void x_fill_property_data (Display *, 1057extern void x_fill_property_data (Display *,
1058 Lisp_Object, 1058 Lisp_Object,
diff --git a/test/ChangeLog b/test/ChangeLog
index 7d33014f75c..2ea325432d0 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,72 @@
12014-12-27 Glenn Morris <rgm@gnu.org>
2
3 * automated/let-alist.el: Load dependency.
4
52014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
6
7 * automated/python-tests.el
8 (python-shell-completion-native-interpreter-disabled-p-1): New
9 test.
10
112014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
12
13 * automated/python-tests.el (python-shell-get-or-create-process-1)
14 (python-shell-get-or-create-process-2)
15 (python-shell-get-or-create-process-3): Remove tests.
16
172014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
18
19 (python-shell-buffer-substring-9): New test.
20
212014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
22
23 * automated/python-tests.el (python-shell-buffer-substring-1)
24 (python-shell-buffer-substring-2, python-shell-buffer-substring-3)
25 (python-shell-buffer-substring-4, python-shell-buffer-substring-5)
26 (python-shell-buffer-substring-6, python-shell-buffer-substring-7)
27 (python-shell-buffer-substring-8)
28 (python-info-encoding-from-cookie-1)
29 (python-info-encoding-from-cookie-2)
30 (python-info-encoding-from-cookie-3)
31 (python-info-encoding-from-cookie-4)
32 (python-info-encoding-from-cookie-5)
33 (python-info-encoding-from-cookie-6)
34 (python-info-encoding-from-cookie-7, python-info-encoding-1)
35 (python-info-encoding-2): New tests.
36
372014-12-27 Michael Albinus <michael.albinus@gmx.de>
38
39 * automated/tramp-tests.el (tramp-test17-insert-directory): Do not
40 expect a given order of "." and "..".
41
422014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
43
44 * automated/python-tests.el (python-indent-electric-colon-2)
45 (python-indent-electric-colon-3): New tests.
46
472014-12-27 João Távora <joaotavora@gmail.com>
48
49 * automated/electric-tests.el (autowrapping-7): Tests for
50 tex-mode.
51
522014-12-27 Glenn Morris <rgm@gnu.org>
53
54 * automated/flymake/warnpred/test.pl: Tweak format, since the
55 previous one seems to have stopped giving a warning with perl 5.20.1.
56
572014-12-26 Fabián Ezequiel Gallina <fgallina@gnu.org>
58
59 * automated/python-tests.el (python-shell-get-process-name-1)
60 (python-shell-internal-get-process-name-1): Cleanup.
61 (python-shell-get-process-name-2)
62 (python-shell-internal-get-process-name-2): New tests.
63 (python-shell-calculate-command-1)
64 (python-shell-calculate-process-environment-3)
65 (python-shell-calculate-exec-path-2, python-shell-make-comint-1)
66 (python-shell-make-comint-2, python-shell-make-comint-4)
67 (python-shell-get-process-1, python-util-clone-local-variables-1):
68 Replace obsolete function and variable references with current.
69
12014-12-19 Artur Malabarba <bruce.connor.am@gmail.com> 702014-12-19 Artur Malabarba <bruce.connor.am@gmail.com>
2 71
3 * automated/let-alist.el: require `cl-lib' 72 * automated/let-alist.el: require `cl-lib'
diff --git a/test/automated/data/flymake/test.pl b/test/automated/data/flymake/test.pl
index 2013b2e4434..d5abcb47e7f 100644
--- a/test/automated/data/flymake/test.pl
+++ b/test/automated/data/flymake/test.pl
@@ -1,2 +1,2 @@
1@arr = [1,2,3,4]; 1@arr = [1,2,3,4];
2@arr[1] = -1; 2my $b = @arr[1];
diff --git a/test/automated/electric-tests.el b/test/automated/electric-tests.el
index b1908e6bb32..cd07213bf20 100644
--- a/test/automated/electric-tests.el
+++ b/test/automated/electric-tests.el
@@ -60,7 +60,7 @@
60 (cl-progv 60 (cl-progv
61 (mapcar #'car bindings) 61 (mapcar #'car bindings)
62 (mapcar #'cdr bindings) 62 (mapcar #'cdr bindings)
63 (self-insert-command 1)))) 63 (call-interactively (key-binding `[,last-command-event])))))
64 (should (equal (buffer-substring-no-properties (point-min) (point-max)) 64 (should (equal (buffer-substring-no-properties (point-min) (point-max))
65 expected-string)) 65 expected-string))
66 (should (equal (point) 66 (should (equal (point)
@@ -575,5 +575,14 @@ baz\"\""
575 (skip-chars-backward "\"") 575 (skip-chars-backward "\"")
576 (mark-sexp -1))) 576 (mark-sexp -1)))
577 577
578(define-electric-pair-test autowrapping-7
579 "foo" "\"" :expected-string "``foo''" :expected-point 8
580 :modes '(tex-mode)
581 :fixture-fn #'(lambda ()
582 (electric-pair-mode 1)
583 (goto-char (point-max))
584 (skip-chars-backward "\"")
585 (mark-sexp -1)))
586
578(provide 'electric-tests) 587(provide 'electric-tests)
579;;; electric-tests.el ends here 588;;; electric-tests.el ends here
diff --git a/test/automated/let-alist.el b/test/automated/let-alist.el
index 6f58908cce7..a45864e220c 100644
--- a/test/automated/let-alist.el
+++ b/test/automated/let-alist.el
@@ -21,6 +21,7 @@
21 21
22(require 'ert) 22(require 'ert)
23(require 'cl-lib) 23(require 'cl-lib)
24(require 'let-alist)
24 25
25(ert-deftest let-alist-surface-test () 26(ert-deftest let-alist-surface-test ()
26 "Tests basic macro expansion for `let-alist'." 27 "Tests basic macro expansion for `let-alist'."
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index de20a80ea52..ca43c45ac5e 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -740,6 +740,39 @@ def b()
740 (python-tests-self-insert ":") 740 (python-tests-self-insert ":")
741 (should (= (current-indentation) 0)))) 741 (should (= (current-indentation) 0))))
742 742
743(ert-deftest python-indent-electric-colon-2 ()
744 "Test indentation case for dedenter."
745 (python-tests-with-temp-buffer
746 "
747if do:
748 something()
749 else
750"
751 (python-tests-look-at "else")
752 (goto-char (line-end-position))
753 (python-tests-self-insert ":")
754 (should (= (current-indentation) 0))))
755
756(ert-deftest python-indent-electric-colon-3 ()
757 "Test indentation case for multi-line dedenter."
758 (python-tests-with-temp-buffer
759 "
760if do:
761 something()
762 elif (this
763 and
764 that)
765"
766 (python-tests-look-at "that)")
767 (goto-char (line-end-position))
768 (python-tests-self-insert ":")
769 (python-tests-look-at "elif" -1)
770 (should (= (current-indentation) 0))
771 (python-tests-look-at "and")
772 (should (= (current-indentation) 6))
773 (python-tests-look-at "that)")
774 (should (= (current-indentation) 6))))
775
743(ert-deftest python-indent-region-1 () 776(ert-deftest python-indent-region-1 ()
744 "Test indentation case from Bug#18843." 777 "Test indentation case from Bug#18843."
745 (let ((contents " 778 (let ((contents "
@@ -1775,52 +1808,41 @@ def f():
1775(defvar python-tests-shell-interpreter "python") 1808(defvar python-tests-shell-interpreter "python")
1776 1809
1777(ert-deftest python-shell-get-process-name-1 () 1810(ert-deftest python-shell-get-process-name-1 ()
1778 "Check process name calculation on different scenarios." 1811 "Check process name calculation sans `buffer-file-name'."
1779 (python-tests-with-temp-buffer 1812 (python-tests-with-temp-buffer
1780 "" 1813 ""
1781 (should (string= (python-shell-get-process-name nil) 1814 (should (string= (python-shell-get-process-name nil)
1782 python-shell-buffer-name)) 1815 python-shell-buffer-name))
1783 ;; When the `current-buffer' doesn't have `buffer-file-name', even 1816 (should (string= (python-shell-get-process-name t)
1784 ;; if dedicated flag is non-nil should not include its name. 1817 (format "%s[%s]" python-shell-buffer-name (buffer-name))))))
1785 (should (string= (python-shell-get-process-name t) 1818
1786 python-shell-buffer-name))) 1819(ert-deftest python-shell-get-process-name-2 ()
1820 "Check process name calculation with `buffer-file-name'."
1787 (python-tests-with-temp-file 1821 (python-tests-with-temp-file
1788 "" 1822 ""
1789 ;; `buffer-file-name' is non-nil but the dedicated flag is nil and 1823 ;; `buffer-file-name' is non-nil but the dedicated flag is nil and
1790 ;; should be respected. 1824 ;; should be respected.
1791 (should (string= (python-shell-get-process-name nil) 1825 (should (string= (python-shell-get-process-name nil)
1792 python-shell-buffer-name)) 1826 python-shell-buffer-name))
1793 (should (string= 1827 (should (string=
1794 (python-shell-get-process-name t) 1828 (python-shell-get-process-name t)
1795 (format "%s[%s]" python-shell-buffer-name buffer-file-name))))) 1829 (format "%s[%s]" python-shell-buffer-name (buffer-name))))))
1796 1830
1797(ert-deftest python-shell-internal-get-process-name-1 () 1831(ert-deftest python-shell-internal-get-process-name-1 ()
1798 "Check the internal process name is config-unique." 1832 "Check the internal process name is buffer-unique sans `buffer-file-name'."
1799 (let* ((python-shell-interpreter python-tests-shell-interpreter) 1833 (python-tests-with-temp-buffer
1800 (python-shell-interpreter-args "") 1834 ""
1801 (python-shell-prompt-regexp ">>> ") 1835 (should (string= (python-shell-internal-get-process-name)
1802 (python-shell-prompt-block-regexp "[.][.][.] ") 1836 (format "%s[%s]" python-shell-internal-buffer-name (buffer-name))))))
1803 (python-shell-setup-codes "") 1837
1804 (python-shell-process-environment "") 1838(ert-deftest python-shell-internal-get-process-name-2 ()
1805 (python-shell-extra-pythonpaths "") 1839 "Check the internal process name is buffer-unique with `buffer-file-name'."
1806 (python-shell-exec-path "") 1840 (python-tests-with-temp-file
1807 (python-shell-virtualenv-path "") 1841 ""
1808 (expected (python-tests-with-temp-buffer 1842 (should (string= (python-shell-internal-get-process-name)
1809 "" (python-shell-internal-get-process-name)))) 1843 (format "%s[%s]" python-shell-internal-buffer-name (buffer-name))))))
1810 ;; Same configurations should match. 1844
1811 (should 1845(ert-deftest python-shell-calculate-command-1 ()
1812 (string= expected
1813 (python-tests-with-temp-buffer
1814 "" (python-shell-internal-get-process-name))))
1815 (let ((python-shell-interpreter-args "-B"))
1816 ;; A minimal change should generate different names.
1817 (should
1818 (not (string=
1819 expected
1820 (python-tests-with-temp-buffer
1821 "" (python-shell-internal-get-process-name))))))))
1822
1823(ert-deftest python-shell-parse-command-1 ()
1824 "Check the command to execute is calculated correctly. 1846 "Check the command to execute is calculated correctly.
1825Using `python-shell-interpreter' and 1847Using `python-shell-interpreter' and
1826`python-shell-interpreter-args'." 1848`python-shell-interpreter-args'."
@@ -1832,7 +1854,7 @@ Using `python-shell-interpreter' and
1832 (format "%s %s" 1854 (format "%s %s"
1833 python-shell-interpreter 1855 python-shell-interpreter
1834 python-shell-interpreter-args) 1856 python-shell-interpreter-args)
1835 (python-shell-parse-command))))) 1857 (python-shell-calculate-command)))))
1836 1858
1837(ert-deftest python-shell-calculate-process-environment-1 () 1859(ert-deftest python-shell-calculate-process-environment-1 ()
1838 "Test `python-shell-process-environment' modification." 1860 "Test `python-shell-process-environment' modification."
@@ -1857,17 +1879,17 @@ Using `python-shell-interpreter' and
1857 path-separator original-pythonpath))))) 1879 path-separator original-pythonpath)))))
1858 1880
1859(ert-deftest python-shell-calculate-process-environment-3 () 1881(ert-deftest python-shell-calculate-process-environment-3 ()
1860 "Test `python-shell-virtualenv-path' modification." 1882 "Test `python-shell-virtualenv-root' modification."
1861 (let* ((original-path (or (getenv "PATH") "")) 1883 (let* ((original-path (or (getenv "PATH") ""))
1862 (python-shell-virtualenv-path 1884 (python-shell-virtualenv-root
1863 (directory-file-name user-emacs-directory)) 1885 (directory-file-name user-emacs-directory))
1864 (process-environment 1886 (process-environment
1865 (python-shell-calculate-process-environment))) 1887 (python-shell-calculate-process-environment)))
1866 (should (not (getenv "PYTHONHOME"))) 1888 (should (not (getenv "PYTHONHOME")))
1867 (should (string= (getenv "VIRTUAL_ENV") python-shell-virtualenv-path)) 1889 (should (string= (getenv "VIRTUAL_ENV") python-shell-virtualenv-root))
1868 (should (equal (getenv "PATH") 1890 (should (equal (getenv "PATH")
1869 (format "%s/bin%s%s" 1891 (format "%s/bin%s%s"
1870 python-shell-virtualenv-path 1892 python-shell-virtualenv-root
1871 path-separator original-path))))) 1893 path-separator original-path)))))
1872 1894
1873(ert-deftest python-shell-calculate-process-environment-4 () 1895(ert-deftest python-shell-calculate-process-environment-4 ()
@@ -1900,13 +1922,13 @@ Using `python-shell-interpreter' and
1900(ert-deftest python-shell-calculate-exec-path-2 () 1922(ert-deftest python-shell-calculate-exec-path-2 ()
1901 "Test `python-shell-exec-path' modification." 1923 "Test `python-shell-exec-path' modification."
1902 (let* ((original-exec-path exec-path) 1924 (let* ((original-exec-path exec-path)
1903 (python-shell-virtualenv-path 1925 (python-shell-virtualenv-root
1904 (directory-file-name (expand-file-name user-emacs-directory))) 1926 (directory-file-name (expand-file-name user-emacs-directory)))
1905 (exec-path (python-shell-calculate-exec-path))) 1927 (exec-path (python-shell-calculate-exec-path)))
1906 (should (equal 1928 (should (equal
1907 exec-path 1929 exec-path
1908 (append (cons 1930 (append (cons
1909 (format "%s/bin" python-shell-virtualenv-path) 1931 (format "%s/bin" python-shell-virtualenv-root)
1910 original-exec-path)))))) 1932 original-exec-path))))))
1911 1933
1912(ert-deftest python-shell-make-comint-1 () 1934(ert-deftest python-shell-make-comint-1 ()
@@ -1922,7 +1944,7 @@ Using `python-shell-interpreter' and
1922 (shell-buffer 1944 (shell-buffer
1923 (python-tests-with-temp-buffer 1945 (python-tests-with-temp-buffer
1924 "" (python-shell-make-comint 1946 "" (python-shell-make-comint
1925 (python-shell-parse-command) proc-name))) 1947 (python-shell-calculate-command) proc-name)))
1926 (process (get-buffer-process shell-buffer))) 1948 (process (get-buffer-process shell-buffer)))
1927 (unwind-protect 1949 (unwind-protect
1928 (progn 1950 (progn
@@ -1943,7 +1965,7 @@ Using `python-shell-interpreter' and
1943 (shell-buffer 1965 (shell-buffer
1944 (python-tests-with-temp-buffer 1966 (python-tests-with-temp-buffer
1945 "" (python-shell-make-comint 1967 "" (python-shell-make-comint
1946 (python-shell-parse-command) proc-name nil t))) 1968 (python-shell-calculate-command) proc-name nil t)))
1947 (process (get-buffer-process shell-buffer))) 1969 (process (get-buffer-process shell-buffer)))
1948 (unwind-protect 1970 (unwind-protect
1949 (progn 1971 (progn
@@ -2010,7 +2032,7 @@ and `python-shell-interpreter-args' in the new shell buffer."
2010 (setenv "PYTHONSTARTUP" startup-file) 2032 (setenv "PYTHONSTARTUP" startup-file)
2011 (python-tests-with-temp-buffer 2033 (python-tests-with-temp-buffer
2012 "" (python-shell-make-comint 2034 "" (python-shell-make-comint
2013 (python-shell-parse-command) proc-name nil)))) 2035 (python-shell-calculate-command) proc-name nil))))
2014 (process (get-buffer-process shell-buffer))) 2036 (process (get-buffer-process shell-buffer)))
2015 (unwind-protect 2037 (unwind-protect
2016 (progn 2038 (progn
@@ -2040,10 +2062,10 @@ and `python-shell-interpreter-args' in the new shell buffer."
2040 (dedicated-proc-name (python-shell-get-process-name t)) 2062 (dedicated-proc-name (python-shell-get-process-name t))
2041 (global-shell-buffer 2063 (global-shell-buffer
2042 (python-shell-make-comint 2064 (python-shell-make-comint
2043 (python-shell-parse-command) global-proc-name)) 2065 (python-shell-calculate-command) global-proc-name))
2044 (dedicated-shell-buffer 2066 (dedicated-shell-buffer
2045 (python-shell-make-comint 2067 (python-shell-make-comint
2046 (python-shell-parse-command) dedicated-proc-name)) 2068 (python-shell-calculate-command) dedicated-proc-name))
2047 (global-process (get-buffer-process global-shell-buffer)) 2069 (global-process (get-buffer-process global-shell-buffer))
2048 (dedicated-process (get-buffer-process dedicated-shell-buffer))) 2070 (dedicated-process (get-buffer-process dedicated-shell-buffer)))
2049 (unwind-protect 2071 (unwind-protect
@@ -2061,84 +2083,6 @@ and `python-shell-interpreter-args' in the new shell buffer."
2061 (ignore-errors (kill-buffer global-shell-buffer)) 2083 (ignore-errors (kill-buffer global-shell-buffer))
2062 (ignore-errors (kill-buffer dedicated-shell-buffer)))))) 2084 (ignore-errors (kill-buffer dedicated-shell-buffer))))))
2063 2085
2064(ert-deftest python-shell-get-or-create-process-1 ()
2065 "Check shell dedicated process creation."
2066 (skip-unless (executable-find python-tests-shell-interpreter))
2067 (python-tests-with-temp-file
2068 ""
2069 (let* ((cmd
2070 (concat (executable-find python-tests-shell-interpreter) " -i"))
2071 (use-dialog-box)
2072 (dedicated-process-name (python-shell-get-process-name t))
2073 (dedicated-process (python-shell-get-or-create-process cmd t))
2074 (dedicated-shell-buffer (process-buffer dedicated-process)))
2075 (unwind-protect
2076 (progn
2077 (set-process-query-on-exit-flag dedicated-process nil)
2078 ;; should be dedicated.
2079 (should (equal (process-name dedicated-process)
2080 dedicated-process-name))
2081 (kill-buffer dedicated-shell-buffer)
2082 ;; Check there are no processes for current buffer.
2083 (should (not (python-shell-get-process))))
2084 (ignore-errors (kill-buffer dedicated-shell-buffer))))))
2085
2086(ert-deftest python-shell-get-or-create-process-2 ()
2087 "Check shell global process creation."
2088 (skip-unless (executable-find python-tests-shell-interpreter))
2089 (python-tests-with-temp-file
2090 ""
2091 (let* ((cmd
2092 (concat (executable-find python-tests-shell-interpreter) " -i"))
2093 (use-dialog-box)
2094 (process-name (python-shell-get-process-name nil))
2095 (process (python-shell-get-or-create-process cmd))
2096 (shell-buffer (process-buffer process)))
2097 (unwind-protect
2098 (progn
2099 (set-process-query-on-exit-flag process nil)
2100 ;; should be global.
2101 (should (equal (process-name process) process-name))
2102 (kill-buffer shell-buffer)
2103 ;; Check there are no processes for current buffer.
2104 (should (not (python-shell-get-process))))
2105 (ignore-errors (kill-buffer shell-buffer))))))
2106
2107(ert-deftest python-shell-get-or-create-process-3 ()
2108 "Check shell dedicated/global process preference."
2109 (skip-unless (executable-find python-tests-shell-interpreter))
2110 (python-tests-with-temp-file
2111 ""
2112 (let* ((cmd
2113 (concat (executable-find python-tests-shell-interpreter) " -i"))
2114 (python-shell-interpreter python-tests-shell-interpreter)
2115 (use-dialog-box)
2116 (dedicated-process-name (python-shell-get-process-name t))
2117 (global-process)
2118 (dedicated-process))
2119 (progn
2120 ;; Create global process
2121 (run-python cmd nil)
2122 (setq global-process (get-buffer-process "*Python*"))
2123 (should global-process)
2124 (set-process-query-on-exit-flag global-process nil)
2125 ;; Create dedicated process
2126 (run-python cmd t)
2127 (setq dedicated-process (get-process dedicated-process-name))
2128 (should dedicated-process)
2129 (set-process-query-on-exit-flag dedicated-process nil)
2130 ;; Prefer dedicated.
2131 (should (equal (python-shell-get-or-create-process)
2132 dedicated-process))
2133 ;; Kill the dedicated so the global takes over.
2134 (kill-buffer (process-buffer dedicated-process))
2135 ;; Detect global.
2136 (should (equal (python-shell-get-or-create-process) global-process))
2137 ;; Kill the global.
2138 (kill-buffer (process-buffer global-process))
2139 ;; Check there are no processes for current buffer.
2140 (should (not (python-shell-get-process)))))))
2141
2142(ert-deftest python-shell-internal-get-or-create-process-1 () 2086(ert-deftest python-shell-internal-get-or-create-process-1 ()
2143 "Check internal shell process creation fallback." 2087 "Check internal shell process creation fallback."
2144 (skip-unless (executable-find python-tests-shell-interpreter)) 2088 (skip-unless (executable-find python-tests-shell-interpreter))
@@ -2424,9 +2368,229 @@ and `python-shell-interpreter-args' in the new shell buffer."
2424 "^\\(o\\.t \\|\\)"))) 2368 "^\\(o\\.t \\|\\)")))
2425 (ignore-errors (delete-file startup-file))))) 2369 (ignore-errors (delete-file startup-file)))))
2426 2370
2371(ert-deftest python-shell-buffer-substring-1 ()
2372 "Selecting a substring of the whole buffer must match its contents."
2373 (python-tests-with-temp-buffer
2374 "
2375class Foo(models.Model):
2376 pass
2377
2378
2379class Bar(models.Model):
2380 pass
2381"
2382 (should (string= (buffer-string)
2383 (python-shell-buffer-substring (point-min) (point-max))))))
2384
2385(ert-deftest python-shell-buffer-substring-2 ()
2386 "Main block should be removed if NOMAIN is non-nil."
2387 (python-tests-with-temp-buffer
2388 "
2389class Foo(models.Model):
2390 pass
2391
2392class Bar(models.Model):
2393 pass
2394
2395if __name__ == \"__main__\":
2396 foo = Foo()
2397 print (foo)
2398"
2399 (should (string= (python-shell-buffer-substring (point-min) (point-max) t)
2400 "
2401class Foo(models.Model):
2402 pass
2403
2404class Bar(models.Model):
2405 pass
2406
2407
2408
2409
2410"))))
2411
2412(ert-deftest python-shell-buffer-substring-3 ()
2413 "Main block should be removed if NOMAIN is non-nil."
2414 (python-tests-with-temp-buffer
2415 "
2416class Foo(models.Model):
2417 pass
2418
2419if __name__ == \"__main__\":
2420 foo = Foo()
2421 print (foo)
2422
2423class Bar(models.Model):
2424 pass
2425"
2426 (should (string= (python-shell-buffer-substring (point-min) (point-max) t)
2427 "
2428class Foo(models.Model):
2429 pass
2430
2431
2432
2433
2434
2435class Bar(models.Model):
2436 pass
2437"))))
2438
2439(ert-deftest python-shell-buffer-substring-4 ()
2440 "Coding cookie should be added for substrings."
2441 (python-tests-with-temp-buffer
2442 "# coding: latin-1
2443
2444class Foo(models.Model):
2445 pass
2446
2447if __name__ == \"__main__\":
2448 foo = Foo()
2449 print (foo)
2450
2451class Bar(models.Model):
2452 pass
2453"
2454 (should (string= (python-shell-buffer-substring
2455 (python-tests-look-at "class Foo(models.Model):")
2456 (progn (python-nav-forward-sexp) (point)))
2457 "# -*- coding: latin-1 -*-
2458
2459class Foo(models.Model):
2460 pass"))))
2461
2462(ert-deftest python-shell-buffer-substring-5 ()
2463 "The proper amount of blank lines is added for a substring."
2464 (python-tests-with-temp-buffer
2465 "# coding: latin-1
2466
2467class Foo(models.Model):
2468 pass
2469
2470if __name__ == \"__main__\":
2471 foo = Foo()
2472 print (foo)
2473
2474class Bar(models.Model):
2475 pass
2476"
2477 (should (string= (python-shell-buffer-substring
2478 (python-tests-look-at "class Bar(models.Model):")
2479 (progn (python-nav-forward-sexp) (point)))
2480 "# -*- coding: latin-1 -*-
2481
2482
2483
2484
2485
2486
2487
2488
2489class Bar(models.Model):
2490 pass"))))
2491
2492(ert-deftest python-shell-buffer-substring-6 ()
2493 "Handle substring with coding cookie in the second line."
2494 (python-tests-with-temp-buffer
2495 "
2496# coding: latin-1
2497
2498class Foo(models.Model):
2499 pass
2500
2501if __name__ == \"__main__\":
2502 foo = Foo()
2503 print (foo)
2504
2505class Bar(models.Model):
2506 pass
2507"
2508 (should (string= (python-shell-buffer-substring
2509 (python-tests-look-at "# coding: latin-1")
2510 (python-tests-look-at "if __name__ == \"__main__\":"))
2511 "# -*- coding: latin-1 -*-
2512
2513
2514class Foo(models.Model):
2515 pass
2516
2517"))))
2518
2519(ert-deftest python-shell-buffer-substring-7 ()
2520 "Ensure first coding cookie gets precedence."
2521 (python-tests-with-temp-buffer
2522 "# coding: utf-8
2523# coding: latin-1
2524
2525class Foo(models.Model):
2526 pass
2527
2528if __name__ == \"__main__\":
2529 foo = Foo()
2530 print (foo)
2531
2532class Bar(models.Model):
2533 pass
2534"
2535 (should (string= (python-shell-buffer-substring
2536 (python-tests-look-at "# coding: latin-1")
2537 (python-tests-look-at "if __name__ == \"__main__\":"))
2538 "# -*- coding: utf-8 -*-
2539
2540
2541class Foo(models.Model):
2542 pass
2543
2544"))))
2545
2546(ert-deftest python-shell-buffer-substring-8 ()
2547 "Ensure first coding cookie gets precedence when sending whole buffer."
2548 (python-tests-with-temp-buffer
2549 "# coding: utf-8
2550# coding: latin-1
2551
2552class Foo(models.Model):
2553 pass
2554"
2555 (should (string= (python-shell-buffer-substring (point-min) (point-max))
2556 "# coding: utf-8
2557
2558
2559class Foo(models.Model):
2560 pass
2561"))))
2562
2563(ert-deftest python-shell-buffer-substring-9 ()
2564 "Check substring starting from `point-min'."
2565 (python-tests-with-temp-buffer
2566 "# coding: utf-8
2567
2568class Foo(models.Model):
2569 pass
2570
2571class Bar(models.Model):
2572 pass
2573"
2574 (should (string= (python-shell-buffer-substring
2575 (point-min)
2576 (python-tests-look-at "class Bar(models.Model):"))
2577 "# coding: utf-8
2578
2579class Foo(models.Model):
2580 pass
2581
2582"))))
2583
2427 2584
2428;;; Shell completion 2585;;; Shell completion
2429 2586
2587(ert-deftest python-shell-completion-native-interpreter-disabled-p-1 ()
2588 (let* ((python-shell-completion-native-disabled-interpreters (list "pypy"))
2589 (python-shell-interpreter "/some/path/to/bin/pypy"))
2590 (should (python-shell-completion-native-interpreter-disabled-p))))
2591
2592
2593
2430 2594
2431;;; PDB Track integration 2595;;; PDB Track integration
2432 2596
@@ -3738,6 +3902,85 @@ foo = True # another comment
3738 (forward-line 1) 3902 (forward-line 1)
3739 (should (python-info-current-line-empty-p)))) 3903 (should (python-info-current-line-empty-p))))
3740 3904
3905(ert-deftest python-info-encoding-from-cookie-1 ()
3906 "Should detect it on first line."
3907 (python-tests-with-temp-buffer
3908 "# coding=latin-1
3909
3910foo = True # another comment
3911"
3912 (should (eq (python-info-encoding-from-cookie) 'latin-1))))
3913
3914(ert-deftest python-info-encoding-from-cookie-2 ()
3915 "Should detect it on second line."
3916 (python-tests-with-temp-buffer
3917 "
3918# coding=latin-1
3919
3920foo = True # another comment
3921"
3922 (should (eq (python-info-encoding-from-cookie) 'latin-1))))
3923
3924(ert-deftest python-info-encoding-from-cookie-3 ()
3925 "Should not be detected on third line (and following ones)."
3926 (python-tests-with-temp-buffer
3927 "
3928
3929# coding=latin-1
3930foo = True # another comment
3931"
3932 (should (not (python-info-encoding-from-cookie)))))
3933
3934(ert-deftest python-info-encoding-from-cookie-4 ()
3935 "Should detect Emacs style."
3936 (python-tests-with-temp-buffer
3937 "# -*- coding: latin-1 -*-
3938
3939foo = True # another comment"
3940 (should (eq (python-info-encoding-from-cookie) 'latin-1))))
3941
3942(ert-deftest python-info-encoding-from-cookie-5 ()
3943 "Should detect Vim style."
3944 (python-tests-with-temp-buffer
3945 "# vim: set fileencoding=latin-1 :
3946
3947foo = True # another comment"
3948 (should (eq (python-info-encoding-from-cookie) 'latin-1))))
3949
3950(ert-deftest python-info-encoding-from-cookie-6 ()
3951 "First cookie wins."
3952 (python-tests-with-temp-buffer
3953 "# -*- coding: iso-8859-1 -*-
3954# vim: set fileencoding=latin-1 :
3955
3956foo = True # another comment"
3957 (should (eq (python-info-encoding-from-cookie) 'iso-8859-1))))
3958
3959(ert-deftest python-info-encoding-from-cookie-7 ()
3960 "First cookie wins."
3961 (python-tests-with-temp-buffer
3962 "# vim: set fileencoding=latin-1 :
3963# -*- coding: iso-8859-1 -*-
3964
3965foo = True # another comment"
3966 (should (eq (python-info-encoding-from-cookie) 'latin-1))))
3967
3968(ert-deftest python-info-encoding-1 ()
3969 "Should return the detected encoding from cookie."
3970 (python-tests-with-temp-buffer
3971 "# vim: set fileencoding=latin-1 :
3972
3973foo = True # another comment"
3974 (should (eq (python-info-encoding) 'latin-1))))
3975
3976(ert-deftest python-info-encoding-2 ()
3977 "Should default to utf-8."
3978 (python-tests-with-temp-buffer
3979 "# No encoding for you
3980
3981foo = True # another comment"
3982 (should (eq (python-info-encoding) 'utf-8))))
3983
3741 3984
3742;;; Utility functions 3985;;; Utility functions
3743 3986
@@ -3767,7 +4010,7 @@ def foo(a, b, c):
3767 . "from IPython.core.completerlib import module_completion") 4010 . "from IPython.core.completerlib import module_completion")
3768 (python-shell-completion-string-code 4011 (python-shell-completion-string-code
3769 . "';'.join(get_ipython().Completer.all_completions('''%s'''))\n") 4012 . "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
3770 (python-shell-virtualenv-path 4013 (python-shell-virtualenv-root
3771 . "/home/user/.virtualenvs/project")))) 4014 . "/home/user/.virtualenvs/project"))))
3772 (with-current-buffer buffer 4015 (with-current-buffer buffer
3773 (kill-all-local-variables) 4016 (kill-all-local-variables)
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index c03b7464b4f..c59445c3b02 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -953,7 +953,12 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
953 (goto-char (point-min)) 953 (goto-char (point-min))
954 (should 954 (should
955 (looking-at-p 955 (looking-at-p
956 "\\(total.+[[:digit:]]+\n\\)?.+ \\.\n.+ \\.\\.\n.+ foo$")))) 956 (concat
957 ;; There might be a summary line.
958 "\\(total.+[[:digit:]]+\n\\)?"
959 ;; We don't know in which order "." and ".." appear.
960 "\\(.+ \\.?\\.\n\\)\\{2\\}"
961 ".+ foo$")))))
957 (ignore-errors (delete-directory tmp-name1 'recursive))))) 962 (ignore-errors (delete-directory tmp-name1 'recursive)))))
958 963
959(ert-deftest tramp-test18-file-attributes () 964(ert-deftest tramp-test18-file-attributes ()