aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Wiegley2016-02-22 11:33:54 -0800
committerJohn Wiegley2016-02-22 11:33:54 -0800
commit81ef756e6aea369ec78f19b3609f01ceddc5851f (patch)
tree183251df6d3bf87ccc1216cf187e141488dd7c82
parent23d463d40cca1b68ef4f74a303b748e0649c506c (diff)
parenta9c48d5c9e3cb5952aab1c6e8821677d49068a74 (diff)
downloademacs-81ef756e6aea369ec78f19b3609f01ceddc5851f.tar.gz
emacs-81ef756e6aea369ec78f19b3609f01ceddc5851f.zip
Merge from origin/emacs-25
a9c48d5 Additional fixes for file notification 6bd9d69 Fix documentation of 'global-disable-point-adjustment' 8c22ac9 ; Spelling fix 2975784 Set file modes of pinentry socket for extra safety 2667b3e Clarify GnuPG version compatibility chapter 5e34c36 Revert "Change the default socket location for pinentry" e19c1c3 Kill off xref--display-history 5698947 Keep the xref buffer visible until the user quits it explicitly e34fbde Change the default socket location for pinentry 5f89658 Mention how to enable pinentry feature db51224 Sync with gnulib aa5a794 Remove `semanticdb-save-all-db-idle' from `auto-save-hook' 2d8b2fd Restore point when writing semantic table to disk 27d3430 Mention pinentry.el in epa manual 5baa001 Fix Bug#22736 7261355 Grammar fix in doc string d0f3b18 Naming fix for consistency 74ec92d Prefer customized value for GnuPG executable ea0b604 Fix memory reservation on MS-Windows c5f72aa Update NextStep readme and add wish list. 6de26a7 Report also result in `file-notify--test-event-handler' 5d17ae7 Improve file-notify-test08-watched-file-in-watched-dir 1cb1268 Fix todo-mode item date editing bugs 1e996cf Fix "[:upper:]" for non-ASCII characters 896f993 Allow customising the article mode cursor behavior 24c1c1d Use pop-to-buffer-same-window in woman.el 2a75f64 New filenotify test for bug#22736 c9bccf7 Report critical battery errors d675db9 Make eww message toggling message clearer 5e0bb40 * lisp/calc/calc-units.el (math-standard-units): Update to 2014 CODATA adjustment. fa8fd65 ; Improve character-folding entries in NEWS 3722a69 Fix bugs in window resizing code 289d5c6 Fix decoding DOS EOL in a unibyte buffer 2abcb06 Correct c-parse-state cache manipulation error. 14aec91 Take advantage of new GnuPG version check function e80c2a7 Make GnuPG version check robuster 15a9464 Fix x-load-color-file pointer signedness 132dbf0 * lisp/time-stamp.el (time-stamp-time-zone): Fix doc string punct. 78ab6f1 Follow convention for greek letter constants. 106b5bb Add Stefan-Boltzmann constant to calc units table. b96baa8 * lisp/calc/calc-units.el (math-build-units-table-buffer): Use special-mode. 5f91cf9 Avoid loading cl-lib for term/xterm.elc, eg in -Q -nw. (Bug#22669) 2d40f7d Fix soffice UserInstallation-URL for Windows b1a3ebe Fix display of <pre> elements 57d0e3d ; * lisp/help-fns.el: Remove outdated comment. 7a0628d ; * admin/make-tarball.txt: Mention cleaning.
-rw-r--r--admin/make-tarball.txt9
-rw-r--r--doc/misc/epa.texi76
-rw-r--r--doc/misc/gnus.texi4
-rw-r--r--doc/misc/texinfo.tex137
-rw-r--r--etc/NEWS20
-rw-r--r--lib/stdalign.in.h4
-rw-r--r--lisp/battery.el6
-rw-r--r--lisp/calc/calc-units.el85
-rw-r--r--lisp/calendar/todo-mode.el20
-rw-r--r--lisp/cedet/semantic/db-file.el32
-rw-r--r--lisp/cedet/semantic/db-mode.el1
-rw-r--r--lisp/custom.el2
-rw-r--r--lisp/doc-view.el5
-rw-r--r--lisp/emacs-lisp/cl-generic.el4
-rw-r--r--lisp/emacs-lisp/package.el15
-rw-r--r--lisp/epg-config.el82
-rw-r--r--lisp/epg.el10
-rw-r--r--lisp/filenotify.el63
-rw-r--r--lisp/gnus/gnus-art.el9
-rw-r--r--lisp/help-fns.el1
-rw-r--r--lisp/net/eww.el13
-rw-r--r--lisp/net/pinentry.el28
-rw-r--r--lisp/progmodes/cc-engine.el6
-rw-r--r--lisp/progmodes/xref.el113
-rw-r--r--lisp/time-stamp.el2
-rw-r--r--lisp/window.el26
-rw-r--r--lisp/woman.el6
-rw-r--r--nextstep/README102
-rw-r--r--nextstep/WISHLIST247
-rw-r--r--src/coding.c6
-rw-r--r--src/keyboard.c12
-rw-r--r--src/regex.c14
-rw-r--r--src/w32heap.c6
-rw-r--r--src/xfaces.c2
-rw-r--r--test/lisp/filenotify-tests.el232
35 files changed, 1044 insertions, 356 deletions
diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt
index 0730b947a03..030ad4cee68 100644
--- a/admin/make-tarball.txt
+++ b/admin/make-tarball.txt
@@ -5,7 +5,7 @@ Instructions to create pretest or release tarballs. -*- coding: utf-8 -*-
5 5
6Steps to take before starting on the first pretest in any release sequence: 6Steps to take before starting on the first pretest in any release sequence:
7 7
80. The release branch (e.g. emacs-24) should already have been made 80. The release branch (e.g. emacs-25) should already have been made
9 and you should use it for all that follows. Diffs from this 9 and you should use it for all that follows. Diffs from this
10 branch should be going to the emacs-diffs mailing list. 10 branch should be going to the emacs-diffs mailing list.
11 11
@@ -26,6 +26,13 @@ General steps (for each step, check for possible errors):
261. git pull # fetch from the repository 261. git pull # fetch from the repository
27 git status # check for locally modified files 27 git status # check for locally modified files
28 28
29 Ensure that you have a clean, unmodified state.
30 If you switched in-place from another branch to the release branch,
31 there could be inappropriate generated ignored files left over.
32 You might want to use "git status --ignored" to check for such files,
33 or some form of "git clean -x". It's probably simpler and safer to
34 make a new working directory exclusively for the release branch.
35
292. Regenerate the etc/AUTHORS file: 362. Regenerate the etc/AUTHORS file:
30 M-: (require 'authors) RET 37 M-: (require 'authors) RET
31 M-x authors RET 38 M-x authors RET
diff --git a/doc/misc/epa.texi b/doc/misc/epa.texi
index 527b44fb180..cb177c41f49 100644
--- a/doc/misc/epa.texi
+++ b/doc/misc/epa.texi
@@ -42,7 +42,7 @@ modify this GNU manual.''
42 42
43@contents 43@contents
44 44
45@node Top 45@node Top, Overview, (dir), (dir)
46@top EasyPG Assistant user's manual 46@top EasyPG Assistant user's manual
47 47
48EasyPG Assistant is an Emacs user interface to GNU Privacy Guard 48EasyPG Assistant is an Emacs user interface to GNU Privacy Guard
@@ -61,6 +61,7 @@ called EasyPG Library.
61* Quick start:: 61* Quick start::
62* Commands:: 62* Commands::
63* Caching Passphrases:: 63* Caching Passphrases::
64* GnuPG version compatibility::
64* Bug Reports:: 65* Bug Reports::
65* GNU Free Documentation License:: The license for this documentation. 66* GNU Free Documentation License:: The license for this documentation.
66* Key Index:: 67* Key Index::
@@ -68,7 +69,7 @@ called EasyPG Library.
68* Variable Index:: 69* Variable Index::
69@end menu 70@end menu
70 71
71@node Overview 72@node Overview, Quick start, Top, Top
72@chapter Overview 73@chapter Overview
73 74
74EasyPG Assistant provides the following features. 75EasyPG Assistant provides the following features.
@@ -82,7 +83,7 @@ EasyPG Assistant provides the following features.
82@item Automatic encryption/decryption of *.gpg files. 83@item Automatic encryption/decryption of *.gpg files.
83@end itemize 84@end itemize
84 85
85@node Quick start 86@node Quick start, Commands, Overview, Top
86@chapter Quick start 87@chapter Quick start
87 88
88EasyPG Assistant commands are prefixed by @samp{epa-}. For example, 89EasyPG Assistant commands are prefixed by @samp{epa-}. For example,
@@ -99,7 +100,7 @@ EasyPG Assistant provides several cryptographic features which can be
99integrated into other Emacs functionalities. For example, automatic 100integrated into other Emacs functionalities. For example, automatic
100encryption/decryption of @file{*.gpg} files. 101encryption/decryption of @file{*.gpg} files.
101 102
102@node Commands 103@node Commands, GnuPG version compatibility, Quick start, Top
103@chapter Commands 104@chapter Commands
104 105
105This chapter introduces various commands for typical use cases. 106This chapter introduces various commands for typical use cases.
@@ -113,7 +114,7 @@ This chapter introduces various commands for typical use cases.
113* Encrypting/decrypting gpg files:: 114* Encrypting/decrypting gpg files::
114@end menu 115@end menu
115 116
116@node Key management 117@node Key management, Cryptographic operations on regions, Commands, Commands
117@section Key management 118@section Key management
118Probably the first step of using EasyPG Assistant is to browse your 119Probably the first step of using EasyPG Assistant is to browse your
119keyring. @kbd{M-x epa-list-keys} is corresponding to @samp{gpg 120keyring. @kbd{M-x epa-list-keys} is corresponding to @samp{gpg
@@ -196,7 +197,7 @@ Delete selected keys. If @var{allow-secret} is non-@code{nil}, it
196also delete the secret keys. 197also delete the secret keys.
197@end deffn 198@end deffn
198 199
199@node Cryptographic operations on regions 200@node Cryptographic operations on regions, Cryptographic operations on files, Key management, Commands
200@section Cryptographic operations on regions 201@section Cryptographic operations on regions
201 202
202@deffn Command epa-decrypt-region start end 203@deffn Command epa-decrypt-region start end
@@ -241,7 +242,7 @@ also ask you whether or not to sign the text before encryption and if
241you answered yes, it will let you select the signing keys. 242you answered yes, it will let you select the signing keys.
242@end deffn 243@end deffn
243 244
244@node Cryptographic operations on files 245@node Cryptographic operations on files, Dired integration, Cryptographic operations on regions, Commands
245@section Cryptographic operations on files 246@section Cryptographic operations on files
246 247
247@deffn Command epa-decrypt-file file &optional output 248@deffn Command epa-decrypt-file file &optional output
@@ -262,7 +263,7 @@ select signing keys, and then a signature type.
262Encrypt @var{file}. It will let you select recipients. 263Encrypt @var{file}. It will let you select recipients.
263@end deffn 264@end deffn
264 265
265@node Dired integration 266@node Dired integration, Mail-mode integration, Cryptographic operations on files, Commands
266@section Dired integration 267@section Dired integration
267 268
268EasyPG Assistant extends Dired Mode for GNU Emacs to allow users to 269EasyPG Assistant extends Dired Mode for GNU Emacs to allow users to
@@ -301,7 +302,7 @@ Encrypt marked files.
301 302
302@end table 303@end table
303 304
304@node Mail-mode integration 305@node Mail-mode integration, Encrypting/decrypting gpg files, Dired integration, Commands
305@section Mail-mode integration 306@section Mail-mode integration
306 307
307EasyPG Assistant provides a minor mode @code{epa-mail-mode} to help 308EasyPG Assistant provides a minor mode @code{epa-mail-mode} to help
@@ -353,7 +354,7 @@ use that option to ignore specific recipients for encryption purposes.
353 354
354@end table 355@end table
355 356
356@node Encrypting/decrypting gpg files 357@node Encrypting/decrypting gpg files, , Mail-mode integration, Commands
357@section Encrypting/decrypting gpg files 358@section Encrypting/decrypting gpg files
358By default, every file whose name ends with @file{.gpg} will be 359By default, every file whose name ends with @file{.gpg} will be
359treated as encrypted. That is, when you open such a file, the 360treated as encrypted. That is, when you open such a file, the
@@ -436,18 +437,51 @@ If non-@code{nil}, disable auto-saving when opening an encrypted file.
436The default value is @code{t}. 437The default value is @code{t}.
437@end defvar 438@end defvar
438 439
439@node Caching Passphrases 440@node GnuPG version compatibility, Caching Passphrases, Commands, Top
441@chapter GnuPG version compatibility
442
443As of February 2016, there are three active branches of GnuPG: 2.1,
4442.0, and 1.4. All those branches should work flawlessly with Emacs
445with basic use-cases. They have, however, some incompatible
446characteristics, which might be visible when used from Emacs.
447
448@itemize
449@item
450The key store format used by GnuPG 2.1 is incompatible with 1.4. That
451means, a key created with GnuPG 2.1 is not visible with 1.4.
452
453@item
454GnuPG 2.1 uses a fixed address for the Unix domain socket used to
455communicate with gpg-agent. The @code{GPG_AGENT_INFO} environment
456variable, which is used by GnuPG 2.0 and 1.4, is ignored. That means,
457if your system has both GnuPG 2.1 and 1.4, the gpg command from GnuPG
4581.4 is not able to use gpg-agent provided by 2.1 (at least out of box).q
459
460@item
461GnuPG 2.1 (2.1.5 or later) has a mechanism to direct the Pinentry
462password prompt to the Emacs minibuffer@footnote{To enable this
463feature, add @samp{allow-emacs-pinentry} to
464@file{~/.gnupg/gpg-agent.conf} and let gpg-agent reload the
465configuration, with: @samp{gpgconf --reload gpg-agent}}, which would
466be useful when you use Emacs remotely or from a text-only terminal.
467That feature is not available in other versions, and more
468specifically, with 2.0 (as of 2.0.29), there is no way to avoid the
469graphical prompt.
470@end itemize
471
472@node Caching Passphrases, Bug Reports, GnuPG version compatibility, Top
440@chapter Caching Passphrases 473@chapter Caching Passphrases
441 474
442Typing passphrases is an irritating task if you frequently open and 475Typing passphrases is a troublesome task if you frequently open and
443close the same file. GnuPG and EasyPG Assistant provide mechanisms to 476close the same file. GnuPG and EasyPG Assistant provide mechanisms to
444remember your passphrases. However, the configuration is a bit 477remember your passphrases. However, the configuration is a bit
445confusing since it depends on your GnuPG installation (GnuPG version 1 or 478confusing since it depends on your GnuPG installation@xref{GnuPG
446GnuPG version 2), encryption method (symmetric or public key), and whether or 479version compatibility}, encryption method (symmetric or public key),
447not you want to use gpg-agent. Here are some questions: 480and whether or not you want to use gpg-agent. Here are some
481questions:
448 482
449@enumerate 483@enumerate
450@item Do you use GnuPG version 2 instead of GnuPG version 1? 484@item Do you use GnuPG version 2.1 or 2.0 instead of GnuPG version 1.4?
451@item Do you use symmetric encryption rather than public key encryption? 485@item Do you use symmetric encryption rather than public key encryption?
452@item Do you want to use gpg-agent? 486@item Do you want to use gpg-agent?
453@end enumerate 487@end enumerate
@@ -473,7 +507,7 @@ To set up elisp passphrase cache, set
473@code{epa-file-cache-passphrase-for-symmetric-encryption}. 507@code{epa-file-cache-passphrase-for-symmetric-encryption}.
474@xref{Encrypting/decrypting gpg files}. 508@xref{Encrypting/decrypting gpg files}.
475 509
476@node Bug Reports 510@node Bug Reports, GNU Free Documentation License, Caching Passphrases, Top
477@chapter Bug Reports 511@chapter Bug Reports
478 512
479Bugs and problems with EasyPG Assistant are actively worked on by the 513Bugs and problems with EasyPG Assistant are actively worked on by the
@@ -495,19 +529,19 @@ Before reporting the bug, you should set @code{epg-debug} in the
495of the @file{ *epg-debug*} buffer. Note that the first letter of the 529of the @file{ *epg-debug*} buffer. Note that the first letter of the
496buffer name is a whitespace. 530buffer name is a whitespace.
497 531
498@node GNU Free Documentation License 532@node GNU Free Documentation License, Key Index, Bug Reports, Top
499@appendix GNU Free Documentation License 533@appendix GNU Free Documentation License
500@include doclicense.texi 534@include doclicense.texi
501 535
502@node Key Index 536@node Key Index, Function Index, GNU Free Documentation License, Top
503@unnumbered Key Index 537@unnumbered Key Index
504@printindex ky 538@printindex ky
505 539
506@node Function Index 540@node Function Index, Variable Index, Key Index, Top
507@unnumbered Function Index 541@unnumbered Function Index
508@printindex fn 542@printindex fn
509 543
510@node Variable Index 544@node Variable Index, , Function Index, Top
511@unnumbered Variable Index 545@unnumbered Variable Index
512@printindex vr 546@printindex vr
513 547
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index fa7cd09123c..f8b61250bb9 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -11829,6 +11829,10 @@ A value of 0.7 (the default) means that they are allowed to take up
11829this, and Emacs supports it, then the images will be rescaled down to 11829this, and Emacs supports it, then the images will be rescaled down to
11830fit these criteria. 11830fit these criteria.
11831 11831
11832@item gnus-article-show-cursor
11833@vindex gnus-article-show-cursor
11834If non-@code{nil}, display the cursor in the article buffer even when
11835the article buffer isn't the current buffer.
11832@end table 11836@end table
11833 11837
11834To use this, make sure that you have @code{w3m} and @code{curl} 11838To use this, make sure that you have @code{w3m} and @code{curl}
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 71b97c070dc..08baf5da257 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
3% Load plain if necessary, i.e., if running under initex. 3% Load plain if necessary, i.e., if running under initex.
4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5% 5%
6\def\texinfoversion{2016-02-09.12} 6\def\texinfoversion{2016-02-16.15}
7% 7%
8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -310,7 +310,7 @@
310% Margin to add to right of even pages, to left of odd pages. 310% Margin to add to right of even pages, to left of odd pages.
311\newdimen\bindingoffset 311\newdimen\bindingoffset
312\newdimen\normaloffset 312\newdimen\normaloffset
313\newdimen\pagewidth \newdimen\pageheight 313\newdimen\txipagewidth \newdimen\txipageheight
314 314
315% Main output routine. 315% Main output routine.
316% 316%
@@ -334,7 +334,7 @@
334 % Common context changes for both heading and footing. 334 % Common context changes for both heading and footing.
335 % Do this outside of the \shipout so @code etc. will be expanded in 335 % Do this outside of the \shipout so @code etc. will be expanded in
336 % the headline as they should be, not taken literally (outputting ''code). 336 % the headline as they should be, not taken literally (outputting ''code).
337 \def\commmonheadfootline{\let\hsize=\pagewidth \texinfochars} 337 \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
338 % 338 %
339 % Retrieve the information for the headings from the marks in the page, 339 % Retrieve the information for the headings from the marks in the page,
340 % and call Plain TeX's \makeheadline and \makefootline, which use the 340 % and call Plain TeX's \makeheadline and \makefootline, which use the
@@ -433,7 +433,7 @@
433\newinsert\margin \dimen\margin=\maxdimen 433\newinsert\margin \dimen\margin=\maxdimen
434 434
435% Main part of page, including any footnotes 435% Main part of page, including any footnotes
436\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} 436\def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
437{\catcode`\@ =11 437{\catcode`\@ =11
438\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi 438\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
439% marginal hacks, juha@viisa.uucp (Juha Takala) 439% marginal hacks, juha@viisa.uucp (Juha Takala)
@@ -724,11 +724,11 @@
724 % \dimen0 is the vertical size of the group's box. 724 % \dimen0 is the vertical size of the group's box.
725 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox 725 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
726 % \dimen2 is how much space is left on the page (more or less). 726 % \dimen2 is how much space is left on the page (more or less).
727 \dimen2 = \pageheight \advance\dimen2 by -\pagetotal 727 \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
728 % if the group doesn't fit on the current page, and it's a big big 728 % if the group doesn't fit on the current page, and it's a big big
729 % group, force a page break. 729 % group, force a page break.
730 \ifdim \dimen0 > \dimen2 730 \ifdim \dimen0 > \dimen2
731 \ifdim \pagetotal < \vfilllimit\pageheight 731 \ifdim \pagetotal < \vfilllimit\txipageheight
732 \page 732 \page
733 \fi 733 \fi
734 \fi 734 \fi
@@ -1100,6 +1100,64 @@ where each line of input produces a line of output.}
1100\newif\ifpdf 1100\newif\ifpdf
1101\newif\ifpdfmakepagedest 1101\newif\ifpdfmakepagedest
1102 1102
1103%
1104% For LuaTeX
1105%
1106
1107\ifx\luatexversion\thisisundefined
1108\else
1109 % Escape PDF strings UTF-8 to UTF-16
1110 \begingroup
1111 \catcode`\%=12
1112 \directlua{
1113 function UTF16oct(str)
1114 tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
1115 for c in string.utfvalues(str) do
1116 if c < 0x10000 then
1117 tex.sprint(
1118 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1119 string.char(0x5c) .. string.char(0x25) .. '03o',
1120 (c / 256), (c % 256)))
1121 else
1122 c = c - 0x10000
1123 local c_hi = c / 1024 + 0xd800
1124 local c_lo = c % 1024 + 0xdc00
1125 tex.sprint(
1126 string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
1127 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1128 string.char(0x5c) .. string.char(0x25) .. '03o' ..
1129 string.char(0x5c) .. string.char(0x25) .. '03o',
1130 (c_hi / 256), (c_hi % 256),
1131 (c_lo / 256), (c_lo % 256)))
1132 end
1133 end
1134 end
1135 }
1136 \endgroup
1137 \def\pdfescapestring#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
1138 \ifnum\luatexversion>84
1139 % For LuaTeX >= 0.85
1140 \def\pdfdest{\pdfextension dest}
1141 \let\pdfoutput\outputmode
1142 \def\pdfliteral{\pdfextension literal}
1143 \def\pdfcatalog{\pdfextension catalog}
1144 \def\pdftexversion{\numexpr\pdffeedback version\relax}
1145 \let\pdfximage\saveimageresource
1146 \let\pdfrefximage\useimageresource
1147 \let\pdflastximage\lastsavedimageresourceindex
1148 \def\pdfendlink{\pdfextension endlink\relax}
1149 \def\pdfoutline{\pdfextension outline}
1150 \def\pdfstartlink{\pdfextension startlink}
1151 \def\pdffontattr{\pdfextension fontattr}
1152 \def\pdfobj{\pdfextension obj}
1153 \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
1154 \let\pdfpagewidth\pagewidth
1155 \let\pdfpageheight\pageheight
1156 \edef\pdfhorigin{\pdfvariable horigin}
1157 \edef\pdfvorigin{\pdfvariable vorigin}
1158 \fi
1159\fi
1160
1103% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 1161% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1104% can be set). So we test for \relax and 0 as well as being undefined. 1162% can be set). So we test for \relax and 0 as well as being undefined.
1105\ifx\pdfoutput\thisisundefined 1163\ifx\pdfoutput\thisisundefined
@@ -1283,18 +1341,23 @@ output) for that.)}
1283 % page number. We could generate a destination for the section 1341 % page number. We could generate a destination for the section
1284 % text in the case where a section has no node, but it doesn't 1342 % text in the case where a section has no node, but it doesn't
1285 % seem worth the trouble, since most documents are normally structured. 1343 % seem worth the trouble, since most documents are normally structured.
1286 \edef\pdfoutlinedest{#3}% 1344 {
1287 \ifx\pdfoutlinedest\empty 1345 \ifx\luatexversion\thisisundefined \else
1288 \def\pdfoutlinedest{#4}% 1346 \turnoffactive % LuaTeX can use Unicode strings for PDF
1289 \else 1347 \fi
1290 \txiescapepdf\pdfoutlinedest 1348 \edef\pdfoutlinedest{#3}%
1291 \fi 1349 \ifx\pdfoutlinedest\empty
1292 % 1350 \def\pdfoutlinedest{#4}%
1293 % Also escape PDF chars in the display string. 1351 \else
1294 \edef\pdfoutlinetext{#1}% 1352 \txiescapepdf\pdfoutlinedest
1295 \txiescapepdf\pdfoutlinetext 1353 \fi
1296 % 1354 %
1297 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% 1355 % Also escape PDF chars in the display string.
1356 \edef\pdfoutlinetext{#1}%
1357 \txiescapepdf\pdfoutlinetext
1358 %
1359 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1360 }
1298 } 1361 }
1299 % 1362 %
1300 \def\pdfmakeoutlines{% 1363 \def\pdfmakeoutlines{%
@@ -1528,7 +1591,16 @@ output) for that.)}
1528 ] 1591 ]
1529 1592
1530 \special{pdf:docview << /PageMode /UseOutlines >> } 1593 \special{pdf:docview << /PageMode /UseOutlines >> }
1531 \special{pdf:tounicode UTF8-UTF16 } 1594 \openin 1 uptex.tex % upTeX has UTF8-UTF16 cmap
1595 \ifeof 1
1596 % upTeX does not exist. To use UTF8-UCS2 cmap.
1597 % In this case, non-BMP characters (over U+FFFF) can not be used.
1598 \special{pdf:tounicode UTF8-UCS2}
1599 \else
1600 % upTeX exists. To use UTF8-UTF16 cmap.
1601 % Non-BMP characters (over U+FFFF) can be used.
1602 \special{pdf:tounicode UTF8-UTF16}
1603 \fi
1532\fi 1604\fi
1533 1605
1534% 1606%
@@ -3570,7 +3642,7 @@ end
3570 % 3642 %
3571 % Leave some space for the footline. Hopefully ok to assume 3643 % Leave some space for the footline. Hopefully ok to assume
3572 % @evenfooting will not be used by itself. 3644 % @evenfooting will not be used by itself.
3573 \global\advance\pageheight by -12pt 3645 \global\advance\txipageheight by -12pt
3574 \global\advance\vsize by -12pt 3646 \global\advance\vsize by -12pt
3575} 3647}
3576 3648
@@ -3595,9 +3667,9 @@ end
3595\def\oddheadingmarks{\headingmarks{odd}{heading}} 3667\def\oddheadingmarks{\headingmarks{odd}{heading}}
3596\def\evenfootingmarks{\headingmarks{even}{footing}} 3668\def\evenfootingmarks{\headingmarks{even}{footing}}
3597\def\oddfootingmarks{\headingmarks{odd}{footing}} 3669\def\oddfootingmarks{\headingmarks{odd}{footing}}
3598\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} 3670\parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
3599 \headingmarks{odd}{heading}{#1} } 3671 \headingmarks{odd}{heading}{#1} }
3600\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} 3672\parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
3601 \headingmarks{odd}{footing}{#1} } 3673 \headingmarks{odd}{footing}{#1} }
3602% #1 = even/odd, #2 = heading/footing, #3 = top/bottom. 3674% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
3603\def\headingmarks#1#2#3 {% 3675\def\headingmarks#1#2#3 {%
@@ -3618,7 +3690,7 @@ end
3618% By default, they are off at the start of a document, 3690% By default, they are off at the start of a document,
3619% and turned `on' after @end titlepage. 3691% and turned `on' after @end titlepage.
3620 3692
3621\def\headings #1 {\csname HEADINGS#1\endcsname} 3693\parseargdef\headings{\csname HEADINGS#1\endcsname}
3622 3694
3623\def\headingsoff{% non-global headings elimination 3695\def\headingsoff{% non-global headings elimination
3624 \evenheadline={\hfil}\evenfootline={\hfil}% 3696 \evenheadline={\hfil}\evenfootline={\hfil}%
@@ -5642,7 +5714,7 @@ end
5642 \wd0=\hsize \wd2=\hsize 5714 \wd0=\hsize \wd2=\hsize
5643 \vbox{% 5715 \vbox{%
5644 \vskip\doublecolumntopgap 5716 \vskip\doublecolumntopgap
5645 \hbox to\pagewidth{\box0\hfil\box2}}% 5717 \hbox to\txipagewidth{\box0\hfil\box2}}%
5646} 5718}
5647 5719
5648 5720
@@ -5669,7 +5741,7 @@ end
5669 % goal. When TeX sees \eject from below which follows the final 5741 % goal. When TeX sees \eject from below which follows the final
5670 % section, it invokes the new output routine that we've set after 5742 % section, it invokes the new output routine that we've set after
5671 % \balancecolumns below; \onepageout will try to fit the two columns 5743 % \balancecolumns below; \onepageout will try to fit the two columns
5672 % and the final section into the vbox of \pageheight (see 5744 % and the final section into the vbox of \txipageheight (see
5673 % \pagebody), causing an overfull box. 5745 % \pagebody), causing an overfull box.
5674 % 5746 %
5675 % Note that glue won't work here, because glue does not exercise the 5747 % Note that glue won't work here, because glue does not exercise the
@@ -6153,7 +6225,7 @@ end
6153 \fi 6225 \fi
6154} 6226}
6155 6227
6156\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} 6228\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
6157 6229
6158\def\CHAPPAGoff{% 6230\def\CHAPPAGoff{%
6159\global\let\contentsalignmacro = \chappager 6231\global\let\contentsalignmacro = \chappager
@@ -6302,7 +6374,7 @@ end
6302% I don't think this chapter style is supported any more, so I'm not 6374% I don't think this chapter style is supported any more, so I'm not
6303% updating it with the new noderef stuff. We'll see. --karl, 11aug03. 6375% updating it with the new noderef stuff. We'll see. --karl, 11aug03.
6304% 6376%
6305\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} 6377\parseargdef\setchapterstyle{\csname CHAPF#1\endcsname}
6306% 6378%
6307\def\unnchfopen #1{% 6379\def\unnchfopen #1{%
6308 \chapoddpage 6380 \chapoddpage
@@ -9043,7 +9115,7 @@ end
9043 % We want to typeset this text as a normal paragraph, even if the 9115 % We want to typeset this text as a normal paragraph, even if the
9044 % footnote reference occurs in (for example) a display environment. 9116 % footnote reference occurs in (for example) a display environment.
9045 % So reset some parameters. 9117 % So reset some parameters.
9046 \hsize=\pagewidth 9118 \hsize=\txipagewidth
9047 \interlinepenalty\interfootnotelinepenalty 9119 \interlinepenalty\interfootnotelinepenalty
9048 \splittopskip\ht\strutbox % top baseline for broken footnotes 9120 \splittopskip\ht\strutbox % top baseline for broken footnotes
9049 \splitmaxdepth\dp\strutbox 9121 \splitmaxdepth\dp\strutbox
@@ -11007,12 +11079,12 @@ directory should work if nowhere else does.}
11007 \advance\vsize by \topskip 11079 \advance\vsize by \topskip
11008 \outervsize = \vsize 11080 \outervsize = \vsize
11009 \advance\outervsize by 2\topandbottommargin 11081 \advance\outervsize by 2\topandbottommargin
11010 \pageheight = \vsize 11082 \txipageheight = \vsize
11011 % 11083 %
11012 \hsize = #2\relax 11084 \hsize = #2\relax
11013 \outerhsize = \hsize 11085 \outerhsize = \hsize
11014 \advance\outerhsize by 0.5in 11086 \advance\outerhsize by 0.5in
11015 \pagewidth = \hsize 11087 \txipagewidth = \hsize
11016 % 11088 %
11017 \normaloffset = #4\relax 11089 \normaloffset = #4\relax
11018 \bindingoffset = #5\relax 11090 \bindingoffset = #5\relax
@@ -11336,9 +11408,10 @@ directory should work if nowhere else does.}
11336 @global@let\ = @eatinput% 11408 @global@let\ = @eatinput%
11337 @catcode`@^^M=13% 11409 @catcode`@^^M=13%
11338 @def@c{@fixbackslash@c}% 11410 @def@c{@fixbackslash@c}%
11411 % Definition for the newline at the end of this file.
11339 @def ^^M{@let^^M@secondlinenl}% 11412 @def ^^M{@let^^M@secondlinenl}%
11340 @gdef @secondlinenl{@let^^M@thirdlinenl}% 11413 % Definition for a newline in the main Texinfo file.
11341 @gdef @thirdlinenl{@fixbackslash}% 11414 @gdef @secondlinenl{@fixbackslash}%
11342}} 11415}}
11343 11416
11344{@catcode`@^=7 @catcode`@^^M=13% 11417{@catcode`@^=7 @catcode`@^^M=13%
diff --git a/etc/NEWS b/etc/NEWS
index bc3e49097b6..9e000be4a7a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -710,10 +710,6 @@ item as before.
710** Search and Replace 710** Search and Replace
711 711
712+++ 712+++
713*** New user option `search-default-mode'
714specifies the default mode for I-search.
715
716+++
717*** `isearch' and `query-replace' can now perform character folding in matches. 713*** `isearch' and `query-replace' can now perform character folding in matches.
718Isearch does that by default, while `query-replace' will do that if 714Isearch does that by default, while `query-replace' will do that if
719the new variable `replace-character-fold' is customized to a non-nil 715the new variable `replace-character-fold' is customized to a non-nil
@@ -728,6 +724,18 @@ and ”), and the letter a will match all of its accented cousins, even
728those composed of multiple characters, as well as many other symbols 724those composed of multiple characters, as well as many other symbols
729like ℀, ℁, ⒜, and ⓐ. 725like ℀, ℁, ⒜, and ⓐ.
730 726
727Character folding is enabled by customizing `search-default-mode' to
728the value `character-fold-to-regexp'. If you want to turn character
729folding off, customize the value of `search-default-mode' to the `nil'
730value. You can also toggle character folding in the middle of a
731search by typing `M-s ''.
732
733+++
734*** New user option `search-default-mode'.
735This option specifies the default mode for Isearch. The default
736value, `character-fold-to-regexp' specifies that Isearch should fold
737characters when searching.
738
731+++ 739+++
732*** New function `character-fold-to-regexp' can be used 740*** New function `character-fold-to-regexp' can be used
733by searching commands to produce a regexp matching anything that 741by searching commands to produce a regexp matching anything that
@@ -1423,7 +1431,9 @@ few or no entries have changed.
1423minibuffer instead of a graphical dialog, depending on whether the gpg 1431minibuffer instead of a graphical dialog, depending on whether the gpg
1424command is called from Emacs (i.e., INSIDE_EMACS environment variable 1432command is called from Emacs (i.e., INSIDE_EMACS environment variable
1425is set). This feature requires newer versions of GnuPG (2.1.5 or 1433is set). This feature requires newer versions of GnuPG (2.1.5 or
1426later) and Pinentry (0.9.5 or later). 1434later) and Pinentry (0.9.5 or later). To use this feature, add
1435"allow-emacs-pinentry" to "~/.gnupg/gpg-agent.conf" and reload the
1436configuration with "gpgconf --reload gpg-agent".
1427 1437
1428+++ 1438+++
1429** cl-generic.el provides CLOS-style multiple-dispatch generic functions. 1439** cl-generic.el provides CLOS-style multiple-dispatch generic functions.
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index cd8395681d9..12f8a15b316 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -103,8 +103,8 @@
103# elif ((defined __APPLE__ && defined __MACH__ \ 103# elif ((defined __APPLE__ && defined __MACH__ \
104 ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ 104 ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
105 : __GNUC__) \ 105 : __GNUC__) \
106 || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \ 106 || 061200 <= __HP_cc || 061200 <= __HP_aCC \
107 || __ICC || 0x590 <= __SUNPRO_C) 107 || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)
108# define _Alignas(a) __attribute__ ((__aligned__ (a))) 108# define _Alignas(a) __attribute__ ((__aligned__ (a)))
109# elif 1300 <= _MSC_VER 109# elif 1300 <= _MSC_VER
110# define _Alignas(a) __declspec (align (a)) 110# define _Alignas(a) __declspec (align (a))
diff --git a/lisp/battery.el b/lisp/battery.el
index d0293697bef..b5e312f6c3e 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -628,12 +628,12 @@ The following %-sequences are provided:
628 (cond ((looking-at "; charging") 628 (cond ((looking-at "; charging")
629 (setq battery-status "charging" 629 (setq battery-status "charging"
630 battery-status-symbol "+")) 630 battery-status-symbol "+"))
631 ((< (string-to-number load-percentage) battery-load-low)
632 (setq battery-status "low"
633 battery-status-symbol "-"))
634 ((< (string-to-number load-percentage) battery-load-critical) 631 ((< (string-to-number load-percentage) battery-load-critical)
635 (setq battery-status "critical" 632 (setq battery-status "critical"
636 battery-status-symbol "!")) 633 battery-status-symbol "!"))
634 ((< (string-to-number load-percentage) battery-load-low)
635 (setq battery-status "low"
636 battery-status-symbol "-"))
637 (t 637 (t
638 (setq battery-status "high" 638 (setq battery-status "high"
639 battery-status-symbol ""))) 639 battery-status-symbol "")))
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index 0c8920848fc..07d9ac90d85 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -43,6 +43,9 @@
43;;; Measures, by François Cardarelli) 43;;; Measures, by François Cardarelli)
44;;; All conversions are exact unless otherwise noted. 44;;; All conversions are exact unless otherwise noted.
45 45
46;; CODATA values updated February 2016, using 2014 adjustment
47;; http://arxiv.org/pdf/1507.07956.pdf
48
46(defvar math-standard-units 49(defvar math-standard-units
47 '( ;; Length 50 '( ;; Length
48 ( m nil "*Meter" ) 51 ( m nil "*Meter" )
@@ -136,8 +139,8 @@
136 "31.10347680 g") ;; ESUWM, 1/12 exact value for lbt 139 "31.10347680 g") ;; ESUWM, 1/12 exact value for lbt
137 ( ct "(2/10) g" "Carat" nil 140 ( ct "(2/10) g" "Carat" nil
138 "0.2 g") ;; ESUWM 141 "0.2 g") ;; ESUWM
139 ( u "1.660538782*10^(-27) kg" "Unified atomic mass" nil 142 ( u "1.660539040*10^(-27) kg" "Unified atomic mass" nil
140 "1.660538782 10^-27 kg (*)");;(approx) CODATA 143 "1.660539040 10^-27 kg (*)");;(approx) CODATA
141 144
142 ;; Force 145 ;; Force
143 ( N "m kg/s^2" "*Newton" ) 146 ( N "m kg/s^2" "*Newton" )
@@ -204,8 +207,8 @@
204 ( C "A s" "Coulomb" ) 207 ( C "A s" "Coulomb" )
205 ( Fdy "ech Nav" "Faraday" ) 208 ( Fdy "ech Nav" "Faraday" )
206 ( e "ech" "Elementary charge" ) 209 ( e "ech" "Elementary charge" )
207 ( ech "1.602176487*10^(-19) C" "Elementary charge" nil 210 ( ech "1.6021766208*10^(-19) C" "Elementary charge" nil
208 "1.602176487 10^-19 C (*)") ;;(approx) CODATA 211 "1.6021766208 10^-19 C (*)") ;;(approx) CODATA
209 ( V "W/A" "Volt" ) 212 ( V "W/A" "Volt" )
210 ( ohm "V/A" "Ohm" ) 213 ( ohm "V/A" "Ohm" )
211 ( Ω "ohm" "Ohm" ) 214 ( Ω "ohm" "Ohm" )
@@ -254,47 +257,51 @@
254 257
255 ;; Other physical quantities 258 ;; Other physical quantities
256 ;; The values are from CODATA, and are approximate. 259 ;; The values are from CODATA, and are approximate.
257 ( h "6.62606896*10^(-34) J s" "*Planck's constant" nil 260 ( h "6.626070040*10^(-34) J s" "*Planck's constant" nil
258 "6.62606896 10^-34 J s (*)") 261 "6.626070040 10^-34 J s (*)")
259 ( hbar "h / (2 pi)" "Planck's constant" ) ;; Exact 262 ( hbar "h / (2 pi)" "Planck's constant" ) ;; Exact
260 ( mu0 "4 pi 10^(-7) H/m" "Permeability of vacuum") ;; Exact 263 ( mu0 "4 pi 10^(-7) H/m" "Permeability of vacuum") ;; Exact
261 ( μ0 "mu0" "Permeability of vacuum") ;; Exact 264 ( μ0 "mu0" "Permeability of vacuum") ;; Exact
262 ( eps0 "1 / (mu0 c^2)" "Permittivity of vacuum" ) 265 ( eps0 "1 / (mu0 c^2)" "Permittivity of vacuum" )
263 ( ε0 "eps0" "Permittivity of vacuum" ) 266 ( ε0 "eps0" "Permittivity of vacuum" )
264 ( G "6.67428*10^(-11) m^3/(kg s^2)" "Gravitational constant" nil 267 ( G "6.67408*10^(-11) m^3/(kg s^2)" "Gravitational constant" nil
265 "6.67428 10^-11 m^3/(kg s^2) (*)") 268 "6.67408 10^-11 m^3/(kg s^2) (*)")
266 ( Nav "6.02214179*10^(23) / mol" "Avogadro's constant" nil 269 ( Nav "6.022140857*10^(23) / mol" "Avogadro's constant" nil
267 "6.02214179 10^23 / mol (*)") 270 "6.022140857 10^23 / mol (*)")
268 ( me "9.10938215*10^(-31) kg" "Electron rest mass" nil 271 ( me "9.10938356*10^(-31) kg" "Electron rest mass" nil
269 "9.10938215 10^-31 kg (*)") 272 "9.10938356 10^-31 kg (*)")
270 ( mp "1.672621637*10^(-27) kg" "Proton rest mass" nil 273 ( mp "1.672621898*10^(-27) kg" "Proton rest mass" nil
271 "1.672621637 10^-27 kg (*)") 274 "1.672621898 10^-27 kg (*)")
272 ( mn "1.674927211*10^(-27) kg" "Neutron rest mass" nil 275 ( mn "1.674927471*10^(-27) kg" "Neutron rest mass" nil
273 "1.674927211 10^-27 kg (*)") 276 "1.674927471 10^-27 kg (*)")
274 ( mmu "1.88353130*10^(-28) kg" "Muon rest mass" nil 277 ( mmu "1.883531594*10^(-28) kg" "Muon rest mass" nil
275 "1.88353130 10^-28 kg (*)") 278 "1.883531594 10^-28 kg (*)")
276 ( mμ "mmu" "Muon rest mass" nil 279 ( mμ "mmu" "Muon rest mass" nil
277 "1.88353130 10^-28 kg (*)") 280 "1.883531594 10^-28 kg (*)")
278 ( Ryd "10973731.568527 /m" "Rydberg's constant" nil 281 ( Ryd "10973731.568508 /m" "Rydberg's constant" nil
279 "10973731.568527 /m (*)") 282 "10973731.568508 /m (*)")
280 ( k "1.3806504*10^(-23) J/K" "Boltzmann's constant" nil 283 ( k "1.38064852*10^(-23) J/K" "Boltzmann's constant" nil
281 "1.3806504 10^-23 J/K (*)") 284 "1.38064852 10^-23 J/K (*)")
282 ( alpha "7.2973525376*10^(-3)" "Fine structure constant" nil 285 ( sigma "5.670367*10^(-8) W/(m^2 K^4)" "Stefan-Boltzmann constant" nil
283 "7.2973525376 10^-3 (*)") 286 "5.670367 10^-8 W/(m^2 K^4) (*)")
287 ( σ "sigma" "Stefan-Boltzmann constant" nil
288 "5.670367 10^-8 W/(m^2 K^4) (*)")
289 ( alpha "7.2973525664*10^(-3)" "Fine structure constant" nil
290 "7.2973525664 10^-3 (*)")
284 ( α "alpha" "Fine structure constant" nil 291 ( α "alpha" "Fine structure constant" nil
285 "7.2973525376 10^-3 (*)") 292 "7.2973525664 10^-3 (*)")
286 ( muB "927.400915*10^(-26) J/T" "Bohr magneton" nil 293 ( muB "927.4009994*10^(-26) J/T" "Bohr magneton" nil
287 "927.400915 10^-26 J/T (*)") 294 "927.4009994 10^-26 J/T (*)")
288 ( muN "5.05078324*10^(-27) J/T" "Nuclear magneton" nil 295 ( muN "5.050783699*10^(-27) J/T" "Nuclear magneton" nil
289 "5.05078324 10^-27 J/T (*)") 296 "5.050783699 10^-27 J/T (*)")
290 ( mue "-928.476377*10^(-26) J/T" "Electron magnetic moment" nil 297 ( mue "-928.4764620*10^(-26) J/T" "Electron magnetic moment" nil
291 "-928.476377 10^-26 J/T (*)") 298 "-928.4764620 10^-26 J/T (*)")
292 ( mup "1.410606662*10^(-26) J/T" "Proton magnetic moment" nil 299 ( mup "1.4106067873*10^(-26) J/T" "Proton magnetic moment" nil
293 "1.410606662 10^-26 J/T (*)") 300 "1.4106067873 10^-26 J/T (*)")
294 ( R0 "8.314472 J/(mol K)" "Molar gas constant" nil 301 ( R0 "8.3144598 J/(mol K)" "Molar gas constant" nil
295 "8.314472 J/(mol K) (*)") 302 "8.3144598 J/(mol K) (*)")
296 ( V0 "22.710981*10^(-3) m^3/mol" "Standard volume of ideal gas" nil 303 ( V0 "22.710947*10^(-3) m^3/mol" "Standard volume of ideal gas" nil
297 "22.710981 10^-3 m^3/mol (*)") 304 "22.710947 10^-3 m^3/mol (*)")
298 ;; Logarithmic units 305 ;; Logarithmic units
299 ( Np nil "*Neper") 306 ( Np nil "*Neper")
300 ( dB "(ln(10)/20) Np" "decibel"))) 307 ( dB "(ln(10)/20) Np" "decibel")))
@@ -1628,7 +1635,7 @@ If COMP or STD is non-nil, put that in the units table instead."
1628 "TeX point will be `pt' instead of `texpt', for example.\n" 1635 "TeX point will be `pt' instead of `texpt', for example.\n"
1629 "To avoid conflicts, the unit names for pint and parsec will\n" 1636 "To avoid conflicts, the unit names for pint and parsec will\n"
1630 "be `pint' and `parsec' instead of `pt' and `pc'.")))) 1637 "be `pint' and `parsec' instead of `pt' and `pc'."))))
1631 (view-mode) 1638 (special-mode)
1632 (message "Formatting units table...done")) 1639 (message "Formatting units table...done"))
1633 (setq math-units-table-buffer-valid t) 1640 (setq math-units-table-buffer-valid t)
1634 (let ((oldbuf (current-buffer))) 1641 (let ((oldbuf (current-buffer)))
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 29d8dfcfb7f..94cd08eaa4e 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -2262,9 +2262,8 @@ made in the number or names of categories."
2262 (mlist (append tmn-array nil)) 2262 (mlist (append tmn-array nil))
2263 (tma-array todo-month-abbrev-array) 2263 (tma-array todo-month-abbrev-array)
2264 (mablist (append tma-array nil)) 2264 (mablist (append tma-array nil))
2265 (yy (and oyear (unless (string= oyear "*") 2265 (yy (and oyear (string-to-number oyear))) ; 0 if year is "*".
2266 (string-to-number oyear)))) 2266 (mm (or (and omonth (if (string= omonth "*") 13
2267 (mm (or (and omonth (unless (string= omonth "*")
2268 (string-to-number omonth))) 2267 (string-to-number omonth)))
2269 (1+ (- (length mlist) 2268 (1+ (- (length mlist)
2270 (length (or (member omonthname mlist) 2269 (length (or (member omonthname mlist)
@@ -2330,12 +2329,11 @@ made in the number or names of categories."
2330 (if omonth 2329 (if omonth
2331 (number-to-string mm) 2330 (number-to-string mm)
2332 (aref tma-array (1- mm)))))) 2331 (aref tma-array (1- mm))))))
2333 (let ((yy (string-to-number year)) ; 0 if year is "*". 2332 ;; Since the number corresponding to the arbitrary
2334 ;; When mm is 13 (corresponding to "*" as value 2333 ;; month name "*" is out of the range of
2335 ;; of month), this raises an args-out-of-range 2334 ;; calendar-last-day-of-month, set it to 1
2336 ;; error in calendar-last-day-of-month, so use 1 2335 ;; (corresponding to January) to allow 31 days.
2337 ;; (corresponding to January) to get 31 days. 2336 (let ((mm (if (= mm 13) 1 mm)))
2338 (mm (if (= mm 13) 1 mm)))
2339 (if (> (string-to-number day) 2337 (if (> (string-to-number day)
2340 (calendar-last-day-of-month mm yy)) 2338 (calendar-last-day-of-month mm yy))
2341 (user-error "%s %s does not have %s days" 2339 (user-error "%s %s does not have %s days"
@@ -2347,7 +2345,7 @@ made in the number or names of categories."
2347 monthname omonthname 2345 monthname omonthname
2348 day (cond 2346 day (cond
2349 ((not current-prefix-arg) 2347 ((not current-prefix-arg)
2350 (todo-read-date 'day mm oyear)) 2348 (todo-read-date 'day mm yy))
2351 ((string= oday "*") 2349 ((string= oday "*")
2352 (user-error "Cannot increment *")) 2350 (user-error "Cannot increment *"))
2353 ((or (string= omonth "*") (string= omonthname "*")) 2351 ((or (string= omonth "*") (string= omonthname "*"))
@@ -5933,7 +5931,7 @@ number of the last the day of the month."
5933 (and day (setq day (if (eq day '*) 5931 (and day (setq day (if (eq day '*)
5934 (symbol-name '*) 5932 (symbol-name '*)
5935 (number-to-string day)))) 5933 (number-to-string day))))
5936 (and month (setq month (if (eq month '*) 5934 (and month (setq month (if (= month 13)
5937 (symbol-name '*) 5935 (symbol-name '*)
5938 (number-to-string month)))) 5936 (number-to-string month))))
5939 (if arg 5937 (if arg
diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el
index d9dd1f94d33..0ae433fecb5 100644
--- a/lisp/cedet/semantic/db-file.el
+++ b/lisp/cedet/semantic/db-file.el
@@ -287,22 +287,22 @@ Argument OBJ is the object to write."
287 (when (semanticdb-live-p obj) 287 (when (semanticdb-live-p obj)
288 (when (semanticdb-in-buffer-p obj) 288 (when (semanticdb-in-buffer-p obj)
289 (with-current-buffer (semanticdb-in-buffer-p obj) 289 (with-current-buffer (semanticdb-in-buffer-p obj)
290 290 (save-excursion
291 ;; Make sure all our tag lists are up to date. 291 ;; Make sure all our tag lists are up to date.
292 (semantic-fetch-tags) 292 (semantic-fetch-tags)
293 293
294 ;; Try to get an accurate unmatched syntax table. 294 ;; Try to get an accurate unmatched syntax table.
295 (when (and (boundp semantic-show-unmatched-syntax-mode) 295 (when (and (boundp semantic-show-unmatched-syntax-mode)
296 semantic-show-unmatched-syntax-mode) 296 semantic-show-unmatched-syntax-mode)
297 ;; Only do this if the user runs unmatched syntax 297 ;; Only do this if the user runs unmatched syntax
298 ;; mode display entries. 298 ;; mode display entries.
299 (oset obj unmatched-syntax 299 (oset obj unmatched-syntax
300 (semantic-show-unmatched-lex-tokens-fetch)) 300 (semantic-show-unmatched-lex-tokens-fetch))
301 ) 301 )
302 302
303 ;; Make sure pointmax is up to date 303 ;; Make sure pointmax is up to date
304 (oset obj pointmax (point-max)) 304 (oset obj pointmax (point-max))
305 )) 305 )))
306 306
307 ;; Make sure that the file size and other attributes are 307 ;; Make sure that the file size and other attributes are
308 ;; up to date. 308 ;; up to date.
diff --git a/lisp/cedet/semantic/db-mode.el b/lisp/cedet/semantic/db-mode.el
index e8be18576c8..73cc7b5585b 100644
--- a/lisp/cedet/semantic/db-mode.el
+++ b/lisp/cedet/semantic/db-mode.el
@@ -39,7 +39,6 @@
39 (semanticdb-kill-hook kill-buffer-hook) 39 (semanticdb-kill-hook kill-buffer-hook)
40 (semanticdb-kill-hook change-major-mode-hook) ;; Not really a kill, but we need the same effect. 40 (semanticdb-kill-hook change-major-mode-hook) ;; Not really a kill, but we need the same effect.
41 (semanticdb-kill-emacs-hook kill-emacs-hook) 41 (semanticdb-kill-emacs-hook kill-emacs-hook)
42 (semanticdb-save-all-db-idle auto-save-hook)
43 ) 42 )
44 "List of hooks and values to add/remove when configuring semanticdb.") 43 "List of hooks and values to add/remove when configuring semanticdb.")
45 44
diff --git a/lisp/custom.el b/lisp/custom.el
index f4045008ebf..056ca341197 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -464,7 +464,7 @@ are not usually written so.
464MEMBERS should be an alist of the form ((NAME WIDGET)...) where 464MEMBERS should be an alist of the form ((NAME WIDGET)...) where
465NAME is a symbol and WIDGET is a widget for editing that symbol. 465NAME is a symbol and WIDGET is a widget for editing that symbol.
466Useful widgets are `custom-variable' for editing variables, 466Useful widgets are `custom-variable' for editing variables,
467`custom-face' for edit faces, and `custom-group' for editing groups. 467`custom-face' for editing faces, and `custom-group' for editing groups.
468 468
469The remaining arguments should have the form 469The remaining arguments should have the form
470 470
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index af7f1996cc5..9d912c3f6d9 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -987,6 +987,11 @@ is named like ODF with the extension turned to pdf."
987 (doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program 987 (doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program
988 (list 988 (list
989 (concat "-env:UserInstallation=file://" 989 (concat "-env:UserInstallation=file://"
990 ;; The URL must be
991 ;; file:///C:/tmp/dir on Windows.
992 ;; https://wiki.documentfoundation.org/UserProfile.
993 (when (eq system-type 'windows-nt)
994 "/")
990 tmp-user-install-dir) 995 tmp-user-install-dir)
991 "--headless" "--convert-to" "pdf" 996 "--headless" "--convert-to" "pdf"
992 "--outdir" (doc-view--current-cache-dir) odf) 997 "--outdir" (doc-view--current-cache-dir) odf)
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 5413bdbdf7f..7ad9f307f93 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -1019,6 +1019,10 @@ The value returned is a list of elements of the form
1019 1019
1020(cl--generic-prefill-dispatchers 0 (eql nil)) 1020(cl--generic-prefill-dispatchers 0 (eql nil))
1021(cl--generic-prefill-dispatchers window-system (eql nil)) 1021(cl--generic-prefill-dispatchers window-system (eql nil))
1022(cl--generic-prefill-dispatchers (terminal-parameter nil 'xterm--get-selection)
1023 (eql nil))
1024(cl--generic-prefill-dispatchers (terminal-parameter nil 'xterm--set-selection)
1025 (eql nil))
1022 1026
1023;;; Support for cl-defstructs specializers. 1027;;; Support for cl-defstructs specializers.
1024 1028
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 14650ba3ab6..dc050444b8d 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1453,9 +1453,8 @@ loading packages twice."
1453(defvar package--downloads-in-progress nil 1453(defvar package--downloads-in-progress nil
1454 "List of in-progress asynchronous downloads.") 1454 "List of in-progress asynchronous downloads.")
1455 1455
1456(declare-function epg-check-configuration "epg-config" 1456(declare-function epg-find-configuration "epg-config"
1457 (config &optional minimum-version)) 1457 (protocol &optional force))
1458(declare-function epg-configuration "epg-config" ())
1459(declare-function epg-import-keys-from-file "epg" (context keys)) 1458(declare-function epg-import-keys-from-file "epg" (context keys))
1460 1459
1461;;;###autoload 1460;;;###autoload
@@ -1555,11 +1554,15 @@ downloads in the background."
1555 (let ((default-keyring (expand-file-name "package-keyring.gpg" 1554 (let ((default-keyring (expand-file-name "package-keyring.gpg"
1556 data-directory)) 1555 data-directory))
1557 (inhibit-message async)) 1556 (inhibit-message async))
1557 (if (get 'package-check-signature 'saved-value)
1558 (when package-check-signature
1559 (epg-find-configuration 'OpenPGP))
1560 (setq package-check-signature
1561 (if (epg-find-configuration 'OpenPGP)
1562 'allow-unsigned)))
1558 (when (and package-check-signature (file-exists-p default-keyring)) 1563 (when (and package-check-signature (file-exists-p default-keyring))
1559 (condition-case-unless-debug error 1564 (condition-case-unless-debug error
1560 (progn 1565 (package-import-keyring default-keyring)
1561 (epg-check-configuration (epg-configuration))
1562 (package-import-keyring default-keyring))
1563 (error (message "Cannot import default keyring: %S" (cdr error)))))) 1566 (error (message "Cannot import default keyring: %S" (cdr error))))))
1564 (package--download-and-read-archives async)) 1567 (package--download-and-read-archives async))
1565 1568
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index c41d97dbfac..8a208044cba 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -23,6 +23,8 @@
23 23
24;;; Code: 24;;; Code:
25 25
26(eval-when-compile (require 'cl-lib))
27
26(defconst epg-package-name "epg" 28(defconst epg-package-name "epg"
27 "Name of this package.") 29 "Name of this package.")
28 30
@@ -76,12 +78,66 @@ Note that the buffer name starts with a space."
76 78
77(defconst epg-gpg-minimum-version "1.4.3") 79(defconst epg-gpg-minimum-version "1.4.3")
78 80
81(defconst epg-config--program-alist
82 '((OpenPGP
83 epg-gpg-program
84 epg-config--make-gpg-configuration
85 ("gpg2" . "2.1.6") ("gpg" . "1.4.3"))
86 (CMS
87 epg-gpgsm-program
88 epg-config--make-gpgsm-configuration
89 ("gpgsm" . "2.0.4")))
90 "Alist used to obtain the usable configuration of executables.
91The first element of each entry is protocol symbol, which is
92either `OpenPGP' or `CMS'. The second element is a symbol where
93the executable name is remembered. The third element is a
94function which constructs a configuration object (actually a
95plist). The rest of the entry is an alist mapping executable
96names to the minimum required version suitable for the use with
97Emacs.")
98
99(defvar epg--configurations nil)
100
79;;;###autoload 101;;;###autoload
80(defun epg-configuration () 102(defun epg-find-configuration (protocol &optional force)
81 "Return a list of internal configuration parameters of `epg-gpg-program'." 103 "Find or create a usable configuration to handle PROTOCOL.
104This function first looks at the existing configuration found by
105the previous invocation of this function, unless FORCE is non-nil.
106
107Then it walks through `epg-config--program-alist'. If
108`epg-gpg-program' or `epg-gpgsm-program' is already set with
109custom, use it. Otherwise, it tries the programs listed in the
110entry until the version requirement is met."
111 (let ((entry (assq protocol epg-config--program-alist)))
112 (unless entry
113 (error "Unknown protocol %S" protocol))
114 (cl-destructuring-bind (symbol constructor . alist)
115 (cdr entry)
116 (or (and (not force) (alist-get protocol epg--configurations))
117 ;; If the executable value is already set with M-x
118 ;; customize, use it without checking.
119 (if (get symbol 'saved-value)
120 (let ((configuration (funcall constructor (symbol-value symbol))))
121 (push (cons protocol configuration) epg--configurations)
122 configuration)
123 (catch 'found
124 (dolist (program-version alist)
125 (let ((executable (executable-find (car program-version))))
126 (when executable
127 (let ((configuration
128 (funcall constructor executable)))
129 (when (ignore-errors
130 (epg-check-configuration configuration
131 (cdr program-version))
132 t)
133 (push (cons protocol configuration) epg--configurations)
134 (throw 'found configuration))))))))))))
135
136;; Create an `epg-configuration' object for `gpg', using PROGRAM.
137(defun epg-config--make-gpg-configuration (program)
82 (let (config groups type args) 138 (let (config groups type args)
83 (with-temp-buffer 139 (with-temp-buffer
84 (apply #'call-process epg-gpg-program nil (list t nil) nil 140 (apply #'call-process program nil (list t nil) nil
85 (append (if epg-gpg-home-directory 141 (append (if epg-gpg-home-directory
86 (list "--homedir" epg-gpg-home-directory)) 142 (list "--homedir" epg-gpg-home-directory))
87 '("--with-colons" "--list-config"))) 143 '("--with-colons" "--list-config")))
@@ -113,10 +169,30 @@ Note that the buffer name starts with a space."
113 type args)))) 169 type args))))
114 (t 170 (t
115 (setq config (cons (cons type args) config)))))) 171 (setq config (cons (cons type args) config))))))
172 (push (cons 'program program) config)
116 (if groups 173 (if groups
117 (cons (cons 'groups groups) config) 174 (cons (cons 'groups groups) config)
118 config))) 175 config)))
119 176
177;; Create an `epg-configuration' object for `gpgsm', using PROGRAM.
178(defun epg-config--make-gpgsm-configuration (program)
179 (with-temp-buffer
180 (call-process program nil (list t nil) nil "--version")
181 (goto-char (point-min))
182 (when (looking-at "\\S-+ (")
183 (goto-char (match-end 0))
184 (backward-char)
185 (forward-sexp)
186 (skip-syntax-forward "-" (point-at-eol))
187 (list (cons 'program program)
188 (cons 'version (buffer-substring (point) (point-at-eol)))))))
189
190;;;###autoload
191(defun epg-configuration ()
192 "Return a list of internal configuration parameters of `epg-gpg-program'."
193 (declare (obsolete epg-find-configuration "25.1"))
194 (epg-config--make-gpg-configuration epg-gpg-program))
195
120(defun epg-config--parse-version (string) 196(defun epg-config--parse-version (string)
121 (let ((index 0) 197 (let ((index 0)
122 version) 198 version)
diff --git a/lisp/epg.el b/lisp/epg.el
index 1f9db23478c..f4058ed35a4 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -186,11 +186,11 @@
186 compress-algorithm 186 compress-algorithm
187 &aux 187 &aux
188 (program 188 (program
189 (pcase protocol 189 (let ((configuration (epg-find-configuration protocol)))
190 (`OpenPGP epg-gpg-program) 190 (unless configuration
191 (`CMS epg-gpgsm-program) 191 (signal 'epg-error
192 (_ (signal 'epg-error 192 (list "no usable configuration" protocol)))
193 (list "unknown protocol" protocol))))))) 193 (alist-get 'program configuration)))))
194 (:copier nil) 194 (:copier nil)
195 (:predicate nil)) 195 (:predicate nil))
196 protocol 196 protocol
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 66e7fd7a315..21046a85a7a 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -27,6 +27,9 @@
27 27
28;;; Code: 28;;; Code:
29 29
30(eval-when-compile
31 (require 'cl))
32
30(defconst file-notify--library 33(defconst file-notify--library
31 (cond 34 (cond
32 ((featurep 'inotify) 'inotify) 35 ((featurep 'inotify) 'inotify)
@@ -54,18 +57,15 @@ different files from the same directory are watched.")
54DESCRIPTOR should be an object returned by `file-notify-add-watch'. 57DESCRIPTOR should be an object returned by `file-notify-add-watch'.
55If it is registered in `file-notify-descriptors', a stopped event is sent." 58If it is registered in `file-notify-descriptors', a stopped event is sent."
56 (let* ((desc (if (consp descriptor) (car descriptor) descriptor)) 59 (let* ((desc (if (consp descriptor) (car descriptor) descriptor))
57 (file (if (consp descriptor) (cdr descriptor)))
58 (registered (gethash desc file-notify-descriptors)) 60 (registered (gethash desc file-notify-descriptors))
61 (file (if (consp descriptor) (cdr descriptor) (caadr registered)))
59 (dir (car registered))) 62 (dir (car registered)))
60 63
61 (when (consp registered) 64 (when (consp registered)
62 ;; Send `stopped' event. 65 ;; Send `stopped' event.
63 (dolist (entry (cdr registered)) 66 (funcall
64 (funcall (cdr entry) 67 (cdr (assoc file (cdr registered)))
65 `(,descriptor stopped 68 `(,descriptor stopped ,(if file (expand-file-name file dir) dir)))
66 ,(or (and (stringp (car entry))
67 (expand-file-name (car entry) dir))
68 dir))))
69 69
70 ;; Modify `file-notify-descriptors'. 70 ;; Modify `file-notify-descriptors'.
71 (if (not file) 71 (if (not file)
@@ -99,6 +99,15 @@ Otherwise, signal a `file-notify-error'."
99 "A pending file notification events for a future `renamed' action. 99 "A pending file notification events for a future `renamed' action.
100It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).") 100It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).")
101 101
102(defun file-notify--event-watched-file (event)
103 "Return file or directory being watched.
104Could be different from the directory watched by the backend library."
105 (let* ((desc (if (consp (car event)) (caar event) (car event)))
106 (registered (gethash desc file-notify-descriptors))
107 (file (if (consp (car event)) (cdar event) (caadr registered)))
108 (dir (car registered)))
109 (if file (expand-file-name file dir) dir)))
110
102(defun file-notify--event-file-name (event) 111(defun file-notify--event-file-name (event)
103 "Return file name of file notification event, or nil." 112 "Return file name of file notification event, or nil."
104 (directory-file-name 113 (directory-file-name
@@ -234,26 +243,6 @@ EVENT is the cadr of the event in `file-notify-handle-event'
234 (funcall (cadr pending-event) (car pending-event)) 243 (funcall (cadr pending-event) (car pending-event))
235 (setq pending-event nil)) 244 (setq pending-event nil))
236 245
237 ;; Check for stopped.
238 (setq
239 stopped
240 (or
241 stopped
242 (and
243 (memq action '(deleted renamed))
244 (= (length (cdr registered)) 1)
245 ;; Not, when a file is backed up.
246 (not (and (stringp file1) (backup-file-name-p file1)))
247 (or
248 ;; Watched file or directory is concerned.
249 (string-equal
250 (file-name-nondirectory file)
251 (file-name-nondirectory (car registered)))
252 ;; File inside a watched directory is concerned.
253 (string-equal
254 (file-name-nondirectory file)
255 (car (cadr registered)))))))
256
257 ;; Apply callback. 246 ;; Apply callback.
258 (when (and action 247 (when (and action
259 (or 248 (or
@@ -273,18 +262,24 @@ EVENT is the cadr of the event in `file-notify-handle-event'
273 (nth 0 entry) (file-name-nondirectory file1))))) 262 (nth 0 entry) (file-name-nondirectory file1)))))
274 ;;(message 263 ;;(message
275 ;;"file-notify-callback %S %S %S %S %S" 264 ;;"file-notify-callback %S %S %S %S %S"
276 ;;(file-notify--descriptor desc file) action file file1 registered) 265 ;;(file-notify--descriptor desc (car entry))
266 ;;action file file1 registered)
277 (if file1 267 (if file1
278 (funcall 268 (funcall
279 callback 269 callback
280 `(,(file-notify--descriptor desc file) ,action ,file ,file1)) 270 `(,(file-notify--descriptor desc (car entry))
271 ,action ,file ,file1))
281 (funcall 272 (funcall
282 callback 273 callback
283 `(,(file-notify--descriptor desc file) ,action ,file))))) 274 `(,(file-notify--descriptor desc (car entry)) ,action ,file))))
284 275
285 ;; Modify `file-notify-descriptors'. 276 ;; Send `stopped' event.
286 (when stopped 277 (when (and (memq action '(deleted renamed))
287 (file-notify-rm-watch (file-notify--descriptor desc file)))))) 278 ;; Not, when a file is backed up.
279 (not (and (stringp file1) (backup-file-name-p file1)))
280 ;; Watched file or directory is concerned.
281 (string-equal file (file-notify--event-watched-file event)))
282 (file-notify-rm-watch (file-notify--descriptor desc (car entry))))))))
288 283
289;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor 284;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor
290;; for every `file-notify-add-watch', while `inotify' returns a unique 285;; for every `file-notify-add-watch', while `inotify' returns a unique
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index c66ca535998..4d8cb802b48 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -518,6 +518,12 @@ each invocation of the saving commands."
518 (item :tag "never" nil) 518 (item :tag "never" nil)
519 (sexp :tag "once" :format "%t\n" :value t))) 519 (sexp :tag "once" :format "%t\n" :value t)))
520 520
521(defcustom gnus-article-show-cursor nil
522 "If non-nil, show the cursor in the Article buffer even when not selected."
523 :version "25.1"
524 :group 'gnus-article
525 :type 'bool)
526
521(defcustom gnus-saved-headers gnus-visible-headers 527(defcustom gnus-saved-headers gnus-visible-headers
522 "Headers to keep if `gnus-save-all-headers' is nil. 528 "Headers to keep if `gnus-save-all-headers' is nil.
523If `gnus-save-all-headers' is non-nil, this variable will be ignored. 529If `gnus-save-all-headers' is non-nil, this variable will be ignored.
@@ -4484,7 +4490,8 @@ commands:
4484 (set (make-local-variable 'nobreak-char-display) nil) 4490 (set (make-local-variable 'nobreak-char-display) nil)
4485 ;; Enable `gnus-article-remove-images' to delete images shr.el renders. 4491 ;; Enable `gnus-article-remove-images' to delete images shr.el renders.
4486 (set (make-local-variable 'shr-put-image-function) 'gnus-shr-put-image) 4492 (set (make-local-variable 'shr-put-image-function) 'gnus-shr-put-image)
4487 (setq cursor-in-non-selected-windows nil) 4493 (unless gnus-article-show-cursor
4494 (setq cursor-in-non-selected-windows nil))
4488 (gnus-set-default-directory) 4495 (gnus-set-default-directory)
4489 (buffer-disable-undo) 4496 (buffer-disable-undo)
4490 (setq buffer-read-only t 4497 (setq buffer-read-only t
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 2021885e996..c3a5f26d261 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -296,7 +296,6 @@ suitable file is found, return nil."
296 (substring-no-properties lib-name 0 -1) 296 (substring-no-properties lib-name 0 -1)
297 lib-name) 297 lib-name)
298 file-name)) 298 file-name))
299 ;; The next three forms are from `find-source-lisp-file'.
300 (src-file (locate-library file-name t nil 'readable))) 299 (src-file (locate-library file-name t nil 'readable)))
301 (and src-file (file-readable-p src-file) src-file)))))) 300 (and src-file (file-readable-p src-file) src-file))))))
302 301
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 7f9f4fad414..91a17755244 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -410,6 +410,10 @@ Currently this means either text/html or application/xhtml+xml."
410 (condition-case nil 410 (condition-case nil
411 (decode-coding-region (point) (point-max) encode) 411 (decode-coding-region (point) (point-max) encode)
412 (coding-system-error nil)) 412 (coding-system-error nil))
413 (save-excursion
414 ;; Remove CRLF before parsing.
415 (while (re-search-forward "\r$" nil t)
416 (replace-match "" t t)))
413 (libxml-parse-html-region (point) (point-max)))))) 417 (libxml-parse-html-region (point) (point-max))))))
414 (source (and (null document) 418 (source (and (null document)
415 (buffer-substring (point) (point-max))))) 419 (buffer-substring (point) (point-max)))))
@@ -1531,11 +1535,10 @@ If CHARSET is nil then use UTF-8."
1531(defun eww-toggle-fonts () 1535(defun eww-toggle-fonts ()
1532 "Toggle whether to use monospaced or font-enabled layouts." 1536 "Toggle whether to use monospaced or font-enabled layouts."
1533 (interactive) 1537 (interactive)
1534 (message "Fonts are now %s" 1538 (setq shr-use-fonts (not shr-use-fonts))
1535 (if (setq shr-use-fonts (not shr-use-fonts)) 1539 (eww-reload)
1536 "on" 1540 (message "Proportional fonts are now %s"
1537 "off")) 1541 (if shr-use-fonts "on" "off")))
1538 (eww-reload))
1539 1542
1540(defun eww-toggle-colors () 1543(defun eww-toggle-colors ()
1541 "Toggle whether to use HTML-specified colors or not." 1544 "Toggle whether to use HTML-specified colors or not."
diff --git a/lisp/net/pinentry.el b/lisp/net/pinentry.el
index 27374afe4bf..082a9c8ff89 100644
--- a/lisp/net/pinentry.el
+++ b/lisp/net/pinentry.el
@@ -26,7 +26,8 @@
26;; This package allows GnuPG passphrase to be prompted through the 26;; This package allows GnuPG passphrase to be prompted through the
27;; minibuffer instead of graphical dialog. 27;; minibuffer instead of graphical dialog.
28;; 28;;
29;; To use, add allow-emacs-pinentry to ~/.gnupg/gpg-agent.conf, and 29;; To use, add "allow-emacs-pinentry" to "~/.gnupg/gpg-agent.conf",
30;; reload the configuration with "gpgconf --reload gpg-agent", and
30;; start the server with M-x pinentry-start. 31;; start the server with M-x pinentry-start.
31;; 32;;
32;; The actual communication path between the relevant components is 33;; The actual communication path between the relevant components is
@@ -48,6 +49,8 @@
48 49
49;;; Code: 50;;; Code:
50 51
52(eval-when-compile (require 'cl-lib))
53
51(defgroup pinentry nil 54(defgroup pinentry nil
52 "The Pinentry server" 55 "The Pinentry server"
53 :version "25.1" 56 :version "25.1"
@@ -171,17 +174,18 @@ will not be shown."
171 (ignore-errors 174 (ignore-errors
172 (let (delete-by-moving-to-trash) 175 (let (delete-by-moving-to-trash)
173 (delete-file server-file))) 176 (delete-file server-file)))
174 (setq pinentry--server-process 177 (cl-letf (((default-file-modes) ?\700))
175 (make-network-process 178 (setq pinentry--server-process
176 :name "pinentry" 179 (make-network-process
177 :server t 180 :name "pinentry"
178 :noquery t 181 :server t
179 :sentinel #'pinentry--process-sentinel 182 :noquery t
180 :filter #'pinentry--process-filter 183 :sentinel #'pinentry--process-sentinel
181 :coding 'no-conversion 184 :filter #'pinentry--process-filter
182 :family 'local 185 :coding 'no-conversion
183 :service server-file)) 186 :family 'local
184 (process-put pinentry--server-process :server-file server-file)))) 187 :service server-file))
188 (process-put pinentry--server-process :server-file server-file)))))
185 189
186(defun pinentry-stop () 190(defun pinentry-stop ()
187 "Stop a Pinentry service." 191 "Stop a Pinentry service."
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 8f2acf3cd61..f5aa4df7c2b 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -3241,7 +3241,7 @@ comment at the start of cc-engine.el for more info."
3241 ;; pair element into an open paren element. Doing that would mean that the 3241 ;; pair element into an open paren element. Doing that would mean that the
3242 ;; new open paren wouldn't have the required preceding paren pair element. 3242 ;; new open paren wouldn't have the required preceding paren pair element.
3243 ;; 3243 ;;
3244 ;; This function is called from c-after-change. 3244 ;; This function is called from c-before-change.
3245 3245
3246 ;; The caches of non-literals: 3246 ;; The caches of non-literals:
3247 ;; Note that we use "<=" for the possibility of the second char of a two-char 3247 ;; Note that we use "<=" for the possibility of the second char of a two-char
@@ -3265,7 +3265,7 @@ comment at the start of cc-engine.el for more info."
3265 ;; below `here'. To maintain its consistency, we may need to insert a new 3265 ;; below `here'. To maintain its consistency, we may need to insert a new
3266 ;; brace pair. 3266 ;; brace pair.
3267 (let ((here-bol (c-point 'bol here)) 3267 (let ((here-bol (c-point 'bol here))
3268 too-high-pa ; recorded {/(/[ next above here, or nil. 3268 too-high-pa ; recorded {/(/[ next above or just below here, or nil.
3269 dropped-cons ; was the last removed element a brace pair? 3269 dropped-cons ; was the last removed element a brace pair?
3270 pa) 3270 pa)
3271 ;; The easy bit - knock over-the-top bits off `c-state-cache'. 3271 ;; The easy bit - knock over-the-top bits off `c-state-cache'.
@@ -3277,7 +3277,7 @@ comment at the start of cc-engine.el for more info."
3277 3277
3278 ;; Do we need to add in an earlier brace pair, having lopped one off? 3278 ;; Do we need to add in an earlier brace pair, having lopped one off?
3279 (if (and dropped-cons 3279 (if (and dropped-cons
3280 (< too-high-pa (+ here c-state-cache-too-far))) 3280 (<= too-high-pa here))
3281 (c-append-lower-brace-pair-to-state-cache too-high-pa here here-bol)) 3281 (c-append-lower-brace-pair-to-state-cache too-high-pa here here-bol))
3282 (setq c-state-cache-good-pos (or (c-state-cache-after-top-paren) 3282 (setq c-state-cache-good-pos (or (c-state-cache-after-top-paren)
3283 (c-state-get-min-scan-pos))))) 3283 (c-state-get-min-scan-pos)))))
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 2fd7297a2e8..f983525e928 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -414,16 +414,17 @@ elements is negated."
414 (set-buffer (marker-buffer marker)) 414 (set-buffer (marker-buffer marker))
415 (xref--goto-char marker))) 415 (xref--goto-char marker)))
416 416
417(defun xref--pop-to-location (item &optional window) 417(defun xref--pop-to-location (item &optional action)
418 "Go to the location of ITEM and display the buffer. 418 "Go to the location of ITEM and display the buffer.
419WINDOW controls how the buffer is displayed: 419ACTION controls how the buffer is displayed:
420 nil -- switch-to-buffer 420 nil -- switch-to-buffer
421 `window' -- pop-to-buffer (other window) 421 `window' -- pop-to-buffer (other window)
422 `frame' -- pop-to-buffer (other frame)" 422 `frame' -- pop-to-buffer (other frame)
423If SELECT is non-nil, select the target window."
423 (let* ((marker (save-excursion 424 (let* ((marker (save-excursion
424 (xref-location-marker (xref-item-location item)))) 425 (xref-location-marker (xref-item-location item))))
425 (buf (marker-buffer marker))) 426 (buf (marker-buffer marker)))
426 (cl-ecase window 427 (cl-ecase action
427 ((nil) (switch-to-buffer buf)) 428 ((nil) (switch-to-buffer buf))
428 (window (pop-to-buffer buf t)) 429 (window (pop-to-buffer buf t))
429 (frame (let ((pop-up-frames t)) (pop-to-buffer buf t)))) 430 (frame (let ((pop-up-frames t)) (pop-to-buffer buf t))))
@@ -436,51 +437,60 @@ WINDOW controls how the buffer is displayed:
436 437
437;; The xref buffer is used to display a set of xrefs. 438;; The xref buffer is used to display a set of xrefs.
438 439
439(defvar-local xref--display-history nil 440(defmacro xref--with-dedicated-window (&rest body)
440 "List of pairs (BUFFER . WINDOW), for temporarily displayed buffers.") 441 `(let* ((xref-w (get-buffer-window xref-buffer-name))
441 442 (xref-w-dedicated (window-dedicated-p xref-w)))
442(defun xref--save-to-history (buf win) 443 (unwind-protect
443 (let ((restore (window-parameter win 'quit-restore))) 444 (progn
444 ;; Save the new entry if the window displayed another buffer 445 (when xref-w
445 ;; previously. 446 (set-window-dedicated-p xref-w 'soft))
446 (when (and restore (not (eq (car restore) 'same))) 447 ,@body)
447 (push (cons buf win) xref--display-history)))) 448 (when xref-w
448 449 (set-window-dedicated-p xref-w xref-w-dedicated)))))
449(defun xref--display-position (pos other-window buf) 450
450 ;; Show the location, but don't hijack focus. 451(defun xref--show-pos-in-buf (pos buf select)
451 (let ((xref-buf (current-buffer))) 452 (let ((xref-buf (current-buffer))
452 (with-selected-window (display-buffer buf other-window) 453 win)
454 (with-selected-window
455 (xref--with-dedicated-window
456 (display-buffer buf))
453 (xref--goto-char pos) 457 (xref--goto-char pos)
454 (run-hooks 'xref-after-jump-hook) 458 (run-hooks 'xref-after-jump-hook)
455 (let ((buf (current-buffer)) 459 (let ((buf (current-buffer)))
456 (win (selected-window))) 460 (setq win (selected-window))
457 (with-current-buffer xref-buf 461 (with-current-buffer xref-buf
458 (setq-local other-window-scroll-buffer buf) 462 (setq-local other-window-scroll-buffer buf))))
459 (xref--save-to-history buf win)))))) 463 (when select
464 (select-window win))))
460 465
461(defun xref--show-location (location) 466(defun xref--show-location (location &optional select)
462 (condition-case err 467 (condition-case err
463 (let* ((marker (xref-location-marker location)) 468 (let* ((marker (xref-location-marker location))
464 (buf (marker-buffer marker))) 469 (buf (marker-buffer marker)))
465 (xref--display-position marker t buf)) 470 (xref--show-pos-in-buf marker buf select))
466 (user-error (message (error-message-string err))))) 471 (user-error (message (error-message-string err)))))
467 472
468(defun xref-show-location-at-point () 473(defun xref-show-location-at-point ()
469 "Display the source of xref at point in the other window, if any." 474 "Display the source of xref at point in the appropriate window, if any."
470 (interactive) 475 (interactive)
471 (let* ((xref (xref--item-at-point)) 476 (let* ((xref (xref--item-at-point))
472 (xref--current-item xref)) 477 (xref--current-item xref))
473 (when xref 478 (when xref
474 (xref--show-location (xref-item-location xref))))) 479 ;; Try to avoid the window the current xref buffer was
480 ;; originally created from.
481 (if (window-live-p xref--window)
482 (with-selected-window xref--window
483 (xref--show-location (xref-item-location xref)))
484 (xref--show-location (xref-item-location xref))))))
475 485
476(defun xref-next-line () 486(defun xref-next-line ()
477 "Move to the next xref and display its source in the other window." 487 "Move to the next xref and display its source in the appropriate window."
478 (interactive) 488 (interactive)
479 (xref--search-property 'xref-item) 489 (xref--search-property 'xref-item)
480 (xref-show-location-at-point)) 490 (xref-show-location-at-point))
481 491
482(defun xref-prev-line () 492(defun xref-prev-line ()
483 "Move to the previous xref and display its source in the other window." 493 "Move to the previous xref and display its source in the appropriate window."
484 (interactive) 494 (interactive)
485 (xref--search-property 'xref-item t) 495 (xref--search-property 'xref-item t)
486 (xref-show-location-at-point)) 496 (xref-show-location-at-point))
@@ -491,16 +501,14 @@ WINDOW controls how the buffer is displayed:
491 (get-text-property (point) 'xref-item))) 501 (get-text-property (point) 'xref-item)))
492 502
493(defvar-local xref--window nil 503(defvar-local xref--window nil
494 "ACTION argument to call `display-buffer' with.") 504 "The original window this xref buffer was created from.")
495 505
496(defun xref-goto-xref () 506(defun xref-goto-xref ()
497 "Jump to the xref on the current line and bury the xref buffer." 507 "Jump to the xref on the current line and select its window."
498 (interactive) 508 (interactive)
499 (let ((xref (or (xref--item-at-point) 509 (let ((xref (or (xref--item-at-point)
500 (user-error "No reference at point"))) 510 (user-error "No reference at point"))))
501 (window xref--window)) 511 (xref--show-location (xref-item-location xref) t)))
502 (xref-quit)
503 (xref--pop-to-location xref window)))
504 512
505(defun xref-query-replace-in-results (from to) 513(defun xref-query-replace-in-results (from to)
506 "Perform interactive replacement of FROM with TO in all displayed xrefs. 514 "Perform interactive replacement of FROM with TO in all displayed xrefs.
@@ -573,7 +581,8 @@ references displayed in the current *xref* buffer."
573 current-beg (car pair) 581 current-beg (car pair)
574 current-end (cdr pair) 582 current-end (cdr pair)
575 current-buf (marker-buffer current-beg)) 583 current-buf (marker-buffer current-beg))
576 (pop-to-buffer current-buf) 584 (xref--with-dedicated-window
585 (pop-to-buffer current-buf))
577 (goto-char current-beg) 586 (goto-char current-beg)
578 (when (re-search-forward from current-end noerror) 587 (when (re-search-forward from current-end noerror)
579 (setq found t))) 588 (setq found t)))
@@ -586,7 +595,6 @@ references displayed in the current *xref* buffer."
586 595
587(defvar xref--xref-buffer-mode-map 596(defvar xref--xref-buffer-mode-map
588 (let ((map (make-sparse-keymap))) 597 (let ((map (make-sparse-keymap)))
589 (define-key map [remap quit-window] #'xref-quit)
590 (define-key map (kbd "n") #'xref-next-line) 598 (define-key map (kbd "n") #'xref-next-line)
591 (define-key map (kbd "p") #'xref-prev-line) 599 (define-key map (kbd "p") #'xref-prev-line)
592 (define-key map (kbd "r") #'xref-query-replace-in-results) 600 (define-key map (kbd "r") #'xref-query-replace-in-results)
@@ -614,27 +622,10 @@ references displayed in the current *xref* buffer."
614 (dotimes (_ n) 622 (dotimes (_ n)
615 (setq xref (xref--search-property 'xref-item backward))) 623 (setq xref (xref--search-property 'xref-item backward)))
616 (cond (xref 624 (cond (xref
617 (xref--pop-to-location xref)) 625 (xref--show-location (xref-item-location xref) t))
618 (t 626 (t
619 (error "No %s xref" (if backward "previous" "next")))))) 627 (error "No %s xref" (if backward "previous" "next"))))))
620 628
621(defun xref-quit (&optional kill)
622 "Bury temporarily displayed buffers, then quit the current window.
623
624If KILL is non-nil, also kill the current buffer.
625
626The buffers that the user has otherwise interacted with in the
627meantime are preserved."
628 (interactive "P")
629 (let ((window (selected-window))
630 (history xref--display-history))
631 (setq xref--display-history nil)
632 (pcase-dolist (`(,buf . ,win) history)
633 (when (and (window-live-p win)
634 (eq buf (window-buffer win)))
635 (quit-window nil win)))
636 (quit-window kill window)))
637
638(defconst xref-buffer-name "*xref*" 629(defconst xref-buffer-name "*xref*"
639 "The name of the buffer to show xrefs.") 630 "The name of the buffer to show xrefs.")
640 631
@@ -724,15 +715,15 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
724 715
725(defvar xref--read-pattern-history nil) 716(defvar xref--read-pattern-history nil)
726 717
727(defun xref--show-xrefs (xrefs window &optional always-show-list) 718(defun xref--show-xrefs (xrefs display-action &optional always-show-list)
728 (cond 719 (cond
729 ((and (not (cdr xrefs)) (not always-show-list)) 720 ((and (not (cdr xrefs)) (not always-show-list))
730 (xref-push-marker-stack) 721 (xref-push-marker-stack)
731 (xref--pop-to-location (car xrefs) window)) 722 (xref--pop-to-location (car xrefs) display-action))
732 (t 723 (t
733 (xref-push-marker-stack) 724 (xref-push-marker-stack)
734 (funcall xref-show-xrefs-function xrefs 725 (funcall xref-show-xrefs-function xrefs
735 `((window . ,window)))))) 726 `((window . ,(selected-window)))))))
736 727
737(defun xref--prompt-p (command) 728(defun xref--prompt-p (command)
738 (or (eq xref-prompt-for-identifier t) 729 (or (eq xref-prompt-for-identifier t)
@@ -761,16 +752,16 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
761 752
762;;; Commands 753;;; Commands
763 754
764(defun xref--find-xrefs (input kind arg window) 755(defun xref--find-xrefs (input kind arg display-action)
765 (let ((xrefs (funcall (intern (format "xref-backend-%s" kind)) 756 (let ((xrefs (funcall (intern (format "xref-backend-%s" kind))
766 (xref-find-backend) 757 (xref-find-backend)
767 arg))) 758 arg)))
768 (unless xrefs 759 (unless xrefs
769 (user-error "No %s found for: %s" (symbol-name kind) input)) 760 (user-error "No %s found for: %s" (symbol-name kind) input))
770 (xref--show-xrefs xrefs window))) 761 (xref--show-xrefs xrefs display-action)))
771 762
772(defun xref--find-definitions (id window) 763(defun xref--find-definitions (id display-action)
773 (xref--find-xrefs id 'definitions id window)) 764 (xref--find-xrefs id 'definitions id display-action))
774 765
775;;;###autoload 766;;;###autoload
776(defun xref-find-definitions (identifier) 767(defun xref-find-definitions (identifier)
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index 79524fb7280..c053ea6e924 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -106,7 +106,7 @@ otherwise would have been updated."
106 106
107(defcustom time-stamp-time-zone nil 107(defcustom time-stamp-time-zone nil
108 "The time zone to be used by \\[time-stamp]. 108 "The time zone to be used by \\[time-stamp].
109Its format is that of the ZONE argument of the `format-time-string' function," 109Its format is that of the ZONE argument of the `format-time-string' function."
110 :type '(choice (const :tag "Emacs local time" nil) 110 :type '(choice (const :tag "Emacs local time" nil)
111 (const :tag "Universal Time" t) 111 (const :tag "Universal Time" t)
112 (const :tag "system wall clock time" wall) 112 (const :tag "system wall clock time" wall)
diff --git a/lisp/window.el b/lisp/window.el
index e4669c1f6e7..c45e60e6204 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -3241,9 +3241,9 @@ move it as far as possible in the desired direction."
3241 (setq ignore 'preserved) 3241 (setq ignore 'preserved)
3242 (setq right first-right) 3242 (setq right first-right)
3243 (while (and right 3243 (while (and right
3244 (or (window-size-fixed-p right horizontal 'preserved)) 3244 (or (window-size-fixed-p right horizontal 'preserved)
3245 (<= (window-size right horizontal t) 3245 (<= (window-size right horizontal t)
3246 (window-min-size right horizontal 'preserved t))) 3246 (window-min-size right horizontal 'preserved t))))
3247 (setq right 3247 (setq right
3248 (or (window-right right) 3248 (or (window-right right)
3249 (progn 3249 (progn
@@ -3352,12 +3352,12 @@ negative, shrink selected window by -DELTA lines or columns."
3352 (window--resize-mini-window minibuffer-window (- delta))) 3352 (window--resize-mini-window minibuffer-window (- delta)))
3353 ((window--resizable-p nil delta horizontal) 3353 ((window--resizable-p nil delta horizontal)
3354 (window-resize nil delta horizontal)) 3354 (window-resize nil delta horizontal))
3355 ((window--resizable-p nil delta horizontal 'preserved)
3356 (window-resize nil delta horizontal 'preserved))
3357 ((eq this-command 'enlarge-window)
3358 (user-error "Cannot enlarge selected window"))
3355 (t 3359 (t
3356 (window-resize 3360 (error "Cannot enlarge selected window")))))
3357 nil (if (> delta 0)
3358 (window-max-delta nil horizontal)
3359 (- (window-min-delta nil horizontal)))
3360 horizontal)))))
3361 3361
3362(defun shrink-window (delta &optional horizontal) 3362(defun shrink-window (delta &optional horizontal)
3363 "Make the selected window DELTA lines smaller. 3363 "Make the selected window DELTA lines smaller.
@@ -3387,12 +3387,12 @@ Also see the `window-min-height' variable."
3387 (window--resize-mini-window minibuffer-window delta)) 3387 (window--resize-mini-window minibuffer-window delta))
3388 ((window--resizable-p nil (- delta) horizontal) 3388 ((window--resizable-p nil (- delta) horizontal)
3389 (window-resize nil (- delta) horizontal)) 3389 (window-resize nil (- delta) horizontal))
3390 ((window--resizable-p nil (- delta) horizontal 'preserved)
3391 (window-resize nil (- delta) horizontal 'preserved))
3392 ((eq this-command 'shrink-window)
3393 (user-error "Cannot shrink selected window"))
3390 (t 3394 (t
3391 (window-resize 3395 (error "Cannot shrink selected window")))))
3392 nil (if (> delta 0)
3393 (- (window-min-delta nil horizontal))
3394 (window-max-delta nil horizontal))
3395 horizontal)))))
3396 3396
3397(defun maximize-window (&optional window) 3397(defun maximize-window (&optional window)
3398 "Maximize WINDOW. 3398 "Maximize WINDOW.
diff --git a/lisp/woman.el b/lisp/woman.el
index 28a47986c2f..a4a0da209cb 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1654,7 +1654,7 @@ Do not call directly!"
1654 (setq woman-frame (make-frame))))) 1654 (setq woman-frame (make-frame)))))
1655 (set-buffer (get-buffer-create bufname)) 1655 (set-buffer (get-buffer-create bufname))
1656 (condition-case nil 1656 (condition-case nil
1657 (display-buffer (current-buffer)) 1657 (pop-to-buffer-same-window (current-buffer))
1658 (error (pop-to-buffer (current-buffer)))) 1658 (error (pop-to-buffer (current-buffer))))
1659 (buffer-disable-undo) 1659 (buffer-disable-undo)
1660 (setq buffer-read-only nil) 1660 (setq buffer-read-only nil)
@@ -2064,14 +2064,14 @@ alist in `woman-buffer-alist' and return nil."
2064 (if (zerop woman-buffer-number) 2064 (if (zerop woman-buffer-number)
2065 (let ((buffer (get-buffer (cdr (car woman-buffer-alist))))) 2065 (let ((buffer (get-buffer (cdr (car woman-buffer-alist)))))
2066 (if buffer 2066 (if buffer
2067 (display-buffer buffer) 2067 (pop-to-buffer-same-window buffer)
2068 ;; Delete alist element: 2068 ;; Delete alist element:
2069 (setq woman-buffer-alist (cdr woman-buffer-alist)) 2069 (setq woman-buffer-alist (cdr woman-buffer-alist))
2070 nil)) 2070 nil))
2071 (let* ((prev-ptr (nthcdr (1- woman-buffer-number) woman-buffer-alist)) 2071 (let* ((prev-ptr (nthcdr (1- woman-buffer-number) woman-buffer-alist))
2072 (buffer (get-buffer (cdr (car (cdr prev-ptr)))))) 2072 (buffer (get-buffer (cdr (car (cdr prev-ptr))))))
2073 (if buffer 2073 (if buffer
2074 (display-buffer buffer) 2074 (pop-to-buffer-same-window buffer)
2075 ;; Delete alist element: 2075 ;; Delete alist element:
2076 (setcdr prev-ptr (cdr (cdr prev-ptr))) 2076 (setcdr prev-ptr (cdr (cdr prev-ptr)))
2077 (if (>= woman-buffer-number (length woman-buffer-alist)) 2077 (if (>= woman-buffer-number (length woman-buffer-alist))
diff --git a/nextstep/README b/nextstep/README
index 45b9b23ee10..c16d55b35b9 100644
--- a/nextstep/README
+++ b/nextstep/README
@@ -1,4 +1,100 @@
1This directory contains files needed to build Emacs on Nextstep-based
2platforms, including GNUstep and Mac OS X (using the Cocoa libraries).
3 1
4See the INSTALL file in this directory for compilation instructions. 2 NS -- the Cocoa interface for OS X and compatible systems
3 ---------------------------------------------------------
4
5This directory contains files needed to build Emacs on system based on
6NextStep (NS), including OS X (Mac) and GNUstep, using the Cocoa API.
7
8
9 HISTORY
10
11Up to Emacs 22, the OS X interface was implemented using the C-based
12Carbon API. Starting with Emacs 23, the interface was rewritten in
13Objective-C using the Cocoa API. Meanwhile, the Carbon interface has
14been maintained independently under the name "mac".
15
16
17 OVERVIEW OF COCOA AND OBJECTIVE-C
18
19Cocoa is an API for the Objective-C language, an objective oriented
20superset of C. Anybody with experience with iOS or modern OS X
21application development should feel at home.
22
23A method call in Objective-C differs from most other languages in the
24fact that it doesn't have a normal name. Instead, the method name is
25made up of the name of each parameter. An exception to this rule are
26methods without parameters.
27
28The following calls a method in the object `anObject'.
29
30 [anObject alpha:1 beta:2 gamma:3];
31
32Classes are declared like the following:
33
34 @interface AClassName
35 {
36 // A class method.
37 + (TYPE)name1:(TYPE)param1
38
39 // An object method.
40 - (TYPE)name1:(TYPE)param1 name2:(TYPE)param2;
41 }
42 @end
43
44
45 GUIDELINES
46
47* Adhere the to the FSF philosophy that a feature in GNU software
48 should not only be available on non-free systems.
49
50* People with varying Cocoa and Objective-C skills will read and
51 modify the NS code over a long period of time. Keep the code simple
52 and avoid language constructs that makes the code hard to maintain.
53
54* Don't use macros and types intended for the XCode Interface Builder,
55 like `IBAction'.
56
57* The NS interface should work on all version of OS X from 10.6.8
58 (Snow Leopard) to the latest official release.
59
60* Under OS X, it is possible to build Emacs using NS, X11, or console
61 only. A new OS X feature should work in all appropriate builds.
62
63
64 TRACING SUPPORT
65
66The NS interface features a printf-based trace package that prints the
67call tree of selected functions in the Cocoa interface, plus various
68extra information. It can be enabled by uncommenting the line
69defining `NSTRACE_ENABLED' in "nsterm.h". To enable more output,
70uncomment the lines defining symbols starting with `NSTRACE_GROUP'.
71
72
73 GNUSTEP AND OTHER COMPATIBLE SYSTEMS
74
75The NS interface works on system compatible with OS X, for example
76GNUstep. Even though they are less frequently used, this is important
77for a number of reasons:
78
79* It supports the GNUstep project and provides an Emacs with the same
80 look-and-feel as the rest of the system.
81
82* This allows other Emacs developers to test their changes on the NS
83 interface without having access to an OS X machine.
84
85* If a feature in the NS interface work on free systems like GNUstep,
86 this meets the FSF requirement that features in GNU software should
87 not only be available on non-free systems.
88
89
90 SEE ALSO
91
92The src/ns... files contains the C and Objective-C parts.
93
94The lisp/term/ns-win.el file contains the lisp part of the NS
95interface.
96
97The INSTALL file in this directory for compilation instructions.
98
99The WISHLIST file in this directory for a list of ideas for future
100development of the NS interface.
diff --git a/nextstep/WISHLIST b/nextstep/WISHLIST
new file mode 100644
index 00000000000..1c4b9e2deb4
--- /dev/null
+++ b/nextstep/WISHLIST
@@ -0,0 +1,247 @@
1 -*- org -*-
2
3 Wish list for the "NS" OS X Emacs port
4 --------------------------------------
5
6 Note: This document is written using "org-mode", a plain-text
7 format supporting outlines. To expand a heading, press TAB. To
8 expand all headings and subheadings, press S-TAB until Emacs
9 responds "SHOW ALL".
10
11* Introduction
12
13This is a wishlist for future development of the "NS" Emacs user
14interface whose primary use is the official Emacs version on OS X.
15
16This list should be seen as a complement to the bug- and wishlist on
17[[http://debbugs.gnu.org/cgi/pkgreport.cgi?package%3Demacs][debbugs]], the Emacs bug tracker.
18
19* Missing features
20
21This sections contains features found in other official Emacs ports.
22
23** Support for "xwidget"
24
25Emacs 25 has support for "xwidgets", a system to include operating
26system components into an Emacs buffer. The components range from
27simple buttons to "webkit" (effectively, a web browser).
28
29Currently, "xwidget" only works for the "gtk+" framework but it is
30designed to be compatible with multiple Emacs ports.
31
32** Respect `frame-inhibit-implied-resize'
33
34When the variable `frame-inhibit-implied-resize' is non-nil, frames
35should not be resized when operations like changing font or toggling
36the tool bar is performed.
37
38Unfortunately, the tool bar (and possible other operations) always
39resize the frame.
40
41** Support `proced' (implement `process-attributes')
42
43Unfortunately, a user-level process like Emacs does not have the
44privileges to get information about other processes under OS X.
45
46There are other ways to do this:
47
48 1) Spawn "ps" and parse the output ("ps" has superuser privileges).
49
50 2) Sign Emacs as part of the distribution process.
51
52 3) Ask the user to self-sign Emacs, if this feature is of interest.
53
54Anders Lindgren <andlind@gmail.com> has implemented
55`process-attributes' for OS X -- which currently only work when
56running Emacs as root.
57
58[[http://emacsredux.com/blog/2013/05/02/manage-processes-with-proced/][See this article by Bozhidar Batsov for an overview of Proced.]]
59
60** Tooltip properties
61
62Tooltip properties like the background color and font are hard wired,
63even though Emacs allow a user to customize such features.
64
65* New features
66
67This section contains features unique to the NS and/or OS X.
68
69** PressAndHold for writing accented character
70
71On OS X, many application supports the press and hold pattern to
72invoke a menu of accented characters. (See example at [[https://support.apple.com/en-us/HT201586][Apple]].)
73
74Currently, this doesn't work in Emacs.
75
76Note that "ns-win.el" explicitly disables this.
77
78Note: This feature might not be allowed to be implemented until also
79implemented in Emacs for a free system.
80
81** Floating scroll bars
82
83In modern OS X applications, the scroll bar often float over the
84content, and is invisible unless actually used. This makes user
85interface less cluttered and more area could be used to contain text.
86
87With floating scroll bars, the user interface would look like it does
88when they are disabled today. However, they will be made visible when
89a scroll action is initiated, e.g. by putting two fingers on a
90trackpad.
91
92Note: This feature might not be allowed to be implemented until also
93implemented in Emacs for a free system.
94
95* Features from the "mac" port
96
97This section contains features available in the "mac" Emacs port.
98
99As the "mac" port (as of this writing) isn't an official Emacs port,
100it might contain features not following the FSF rule "must exist on
101free systems".
102
103The "mac" port is based on the Emacs 22 C-based Carbon interface. It
104has been maintained in parallel to the official Cocoa-based NS
105interface. The Carbon interface has been enhanced, and a number of the
106features of that interface could be implemented NS.
107
108** Smooth scrolling -- maybe not a good idea
109
110Today, by default, scrolling with a trackpad makes the text move in
111steps of five lines. (Scrolling with SHIFT scrolls one line at a
112time.)
113
114The "mac" port provides smooth, pixel-based, scrolling. This is a very
115popular features. However, there are drawbacks to this method: what
116happens if only a fraction of a line is visible at the top of a
117window, is the partially visible text considered part of the window or
118not? (Technically, what should `window-start' return.)
119
120An alternative would be to make one-line scrolling the default on NS
121(or in Emacs in general).
122
123Note: This feature might not be allowed to be implemented until also
124implemented in Emacs for a free system.
125
126** Mouse gestures
127
128The "mac" port defines the gestures `swipe-left/right/up/down',
129`magnify-up/down', and `rotate-left/right'.
130
131It also binds the magnification commands to change the font
132size. (This should be not be done in a specific interface, instead
133Emacs should do this binding globally.)
134
135Note: This feature might not be allowed to be implemented until also
136implemented in Emacs for a free system.
137
138** Synthesize bold fonts
139
140* Open issues
141
142This section contains issues where there is an ongoing debate.
143
144** Key bindings of CMD and ALT
145
146Currently in the "ns" port, ALT is bound to Meta and CMD is bound to
147Super -- allowing the user to use typical OS X commands like CMD-A to
148mark everything.
149
150Unfortunately, when using an international keyboard, you can't type
151normal characters like "(" etc.
152
153There are many alternative key bindings. One solution is to bind CMD
154to Meta and pass ALT to the system. In fact, this is what Emacs did up
155to, and including, version 22. Also, this is how the "mac" port binds
156the keys.
157
158One could envision asymmetrical variants as well, however, this is
159inappropriate for the default setting.
160
161See the discussion on emacs-devel [[https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg01575.html][part 1]] and [[https://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00008.html][part 2]].
162
163* Bugs
164
165This sections contains a small selection of bugs which are hard to
166fix. For other bugs, see the official bug tracker debbugs.gnu.org.
167
168** Incorrect translation of Super modifier with Ctrl or Meta on OS X
169
170When pressing `M-s-a', Emacs replies "M-s-å is undefined". What
171happened is a mix of Emacs view that Meta and Super has been pressed,
172and OS X view that ALT-a should yield "å".
173
174The bug reports suggests two different patched, unfortunately, none
175work properly. For example:
176
177 Use a Swedish keyboard layout
178
179 (setq ns-alternate-modifier nil)
180
181 "CMD-ALT-9"
182
183Today, this correctly yields that s-] is undefined. With the either
184of the two patches, Emacs responds that s-9 was pressed.
185
186More investigation is needed to fix this problem.
187
188Links:
189- [[http://debbugs.gnu.org/cgi/bugreport.cgi?bug%3D19977][bug#19977]]
190- [[http://debbugs.gnu.org/cgi/bugreport.cgi?bug%3D21330][bug#21330]]
191- [[http://debbugs.gnu.org/cgi/bugreport.cgi?bug%3D21551][bug#21551]]
192
193** Toggline the toolbar in fullheight or maximized modes
194
195The toolbar, in the NS interface, is not considered part of the text
196area. When it is toggled, the Emacs frame change height accordingly.
197
198Unfortunately, this also occurs when the frame is in fullheight or
199maximized modes (N.B. this is not the same as "fullscreen"). The
200effect is that the full frame size either increases (stretching down
201below the lower edge of the screen) or decreases (leaving space
202between the lower edge of the frame and the lower edge of the screen).
203
204A better solution would be for the frame to retain its size,
205i.e. change the text area.
206
207This is related to the `frame-inhibit-implied-resize' issue.
208
209* Internal development features
210
211** Regression test system (or at least a checklist)
212
213Today, after each change to the user interface, Emacs must be manually
214tested. Often, small details are overlooked ("Oh, I didn't test
215toggling the tool-bar in one of the full screen modes, when multiple
216frame were open -- silly me.")
217
218It would be an enormous help if this could be tested automatically.
219Many features are generic, however, the NS interface provides a number
220of unique features.
221
222*** Existing packages
223
224Note that there is a generic UI test named "[[http://debbugs.gnu.org/cgi/bugreport.cgi?bug%3D21415#284][frame-test.el]]". The NS
225interface pass this, with the exception of two toolbar related
226errors.
227
228*** Anders frame test
229
230Anders Lindgren <andlind@gmail.com> has implemented some (very basic)
231tests for full screen, toolbar, and auto-hiding the menu bar.
232
233** Make sure all build variants work
234
235Emacs can be build in a number of different ways. For each feature,
236consider if is really is "NS" specific, or if it should be applied to
237all build versions.
238
239- With the "NS" interface. This is the normal way to build Emacs on
240 OS X.
241
242- With the "X11" interface. On OS X, this is mainly of interest to
243 developers of Emacs to get a "reference" interface implementations.
244 However, it might be of interest for people working remotely, as X11
245 applications can be used over a network connection.
246
247- Console only.
diff --git a/src/coding.c b/src/coding.c
index 3bee16c4f0c..e591bedc3e5 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6828,11 +6828,11 @@ decode_eol (struct coding_system *coding)
6828 } 6828 }
6829 else 6829 else
6830 { 6830 {
6831 ptrdiff_t pos_byte = coding->dst_pos_byte;
6832 ptrdiff_t pos = coding->dst_pos; 6831 ptrdiff_t pos = coding->dst_pos;
6833 ptrdiff_t pos_end = pos + coding->produced_char - 1; 6832 ptrdiff_t pos_byte = coding->dst_pos_byte;
6833 ptrdiff_t pos_end = pos_byte + coding->produced - 1;
6834 6834
6835 while (pos < pos_end) 6835 while (pos_byte < pos_end)
6836 { 6836 {
6837 p = BYTE_POS_ADDR (pos_byte); 6837 p = BYTE_POS_ADDR (pos_byte);
6838 if (*p == '\r' && p[1] == '\n') 6838 if (*p == '\r' && p[1] == '\n')
diff --git a/src/keyboard.c b/src/keyboard.c
index 3431cd8fbd2..4d107277634 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -11622,10 +11622,10 @@ It's called with one argument, the help string to display. */);
11622 DEFVAR_LISP ("disable-point-adjustment", Vdisable_point_adjustment, 11622 DEFVAR_LISP ("disable-point-adjustment", Vdisable_point_adjustment,
11623 doc: /* If non-nil, suppress point adjustment after executing a command. 11623 doc: /* If non-nil, suppress point adjustment after executing a command.
11624 11624
11625After a command is executed, if point is moved into a region that has 11625After a command is executed, if point moved into a region that has
11626special properties (e.g. composition, display), we adjust point to 11626special properties (e.g. composition, display), Emacs adjusts point to
11627the boundary of the region. But, when a command sets this variable to 11627the boundary of the region. But when a command binds this variable to
11628non-nil, we suppress the point adjustment. 11628non-nil, this point adjustment is suppressed.
11629 11629
11630This variable is set to nil before reading a command, and is checked 11630This variable is set to nil before reading a command, and is checked
11631just after executing the command. */); 11631just after executing the command. */);
@@ -11633,9 +11633,9 @@ just after executing the command. */);
11633 11633
11634 DEFVAR_LISP ("global-disable-point-adjustment", 11634 DEFVAR_LISP ("global-disable-point-adjustment",
11635 Vglobal_disable_point_adjustment, 11635 Vglobal_disable_point_adjustment,
11636 doc: /* If non-nil, always suppress point adjustment. 11636 doc: /* If non-nil, always suppress point adjustments.
11637 11637
11638The default value is nil, in which case, point adjustment are 11638The default value is nil, in which case point adjustments are
11639suppressed only after special commands that set 11639suppressed only after special commands that set
11640`disable-point-adjustment' (which see) to non-nil. */); 11640`disable-point-adjustment' (which see) to non-nil. */);
11641 Vglobal_disable_point_adjustment = Qnil; 11641 Vglobal_disable_point_adjustment = Qnil;
diff --git a/src/regex.c b/src/regex.c
index dd3f2b3cd67..164eb4612ae 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -5444,7 +5444,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
5444 case charset: 5444 case charset:
5445 case charset_not: 5445 case charset_not:
5446 { 5446 {
5447 register unsigned int c; 5447 register unsigned int c, corig;
5448 boolean not = (re_opcode_t) *(p - 1) == charset_not; 5448 boolean not = (re_opcode_t) *(p - 1) == charset_not;
5449 int len; 5449 int len;
5450 5450
@@ -5473,7 +5473,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
5473 } 5473 }
5474 5474
5475 PREFETCH (); 5475 PREFETCH ();
5476 c = RE_STRING_CHAR_AND_LENGTH (d, len, target_multibyte); 5476 corig = c = RE_STRING_CHAR_AND_LENGTH (d, len, target_multibyte);
5477 if (target_multibyte) 5477 if (target_multibyte)
5478 { 5478 {
5479 int c1; 5479 int c1;
@@ -5517,11 +5517,17 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1,
5517 { 5517 {
5518 int class_bits = CHARSET_RANGE_TABLE_BITS (&p[-1]); 5518 int class_bits = CHARSET_RANGE_TABLE_BITS (&p[-1]);
5519 5519
5520 if ( (class_bits & BIT_LOWER && ISLOWER (c)) 5520 if ( (class_bits & BIT_LOWER
5521 && (ISLOWER (c)
5522 || (corig != c
5523 && c == upcase (corig) && ISUPPER(c))))
5521 | (class_bits & BIT_MULTIBYTE) 5524 | (class_bits & BIT_MULTIBYTE)
5522 | (class_bits & BIT_PUNCT && ISPUNCT (c)) 5525 | (class_bits & BIT_PUNCT && ISPUNCT (c))
5523 | (class_bits & BIT_SPACE && ISSPACE (c)) 5526 | (class_bits & BIT_SPACE && ISSPACE (c))
5524 | (class_bits & BIT_UPPER && ISUPPER (c)) 5527 | (class_bits & BIT_UPPER
5528 && (ISUPPER (c)
5529 || (corig != c
5530 && c == downcase (corig) && ISLOWER (c))))
5525 | (class_bits & BIT_WORD && ISWORD (c)) 5531 | (class_bits & BIT_WORD && ISWORD (c))
5526 | (class_bits & BIT_ALPHA && ISALPHA (c)) 5532 | (class_bits & BIT_ALPHA && ISALPHA (c))
5527 | (class_bits & BIT_ALNUM && ISALNUM (c)) 5533 | (class_bits & BIT_ALNUM && ISALNUM (c))
diff --git a/src/w32heap.c b/src/w32heap.c
index 69706a3a57d..b908169b96c 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -641,12 +641,14 @@ mmap_alloc (void **var, size_t nbytes)
641 advance, and the buffer is enlarged several times as the data is 641 advance, and the buffer is enlarged several times as the data is
642 decompressed on the fly. */ 642 decompressed on the fly. */
643 if (nbytes < MAX_BUFFER_SIZE) 643 if (nbytes < MAX_BUFFER_SIZE)
644 p = VirtualAlloc (NULL, (nbytes * 2), MEM_RESERVE, PAGE_READWRITE); 644 p = VirtualAlloc (NULL, ROUND_UP (nbytes * 2, get_allocation_unit ()),
645 MEM_RESERVE, PAGE_READWRITE);
645 646
646 /* If it fails, or if the request is above 512MB, try with the 647 /* If it fails, or if the request is above 512MB, try with the
647 requested size. */ 648 requested size. */
648 if (p == NULL) 649 if (p == NULL)
649 p = VirtualAlloc (NULL, nbytes, MEM_RESERVE, PAGE_READWRITE); 650 p = VirtualAlloc (NULL, ROUND_UP (nbytes, get_allocation_unit ()),
651 MEM_RESERVE, PAGE_READWRITE);
650 652
651 if (p != NULL) 653 if (p != NULL)
652 { 654 {
diff --git a/src/xfaces.c b/src/xfaces.c
index 2880eedc1e5..7762e0f61e9 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6207,7 +6207,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */)
6207 int num; 6207 int num;
6208 6208
6209 while (fgets (buf, sizeof (buf), fp) != NULL) { 6209 while (fgets (buf, sizeof (buf), fp) != NULL) {
6210 if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3) 6210 if (sscanf (buf, "%d %d %d %n", &red, &green, &blue, &num) == 3)
6211 { 6211 {
6212#ifdef HAVE_NTGUI 6212#ifdef HAVE_NTGUI
6213 int color = RGB (red, green, blue); 6213 int color = RGB (red, green, blue);
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index a8521828c0e..a16de7fb058 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -58,6 +58,8 @@
58(defvar file-notify--test-tmpfile nil) 58(defvar file-notify--test-tmpfile nil)
59(defvar file-notify--test-tmpfile1 nil) 59(defvar file-notify--test-tmpfile1 nil)
60(defvar file-notify--test-desc nil) 60(defvar file-notify--test-desc nil)
61(defvar file-notify--test-desc1 nil)
62(defvar file-notify--test-desc2 nil)
61(defvar file-notify--test-results nil) 63(defvar file-notify--test-results nil)
62(defvar file-notify--test-event nil) 64(defvar file-notify--test-event nil)
63(defvar file-notify--test-events nil) 65(defvar file-notify--test-events nil)
@@ -77,6 +79,8 @@ It is different for local and remote file notification libraries.")
77(defun file-notify--test-cleanup () 79(defun file-notify--test-cleanup ()
78 "Cleanup after a test." 80 "Cleanup after a test."
79 (file-notify-rm-watch file-notify--test-desc) 81 (file-notify-rm-watch file-notify--test-desc)
82 (file-notify-rm-watch file-notify--test-desc1)
83 (file-notify-rm-watch file-notify--test-desc2)
80 84
81 (ignore-errors 85 (ignore-errors
82 (delete-file (file-newest-backup file-notify--test-tmpfile))) 86 (delete-file (file-newest-backup file-notify--test-tmpfile)))
@@ -96,6 +100,8 @@ It is different for local and remote file notification libraries.")
96 (setq file-notify--test-tmpfile nil 100 (setq file-notify--test-tmpfile nil
97 file-notify--test-tmpfile1 nil 101 file-notify--test-tmpfile1 nil
98 file-notify--test-desc nil 102 file-notify--test-desc nil
103 file-notify--test-desc1 nil
104 file-notify--test-desc2 nil
99 file-notify--test-results nil 105 file-notify--test-results nil
100 file-notify--test-events nil) 106 file-notify--test-events nil)
101 (when file-notify--test-event 107 (when file-notify--test-event
@@ -250,19 +256,15 @@ is bound somewhere."
250 (should (equal (car file-notify--test-event) file-notify--test-desc)) 256 (should (equal (car file-notify--test-event) file-notify--test-desc))
251 ;; Check the file name. 257 ;; Check the file name.
252 (should 258 (should
253 (or (string-equal (file-notify--event-file-name file-notify--test-event) 259 (string-prefix-p
254 file-notify--test-tmpfile) 260 (file-notify--event-watched-file file-notify--test-event)
255 (string-equal (file-notify--event-file-name file-notify--test-event) 261 (file-notify--event-file-name file-notify--test-event)))
256 file-notify--test-tmpfile1)
257 (string-equal (file-notify--event-file-name file-notify--test-event)
258 temporary-file-directory)))
259 ;; Check the second file name if exists. 262 ;; Check the second file name if exists.
260 (when (eq (nth 1 file-notify--test-event) 'renamed) 263 (when (eq (nth 1 file-notify--test-event) 'renamed)
261 (should 264 (should
262 (or (string-equal (file-notify--event-file1-name file-notify--test-event) 265 (string-prefix-p
263 file-notify--test-tmpfile1) 266 (file-notify--event-watched-file file-notify--test-event)
264 (string-equal (file-notify--event-file1-name file-notify--test-event) 267 (file-notify--event-file1-name file-notify--test-event)))))
265 temporary-file-directory)))))
266 268
267(defun file-notify--test-event-handler (event) 269(defun file-notify--test-event-handler (event)
268 "Run a test over FILE-NOTIFY--TEST-EVENT. 270 "Run a test over FILE-NOTIFY--TEST-EVENT.
@@ -275,7 +277,8 @@ and the event to `file-notify--test-events'."
275 (unless (string-match 277 (unless (string-match
276 (regexp-quote ".#") 278 (regexp-quote ".#")
277 (file-notify--event-file-name file-notify--test-event)) 279 (file-notify--event-file-name file-notify--test-event))
278 ;;(message "file-notify--test-event-handler %S" file-notify--test-event) 280 ;;(message "file-notify--test-event-handler result: %s event: %S"
281 ;;(null (ert-test-failed-p result)) file-notify--test-event)
279 (setq file-notify--test-events 282 (setq file-notify--test-events
280 (append file-notify--test-events `(,file-notify--test-event)) 283 (append file-notify--test-events `(,file-notify--test-event))
281 file-notify--test-results 284 file-notify--test-results
@@ -319,25 +322,28 @@ EVENTS is either a simple list of events, or a list of lists of
319events, which represent different possible results. Don't wait 322events, which represent different possible results. Don't wait
320longer than timeout seconds for the events to be delivered." 323longer than timeout seconds for the events to be delivered."
321 (declare (indent 1)) 324 (declare (indent 1))
322 (let ((outer (make-symbol "outer"))) 325 `(let* ((events (if (consp (car ,events)) ,events (list ,events)))
323 `(let* ((,outer file-notify--test-events) 326 (max-length (apply 'max (mapcar 'length events)))
324 (events (if (consp (car ,events)) ,events (list ,events))) 327 create-lockfiles)
325 (max-length (apply 'max (mapcar 'length events))) 328 ;; Flush pending events.
326 create-lockfiles) 329 (file-notify--wait-for-events
327 ;; Flush pending events. 330 (file-notify--test-timeout)
328 (file-notify--wait-for-events 331 (input-pending-p))
329 (file-notify--test-timeout) 332 (setq file-notify--test-events nil
330 (input-pending-p)) 333 file-notify--test-results nil)
331 (let (file-notify--test-events) 334 ,@body
332 ,@body 335 (file-notify--wait-for-events
333 (file-notify--wait-for-events 336 ;; More events need more time. Use some fudge factor.
334 ;; More events need more time. Use some fudge factor. 337 (* (ceiling max-length 100) (file-notify--test-timeout))
335 (* (ceiling max-length 100) (file-notify--test-timeout)) 338 (= max-length (length file-notify--test-events)))
336 (= max-length (length file-notify--test-events))) 339 ;; Check the result sequence just to make sure that all events
337 ;; One of the possible results shall match. 340 ;; are as expected.
338 (should (file-notify--test-with-events-check events)) 341 (dolist (result file-notify--test-results)
339 (setq ,outer (append ,outer file-notify--test-events))) 342 (when (ert-test-failed-p result)
340 (setq file-notify--test-events ,outer)))) 343 (ert-fail
344 (cadr (ert-test-result-with-condition-condition result)))))
345 ;; One of the possible event sequences shall match.
346 (should (file-notify--test-with-events-check events))))
341 347
342(ert-deftest file-notify-test02-events () 348(ert-deftest file-notify-test02-events ()
343 "Check file creation/change/removal notifications." 349 "Check file creation/change/removal notifications."
@@ -366,9 +372,7 @@ longer than timeout seconds for the events to be delivered."
366 "another text" nil file-notify--test-tmpfile nil 'no-message) 372 "another text" nil file-notify--test-tmpfile nil 'no-message)
367 (read-event nil nil file-notify--test-read-event-timeout) 373 (read-event nil nil file-notify--test-read-event-timeout)
368 (delete-file file-notify--test-tmpfile)) 374 (delete-file file-notify--test-tmpfile))
369 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it. 375 (file-notify-rm-watch file-notify--test-desc))
370 (let (file-notify--test-events)
371 (file-notify-rm-watch file-notify--test-desc)))
372 376
373 ;; Check file change and deletion. 377 ;; Check file change and deletion.
374 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) 378 (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
@@ -398,9 +402,7 @@ longer than timeout seconds for the events to be delivered."
398 "another text" nil file-notify--test-tmpfile nil 'no-message) 402 "another text" nil file-notify--test-tmpfile nil 'no-message)
399 (read-event nil nil file-notify--test-read-event-timeout) 403 (read-event nil nil file-notify--test-read-event-timeout)
400 (delete-file file-notify--test-tmpfile)) 404 (delete-file file-notify--test-tmpfile))
401 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it. 405 (file-notify-rm-watch file-notify--test-desc)
402 (let (file-notify--test-events)
403 (file-notify-rm-watch file-notify--test-desc))
404 406
405 ;; Check file creation, change and deletion when watching a 407 ;; Check file creation, change and deletion when watching a
406 ;; directory. There must be a `stopped' event when deleting 408 ;; directory. There must be a `stopped' event when deleting
@@ -432,9 +434,7 @@ longer than timeout seconds for the events to be delivered."
432 "any text" nil file-notify--test-tmpfile nil 'no-message) 434 "any text" nil file-notify--test-tmpfile nil 'no-message)
433 (read-event nil nil file-notify--test-read-event-timeout) 435 (read-event nil nil file-notify--test-read-event-timeout)
434 (delete-directory temporary-file-directory 'recursive)) 436 (delete-directory temporary-file-directory 'recursive))
435 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it. 437 (file-notify-rm-watch file-notify--test-desc))
436 (let (file-notify--test-events)
437 (file-notify-rm-watch file-notify--test-desc)))
438 438
439 ;; Check copy of files inside a directory. 439 ;; Check copy of files inside a directory.
440 (let ((temporary-file-directory 440 (let ((temporary-file-directory
@@ -474,9 +474,7 @@ longer than timeout seconds for the events to be delivered."
474 (set-file-times file-notify--test-tmpfile '(0 0)) 474 (set-file-times file-notify--test-tmpfile '(0 0))
475 (read-event nil nil file-notify--test-read-event-timeout) 475 (read-event nil nil file-notify--test-read-event-timeout)
476 (delete-directory temporary-file-directory 'recursive)) 476 (delete-directory temporary-file-directory 'recursive))
477 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it. 477 (file-notify-rm-watch file-notify--test-desc))
478 (let (file-notify--test-events)
479 (file-notify-rm-watch file-notify--test-desc)))
480 478
481 ;; Check rename of files inside a directory. 479 ;; Check rename of files inside a directory.
482 (let ((temporary-file-directory 480 (let ((temporary-file-directory
@@ -510,9 +508,7 @@ longer than timeout seconds for the events to be delivered."
510 ;; After the rename, we won't get events anymore. 508 ;; After the rename, we won't get events anymore.
511 (read-event nil nil file-notify--test-read-event-timeout) 509 (read-event nil nil file-notify--test-read-event-timeout)
512 (delete-directory temporary-file-directory 'recursive)) 510 (delete-directory temporary-file-directory 'recursive))
513 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it. 511 (file-notify-rm-watch file-notify--test-desc))
514 (let (file-notify--test-events)
515 (file-notify-rm-watch file-notify--test-desc)))
516 512
517 ;; Check attribute change. Does not work for cygwin. 513 ;; Check attribute change. Does not work for cygwin.
518 (unless (eq system-type 'cygwin) 514 (unless (eq system-type 'cygwin)
@@ -545,17 +541,7 @@ longer than timeout seconds for the events to be delivered."
545 (set-file-times file-notify--test-tmpfile '(0 0)) 541 (set-file-times file-notify--test-tmpfile '(0 0))
546 (read-event nil nil file-notify--test-read-event-timeout) 542 (read-event nil nil file-notify--test-read-event-timeout)
547 (delete-file file-notify--test-tmpfile)) 543 (delete-file file-notify--test-tmpfile))
548 ;; `file-notify-rm-watch' fires the `stopped' event. Suppress it. 544 (file-notify-rm-watch file-notify--test-desc)))
549 (let (file-notify--test-events)
550 (file-notify-rm-watch file-notify--test-desc)))
551
552 ;; Check the global sequence again just to make sure that
553 ;; `file-notify--test-events' has been set correctly.
554 (should file-notify--test-results)
555 (dolist (result file-notify--test-results)
556 (when (ert-test-failed-p result)
557 (ert-fail
558 (cadr (ert-test-result-with-condition-condition result))))))
559 545
560 ;; Cleanup. 546 ;; Cleanup.
561 (file-notify--test-cleanup))) 547 (file-notify--test-cleanup)))
@@ -825,7 +811,7 @@ longer than timeout seconds for the events to be delivered."
825 (dotimes (i n) 811 (dotimes (i n)
826 ;; It matters which direction we rename, at least for 812 ;; It matters which direction we rename, at least for
827 ;; kqueue. This backend parses directories in alphabetic 813 ;; kqueue. This backend parses directories in alphabetic
828 ;; order (x%d before y%d). So we rename both directions. 814 ;; order (x%d before y%d). So we rename into both directions.
829 (if (zerop (mod i 2)) 815 (if (zerop (mod i 2))
830 (progn 816 (progn
831 (push (expand-file-name (format "x%d" i)) source-file-list) 817 (push (expand-file-name (format "x%d" i)) source-file-list)
@@ -885,6 +871,11 @@ longer than timeout seconds for the events to be delivered."
885 ((or (string-equal (file-notify--test-library) "w32notify") 871 ((or (string-equal (file-notify--test-library) "w32notify")
886 (file-remote-p temporary-file-directory)) 872 (file-remote-p temporary-file-directory))
887 '(changed changed)) 873 '(changed changed))
874 ;; gfilenotify raises one or two `changed' events
875 ;; randomly, no chance to test. So we accept both cases.
876 ((string-equal "gfilenotify" (file-notify--test-library))
877 '((changed)
878 (changed changed)))
888 (t '(changed))) 879 (t '(changed)))
889 ;; There shouldn't be any problem, because the file is kept. 880 ;; There shouldn't be any problem, because the file is kept.
890 (with-temp-buffer 881 (with-temp-buffer
@@ -938,6 +929,133 @@ longer than timeout seconds for the events to be delivered."
938(file-notify--deftest-remote file-notify-test07-backup 929(file-notify--deftest-remote file-notify-test07-backup
939 "Check that backup keeps file notification for remote files.") 930 "Check that backup keeps file notification for remote files.")
940 931
932(ert-deftest file-notify-test08-watched-file-in-watched-dir ()
933 "Watches a directory and a file in that directory separately.
934Checks that the callbacks are only called with events with
935descriptors that were issued when registering the watches. This
936test caters for the situation in bug#22736 where the callback for
937the directory received events for the file with the descriptor of
938the file watch."
939 :tags '(:expensive-test)
940 (skip-unless (file-notify--test-local-enabled))
941
942 ;; A directory to be watched.
943 (should
944 (setq file-notify--test-tmpfile
945 (make-temp-file "file-notify-test-parent" t)))
946 ;; A file to be watched.
947 (should
948 (setq file-notify--test-tmpfile1
949 (let ((temporary-file-directory file-notify--test-tmpfile))
950 (file-notify--test-make-temp-name))))
951 (write-region "any text" nil file-notify--test-tmpfile1 nil 'no-message)
952 (unwind-protect
953 (cl-flet (;; Directory monitor.
954 (dir-callback (event)
955 (let ((file-notify--test-desc file-notify--test-desc1))
956 (file-notify--test-event-handler event)))
957 ;; File monitor.
958 (file-callback (event)
959 (let ((file-notify--test-desc file-notify--test-desc2))
960 (file-notify--test-event-handler event))))
961 (should
962 (setq file-notify--test-desc1
963 (file-notify-add-watch
964 file-notify--test-tmpfile
965 '(change) #'dir-callback)))
966 (should
967 (setq file-notify--test-desc2
968 (file-notify-add-watch
969 file-notify--test-tmpfile1
970 '(change) #'file-callback)))
971 (should (file-notify-valid-p file-notify--test-desc1))
972 (should (file-notify-valid-p file-notify--test-desc2))
973 (should-not (equal file-notify--test-desc1 file-notify--test-desc2))
974 ;; gfilenotify raises one or two `changed' events randomly in
975 ;; the file monitor, no chance to test.
976 (unless (string-equal "gfilenotify" (file-notify--test-library))
977 (let ((n 100) events)
978 ;; Compute the expected events.
979 (dotimes (_i (/ n 2))
980 (setq events
981 (append
982 (append
983 ;; Directory monitor and file monitor.
984 (cond
985 ;; In the remote case, there are two `changed'
986 ;; events.
987 ((file-remote-p temporary-file-directory)
988 '(changed changed changed changed))
989 ;; The directory monitor in kqueue does not
990 ;; raise any `changed' event. Just the file
991 ;; monitor event is received.
992 ((string-equal (file-notify--test-library) "kqueue")
993 '(changed))
994 ;; Otherwise, both monitors report the
995 ;; `changed' event.
996 (t '(changed changed)))
997 ;; Just the directory monitor.
998 (cond
999 ;; In kqueue, there is an additional `changed'
1000 ;; event. Why?
1001 ((string-equal (file-notify--test-library) "kqueue")
1002 '(changed created changed))
1003 (t '(created changed))))
1004 events)))
1005
1006 ;; Run the test.
1007 (file-notify--test-with-events events
1008 (dotimes (i n)
1009 (read-event nil nil file-notify--test-read-event-timeout)
1010 (if (zerop (mod i 2))
1011 (write-region
1012 "any text" nil file-notify--test-tmpfile1 t 'no-message)
1013 (let ((temporary-file-directory file-notify--test-tmpfile))
1014 (write-region
1015 "any text" nil
1016 (file-notify--test-make-temp-name) nil 'no-message)))))))
1017
1018 ;; If we delete the file, the directory monitor shall still be
1019 ;; active. We receive the `deleted' event from both the
1020 ;; directory and the file monitor. The `stopped' event is
1021 ;; from the file monitor. It's undecided in which order the
1022 ;; the directory and the file monitor are triggered.
1023 (file-notify--test-with-events
1024 '((deleted deleted stopped)
1025 (deleted stopped deleted))
1026 (delete-file file-notify--test-tmpfile1))
1027 (should (file-notify-valid-p file-notify--test-desc1))
1028 (should-not (file-notify-valid-p file-notify--test-desc2))
1029
1030 ;; Now we delete the directory.
1031 (file-notify--test-with-events
1032 (cond
1033 ;; In kqueue, just one `deleted' event for the directory
1034 ;; is received.
1035 ((string-equal (file-notify--test-library) "kqueue")
1036 '(deleted stopped))
1037 (t (append
1038 ;; The directory monitor raises a `deleted' event for
1039 ;; every file contained in the directory, we must
1040 ;; count them.
1041 (make-list
1042 (length
1043 (directory-files
1044 file-notify--test-tmpfile nil
1045 directory-files-no-dot-files-regexp 'nosort))
1046 'deleted)
1047 ;; The events of the directory itself.
1048 '(deleted stopped))))
1049 (delete-directory file-notify--test-tmpfile 'recursive))
1050 (should-not (file-notify-valid-p file-notify--test-desc1))
1051 (should-not (file-notify-valid-p file-notify--test-desc2)))
1052
1053 ;; Cleanup.
1054 (file-notify--test-cleanup)))
1055
1056(file-notify--deftest-remote file-notify-test08-watched-file-in-watched-dir
1057 "Check `file-notify-test08-watched-file-in-watched-dir' for remote files.")
1058
941(defun file-notify-test-all (&optional interactive) 1059(defun file-notify-test-all (&optional interactive)
942 "Run all tests for \\[file-notify]." 1060 "Run all tests for \\[file-notify]."
943 (interactive "p") 1061 (interactive "p")