aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Tromey2013-01-16 11:48:32 -0700
committerTom Tromey2013-01-16 11:48:32 -0700
commit6f4de085f065e11f4df3195d47479f28f5ef08ba (patch)
tree1211a00f1afc86c2b73624897993db02a4852943
parente078a23febca14bc919c5806670479c395e3253e (diff)
parentffe04adc88e546c406f9b050238fb98a7243c7a0 (diff)
downloademacs-6f4de085f065e11f4df3195d47479f28f5ef08ba.tar.gz
emacs-6f4de085f065e11f4df3195d47479f28f5ef08ba.zip
merge from trunk
-rw-r--r--ChangeLog35
-rw-r--r--admin/ChangeLog16
-rw-r--r--admin/MAINTAINERS13
-rw-r--r--admin/coccinelle/xsave.cocci11
-rw-r--r--admin/make-tarball.txt99
-rw-r--r--admin/nt/README-ftp-server2
-rw-r--r--autogen/config.in4
-rwxr-xr-xautogen/configure17
-rw-r--r--configure.ac16
-rw-r--r--doc/emacs/ChangeLog5
-rw-r--r--doc/emacs/help.texi9
-rw-r--r--doc/lispref/ChangeLog9
-rw-r--r--doc/lispref/commands.texi8
-rw-r--r--doc/lispref/windows.texi9
-rw-r--r--doc/misc/ChangeLog45
-rw-r--r--doc/misc/autotype.texi3
-rw-r--r--doc/misc/cc-mode.texi2
-rw-r--r--doc/misc/htmlfontify.texi49
-rw-r--r--doc/misc/info.texi3
-rw-r--r--doc/misc/org.texi220
-rw-r--r--doc/misc/pgg.texi4
-rw-r--r--doc/misc/tramp.texi16
-rw-r--r--etc/ChangeLog2
-rw-r--r--etc/NEWS17
-rw-r--r--etc/ORG-NEWS44
-rw-r--r--etc/refcards/orgcard.pdfbin118624 -> 118630 bytes
-rw-r--r--etc/refcards/orgcard.tex4
-rw-r--r--lib-src/ChangeLog6
-rw-r--r--lib-src/make-docfile.c4
-rw-r--r--lib/getopt.in.h2
-rw-r--r--lib/getopt_.h8
-rw-r--r--lib/stdint.in.h2
-rw-r--r--lib/stdlib.in.h5
-rw-r--r--lib/strftime.c9
-rw-r--r--lib/unistd.in.h2
-rw-r--r--lisp/ChangeLog489
-rw-r--r--lisp/apropos.el40
-rw-r--r--lisp/autorevert.el139
-rw-r--r--lisp/calc/calc.el8
-rw-r--r--lisp/calendar/calendar.el12
-rw-r--r--lisp/color.el4
-rw-r--r--lisp/comint.el6
-rw-r--r--lisp/cus-start.el10
-rw-r--r--lisp/doc-view.el265
-rw-r--r--lisp/emacs-lisp/advice.el34
-rw-r--r--lisp/emacs-lisp/authors.el16
-rw-r--r--lisp/emacs-lisp/crm.el59
-rw-r--r--lisp/emacs-lisp/edebug.el8
-rw-r--r--lisp/emacs-lisp/ert.el2
-rw-r--r--lisp/emacs-lisp/nadvice.el40
-rw-r--r--lisp/emacs-lisp/pcase.el29
-rw-r--r--lisp/emacs-lisp/timer.el4
-rw-r--r--lisp/emacs-lisp/trace.el32
-rw-r--r--lisp/erc/ChangeLog5
-rw-r--r--lisp/erc/erc-dcc.el4
-rw-r--r--lisp/faces.el36
-rw-r--r--lisp/ffap.el20
-rw-r--r--lisp/files.el2
-rw-r--r--lisp/font-lock.el4
-rw-r--r--lisp/gnus/ChangeLog67
-rw-r--r--lisp/gnus/gnus-art.el4
-rw-r--r--lisp/gnus/gnus-async.el2
-rw-r--r--lisp/gnus/gnus-start.el2
-rw-r--r--lisp/gnus/gnus-sum.el23
-rw-r--r--lisp/gnus/message.el5
-rw-r--r--lisp/gnus/mml-smime.el92
-rw-r--r--lisp/gnus/nnimap.el5
-rw-r--r--lisp/gnus/smiley.el5
-rw-r--r--lisp/help-mode.el2
-rw-r--r--lisp/image-mode.el5
-rw-r--r--lisp/imenu.el2
-rw-r--r--lisp/info.el62
-rw-r--r--lisp/international/mule-cmds.el8
-rw-r--r--lisp/international/mule.el2
-rw-r--r--lisp/isearch.el4
-rw-r--r--lisp/jit-lock.el44
-rw-r--r--lisp/mail/rmail.el2
-rw-r--r--lisp/mail/rmailmm.el17
-rw-r--r--lisp/mail/sendmail.el3
-rw-r--r--lisp/man.el79
-rw-r--r--lisp/menu-bar.el4
-rw-r--r--lisp/misearch.el2
-rw-r--r--lisp/net/tramp-adb.el86
-rw-r--r--lisp/net/tramp-sh.el28
-rw-r--r--lisp/net/tramp.el61
-rw-r--r--lisp/newcomment.el3
-rw-r--r--lisp/org/ChangeLog382
-rw-r--r--lisp/org/ob-eval.el20
-rw-r--r--lisp/org/ob-exp.el1
-rw-r--r--lisp/org/org-agenda.el363
-rw-r--r--lisp/org/org-ascii.el12
-rw-r--r--lisp/org/org-capture.el10
-rw-r--r--lisp/org/org-clock.el19
-rw-r--r--lisp/org/org-colview.el2
-rw-r--r--lisp/org/org-compat.el50
-rw-r--r--lisp/org/org-crypt.el4
-rw-r--r--lisp/org/org-docbook.el17
-rw-r--r--lisp/org/org-element.el10
-rw-r--r--lisp/org/org-exp.el5
-rw-r--r--lisp/org/org-faces.el3
-rw-r--r--lisp/org/org-html.el18
-rw-r--r--lisp/org/org-icalendar.el5
-rw-r--r--lisp/org/org-inlinetask.el3
-rw-r--r--lisp/org/org-install.el6
-rw-r--r--lisp/org/org-jsinfo.el2
-rw-r--r--lisp/org/org-latex.el2
-rw-r--r--lisp/org/org-list.el18
-rw-r--r--lisp/org/org-macs.el9
-rw-r--r--lisp/org/org-mobile.el39
-rw-r--r--lisp/org/org-odt.el23
-rw-r--r--lisp/org/org-publish.el2
-rw-r--r--lisp/org/org-src.el96
-rw-r--r--lisp/org/org-table.el12
-rw-r--r--lisp/org/org-version.el4
-rw-r--r--lisp/org/org.el780
-rw-r--r--lisp/printing.el10
-rw-r--r--lisp/progmodes/cc-engine.el42
-rw-r--r--lisp/progmodes/cc-fonts.el12
-rw-r--r--lisp/progmodes/compile.el14
-rw-r--r--lisp/progmodes/etags.el7
-rw-r--r--lisp/progmodes/flymake.el12
-rw-r--r--lisp/progmodes/gdb-mi.el8
-rw-r--r--lisp/progmodes/js.el37
-rw-r--r--lisp/progmodes/python.el13
-rw-r--r--lisp/progmodes/sql.el68
-rw-r--r--lisp/progmodes/which-func.el6
-rw-r--r--lisp/ps-print.el16
-rw-r--r--lisp/server.el4
-rw-r--r--lisp/simple.el142
-rw-r--r--lisp/subr.el19
-rw-r--r--lisp/textmodes/flyspell.el21
-rw-r--r--lisp/textmodes/ispell.el4
-rw-r--r--lisp/textmodes/sgml-mode.el2
-rw-r--r--lisp/vc/compare-w.el6
-rw-r--r--lisp/vc/diff.el2
-rw-r--r--lisp/vc/log-edit.el15
-rw-r--r--lisp/vc/pcvs.el20
-rw-r--r--lisp/vc/vc-bzr.el19
-rw-r--r--lisp/vc/vc-hooks.el28
-rw-r--r--lisp/vc/vc.el15
-rw-r--r--lisp/whitespace.el8
-rw-r--r--lisp/wid-edit.el11
-rw-r--r--m4/largefile.m423
-rwxr-xr-xmake-dist10
-rw-r--r--nt/ChangeLog10
-rw-r--r--nt/config.nt6
-rw-r--r--nt/inc/unistd.h1
-rw-r--r--src/ChangeLog258
-rw-r--r--src/alloc.c117
-rw-r--r--src/buffer.c104
-rw-r--r--src/buffer.h11
-rw-r--r--src/coding.c9
-rw-r--r--src/data.c10
-rw-r--r--src/dired.c2
-rw-r--r--src/editfns.c61
-rw-r--r--src/emacs.c19
-rw-r--r--src/eval.c3
-rw-r--r--src/fileio.c39
-rw-r--r--src/font.c2
-rw-r--r--src/ftfont.c22
-rw-r--r--src/gtkutil.c23
-rw-r--r--src/indent.c4
-rw-r--r--src/insdel.c45
-rw-r--r--src/keyboard.c152
-rw-r--r--src/keymap.c16
-rw-r--r--src/lisp.h74
-rw-r--r--src/lread.c2
-rw-r--r--src/nsfns.m8
-rw-r--r--src/nsfont.m35
-rw-r--r--src/nsmenu.m3
-rw-r--r--src/nsterm.h4
-rw-r--r--src/nsterm.m2
-rw-r--r--src/print.c73
-rw-r--r--src/sysdep.c45
-rw-r--r--src/term.c31
-rw-r--r--src/undo.c212
-rw-r--r--src/w32.c2
-rw-r--r--src/w32term.c2
-rw-r--r--src/window.c5
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xfns.c3
-rw-r--r--src/xmenu.c20
-rw-r--r--src/xml.c17
-rw-r--r--src/xselect.c2
-rw-r--r--src/xterm.c43
-rw-r--r--test/ChangeLog21
-rw-r--r--test/automated/advice-tests.el191
-rw-r--r--test/automated/compile-tests.el4
-rw-r--r--test/automated/man-tests.el118
-rw-r--r--test/automated/undo-tests.el231
190 files changed, 4941 insertions, 2221 deletions
diff --git a/ChangeLog b/ChangeLog
index a6d5148c777..cf2d0dc250c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
12013-01-16 Paul Eggert <eggert@cs.ucla.edu>
2
3 Merge from gnulib, incorporating:
4 2013-01-16 largefile: port better to Mac OS X 10.5
5 2013-01-15 stdint: fix build with Android's Bionic fox x86
6
72013-01-16 Paul Eggert <eggert@cs.ucla.edu>
8
9 * configure.ac: Document that --enable-gcc-warnings emits errors.
10 (Bug#13448)
11
122013-01-13 Glenn Morris <rgm@gnu.org>
13
14 * make-dist: Add options for xz compression and no compression.
15
162013-01-12 Paul Eggert <eggert@cs.ucla.edu>
17
18 Enable conservative stack scanning for all architectures.
19 Suggested by Stefan Monnier in
20 <http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00183.html>.
21 * configure.ac (GC_MARK_STACK): Remove.
22
232013-01-11 Paul Eggert <eggert@cs.ucla.edu>
24
25 * lib/getopt_.h: Remove trailing CRs that crept in.
26
272013-01-11 Eli Zaretskii <eliz@gnu.org>
28
29 * lib/getopt_.h: Regenerate.
30
312013-01-10 Paul Eggert <eggert@cs.ucla.edu>
32
33 Merge from gnulib, incorporating:
34 2013-01-09 stdlib: port to Solaris 2.6
35
12013-01-04 Glenn Morris <rgm@gnu.org> 362013-01-04 Glenn Morris <rgm@gnu.org>
2 37
3 * info/dir: Add htmlfontify. 38 * info/dir: Add htmlfontify.
diff --git a/admin/ChangeLog b/admin/ChangeLog
index fa001ede6cb..5da0bf0c67d 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,8 @@
12013-01-15 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * coccinelle/xsave.cocci: Semantic patch to adjust users of
4 XSAVE_POINTER and XSAVE_INTEGER macros.
5
12013-01-03 Glenn Morris <rgm@gnu.org> 62013-01-03 Glenn Morris <rgm@gnu.org>
2 7
3 * check-doc-strings: Update for CVS->bzr, moved lispref/ directory. 8 * check-doc-strings: Update for CVS->bzr, moved lispref/ directory.
@@ -132,15 +137,14 @@
132 137
133 * grammars/bovine-grammar.el (bovine--grammar-newstyle-unquote): 138 * grammars/bovine-grammar.el (bovine--grammar-newstyle-unquote):
134 Remove. 139 Remove.
135 (bovine-grammar-expand-form): Test for emacs-major-version. 140 (bovine-grammar-expand-form): Test for emacs-major-version.
136 141
137 * grammars/c.by: Add EXPLICIT to keyword tokens. 142 * grammars/c.by: Add EXPLICIT to keyword tokens.
143 Add %provide token.
138 144
139 * grammars/f90.by: Add %provide token. 145 * grammars/grammar.wy (semantic-grammar-lexer): Remove, since it
140
141 * grammar/grammar.wy (semantic-grammar-lexer): Remove, since it
142 was copied to grammar.el. New %provide token to generate prefix 146 was copied to grammar.el. New %provide token to generate prefix
143 which conforms with Emacs conventions. Remove lexer definition, 147 which conforms with Emacs conventions. Remove lexer definition,
144 which is now in grammar.el. 148 which is now in grammar.el.
145 149
1462012-09-27 Glenn Morris <rgm@gnu.org> 1502012-09-27 Glenn Morris <rgm@gnu.org>
@@ -184,7 +188,7 @@
1842012-09-13 Paul Eggert <eggert@cs.ucla.edu> 1882012-09-13 Paul Eggert <eggert@cs.ucla.edu>
185 189
186 Simplify SIGIO usage (Bug#12408). 190 Simplify SIGIO usage (Bug#12408).
187 * CPP_DEFINES (BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL) 191 * CPP-DEFINES (BROKEN_SIGAIO, BROKEN_SIGIO, BROKEN_SIGPOLL)
188 (BROKEN_SIGPTY, NO_TERMIO): Remove. 192 (BROKEN_SIGPTY, NO_TERMIO): Remove.
189 193
1902012-09-11 Paul Eggert <eggert@cs.ucla.edu> 1942012-09-11 Paul Eggert <eggert@cs.ucla.edu>
diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS
index 34763083e9a..efcc63081b5 100644
--- a/admin/MAINTAINERS
+++ b/admin/MAINTAINERS
@@ -16,9 +16,6 @@ maintainer has been found so far.
161. 161.
17============================================================================== 17==============================================================================
18 18
19Richard Stallman
20 ???
21
22Jason Rumney 19Jason Rumney
23 W32 20 W32
24 21
@@ -71,13 +68,6 @@ Jay Belanger
71 etc/calccard.tex 68 etc/calccard.tex
72 doc/misc/calc.texi 69 doc/misc/calc.texi
73 70
74Michael Olson
75 ERC
76 lisp/erc/*
77 etc/ERC-NEWS
78 doc/misc/erc.texi
79 lisp/emacs-lisp/tq.el
80
81Bastien Guerry 71Bastien Guerry
82 Org 72 Org
83 lisp/org/* 73 lisp/org/*
@@ -87,9 +77,6 @@ Bastien Guerry
872. 772.
88============================================================================== 78==============================================================================
89 79
90Steven Tamm
91 MacOS
92
93Eli Zaretskii 80Eli Zaretskii
94 doc/* 81 doc/*
95 lispref/* 82 lispref/*
diff --git a/admin/coccinelle/xsave.cocci b/admin/coccinelle/xsave.cocci
new file mode 100644
index 00000000000..5172bb55b33
--- /dev/null
+++ b/admin/coccinelle/xsave.cocci
@@ -0,0 +1,11 @@
1// Adjust users of XSAVE_POINTER and XSAVE_INTEGER.
2@@
3expression E;
4@@
5(
6- XSAVE_POINTER (E)
7+ XSAVE_POINTER (E, 0)
8|
9- XSAVE_INTEGER (E)
10+ XSAVE_INTEGER (E, 1)
11)
diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt
index 573bb218c43..3825ac49278 100644
--- a/admin/make-tarball.txt
+++ b/admin/make-tarball.txt
@@ -2,22 +2,46 @@ Instructions to create pretest or release tarballs.
2-- originally written by Gerd Moellmann, amended by Francesco Potortì 2-- originally written by Gerd Moellmann, amended by Francesco Potortì
3 with the initial help of Eli Zaretskii 3 with the initial help of Eli Zaretskii
4 4
5For each step, check for possible errors.
6 5
70. Decide on versions of automake and autoconf, and ensure you will 6Steps to take before starting on the first pretest in any release sequence:
7
81. Decide on versions of automake and autoconf, and ensure you will
8 have them available for the duration of the release process. 9 have them available for the duration of the release process.
9 10
112. Consider increasing the value of the variable
12 `customize-changed-options-previous-release' in cus-edit.el to
13 refer to a newer version of Emacs. (This is probably needed only
14 when preparing the first pretest for a major Emacs release.)
15 Commit cus-edit.el if changed.
16
17
18General steps (for each step, check for possible errors):
19
101. `bzr update' (for a bound branch), or `bzr pull'. 201. `bzr update' (for a bound branch), or `bzr pull'.
11 bzr status # check for locally modified files 21 bzr status # check for locally modified files
12 22
132. Bootstrap to make 100% sure all elc files are up-to-date, and to 232. Bootstrap to make 100% sure all elc files are up-to-date, and to
14 make sure that the later tagged version will bootstrap, should it be 24 make sure that the later tagged version will bootstrap, should it be
15 necessary to check it out. 25 necessary to check it out.
16 26
173. Regenerate the etc/AUTHORS file: 273. Regenerate the etc/AUTHORS file:
18 M-: (require 'authors) RET, M-x authors RET, save the *Authors* buffer. 28 M-: (require 'authors) RET
19 If there are errors that relate to syntactically incorrect 29 M-x authors RET
20 ChangeLog entries, consider fixing them and repeating. 30
31 There is almost guaranteed to be an "*Authors Errors*" buffer with
32 problems caused by certain bad ChangeLog entries. You can ignore
33 the very old ones (eg lisp/erc has a lot). If there are errors
34 related to new entries (especially entries that are new since the
35 last pretest), see if you can fix them. If there was a ChangeLog
36 typo, fix it. If a file was deleted or renamed, consider adding
37 an appropriate entry to authors-ignored-files, authors-valid-file-names,
38 or authors-renamed-files-alist.
39
40 If necessary, repeat M-x authors after making those changes.
41 Save the "*Authors*" buffer as etc/AUTHORS.
42 Check the diff looks reasonable. Maybe add entries to
43 authors-ambiguous-files or authors-aliases, and repeat.
44 Commit any fixes to ChangeLogs or authors.el.
21 45
224. Set the version number (M-x load-file RET admin/admin.el RET, then 464. Set the version number (M-x load-file RET admin/admin.el RET, then
23 M-x set-version RET). For a release, add released ChangeLog 47 M-x set-version RET). For a release, add released ChangeLog
@@ -26,20 +50,18 @@ For each step, check for possible errors.
26 For a pretest, start at version .90. After .99, use .990 (so that 50 For a pretest, start at version .90. After .99, use .990 (so that
27 it sorts). 51 it sorts).
28 52
29 If needed, increment the value of the variable
30 `customize-changed-options-previous-release' in cus-edit.el to
31 refer to a newer release of Emacs. (This is probably needed only
32 when preparing a major Emacs release, or branching for it.)
33
345. autoreconf -i -I m4 --force 535. autoreconf -i -I m4 --force
35 make bootstrap 54 make bootstrap
36 55
376. Commit etc/AUTHORS, all the files changed by M-x set-version, and 566. Copy lisp/loaddefs.el to lisp/ldefs-boot.el.
38 lisp/cus-edit.el (if modified). 57
39 Copy lisp/loaddefs.el to lisp/ldefs-boot.el and commit lisp/ldefs-boot.el. 58 Commit etc/AUTHORS, lisp/ldefs-boot.el, and the files changed
59 by M-x set-version.
40 For a release, also commit the ChangeLog files in all directories. 60 For a release, also commit the ChangeLog files in all directories.
41 61
427. make-dist --snapshot. Check the contents of the new tar with 627. ./make-dist --snapshot --no-compress
63
64 Check the contents of the new tar with
43 admin/diff-tar-files against an older tar file. Some old pretest 65 admin/diff-tar-files against an older tar file. Some old pretest
44 tarballs may be found at <ftp://alpha.gnu.org/gnu/emacs/pretest>; 66 tarballs may be found at <ftp://alpha.gnu.org/gnu/emacs/pretest>;
45 old release tarballs are at <ftp://ftp.gnu.org/pub/gnu/emacs/>. 67 old release tarballs are at <ftp://ftp.gnu.org/pub/gnu/emacs/>.
@@ -49,15 +71,15 @@ For each step, check for possible errors.
49 something like `find . | sort' in a clean bzr tree, and compare the 71 something like `find . | sort' in a clean bzr tree, and compare the
50 results against the new tar contents. 72 results against the new tar contents.
51 73
528. tar -zxf emacs-NEW.tar.gz; cd emacs-NEW 748. tar -xf emacs-NEW.tar; cd emacs-NEW
53 ./configure && make && make -n install 75 ./configure --prefix=/tmp/emacs && make && make install
54 Use `script' or M-x compile to save the compilation log in 76 Use `script' or M-x compile to save the compilation log in
55 compile-NEW.log and compare it against an old one. The easiest way 77 compile-NEW.log and compare it against an old one. The easiest way
56 to do that is to visit the old log in Emacs, change the version 78 to do that is to visit the old log in Emacs, change the version
57 number of the old Emacs to __, do the same with the new log and do 79 number of the old Emacs to __, do the same with the new log and do
58 M-x ediff. Especially check that Info files aren't built. 80 M-x ediff. Especially check that Info files aren't built.
59 81
609. cd EMACS_ROOT_DIR; bzr tag TAG 829. cd EMACS_ROOT_DIR && bzr tag TAG
61 TAG is emacs-XX.Y.ZZ for a pretest, emacs-XX.Y for a release. 83 TAG is emacs-XX.Y.ZZ for a pretest, emacs-XX.Y for a release.
62 84
63 Shortly before the release, cut the version branch also, and open 85 Shortly before the release, cut the version branch also, and open
@@ -65,16 +87,37 @@ For each step, check for possible errors.
65 be sent to the emacs-diffs mailing list (by default, the list 87 be sent to the emacs-diffs mailing list (by default, the list
66 normally only gets commits to the trunk). 88 normally only gets commits to the trunk).
67 89
6810. Now you should upload the files to the GNU ftp server. In order to 9010. Decide what compression schemes to offer.
91 For a release, at least gz and xz:
92 gzip --best -c emacs-NEW.tar > emacs-NEW.tar.gz
93 xz -c emacs-NEW.tar > emacs-NEW.tar.xz
94
95 Now you should upload the files to the GNU ftp server. In order to
69 do that, you must be registered as an Emacs maintainer and have your 96 do that, you must be registered as an Emacs maintainer and have your
70 GPG key acknowledged by the ftp people. For instructions, see 97 GPG key acknowledged by the ftp people. For instructions, see
71 http://www.gnu.org/prep/maintain/html_node/Automated-Upload-Registration.html 98 http://www.gnu.org/prep/maintain/html_node/Automated-Upload-Registration.html
72 You can use the gnulib script "gnupload" to upload each FILE, like this: 99 The simplest method is to use the gnulib <http://www.gnu.org/s/gnulib/>
73 gnupload --to alpha.gnu.org:emacs/pretest FILE (for a pretest) 100 script "build-aux/gnupload" to upload each FILE, like this:
74 gnupload --to ftp.gnu.org:emacs FILE (for a release) 101
102 For a pretest:
103 gnupload [--user your@gpg.key.email] --to alpha.gnu.org:emacs/pretest \
104 FILE.gz FILE.xz ...
105
106 For a release:
107 gnupload [--user your@gpg.key.email] --to ftp.gnu.org:emacs \
108 FILE.gz FILE.xz ...
109
110 You only need the --user part if you have multiple GPG keys and do
111 not want to use the default.
112 Obviously, if you do not have a fast uplink, be prepared for the
113 upload to take a while.
114
115
116 If you prefer to do it yourself rather than use gnupload:
117
118 For each FILE, create a detached GPG binary signature and a
119 clearsigned directive file like this:
75 120
76 Instead of using gnupload, for each FILE, create a detached GPG
77 binary signature and a clearsigned directive file like this:
78 gpg -b FILE 121 gpg -b FILE
79 echo directory: emacs/pretest > FILE.directive (for a pretest) 122 echo directory: emacs/pretest > FILE.directive (for a pretest)
80 echo directory: emacs > FILE.directive (for a release) 123 echo directory: emacs > FILE.directive (for a release)
@@ -85,13 +128,12 @@ For each step, check for possible errors.
85 For a pretest, place the files in /incoming/alpha instead, so that 128 For a pretest, place the files in /incoming/alpha instead, so that
86 they appear on ftp://alpha.gnu.org/. 129 they appear on ftp://alpha.gnu.org/.
87 130
88 For a release, upload xz and bz2 tarfiles as well; this can save a lot
89 of bandwidth.
90
9111. After five minutes, verify that the files are visible at 13111. After five minutes, verify that the files are visible at
92 ftp://alpha.gnu.org/gnu/emacs/pretest/ for a pretest, at 132 ftp://alpha.gnu.org/gnu/emacs/pretest/ for a pretest, or
93 ftp://ftp.gnu.org/gnu/emacs/ for a release. 133 ftp://ftp.gnu.org/gnu/emacs/ for a release.
94 134
135 Download them and check the signatures. Check they build.
136
9512. For a pretest, announce it on emacs-devel and info-gnu-emacs@gnu.org. 13712. For a pretest, announce it on emacs-devel and info-gnu-emacs@gnu.org.
96 For a release, also announce it on info-gnu@gnu.org. (Probably 138 For a release, also announce it on info-gnu@gnu.org. (Probably
97 bcc the info- addresses to make it less likely that people will 139 bcc the info- addresses to make it less likely that people will
@@ -99,3 +141,4 @@ For each step, check for possible errors.
99 141
10013. For a release, update the Emacs homepage in the web repository. 14213. For a release, update the Emacs homepage in the web repository.
101 Also add the new NEWS file as NEWS.xx.y. 143 Also add the new NEWS file as NEWS.xx.y.
144 Maybe regenerate the html manuals, update the FAQ, etc, etc.
diff --git a/admin/nt/README-ftp-server b/admin/nt/README-ftp-server
index 16d8887ed5a..5983a0f9617 100644
--- a/admin/nt/README-ftp-server
+++ b/admin/nt/README-ftp-server
@@ -288,4 +288,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
288GNU General Public License for more details. 288GNU General Public License for more details.
289 289
290You should have received a copy of the GNU General Public License 290You should have received a copy of the GNU General Public License
291along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 291along with GNU Emacs. If not, see http://www.gnu.org/licenses/.
diff --git a/autogen/config.in b/autogen/config.in
index 68f2c426ffa..b02b1fe462a 100644
--- a/autogen/config.in
+++ b/autogen/config.in
@@ -160,10 +160,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
160/* Mark a secondary stack, like the register stack on the ia64. */ 160/* Mark a secondary stack, like the register stack on the ia64. */
161#undef GC_MARK_SECONDARY_STACK 161#undef GC_MARK_SECONDARY_STACK
162 162
163/* Define to GC_USE_GCPROS_AS_BEFORE if conservative garbage collection is not
164 known to work. */
165#undef GC_MARK_STACK
166
167/* Define if setjmp is known to save all registers relevant for conservative 163/* Define if setjmp is known to save all registers relevant for conservative
168 garbage collection in the jmp_buf. */ 164 garbage collection in the jmp_buf. */
169#undef GC_SETJMP_WORKS 165#undef GC_SETJMP_WORKS
diff --git a/autogen/configure b/autogen/configure
index e1df418eede..8b9b502fb19 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -2076,9 +2076,10 @@ Optional Features:
2076 --disable-dependency-tracking speeds up one-time build 2076 --disable-dependency-tracking speeds up one-time build
2077 --enable-dependency-tracking do not reject slow dependency extractors 2077 --enable-dependency-tracking do not reject slow dependency extractors
2078 --disable-largefile omit support for large files 2078 --disable-largefile omit support for large files
2079 --enable-gcc-warnings turn on lots of GCC warnings. This is intended for 2079 --enable-gcc-warnings turn on lots of GCC warnings/errors. This is
2080 developers, and may generate false alarms when used 2080 intended for developers, and may generate false
2081 with older or non-GNU development tools. 2081 alarms when used with older or non-GNU development
2082 tools.
2082 --enable-link-time-optimization 2083 --enable-link-time-optimization
2083 build emacs with link-time optimization. This is 2084 build emacs with link-time optimization. This is
2084 supported only for GCC since 4.5.0. 2085 supported only for GCC since 4.5.0.
@@ -15707,14 +15708,7 @@ esac
15707 15708
15708 15709
15709 15710
15710
15711
15712case $opsys in 15711case $opsys in
15713 aix4-2 | hpux* | unixware)
15714 $as_echo "#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE" >>confdefs.h
15715
15716 ;;
15717
15718 gnu-linux | gnu-kfreebsd ) 15712 gnu-linux | gnu-kfreebsd )
15719 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 15713 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15720/* end confdefs.h. */ 15714/* end confdefs.h. */
@@ -15739,9 +15733,6 @@ _ACEOF
15739if ac_fn_c_try_cpp "$LINENO"; then : 15733if ac_fn_c_try_cpp "$LINENO"; then :
15740 $as_echo "#define GC_SETJMP_WORKS 1" >>confdefs.h 15734 $as_echo "#define GC_SETJMP_WORKS 1" >>confdefs.h
15741 15735
15742else
15743 $as_echo "#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE" >>confdefs.h
15744
15745fi 15736fi
15746rm -f conftest.err conftest.$ac_ext 15737rm -f conftest.err conftest.$ac_ext
15747 ;; 15738 ;;
diff --git a/configure.ac b/configure.ac
index 4d1ef0b6783..4c1c5a8e738 100644
--- a/configure.ac
+++ b/configure.ac
@@ -627,7 +627,7 @@ fi
627 627
628AC_ARG_ENABLE([gcc-warnings], 628AC_ARG_ENABLE([gcc-warnings],
629 [AS_HELP_STRING([--enable-gcc-warnings], 629 [AS_HELP_STRING([--enable-gcc-warnings],
630 [turn on lots of GCC warnings. This is intended for 630 [turn on lots of GCC warnings/errors. This is intended for
631 developers, and may generate false alarms when used 631 developers, and may generate false alarms when used
632 with older or non-GNU development tools.])], 632 with older or non-GNU development tools.])],
633 [case $enableval in 633 [case $enableval in
@@ -3777,22 +3777,13 @@ case $opsys in
3777esac 3777esac
3778 3778
3779 3779
3780dnl These won't be used automatically yet. We also need to know, at least, 3780dnl This won't be used automatically yet. We also need to know, at least,
3781dnl that the stack is continuous. 3781dnl that the stack is continuous.
3782AH_TEMPLATE(GC_SETJMP_WORKS, [Define if setjmp is known to save all 3782AH_TEMPLATE(GC_SETJMP_WORKS, [Define if setjmp is known to save all
3783 registers relevant for conservative garbage collection in the jmp_buf.]) 3783 registers relevant for conservative garbage collection in the jmp_buf.])
3784 3784
3785AH_TEMPLATE(GC_MARK_STACK, [Define to GC_USE_GCPROS_AS_BEFORE if
3786 conservative garbage collection is not known to work.])
3787
3788 3785
3789case $opsys in 3786case $opsys in
3790 aix4-2 | hpux* | unixware)
3791 dnl Conservative garbage collection has not been tested, so for now
3792 dnl play it safe and stick with the old-fashioned way of marking.
3793 AC_DEFINE(GC_MARK_STACK, [GC_USE_GCPROS_AS_BEFORE])
3794 ;;
3795
3796 dnl Not all the architectures are tested, but there are Debian packages 3787 dnl Not all the architectures are tested, but there are Debian packages
3797 dnl for SCM and/or Guile on them, so the technique must work. See also 3788 dnl for SCM and/or Guile on them, so the technique must work. See also
3798 dnl comments in alloc.c concerning setjmp and gcc. 3789 dnl comments in alloc.c concerning setjmp and gcc.
@@ -3807,8 +3798,7 @@ case $opsys in
3807#else 3798#else
3808# error "setjmp not known to work on this arch" 3799# error "setjmp not known to work on this arch"
3809#endif 3800#endif
3810 ]], [[]])], AC_DEFINE(GC_SETJMP_WORKS, 1), 3801 ]], [[]])], AC_DEFINE(GC_SETJMP_WORKS, 1))
3811 AC_DEFINE(GC_MARK_STACK, [GC_USE_GCPROS_AS_BEFORE]) )
3812 ;; 3802 ;;
3813esac 3803esac
3814 3804
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 601949af88e..1b5bdc8fb53 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,8 @@
12013-01-07 Bastien Guerry <bzg@gnu.org>
2
3 * help.texi (Apropos): Document `apropos-user-option' and update
4 the doc for `apropos-variable'.
5
12013-01-05 Glenn Morris <rgm@gnu.org> 62013-01-05 Glenn Morris <rgm@gnu.org>
2 7
3 * text.texi (HTML Mode): Remove deleted nxml C-RET binding. 8 * text.texi (HTML Mode): Remove deleted nxml C-RET binding.
diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index 0a0a3865d2d..75b250d0f40 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -295,11 +295,16 @@ search for noninteractive functions too.
295Search for functions and variables. Both interactive functions 295Search for functions and variables. Both interactive functions
296(commands) and noninteractive functions can be found by this. 296(commands) and noninteractive functions can be found by this.
297 297
298@item M-x apropos-variable 298@item M-x apropos-user-option
299@findex apropos-variable 299@findex apropos-user-option
300Search for user-customizable variables. With a prefix argument, 300Search for user-customizable variables. With a prefix argument,
301search for non-customizable variables too. 301search for non-customizable variables too.
302 302
303@item M-x apropos-variable
304@findex apropos-variable
305Search for variables. With a prefix argument, search for
306customizable variables only.
307
303@item M-x apropos-value 308@item M-x apropos-value
304@findex apropos-value 309@findex apropos-value
305Search for variables whose values match the specified pattern. With a 310Search for variables whose values match the specified pattern. With a
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 31c81e62ac1..2631bdf708a 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,12 @@
12013-01-09 Glenn Morris <rgm@gnu.org>
2
3 * commands.texi (Interactive Codes):
4 Whitespace does not terminate interactive "S". (Bug#13393)
5
62013-01-06 Chong Yidong <cyd@gnu.org>
7
8 * windows.texi (Vertical Scrolling): Fix typos (Bug#13267).
9
12013-01-05 Glenn Morris <rgm@gnu.org> 102013-01-05 Glenn Morris <rgm@gnu.org>
2 11
3 * display.texi (Overlay Properties): Mention field. (Bug#13364) 12 * display.texi (Overlay Properties): Mention field. (Bug#13364)
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index f3589fc2edd..846d6f3a4a9 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -471,10 +471,10 @@ Arbitrary text, read in the minibuffer and returned as a string
471these characters in the input.) Prompt. 471these characters in the input.) Prompt.
472 472
473@item S 473@item S
474An interned symbol whose name is read in the minibuffer. Any whitespace 474An interned symbol whose name is read in the minibuffer. Terminate
475character terminates the input. (Use @kbd{C-q} to include whitespace in 475the input with either @kbd{C-j} or @key{RET}. Other characters that
476the string.) Other characters that normally terminate a symbol (e.g., 476normally terminate a symbol (e.g., whitespace, parentheses and
477parentheses and brackets) do not do so here. Prompt. 477brackets) do not do so here. Prompt.
478 478
479@item U 479@item U
480A key sequence or @code{nil}. Can be used after a @samp{k} or 480A key sequence or @code{nil}. Can be used after a @samp{k} or
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index b3c143496dd..792002add81 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -3054,10 +3054,11 @@ pixels. In this case, the return value is @var{lines}.
3054@end defun 3054@end defun
3055 3055
3056@defvar auto-window-vscroll 3056@defvar auto-window-vscroll
3057If this variable is non-@code{nil}, the line-move, scroll-up, and 3057If this variable is non-@code{nil}, the @code{line-move},
3058scroll-down functions will automatically modify the vertical scroll 3058@code{scroll-up}, and @code{scroll-down} functions will automatically
3059position to scroll through display rows that are taller than the height 3059modify the vertical scroll position to scroll through display rows
3060of the window, for example in the presence of large images. 3060that are taller than the height of the window, for example in the
3061presence of large images.
3061@end defvar 3062@end defvar
3062 3063
3063@node Horizontal Scrolling 3064@node Horizontal Scrolling
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index d756f4fd0f0..95c7ac7b233 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,48 @@
12013-01-13 Bastien Guerry <bzg@gnu.org>
2
3 * org.texi (Installation): Simplify.
4
52013-01-13 François Allisson <francois@allisson.co> (tiny change)
6
7 * org.texi (Handling links): Update the mention to the obsolete
8 variable `org-link-to-org-use-id' with a mention to the newer
9 variable `org-id-link-to-org-use-id'. Mention the need to load
10 the org-id library.
11
122013-01-10 Michael Albinus <michael.albinus@gmx.de>
13
14 * tramp.texi (Default Host): Introduce `tramp-default-host-alist'.
15
162013-01-09 Bastien Guerry <bzg@gnu.org>
17
18 * org.texi (Pushing to MobileOrg): Add footnote about using
19 symbolic links in `org-directory'.
20 (Timestamps, Deadlines and scheduling): Use `diary-float' instead
21 of the now obsolete alias `org-float'.
22 (TODO basics): Add `org-use-fast-todo-selection' to the variable
23 index. Fix description of TODO keywords cycling.
24 (Advanced features): Add missing argument for @item.
25 (Storing searches): Add index entries and a note about
26 *-tree agenda views.
27 (Structure editing): Document `org-mark-element' and
28 `org-mark-subtree'.
29 (Tag inheritance): Document `org-agenda-use-tag-inheritance'.
30
312013-01-08 Juri Linkov <juri@jurta.org>
32
33 * info.texi (Go to node): Mention the abbreviated format
34 `(FILENAME)' equal to `(FILENAME)Top'. (Bug#13365)
35
362013-01-06 Andreas Schwab <schwab@linux-m68k.org>
37
38 * autotype.texi: Remove undefined command @subtitlefont.
39 * cc-mode.texi: Likewise.
40
41 * org.texi (Advanced features): Use `@w{ }' instead of `@ ' in
42 @item argument.
43 (Property searches): Use \\ instead of @backslashchar{}.
44 * pgg.texi (VERSION): Move @set below @setfilename.
45
12013-01-05 Andreas Schwab <schwab@linux-m68k.org> 462013-01-05 Andreas Schwab <schwab@linux-m68k.org>
2 47
3 * ada-mode.texi: Remove braces from @title argument. 48 * ada-mode.texi: Remove braces from @title argument.
diff --git a/doc/misc/autotype.texi b/doc/misc/autotype.texi
index ad6a2902b1e..137ed6b43e8 100644
--- a/doc/misc/autotype.texi
+++ b/doc/misc/autotype.texi
@@ -37,8 +37,7 @@ modify this GNU manual.''
37 37
38@center @titlefont{Autotyping} 38@center @titlefont{Autotyping}
39@sp 2 39@sp 2
40@center @subtitlefont{Convenient features for text that you enter 40@center Convenient features for text that you enter frequently in Emacs
41frequently in Emacs}
42@sp 2 41@sp 2
43@center Daniel Pfeiffer 42@center Daniel Pfeiffer
44@center additions by Dave Love 43@center additions by Dave Love
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index f63c6c54a16..55b7028101a 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -188,7 +188,7 @@ modify this GNU manual.''
188 188
189@center @titlefont{CC Mode 5.32} 189@center @titlefont{CC Mode 5.32}
190@sp 2 190@sp 2
191@center @subtitlefont{A GNU Emacs mode for editing C and C-like languages} 191@center A GNU Emacs mode for editing C and C-like languages
192@sp 2 192@sp 2
193@center Barry A. Warsaw, Martin Stjernholm, Alan Mackenzie 193@center Barry A. Warsaw, Martin Stjernholm, Alan Mackenzie
194 194
diff --git a/doc/misc/htmlfontify.texi b/doc/misc/htmlfontify.texi
index 911cdd3cd5f..6cb8942bf15 100644
--- a/doc/misc/htmlfontify.texi
+++ b/doc/misc/htmlfontify.texi
@@ -7,7 +7,7 @@
7 7
8@copying 8@copying
9This manual documents Htmlfontify, a source code -> crosslinked + 9This manual documents Htmlfontify, a source code -> crosslinked +
10formatted + syntax colorised html transformer. 10formatted + syntax colorized html transformer.
11 11
12Copyright @copyright{} 2002, 2003, 2013 Free Software Foundation, Inc. 12Copyright @copyright{} 2002, 2003, 2013 Free Software Foundation, Inc.
13 13
@@ -56,7 +56,7 @@ modify this GNU manual.''
56@menu 56@menu
57* Introduction:: About Htmlfontify. 57* Introduction:: About Htmlfontify.
58* Usage & Examples:: How to use Htmlfontify. 58* Usage & Examples:: How to use Htmlfontify.
59* Customisation:: Fine-tuning Htmlfontify's behaviour. 59* Customization:: Fine-tuning Htmlfontify's behaviour.
60* Requirements:: External programs used by Htmlfontify. 60* Requirements:: External programs used by Htmlfontify.
61* GNU Free Documentation License:: The license for this documentation. 61* GNU Free Documentation License:: The license for this documentation.
62* Index:: Index of contents. 62* Index:: Index of contents.
@@ -68,7 +68,7 @@ modify this GNU manual.''
68 68
69Htmlfontify provides a means of converting individual Emacs buffers, 69Htmlfontify provides a means of converting individual Emacs buffers,
70source files, or entire source trees to html, preserving formatting 70source files, or entire source trees to html, preserving formatting
71and Emacs colorisation / syntax highlighting as much as possible 71and Emacs colorization / syntax highlighting as much as possible
72through careful application of CSS stylesheets and html tags. 72through careful application of CSS stylesheets and html tags.
73 73
74It can also turn instances of functions, methods and (for some 74It can also turn instances of functions, methods and (for some
@@ -76,7 +76,7 @@ languages) variables and other constructs and items into links
76to their definitions, and create an index file (or files) of 76to their definitions, and create an index file (or files) of
77all such symbols, also linked to their points of definition. 77all such symbols, also linked to their points of definition.
78 78
79Htmlfontify also provides several customisation items, which should 79Htmlfontify also provides several customization items, which should
80allow it to mesh more-or-less seamlessly with various templating or 80allow it to mesh more-or-less seamlessly with various templating or
81publishing systems (in the event, for instance, that you don't want 81publishing systems (in the event, for instance, that you don't want
82to produce the html pages directly). 82to produce the html pages directly).
@@ -93,7 +93,7 @@ batch mode.
93@menu 93@menu
94* Interactive:: Using Htmlfontify interactively. 94* Interactive:: Using Htmlfontify interactively.
95* Non-interactive:: Using Htmlfontify from elisp. 95* Non-interactive:: Using Htmlfontify from elisp.
96* Variables:: Variables (other than customisation entries). 96* Variables:: Variables (other than customization entries).
97* Data Structures:: Important data structures. 97* Data Structures:: Important data structures.
98* Examples:: Example(s) of Htmlfontify in use. 98* Examples:: Example(s) of Htmlfontify in use.
99@end menu 99@end menu
@@ -236,7 +236,7 @@ color map specified, otherwise it uses Htmlfontify's built in map.
236@end lisp 236@end lisp
237 237
238Return a @code{defface} style alist of possible specifications for 238Return a @code{defface} style alist of possible specifications for
239@var{face}, with any entries resulting from user customisation 239@var{face}, with any entries resulting from user customization
240(@code{custom-set-faces}) taking precedence. 240(@code{custom-set-faces}) taking precedence.
241 241
242See also: @ref{hfy-default-face-def} 242See also: @ref{hfy-default-face-def}
@@ -268,10 +268,10 @@ does things like deferring fontification until a section of the buffer is
268exposed and rendered, or until Emacs is idle for a while. Sometimes, in 268exposed and rendered, or until Emacs is idle for a while. Sometimes, in
269non-interactive circumstances, or if it can't see X, it doesn't bother 269non-interactive circumstances, or if it can't see X, it doesn't bother
270with some of the harder stuff. While this is all great from the perspective 270with some of the harder stuff. While this is all great from the perspective
271of a user waiting for Emacs to load a 20000 line file and colorise it, 271of a user waiting for Emacs to load a 20000 line file and colorize it,
272it's a pain from the point of view from non-interactive code. This function 272it's a pain from the point of view from non-interactive code. This function
273lies, cheats, steals and generally bullies Emacs into fontifying a buffer 273lies, cheats, steals and generally bullies Emacs into fontifying a buffer
274from start to finish, with all the extra frills, whether it thinks it nneds 274from start to finish, with all the extra frills, whether it thinks it needs
275to or not. Oh yes: it operates on the current buffer. 275to or not. Oh yes: it operates on the current buffer.
276 276
277@item hfy-link-style-string 277@item hfy-link-style-string
@@ -861,7 +861,7 @@ As per @ref{hfy-color} but for background colors.
861(hfy-kludge-cperl-mode) 861(hfy-kludge-cperl-mode)
862@end lisp 862@end lisp
863 863
864cperl mode does its damndest not to do some of its fontification when not 864cperl mode does its best to not do some of its fontification when not
865in a windowing system---we try to trick it@dots{} 865in a windowing system---we try to trick it@dots{}
866 866
867@item hfy-href 867@item hfy-href
@@ -1044,7 +1044,7 @@ Convert an Emacs @code{:width} attribute to a CSS font-stretch attribute.
1044@section Variables 1044@section Variables
1045@cindex variables 1045@cindex variables
1046 1046
1047Important variables that are not customisation items: 1047Important variables that are not customization items:
1048 1048
1049@table @code 1049@table @code
1050 1050
@@ -1234,7 +1234,7 @@ main-content <=MAIN_CONTENT;\n" rtfm-section file style rtfm-section file))
1234 1234
1235;; Here's the function I actually call---it asks me for a section label, 1235;; Here's the function I actually call---it asks me for a section label,
1236;; and source and destination directories, and then binds a couple of 1236;; and source and destination directories, and then binds a couple of
1237;; customisation variable in a let before calling htmlfontify: 1237;; customization variable in a let before calling htmlfontify:
1238(defun rtfm-build-source-docs (section srcdir destdir) 1238(defun rtfm-build-source-docs (section srcdir destdir)
1239 (interactive 1239 (interactive
1240 "s section[eg- emacs / p4-blame]:\nD source-dir: \nD output-dir: ") 1240 "s section[eg- emacs / p4-blame]:\nD source-dir: \nD output-dir: ")
@@ -1252,11 +1252,11 @@ main-content <=MAIN_CONTENT;\n" rtfm-section file style rtfm-section file))
1252 (htmlfontify-copy-and-link-dir srcdir destdir ".src" ".html"))) 1252 (htmlfontify-copy-and-link-dir srcdir destdir ".src" ".html")))
1253@end lisp 1253@end lisp
1254 1254
1255@node Customisation 1255@node Customization
1256@chapter Customisation 1256@chapter Customization
1257@cindex variables (customisation) 1257@cindex variables (customization)
1258 1258
1259Htmlfontify provides the following variable and customisation entries: 1259Htmlfontify provides the following variable and customization entries:
1260 1260
1261@table @code 1261@table @code
1262@comment AUTOGENERATED BLOCK 1262@comment AUTOGENERATED BLOCK
@@ -1394,7 +1394,7 @@ when @ref{hfy-display-class} has been set (the normal Htmlfontify way of
1394extracting potentially non-current face information doesn't necessarily 1394extracting potentially non-current face information doesn't necessarily
1395work for @code{default}). 1395work for @code{default}).
1396 1396
1397For example, I customise this to: 1397For example, I customize this to:
1398 1398
1399@lisp 1399@lisp
1400((t :background "black" :foreground "white" :family "misc-fixed")) 1400((t :background "black" :foreground "white" :family "misc-fixed"))
@@ -1405,7 +1405,7 @@ For example, I customise this to:
1405@anchor{hfy-init-kludge-hooks} 1405@anchor{hfy-init-kludge-hooks}
1406 1406
1407List of functions to call when starting htmlfontify-buffer to do any 1407List of functions to call when starting htmlfontify-buffer to do any
1408kludging necessary to get highlighting modes to bahave as you want, even 1408kludging necessary to get highlighting modes to behave as you want, even
1409when not running under a window system. 1409when not running under a window system.
1410 1410
1411@item hfy-shell-file-name 1411@item hfy-shell-file-name
@@ -1421,7 +1421,7 @@ Currently this is only required/used when using GNU etags, see
1421@vindex hfy-optimisations 1421@vindex hfy-optimisations
1422@anchor{hfy-optimisations} 1422@anchor{hfy-optimisations}
1423 1423
1424Optimisations to turn on. So far, the following have been implemented: 1424Optimizations to turn on. So far, the following have been implemented:
1425 1425
1426@table @option 1426@table @option
1427@item merge-adjacent-tags 1427@item merge-adjacent-tags
@@ -1454,7 +1454,8 @@ Suppress hyperlinking between files highlighted by different modes.
1454 1454
1455@end table 1455@end table
1456 1456
1457Note: like compiler optimisations, these optimise the _output_ of the code, 1457Note: like compiler optimizations, these optimize the @emph{output} of
1458the code,
1458not the processing of the source itself, and are therefore likely to slow 1459not the processing of the source itself, and are therefore likely to slow
1459Htmlfontify down, at least a little. Except for skip-refontification, 1460Htmlfontify down, at least a little. Except for skip-refontification,
1460which can never slow you down, but may result in incomplete fontification. 1461which can never slow you down, but may result in incomplete fontification.
@@ -1470,7 +1471,7 @@ Regex to remove from the <style> a variant of an Htmlfontify CSS class.
1470@anchor{hfy-link-extn} 1471@anchor{hfy-link-extn}
1471 1472
1472File extension used for href links---useful where the Htmlfontify 1473File extension used for href links---useful where the Htmlfontify
1473output files are going to be processed again, with a rersulting change 1474output files are going to be processed again, with a resulting change
1474in file extension. If @code{nil}, then any code using this should fall back 1475in file extension. If @code{nil}, then any code using this should fall back
1475to @ref{hfy-extn}. 1476to @ref{hfy-extn}.
1476 1477
@@ -1570,16 +1571,16 @@ money are always welcome.
1570 1571
1571@item 1572@item
1572A copy of etags (exuberant-ctags or GNU etags). Htmlfontify attempts 1573A copy of etags (exuberant-ctags or GNU etags). Htmlfontify attempts
1573to autodetect the version you have and customise itself accordingly, 1574to autodetect the version you have and customize itself accordingly,
1574but you should be able to override this. 1575but you should be able to override this.
1575 1576
1576See: @ref{Customisation} 1577See: @ref{Customization}
1577 1578
1578@item 1579@item
1579A copy of find (e.g., GNU find) that provides the @code{-path} predicate. 1580A copy of find (e.g., GNU find) that provides the @code{-path} predicate.
1580 1581
1581You may be able to work around this with a suitable clever shell 1582You may be able to work around this with a suitable clever shell
1582command and the customisation entry: @ref{hfy-find-cmd} 1583command and the customization entry: @ref{hfy-find-cmd}
1583 1584
1584@item 1585@item
1585A copy of sed (e.g., GNU sed). 1586A copy of sed (e.g., GNU sed).
@@ -1603,7 +1604,7 @@ A copy of the @code{file} command.
1603@item Functions 1604@item Functions
1604@printindex fn 1605@printindex fn
1605 1606
1606@item Variables & Customisation 1607@item Variables & Customization
1607@printindex vr 1608@printindex vr
1608 1609
1609@end table 1610@end table
diff --git a/doc/misc/info.texi b/doc/misc/info.texi
index 70dfffde393..d17a65571f1 100644
--- a/doc/misc/info.texi
+++ b/doc/misc/info.texi
@@ -1079,7 +1079,8 @@ partial node name.
1079node name by putting it at the front, in parentheses. Thus, 1079node name by putting it at the front, in parentheses. Thus,
1080@kbd{g(dir)Top@key{RET}} would go to the Info Directory node, which is 1080@kbd{g(dir)Top@key{RET}} would go to the Info Directory node, which is
1081the node @samp{Top} in the Info file @file{dir}. Likewise, 1081the node @samp{Top} in the Info file @file{dir}. Likewise,
1082@kbd{g(emacs)Top@key{RET}} goes to the top node of the Emacs manual. 1082@kbd{g(emacs)Top@key{RET}} (or just @kbd{g(emacs)@key{RET}}) goes to the
1083top node of the Emacs manual.
1083 1084
1084 The node name @samp{*} specifies the whole file. So you can look at 1085 The node name @samp{*} specifies the whole file. So you can look at
1085all of the current file by typing @kbd{g*@key{RET}} or all of any 1086all of the current file by typing @kbd{g*@key{RET}} or all of any
diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index bea130ccb43..d41d2848cc6 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -2,7 +2,7 @@
2@c %**start of header 2@c %**start of header
3@setfilename ../../info/org 3@setfilename ../../info/org
4@settitle The Org Manual 4@settitle The Org Manual
5@set VERSION 7.9.2 (GNU Emacs 24.3) 5@set VERSION 7.9.3d (GNU Emacs 24.3)
6 6
7@c Use proper quote and backtick for code sections in PDF output 7@c Use proper quote and backtick for code sections in PDF output
8@c Cf. Texinfo manual 14.2 8@c Cf. Texinfo manual 14.2
@@ -339,7 +339,7 @@ with contributions by David O'Toole, Bastien Guerry, Philip Rooke, Dan Davison,
339Introduction 339Introduction
340 340
341* Summary:: Brief summary of what Org does 341* Summary:: Brief summary of what Org does
342* Installation:: How to install a downloaded version of Org 342* Installation:: Installing Org
343* Activation:: How to activate Org for certain buffers 343* Activation:: How to activate Org for certain buffers
344* Feedback:: Bug reports, ideas, patches etc. 344* Feedback:: Bug reports, ideas, patches etc.
345* Conventions:: Typesetting conventions in the manual 345* Conventions:: Typesetting conventions in the manual
@@ -771,7 +771,7 @@ MobileOrg
771 771
772@menu 772@menu
773* Summary:: Brief summary of what Org does 773* Summary:: Brief summary of what Org does
774* Installation:: How to install a downloaded version of Org 774* Installation:: Installing Org
775* Activation:: How to activate Org for certain buffers 775* Activation:: How to activate Org for certain buffers
776* Feedback:: Bug reports, ideas, patches etc. 776* Feedback:: Bug reports, ideas, patches etc.
777* Conventions:: Typesetting conventions in the manual 777* Conventions:: Typesetting conventions in the manual
@@ -851,118 +851,69 @@ Theory Ltd.}
851@cindex installation 851@cindex installation
852@cindex XEmacs 852@cindex XEmacs
853 853
854@b{Important:} @i{If you the version of Org that comes with Emacs or as a 854Org is part of recent distributions of GNU Emacs, so you normally don't need
855XEmacs package, please skip this section and go directly to @ref{Activation}. 855to install it. If, for one reason or another, you want to install Org on top
856If you downloaded Org as an ELPA package, please read the instructions on the 856of this pre-packaged version, there are three ways to do it:
857@uref{http://orgmode.org/elpa.html, Org ELPA page}. To see what version of Org
858(if any) is part of your Emacs distribution, type @kbd{M-x org-version} (if
859your Emacs distribution does not come with Org, this function will not be
860defined).}
861
862Installation of Org mode uses a build system, which is described in more
863detail on @uref{http://orgmode.org/worg/dev/org-build-system.html, Worg}.
864
865If you have downloaded Org from the Web as a distribution @file{.zip} or
866@file{.tar.gz} archive, take the following steps to install it:
867 857
868@itemize @bullet 858@itemize @bullet
869@item Unpack the distribution archive. 859@item By using Emacs package system.
870@item Change into (@code{cd}) the Org directory. 860@item By downloading Org as an archive.
871@item Run @code{make help config} 861@item By using Org's git repository.
872and then check and edit the file @file{local.mk} if the default configuration
873does not match your system. Set the name of the Emacs binary (likely either
874@file{emacs} or @file{xemacs}), and the paths to the directories where local
875Lisp and Info files will be installed. If the Emacs binary is not in your
876path, give the full path to the executable. Avoid spaces in any path names.
877@item Run @code{make config}
878again to check the configuration.
879@item Run @code{make install} or @code{sudo make install}
880to build and install Org mode on your system.
881@end itemize 862@end itemize
882 863
883If you use a cloned Git repository, then the procedure is slightly different. 864We @b{strongly recommend} to stick to a single installation method.
884The following description assumes that you are using the @code{master} branch
885(where the development is done). You could also use the @code{maint} branch
886instead, where the release versions are published, just replace @code{master}
887with @code{maint} in the description below.
888 865
889@itemize @bullet 866@subsubheading Using Emacs packaging system
890@item Change into (@code{cd}) the Org repository.
891@item Run @code{git checkout master}
892to switch to the @code{master} branch of the Org repository.
893@item Run @code{make help}
894and then check and edit the file @file{local.mk}. You must set the name of
895the Emacs binary (likely either @file{emacs} or @file{xemacs}), and the paths
896to the directories where local Lisp and Info files will be installed. If the
897Emacs binary is not in your path, you must give the full path to the
898executable. Avoid spaces in any path names.
899@item Run @code{make config}
900to check the configuration.
901@item Optionally run @code{make test}
902to build Org mode and then run the full testsuite.
903@item Run @code{make update2} or @code{make up2}
904to update the Git repository and build and install Org mode. The latter
905invocation runs the complete test suite before installation and installs only
906if the build passes all tests.
907@end itemize
908 867
909If you don't have access to the system-wide directories and you don't want to 868Recent Emacs distributions include a packaging system which lets you install
910install somewhere into your home directory, you can run Org directly from the 869Elisp libraries. You can install Org with @kbd{M-x package-install RET org}.
911distribution directory or Org repository by compiling Org mode in place: 870To make sure your Org configuration is well taken into account, initialize
871the package system with @code{(package-initialize)} before setting any Org
872option. If you want to use Org's package repository, check out the
873@uref{http://orgmode.org/elpa.html, Org ELPA page}.
912 874
913@itemize @bullet 875@subsubheading Downloading Org as an archive
914@item Change into (@code{cd}) the Org repository.
915@item Run @code{git checkout master}
916to switch to the @code{master} branch of the Org repository.
917@item Run @code{make compile}
918@end itemize
919 876
920Last but not least you can also run Org mode directly from an Org repository 877You can download Org latest release from @uref{http://orgmode.org/, Org's
921without any compilation. Simply replace the last step in the recipe above 878website}. In this case, make sure you set the load-path correctly in your
922with @code{make uncompiled}. 879@file{.emacs}:
923
924Then add the following line to @file{.emacs}:
925 880
926@example 881@example
927(add-to-list 'load-path "~/path/to/orgdir/lisp") 882(add-to-list 'load-path "~/path/to/orgdir/lisp")
928@end example 883@end example
929 884
930@noindent 885The downloaded archive contains contributed libraries that are not included
931If you plan to use code from the @file{contrib} subdirectory without 886in Emacs. If you want to use them, add the @file{contrib} directory to your
932compiling them, do a similar step for this directory: 887load-path:
933 888
934@example 889@example
935(add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t) 890(add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t)
936@end example 891@end example
937 892
938If you want to include those files with the build and install, please 893Optionally, you can compile the files and/or install them in your system.
939customize the variable @code{ORG_ADD_CONTRIB} instead in your @code{local.mk} 894Run @code{make help} to list compilation and installation options.
940file, for more details please see this
941@uref{http://orgmode.org/worg/dev/org-build-system.html#sec-4-1-2,
942description on Worg}.
943 895
944Installing Info files is system dependent, because of differences in the 896@subsubheading Using Org's git repository
945@file{install-info} program. The Info documentation is installed together 897
946with the rest of Org mode. If you don't install Org mode, it is possible to 898You can clone Org's repository and install Org like this:
947install the Info documentation separately (you need to have
948install-info@footnote{The output from install-info (if any) is system
949dependent. In particular Debian and its derivatives use two different
950versions of install-info and you may see the message:
951 899
952@example 900@example
953This is not dpkg install-info anymore, but GNU install-info 901$ cd ~/src/
954See the man page for ginstall-info for command line arguments 902$ git clone git://orgmode.org/org-mode.git
903$ make autoloads
955@end example 904@end example
956 905
957@noindent which can be safely ignored.} 906Note that @code{make autoloads} is mandatory: it defines Org's version and
958on your system). 907Org's autoloaded functions, respectively in @file{org-version.el} and in
908@file{org-loaddefs.el}.
959 909
960@example 910Remember to add the correct load-path as described in the method above.
961make install-info
962@end example
963 911
964Do not forget to activate Org as described in the following section. 912You can also compile and install Org from this git repository: check
965@page 913@code{make help} to get the list of compilation/installation options.
914
915For more detailed explanations on Org's build system, please check the Org
916Build System page on @uref{http://orgmode.org/worg/dev/org-build-system.html, Worg}.
966 917
967@node Activation, Feedback, Installation, Introduction 918@node Activation, Feedback, Installation, Introduction
968@section Activation 919@section Activation
@@ -1470,6 +1421,13 @@ Move subtree up (swap with previous subtree of same
1470level). 1421level).
1471@orgcmd{M-S-@key{down},org-move-subtree-down} 1422@orgcmd{M-S-@key{down},org-move-subtree-down}
1472Move subtree down (swap with next subtree of same level). 1423Move subtree down (swap with next subtree of same level).
1424@orgcmd{M-h,org-mark-element}
1425Mark the element at point. Hitting repeatedly will mark subsequent elements
1426of the one just marked. E.g. hitting @key{M-h} on a paragraph will mark it,
1427hitting @key{M-h} immediately again will mark the next one.
1428@orgcmd{C-c @@,org-mark-subtree}
1429Mark the subtree at point. Hitting repeatedly will mark subsequent subtrees
1430of the same level than the marked subtree.
1473@orgcmd{C-c C-x C-w,org-cut-subtree} 1431@orgcmd{C-c C-x C-w,org-cut-subtree}
1474Kill subtree, i.e., remove it from buffer but save in kill ring. 1432Kill subtree, i.e., remove it from buffer but save in kill ring.
1475With a numeric prefix argument N, kill N sequential subtrees. 1433With a numeric prefix argument N, kill N sequential subtrees.
@@ -3027,7 +2985,7 @@ lines will be left alone by this command.
3027Selects this line for global recalculation with @kbd{C-u C-c *}, but 2985Selects this line for global recalculation with @kbd{C-u C-c *}, but
3028not for automatic recalculation. Use this when automatic 2986not for automatic recalculation. Use this when automatic
3029recalculation slows down editing too much. 2987recalculation slows down editing too much.
3030@item @ 2988@item @w{ }
3031Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}. 2989Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
3032All lines that should be recalculated should be marked with @samp{#} 2990All lines that should be recalculated should be marked with @samp{#}
3033or @samp{*}. 2991or @samp{*}.
@@ -3377,13 +3335,16 @@ be the description@footnote{If the headline contains a timestamp, it will be
3377removed from the link and result in a wrong link---you should avoid putting 3335removed from the link and result in a wrong link---you should avoid putting
3378timestamp in the headline.}. 3336timestamp in the headline.}.
3379 3337
3380@vindex org-link-to-org-use-id 3338@vindex org-id-link-to-org-use-id
3381@cindex property, CUSTOM_ID 3339@cindex property, CUSTOM_ID
3382@cindex property, ID 3340@cindex property, ID
3383If the headline has a @code{CUSTOM_ID} property, a link to this custom ID 3341If the headline has a @code{CUSTOM_ID} property, a link to this custom ID
3384will be stored. In addition or alternatively (depending on the value of 3342will be stored. In addition or alternatively (depending on the value of
3385@code{org-link-to-org-use-id}), a globally unique @code{ID} property will be 3343@code{org-id-link-to-org-use-id}), a globally unique @code{ID} property will
3386created and/or used to construct a link. So using this command in Org 3344be created and/or used to construct a link@footnote{The library @code{org-id}
3345must first be loaded, either through @code{org-customize} by enabling
3346@code{id} in @code{org-modules} , or by adding @code{(require 'org-id)} in
3347your @file{.emacs}.}. So using this command in Org
3387buffers will potentially create two links: a human-readable from the custom 3348buffers will potentially create two links: a human-readable from the custom
3388ID, and one that is globally unique and works even if the entry is moved from 3349ID, and one that is globally unique and works even if the entry is moved from
3389file to file. Later, when inserting the link, you need to decide which one 3350file to file. Later, when inserting the link, you need to decide which one
@@ -3747,6 +3708,8 @@ The most important commands to work with TODO entries are:
3747@table @kbd 3708@table @kbd
3748@orgcmd{C-c C-t,org-todo} 3709@orgcmd{C-c C-t,org-todo}
3749@cindex cycling, of TODO states 3710@cindex cycling, of TODO states
3711@vindex org-use-fast-todo-selection
3712
3750Rotate the TODO state of the current item among 3713Rotate the TODO state of the current item among
3751 3714
3752@example 3715@example
@@ -3754,14 +3717,19 @@ Rotate the TODO state of the current item among
3754'--------------------------------' 3717'--------------------------------'
3755@end example 3718@end example
3756 3719
3757The same rotation can also be done ``remotely'' from the timeline and 3720If TODO keywords have fast access keys (see @ref{Fast access to TODO
3758agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}). 3721states}), you will be prompted for a TODO keyword through the fast selection
3722interface; this is the default behavior when
3723@var{org-use-fast-todo-selection} is @code{non-nil}.
3724
3725The same rotation can also be done ``remotely'' from the timeline and agenda
3726buffers with the @kbd{t} command key (@pxref{Agenda commands}).
3759 3727
3760@orgkey{C-u C-c C-t} 3728@orgkey{C-u C-c C-t}
3761Select a specific keyword using completion or (if it has been set up) 3729When TODO keywords have no selection keys, select a specific keyword using
3762the fast selection interface. For the latter, you need to assign keys 3730completion; otherwise force cycling through TODO states with no prompt. When
3763to TODO states, see @ref{Per-file keywords}, and @ref{Setting tags}, for 3731@var{org-use-fast-todo-selection} is set to @code{prefix}, use the fast
3764more information. 3732selection interface.
3765 3733
3766@kindex S-@key{right} 3734@kindex S-@key{right}
3767@kindex S-@key{left} 3735@kindex S-@key{left}
@@ -4617,9 +4585,8 @@ changes in the line.}:
4617@noindent 4585@noindent
4618@vindex org-use-tag-inheritance 4586@vindex org-use-tag-inheritance
4619@vindex org-tags-exclude-from-inheritance 4587@vindex org-tags-exclude-from-inheritance
4620To limit tag inheritance to specific tags, or to turn it off entirely, use 4588To limit tag inheritance to specific tags, use @code{org-tags-exclude-from-inheritance}.
4621the variables @code{org-use-tag-inheritance} and 4589To turn it off entirely, use @code{org-use-tag-inheritance}.
4622@code{org-tags-exclude-from-inheritance}.
4623 4590
4624@vindex org-tags-match-list-sublevels 4591@vindex org-tags-match-list-sublevels
4625When a headline matches during a tags search while tag inheritance is turned 4592When a headline matches during a tags search while tag inheritance is turned
@@ -4630,6 +4597,15 @@ of matches may then become very long. If you only want to see the first tags
4630match in a subtree, configure the variable 4597match in a subtree, configure the variable
4631@code{org-tags-match-list-sublevels} (not recommended). 4598@code{org-tags-match-list-sublevels} (not recommended).
4632 4599
4600@vindex org-agenda-use-tag-inheritance
4601Tag inheritance is relevant when the agenda search tries to match a tag,
4602either in the @code{tags} or @code{tags-todo} agenda types. In other agenda
4603types, @code{org-use-tag-inheritance} has no effect. Still, you may want to
4604have your tags correctly set in the agenda, so that tag filtering works fine,
4605with inherited tags. Set @code{org-agenda-use-tag-inheritance} to control
4606this: the default value includes all agenda types, but setting this to nil
4607can really speed up agenda generation.
4608
4633@node Setting tags, Tag searches, Tag inheritance, Tags 4609@node Setting tags, Tag searches, Tag inheritance, Tags
4634@section Setting tags 4610@section Setting tags
4635@cindex setting tags 4611@cindex setting tags
@@ -5050,7 +5026,7 @@ FILE @r{The filename the entry is located in.}
5050To create sparse trees and special lists with selection based on properties, 5026To create sparse trees and special lists with selection based on properties,
5051the same commands are used as for tag searches (@pxref{Tag searches}). 5027the same commands are used as for tag searches (@pxref{Tag searches}).
5052@table @kbd 5028@table @kbd
5053@orgcmdkkc{C-c / m,C-c @backslashchar{},org-match-sparse-tree} 5029@orgcmdkkc{C-c / m,C-c \\,org-match-sparse-tree}
5054Create a sparse tree with all matching entries. With a 5030Create a sparse tree with all matching entries. With a
5055@kbd{C-u} prefix argument, ignore headlines that are not a TODO line. 5031@kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
5056@orgcmd{C-c a m,org-tags-view} 5032@orgcmd{C-c a m,org-tags-view}
@@ -5512,7 +5488,7 @@ example with optional time
5512 5488
5513@example 5489@example
5514* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month 5490* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
5515 <%%(org-float t 4 2)> 5491 <%%(diary-float t 4 2)>
5516@end example 5492@end example
5517 5493
5518@item Time/Date range 5494@item Time/Date range
@@ -5850,7 +5826,7 @@ entries. Org mode will issue early and late warnings based on the
5850assumption that the timestamp represents the @i{nearest instance} of 5826assumption that the timestamp represents the @i{nearest instance} of
5851the repeater. However, the use of diary sexp entries like 5827the repeater. However, the use of diary sexp entries like
5852@c 5828@c
5853@code{<%%(org-float t 42)>} 5829@code{<%%(diary-float t 42)>}
5854@c 5830@c
5855in scheduling and deadline timestamps is limited. Org mode does not 5831in scheduling and deadline timestamps is limited. Org mode does not
5856know enough about the internals of each sexp function to issue early and 5832know enough about the internals of each sexp function to issue early and
@@ -6539,7 +6515,7 @@ suggestion.} for capturing new material.
6539@table @kbd 6515@table @kbd
6540@orgcmd{C-c c,org-capture} 6516@orgcmd{C-c c,org-capture}
6541Call the command @code{org-capture}. Note that this keybinding is global and 6517Call the command @code{org-capture}. Note that this keybinding is global and
6542not active by default; you need to install it. If you have templates 6518not active by default: you need to install it. If you have templates
6543@cindex date tree 6519@cindex date tree
6544defined @pxref{Capture templates}, it will offer these templates for 6520defined @pxref{Capture templates}, it will offer these templates for
6545selection or use a new Org outline node as the default template. It will 6521selection or use a new Org outline node as the default template. It will
@@ -8621,6 +8597,13 @@ buffer, or a sparse tree (the latter covering of course only the current
8621buffer). 8597buffer).
8622@kindex C-c a C 8598@kindex C-c a C
8623@vindex org-agenda-custom-commands 8599@vindex org-agenda-custom-commands
8600@cindex agenda views, main example
8601@cindex tags, as an agenda view
8602@cindex todo, as an agenda view
8603@cindex tags-todo
8604@cindex todo-tree
8605@cindex occur-tree
8606@cindex tags-tree
8624 8607
8625Custom commands are configured in the variable 8608Custom commands are configured in the variable
8626@code{org-agenda-custom-commands}. You can customize this variable, for 8609@code{org-agenda-custom-commands}. You can customize this variable, for
@@ -8681,6 +8664,9 @@ additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
8681Peter, or Kim) as additional tag to match. 8664Peter, or Kim) as additional tag to match.
8682@end table 8665@end table
8683 8666
8667Note that the @code{*-tree} agenda views need to be called from an
8668Org buffer as they operate on the current buffer only.
8669
8684@node Block agenda, Setting Options, Storing searches, Custom agenda views 8670@node Block agenda, Setting Options, Storing searches, Custom agenda views
8685@subsection Block agenda 8671@subsection Block agenda
8686@cindex block agenda 8672@cindex block agenda
@@ -16537,14 +16523,18 @@ to the directory @code{org-mobile-directory}. By default this list contains
16537all agenda files (as listed in @code{org-agenda-files}), but additional files 16523all agenda files (as listed in @code{org-agenda-files}), but additional files
16538can be included by customizing @code{org-mobile-files}. File names will be 16524can be included by customizing @code{org-mobile-files}. File names will be
16539staged with paths relative to @code{org-directory}, so all files should be 16525staged with paths relative to @code{org-directory}, so all files should be
16540inside this directory. The push operation also creates a special Org file 16526inside this directory@footnote{Symbolic links in @code{org-directory} need to
16541@file{agendas.org} with all custom agenda view defined by the 16527have the same name than their targets.}.
16542user@footnote{While creating the agendas, Org mode will force ID properties 16528
16543on all referenced entries, so that these entries can be uniquely identified 16529The push operation also creates a special Org file @file{agendas.org} with
16544if @i{MobileOrg} flags them for further action. If you do not want to get 16530all custom agenda view defined by the user@footnote{While creating the
16545these properties in so many entries, you can set the variable 16531agendas, Org mode will force ID properties on all referenced entries, so that
16546@code{org-mobile-force-id-on-agenda-items} to @code{nil}. Org mode will then 16532these entries can be uniquely identified if @i{MobileOrg} flags them for
16547rely on outline paths, in the hope that these will be unique enough.}. 16533further action. If you do not want to get these properties in so many
16534entries, you can set the variable @code{org-mobile-force-id-on-agenda-items}
16535to @code{nil}. Org mode will then rely on outline paths, in the hope that
16536these will be unique enough.}.
16537
16548Finally, Org writes the file @file{index.org}, containing links to all other 16538Finally, Org writes the file @file{index.org}, containing links to all other
16549files. @i{MobileOrg} first reads this file from the server, and then 16539files. @i{MobileOrg} first reads this file from the server, and then
16550downloads all agendas and Org files listed in it. To speed up the download, 16540downloads all agendas and Org files listed in it. To speed up the download,
diff --git a/doc/misc/pgg.texi b/doc/misc/pgg.texi
index bb40a9f541d..a18a22e649f 100644
--- a/doc/misc/pgg.texi
+++ b/doc/misc/pgg.texi
@@ -2,9 +2,9 @@
2 2
3@include gnus-overrides.texi 3@include gnus-overrides.texi
4 4
5@set VERSION 0.1
6
7@setfilename ../../info/pgg 5@setfilename ../../info/pgg
6
7@set VERSION 0.1
8@settitle PGG @value{VERSION} 8@settitle PGG @value{VERSION}
9 9
10@copying 10@copying
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index a683425868a..3a859c62728 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -1279,8 +1279,8 @@ example, if you always have to use the user @samp{john} in the domain
1279@end lisp 1279@end lisp
1280 1280
1281@noindent 1281@noindent
1282See the documentation for the variable 1282See the documentation for the variable @code{tramp-default-user-alist}
1283@code{tramp-default-user-alist} for more details. 1283for more details.
1284 1284
1285One trap to fall in must be known. If @value{tramp} finds a default 1285One trap to fall in must be known. If @value{tramp} finds a default
1286user, this user will be passed always to the connection command as 1286user, this user will be passed always to the connection command as
@@ -1338,6 +1338,18 @@ Note, however, that the most simplification @samp{/::} won't work,
1338because @samp{/:} is the prefix for quoted file names. 1338because @samp{/:} is the prefix for quoted file names.
1339@end ifset 1339@end ifset
1340 1340
1341@vindex tramp-default-host-alist
1342Like with methods and users, you can also specify different default
1343hosts for certain method/user combinations via the variable
1344@code{tramp-default-host-alist}. Usually, this isn't necessary,
1345because @code{tramp-default-host} should be sufficient. For some
1346methods, like @code{adb}, that default value must be overwritten,
1347which is already the initial value of @code{tramp-default-host-alist}.
1348
1349@noindent
1350See the documentation for the variable @code{tramp-default-host-alist}
1351for more details.
1352
1341 1353
1342@node Multi-hops 1354@node Multi-hops
1343@section Connecting to a remote host using multiple hops 1355@section Connecting to a remote host using multiple hops
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 1c057848ead..6c1a08cb670 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -85,7 +85,7 @@
85 85
862012-10-01 Eric Ludlam <zappo@gnu.org> 862012-10-01 Eric Ludlam <zappo@gnu.org>
87 87
88 * srecode/cc.srt, srecode/ede-autoconf.srt: New files. 88 * srecode/c.srt, srecode/ede-autoconf.srt: New files.
89 89
90 * srecode/cpp.srt: Move parts to c.srt. 90 * srecode/cpp.srt: Move parts to c.srt.
91 91
diff --git a/etc/NEWS b/etc/NEWS
index 4035276467d..0471683fa9b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -32,6 +32,13 @@ configure option `--without-acl'.
32* Changes in Emacs 24.4 32* Changes in Emacs 24.4
33 33
34+++ 34+++
35** `apropos-variable' is now `apropos-user-option'
36`apropos-user-option' shows all user options while `apropos-variable'
37shows all variables. When called with a universal prefix argument,
38the two commands swap their behaviors. When `apropos-do-all' is
39non-nil, they output the same results.
40
41+++
35** `eval-defun' on an already defined defcustom calls the :set function, 42** `eval-defun' on an already defined defcustom calls the :set function,
36if there is one. 43if there is one.
37 44
@@ -51,6 +58,8 @@ entries of a file. On GNU/Linux, the POSIX ACL interface is used via
51libacl. On MS-Windows, the NT Security APIs are used to emulate the 58libacl. On MS-Windows, the NT Security APIs are used to emulate the
52POSIX ACL interfaces. 59POSIX ACL interfaces.
53 60
61** New option `scroll-bar-adjust-thumb-portion'.
62
54* Editing Changes in Emacs 24.4 63* Editing Changes in Emacs 24.4
55 64
56** New commands `toggle-frame-fullscreen' and `toggle-frame-maximized', 65** New commands `toggle-frame-fullscreen' and `toggle-frame-maximized',
@@ -59,6 +68,11 @@ bound to <f11> and M-<f10>, respectively.
59 68
60* Changes in Specialized Modes and Packages in Emacs 24.4 69* Changes in Specialized Modes and Packages in Emacs 24.4
61 70
71** jit-lock-debug-mode lets you use the debuggers on code run via jit-lock.
72
73** completing-read-multiple's separator can now be a regexp.
74The default separator is changed to allow surrounding spaces around the comma.
75
62** Battery 76** Battery
63 77
64*** Battery information via the BSD `apm' utility is now supported. 78*** Battery information via the BSD `apm' utility is now supported.
@@ -198,6 +212,9 @@ property using the supplied face spec.
198*** Face specs set via Custom themes now replace the `defface' spec 212*** Face specs set via Custom themes now replace the `defface' spec
199rather than inheriting from it (as do face specs set via Customize). 213rather than inheriting from it (as do face specs set via Customize).
200 214
215*** New face characteristic (supports :underline (:style wave))
216specifies whether or not the terminal can display a wavy line.
217
201** time-to-seconds is not obsolete any more. 218** time-to-seconds is not obsolete any more.
202** New function special-form-p. 219** New function special-form-p.
203** Docstrings can be made dynamic by adding a `dynamic-docstring-function' 220** Docstrings can be made dynamic by adding a `dynamic-docstring-function'
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a84165a0f74..4d16d1925eb 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1,10 +1,54 @@
1ORG NEWS -- history of user-visible changes. -*- org -*- 1ORG NEWS -- history of user-visible changes. -*- org -*-
2 2
3#+LINK: doc http://orgmode.org/worg/doc.html#%s
4
3Copyright (C) 2012-2013 Free Software Foundation, Inc. 5Copyright (C) 2012-2013 Free Software Foundation, Inc.
4See the end of the file for license conditions. 6See the end of the file for license conditions.
5 7
6Please send Org bug reports to emacs-orgmode@gnu.org. 8Please send Org bug reports to emacs-orgmode@gnu.org.
7 9
10* Version 7.9.3
11
12** New option [[doc::org-agenda-use-tag-inheritance][org-agenda-use-tag-inheritance]]
13
14[[doc::org-use-tag-inheritance][org-use-tag-inheritance]] controls whether tags are inherited when
15org-tags-view is called (either in =tags=, =tags-tree= or =tags-todo=
16agenda views.)
17
18When generating other agenda types such as =agenda=, =todo= and
19=todo-tree=, tags inheritance is not used when selecting the entries
20to display. Still, you might want to have all tag information correct
21in the agenda buffer, e.g. for tag filtering. In that case, add the
22agenda type to this variable.
23
24Setting this variable to nil should considerably speeds up the agenda
25generation.
26
27Note that the default was to display inherited tags in the agenda
28lines even if `org-use-tag-inheritance' was nil. The default is now
29to *never* display inherited tags in agenda lines, but to /know/ about
30them when the agenda type is listed in [[doc::org-agenda-use-tag-inheritance][org-agenda-use-tag-inheritance]].
31
32** New default value nil for [[doc::org-agenda-dim-blocked-tasks][org-agenda-dim-blocked-tasks]]
33
34Using `nil' as the default value speeds up the agenda generation. You
35can hit `#' (or `C-u #') in agenda buffers to temporarily dim (or turn
36invisible) blocked tasks.
37
38** New speedy keys for [[doc::org-speed-commands-default][org-speed-commands-default]]
39
40You can now use `:' (instead of `;') for setting tags---this is
41consistent with using the `:' key in agenda view.
42
43You can now use `=' for [[doc::org-columns][org-columns]].
44
45** =org-float= is now obsolete, use =diary-float= instead
46** Enhanced compatibility with Emacs 22 and XEmacs
47
48Thanks to Achim for his work on enhancing Org's compatibility with
49various Emacsen. Things may not be perfect, but Org should work okay
50in most environments.
51
8* Version 7.9.2 52* Version 7.9.2
9 53
10** New ELPA repository for Org packages 54** New ELPA repository for Org packages
diff --git a/etc/refcards/orgcard.pdf b/etc/refcards/orgcard.pdf
index ccc02ae7968..8fc57d9c6d8 100644
--- a/etc/refcards/orgcard.pdf
+++ b/etc/refcards/orgcard.pdf
Binary files differ
diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 487b72be464..651d7dd08eb 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -1,6 +1,6 @@
1% Reference Card for Org Mode 1% Reference Card for Org Mode
2\def\orgversionnumber{7.9.2} 2\def\orgversionnumber{7.9.3}
3\def\versionyear{2012} % latest update 3\def\versionyear{2013} % latest update
4\input emacsver.tex 4\input emacsver.tex
5 5
6%**start of header 6%**start of header
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 92b970eb778..2bdbebeb110 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,9 @@
12013-01-15 Paul Eggert <eggert@cs.ucla.edu>
2
3 * make-docfile.c (write_globals): Make it a bit clearer (Bug#13448).
4 This pacifies GCC 4.7.2 when Emacs is configured with
5 --enable-link-time-optimization and --enable-gcc-warnings.
6
12013-01-01 Juanma Barranquero <lekktu@gmail.com> 72013-01-01 Juanma Barranquero <lekktu@gmail.com>
2 8
3 * makefile.w32-in (lisp1): Add macroexp.elc (bug#13320). 9 * makefile.w32-in (lisp1): Add macroexp.elc (bug#13320).
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 54a53c0d441..68e5279fd15 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -624,7 +624,7 @@ write_globals (void)
624 qsort (globals, num_globals, sizeof (struct global), compare_globals); 624 qsort (globals, num_globals, sizeof (struct global), compare_globals);
625 for (i = 0; i < num_globals; ++i) 625 for (i = 0; i < num_globals; ++i)
626 { 626 {
627 char const *type; 627 char const *type = 0;
628 628
629 switch (globals[i].type) 629 switch (globals[i].type)
630 { 630 {
@@ -649,7 +649,7 @@ write_globals (void)
649 fatal ("not a recognized DEFVAR_", 0); 649 fatal ("not a recognized DEFVAR_", 0);
650 } 650 }
651 651
652 if (globals[i].type != FUNCTION) 652 if (type)
653 { 653 {
654 fprintf (outfile, " %s f_%s;\n", type, globals[i].name); 654 fprintf (outfile, " %s f_%s;\n", type, globals[i].name);
655 fprintf (outfile, "#define %s globals.f_%s\n", 655 fprintf (outfile, "#define %s globals.f_%s\n",
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 490994f860f..d9c7d8144ae 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -49,7 +49,9 @@
49 linkers. */ 49 linkers. */
50#if defined __GETOPT_PREFIX && !defined __need_getopt 50#if defined __GETOPT_PREFIX && !defined __need_getopt
51# if !@HAVE_GETOPT_H@ 51# if !@HAVE_GETOPT_H@
52# define __need_system_stdlib_h
52# include <stdlib.h> 53# include <stdlib.h>
54# undef __need_system_stdlib_h
53# include <stdio.h> 55# include <stdio.h>
54# include <unistd.h> 56# include <unistd.h>
55# endif 57# endif
diff --git a/lib/getopt_.h b/lib/getopt_.h
index 3f602dba2c6..dd958138b22 100644
--- a/lib/getopt_.h
+++ b/lib/getopt_.h
@@ -1,6 +1,6 @@
1/* Declarations for getopt. 1/* Declarations for getopt.
2 Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free 2 Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free Software
3 Software Foundation, Inc. 3 Foundation, Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
6 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
@@ -53,7 +53,9 @@
53 linkers. */ 53 linkers. */
54#if defined __GETOPT_PREFIX && !defined __need_getopt 54#if defined __GETOPT_PREFIX && !defined __need_getopt
55# if !HAVE_GETOPT_H 55# if !HAVE_GETOPT_H
56# define __need_system_stdlib_h
56# include <stdlib.h> 57# include <stdlib.h>
58# undef __need_system_stdlib_h
57# include <stdio.h> 59# include <stdio.h>
58# include <unistd.h> 60# include <unistd.h>
59# endif 61# endif
@@ -128,7 +130,7 @@
128 130
129/* The definition of _GL_ARG_NONNULL is copied here. */ 131/* The definition of _GL_ARG_NONNULL is copied here. */
130/* A C macro for declaring that specific arguments must not be NULL. 132/* A C macro for declaring that specific arguments must not be NULL.
131 Copyright (C) 2009-2012 Free Software Foundation, Inc. 133 Copyright (C) 2009-2013 Free Software Foundation, Inc.
132 134
133 This program is free software: you can redistribute it and/or modify it 135 This program is free software: you can redistribute it and/or modify it
134 under the terms of the GNU General Public License as published 136 under the terms of the GNU General Public License as published
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 6e5824b5b67..2db8b2e378b 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -39,7 +39,7 @@
39 Ideally we should test __BIONIC__ here, but it is only defined after 39 Ideally we should test __BIONIC__ here, but it is only defined after
40 <sys/cdefs.h> has been included; hence test __ANDROID__ instead. */ 40 <sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
41#if defined __ANDROID__ \ 41#if defined __ANDROID__ \
42 && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_ 42 && defined _SYS_TYPES_H_ && !defined __need_size_t
43# @INCLUDE_NEXT@ @NEXT_STDINT_H@ 43# @INCLUDE_NEXT@ @NEXT_STDINT_H@
44#else 44#else
45 45
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 3b3b4b1bd43..422ad714c32 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -20,8 +20,9 @@
20#endif 20#endif
21@PRAGMA_COLUMNS@ 21@PRAGMA_COLUMNS@
22 22
23#if defined __need_malloc_and_calloc 23#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
24/* Special invocation convention inside glibc header files. */ 24/* Special invocation conventions inside some gnulib header files,
25 and inside some glibc header files, respectively. */
25 26
26#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ 27#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
27 28
diff --git a/lib/strftime.c b/lib/strftime.c
index 213ced860de..91d5d85cbcf 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -208,7 +208,14 @@ extern char *tzname[];
208 else if (to_uppcase) \ 208 else if (to_uppcase) \
209 fwrite_uppcase (p, (s), _n); \ 209 fwrite_uppcase (p, (s), _n); \
210 else \ 210 else \
211 fwrite (s, _n, 1, p); \ 211 { \
212 /* Ignore the value of fwrite. The caller can determine whether \
213 an error occurred by inspecting ferror (P). All known fwrite \
214 implementations set the stream's error indicator when they \
215 fail due to ENOMEM etc., even though C11 and POSIX.1-2008 do \
216 not require this. */ \
217 fwrite (s, _n, 1, p); \
218 } \
212 } \ 219 } \
213 while (0) \ 220 while (0) \
214 ) 221 )
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 5127eecd603..f011b71d5f5 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -79,7 +79,9 @@
79/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ 79/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
80/* But avoid namespace pollution on glibc systems. */ 80/* But avoid namespace pollution on glibc systems. */
81#ifndef __GLIBC__ 81#ifndef __GLIBC__
82# define __need_system_stdlib_h
82# include <stdlib.h> 83# include <stdlib.h>
84# undef __need_system_stdlib_h
83#endif 85#endif
84 86
85/* Native Windows platforms declare chdir, getcwd, rmdir in 87/* Native Windows platforms declare chdir, getcwd, rmdir in
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f2c6b569126..f324ebbad51 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,480 @@
12013-01-15 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/nadvice.el (advice--tweak): Make it possible for `tweak'
4 to return an explicit nil.
5 (advice--remove-function): Change accordingly.
6
7 * emacs-lisp/advice.el (ad-preactivate-advice): Adjust the cleanup to
8 the use of nadvice.el.
9
10 * progmodes/which-func.el (which-function): Silence imenu errors
11 (bug#13433).
12
132013-01-15 Michael R. Mauger <mmaug@yahoo.com>
14
15 * progmodes/sql.el: (sql-imenu-generic-expression):
16 (sql-mode-font-lock-object-name): Match schema qualified names.
17 (sql-connect): Use string keys.
18 (sql-product-interactive): Wait for interpreter prompt.
19 (sql-comint-oracle): Set process coding based on NLS_LANG.
20
212013-01-15 Michael R. Mauger <mmaug@yahoo.com>
22
23 * progmodes/sql.el (sql-output-to-send): Remove, unused.
24 (sql-interactive-remove-continuation-prompt):
25 (sql-send-magic-terminator, sql-interactive-mode): Remove references.
26
272013-01-14 Leo Liu <sdl.web@gmail.com>
28
29 * calendar/calendar.el (calendar-redraw): Sync window-point and point.
30 (Bug#13420)
31
322013-01-14 Glenn Morris <rgm@gnu.org>
33
34 * progmodes/compile.el (compilation-error-regexp-alist-alist):
35 Fix interpretation of gnu line.col1-col2 format. (Bug#13335)
36
372013-01-13 Fabián Ezequiel Gallina <fgallina@cuca>
38
39 * progmodes/python.el (python-nav-end-of-statement):
40 Fix cornercase when handling multiline strings.
41
422013-01-13 Richard Stallman <rms@gnu.org>
43
44 * mail/sendmail.el (mail-position-on-field): Add doc string.
45
46 * mail/rmailmm.el (rmail-insert-mime-forwarded-message):
47 Get current message boundaries and pass them to
48 message-forward-make-body-mime. Minor style changes.
49
502013-01-13 Eli Zaretskii <eliz@gnu.org>
51
52 * cus-start.el (all): Avoid warnings about
53 scroll-bar-adjust-thumb-portion on platforms where it is not defined.
54
552013-01-11 Jan Djärv <jan.h.d@swipnet.se>
56
57 * cus-start.el (all): Add scroll-bar-adjust-thumb-portion.
58
592013-01-13 Stefan Monnier <monnier@iro.umontreal.ca>
60
61 * jit-lock.el (jit-lock-debug-mode): New minor mode.
62 (jit-lock--debug-fontifying): New var.
63 (jit-lock--debug-fontify): New function.
64 * subr.el (condition-case-unless-debug): Don't prevent catching the
65 error, just let the debbugger run.
66 * emacs-lisp/timer.el (timer-event-handler): Don't prevent debugging
67 timer code and don't drop errors silently.
68
692013-01-12 Michael Albinus <michael.albinus@gmx.de>
70
71 * autorevert.el (auto-revert-notify-watch-descriptor): Give it
72 `permanent-local' property.
73 (auto-revert-notify-handler): Use `file-equal-p'.
74
752013-01-12 Eli Zaretskii <eliz@gnu.org>
76
77 * autorevert.el (auto-revert-notify-handler): Fix filtering of
78 file notification by ACTION. For filtering by file name, compare
79 only the non-directory part of the file name.
80
812013-01-12 Stefan Monnier <monnier@iro.umontreal.ca>
82
83 * autorevert.el: Use cl-lib instead of cl.
84
85 * vc/vc-bzr.el (vc-bzr--sanitize-header): New function (bug#13307).
86 (vc-bzr-checkin): Use it.
87 * vc/log-edit.el (log-edit-extract-headers): Don't presume FUNCTION
88 will preserve match-data.
89
902013-01-11 Felix H. Dahlke <fhd@ubercode.de>
91
92 * progmodes/js.el: Fix multiline declarations's indentation (bug#8576).
93 (js--declaration-keyword-re): New var.
94 (js--multi-line-declaration-indentation): New function.
95 (js--proper-indentation): Use it.
96
972013-01-11 Aaron S. Hawley <Aaron.Hawley@vtinfo.com>
98
99 * calc/calc.el (calc-highlight-selections-with-faces)
100 (calc-dispatch):
101 * comint.el (comint-history-isearch-message):
102 * emacs-lisp/edebug.el (edebug-read, edebug-eval-defun):
103 * ffap.el (ffap-string-at-point-region, ffap-next)
104 (ffap-string-at-point, ffap-string-around)
105 (ffap-copy-string-as-kill, ffap-highlight-overlay)
106 (ffap-literally):
107 * font-lock.el (font-lock-keywords-alist)
108 (font-lock-removed-keywords-alist):
109 * help-mode.el (help-xref-symbol-regexp):
110 * info.el (Info-find-emacs-command-nodes):
111 * international/mule.el (add-to-coding-system-list):
112 * isearch.el (isearch-message-function, isearch-fail-pos):
113 * misearch.el (multi-isearch-next-buffer-function):
114 * newcomment.el (comment-box):
115 * printing.el (pr-txt-printer-alist, pr-ps-printer-alist)
116 (pr-setting-database):
117 * progmodes/cc-fonts.el (c-font-lock-keywords-3)
118 (c++-font-lock-keywords-3, objc-font-lock-keywords-3)
119 (java-font-lock-keywords-3, idl-font-lock-keywords-3)
120 (pike-font-lock-keywords-3):
121 * progmodes/compile.el (compile):
122 * progmodes/etags.el (tags-table-files)
123 (tags-table-files-function, tags-included-tables-function):
124 * progmodes/gdb-mi.el (gdb, gdb-setup-windows)
125 (gdb-restore-windows):
126 * ps-print.el (ps-even-or-odd-pages, ps-spool-buffer-with-faces)
127 (ps-n-up-filling-database):
128 * server.el (server-buffer, server-log):
129 * simple.el (newline, delete-backward-char, delete-forward-char)
130 (minibuffer-history-isearch-message, kill-line, track-eol)
131 (temporary-goal-column):
132 * textmodes/flyspell.el (flyspell-mark-duplications-flag)
133 (flyspell-default-deplacement-commands):
134 * textmodes/ispell.el (ispell-accept-output):
135 * textmodes/sgml-mode.el (html-tag-help):
136 * vc/compare-w.el (compare-ignore-whitespace)
137 (compare-ignore-case, compare-windows-dehighlight):
138 * vc/diff.el (diff):
139 * whitespace.el (whitespace-point)
140 (whitespace-font-lock-refontify, whitespace-bob-marker)
141 (whitespace-eob-marker): Fix ambiguous doc string cross-reference(s).
142
1432013-01-11 Michael Albinus <michael.albinus@gmx.de>
144
145 * autorevert.el (top): Require 'cl in order to pacify byte compiler.
146 (auto-revert-notify-rm-watch): Ignore errors.
147 (auto-revert-notify-add-watch): Ignore errors. Use '(modify) for
148 inotify, and '(size last-write-time) for w32notify.
149 Set buffer-local `auto-revert-use-notify' to nil when adding a file
150 watch fails - this is a fallback to the file modification check.
151 (auto-revert-notify-event-p, auto-revert-notify-event-descriptor)
152 (auto-revert-notify-event-action)
153 (auto-revert-notify-event-file-name): New defuns.
154 (auto-revert-notify-handler): Use them. Implement first
155 plausibility checks.
156 (auto-revert-handler): Handle also `auto-revert-tail-mode'.
157
1582013-01-11 Julien Danjou <julien@danjou.info>
159
160 * color.el (color-rgb-to-hsv): Fix conversion computing in case min and
161 max are almost equal. Also return the correct value for V which is
162 already between 0 and 1.
163
1642013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
165
166 * emacs-lisp/ert.el (ert-run-test): Use point-max-marker.
167
1682013-01-11 Eli Zaretskii <eliz@gnu.org>
169
170 * autorevert.el (auto-revert-notify-rm-watch)
171 (auto-revert-notify-add-watch): Fix typos in w32notify function
172 names.
173
1742013-01-10 Michael Albinus <michael.albinus@gmx.de>
175
176 * autorevert.el (auto-revert-notify-enabled): Move up.
177 (auto-revert-use-notify): New defcustom.
178 (auto-revert-mode, global-auto-revert-mode)
179 (auto-revert-notify-add-watch, auto-revert-handler)
180 (auto-revert-buffers): Use `auto-revert-use-notify' instead of
181 `auto-revert-notify-enabled'.
182
1832013-01-10 Elias Pipping <pipping@exherbo.org>
184
185 * files.el (auto-mode-alist): Use doc-view for djvu files (bug#13164).
186 * doc-view.el (doc-view-document->bitmap):
187 Use doc-view-single-page-converter-function instead of
188 single-page-converter arg; adjust callers.
189
1902013-01-10 Feng Li <fengli@gmail.com> (tiny change)
191
192 * progmodes/which-func.el (which-function): Understand Semantic's use
193 of overlays in imenu--index-alist.
194
1952013-01-10 Wolfgang Jenkner <wjenkner@inode.at>
196
197 * man.el: Handle different "man -k" behaviors (bug#13160). Use utf-8.
198 (Man-man-k-use-anchor): New var.
199 (Man-parse-man-k): New function.
200 (Man-completion-table): Use it.
201 (man): Flush the completion cache between uses.
202
2032013-01-10 Michael Albinus <michael.albinus@gmx.de>
204
205 * autorevert.el: Add file watch support.
206 (auto-revert-notify-enabled): New defconst.
207 (auto-revert-notify-watch-descriptor-hash-list)
208 (auto-revert-notify-watch-descriptor)
209 (auto-revert-notify-modified-p): New defvars.
210 (auto-revert-notify-rm-watch, auto-revert-notify-add-watch)
211 (auto-revert-notify-handler): New defuns.
212 (auto-revert-mode, global-auto-revert-mode): Remove file watches
213 when mode is disabled.
214 (auto-revert-handler): Check for `auto-revert-notify-modified-p'.
215 (auto-revert-buffers): Add file watches for active buffers.
216
2172013-01-10 Dmitry Antipov <dmantipov@yandex.ru>
218
219 * cus-start.el (toplevel): Only allow float values for
220 scroll-up-aggressively and scroll-down-aggressively.
221 Allow any number for line-spacing.
222
2232013-01-10 Stefan Monnier <monnier@iro.umontreal.ca>
224
225 * doc-view.el (doc-view-pdfdraw-program): Allow "pdfdraw" name.
226 (doc-view-pdf->png-converter-function): Use mupdf if available.
227 (doc-view-djvu->png-converter-function)
228 (doc-view-ps->png-converter-function): Remove.
229 (doc-view--image-file-pattern): Replace doc-view--image-file-extension.
230 (doc-view-goto-page, doc-view-convert-current-doc, doc-view-display)
231 (doc-view-already-converted-p): Adjust accordingly.
232 (doc-view-mode-p): Simplify.
233 (doc-view-enlarge): Use setq-local.
234 (doc-view-pdf->png-converter-ghostscript)
235 (doc-view-djvu->png-converter-ddjvu)
236 (doc-view-pdf->png-converter-mupdf): Rework to call
237 doc-view-start-process directly.
238 (doc-view-pdf/ps->png): Simplify accordingly.
239 (doc-view-pdf->png-1, doc-view-djvu->png-1): Remove.
240 (doc-view-document->bitmap): Rename from doc-view-document->png.
241 (doc-view-convert-current-doc): Merge pdf and djvu cases.
242 (doc-view-set-slice-from-bounding-box): Fix completion table.
243 (doc-view-mode): Use add-hook for after-revert-hook.
244
2452013-01-10 Glenn Morris <rgm@gnu.org>
246
247 * emacs-lisp/authors.el (authors-ignored-files)
248 (authors-valid-file-names, authors-renamed-files-alist):
249 Add some more entries.
250
2512013-01-10 Stefan Monnier <monnier@iro.umontreal.ca>
252
253 * image-mode.el (image-mode-winprops): Don't throw away the fallback
254 `t' pseudo-window entry.
255
2562013-01-10 Alan Mackenzie <acm@muc.de>
257
258 Fix bugs in the c-parse-state mechanism. Reuse some markers
259 instead of continually generating new ones.
260
261 * progmodes/cc-engine.el (c-state-old-cpp-beg-marker)
262 (c-state-old-cpp-end-marker): New variables.
263 (c-append-lower-brace-pair-to-state-cache): Start a backward
264 search for "}" definitively outside CPP constructs.
265 (c-remove-stale-state-cache): Inform the caller of a need to
266 search back for a brace pair in certain circumstances.
267 (c-state-maybe-marker): New macro.
268 (c-parse-state): Reuse markers when appropriate.
269
2702013-01-10 Glenn Morris <rgm@gnu.org>
271
272 * simple.el (execute-extended-command): Doc fix.
273 Bind prefix-arg around read-extended-command, for prompt. (Bug#13395)
274
2752013-01-10 Chong Yidong <cyd@gnu.org>
276
277 * faces.el (read-face-name): Doc fix.
278
2792013-01-10 Roland Winkler <winkler@gnu.org>
280
281 * emacs-lisp/crm.el: Allow any regexp for separators.
282 (crm-default-separator): All spaces around the default comma separator.
283 (crm--completion-command): New macro.
284 (crm-completion-help, crm-complete, crm-complete-word): Use it.
285 (crm-complete-and-exit): Handle non-single-char separators.
286
2872013-01-09 Elias Pipping <pipping@lavabit.com>
288
289 * doc-view.el: Add support for DjVu (bug#13164).
290 (doc-view-djvu->png-converter-function): New config var.
291 (doc-view-single-page-converter-function, doc-view--image-type)
292 (doc-view--image-file-extension): New vars.
293 (doc-view-mode): Initialize them.
294 (doc-view-goto-page): Use them.
295 (doc-view-mode-p): Add support for ddjvu.
296 (doc-view-djvu->png-converter-ddjvu, doc-view-djvu->png-1)
297 (doc-view-set-up-single-converter): New funs.
298 (doc-view-pdf/ps->png): Extend for djvu.
299 (doc-view-document->png): Rename from doc-view-pdf->png.
300 (doc-view-convert-current-doc): Handle djvu.
301 (doc-view-insert-image, doc-view-display)
302 (doc-view-already-converted-p): Don't hardcode png.
303 (doc-view-set-doc-type): Recognize djvu docs.
304
3052013-01-09 Elias Pipping <pipping@lavabit.com>
306
307 * doc-view.el: Add support for mupdf converter (bug#13164).
308 (doc-view-pdfdraw-program, doc-view-pdf->png-converter-function)
309 (doc-view-ps->png-converter-function): New config vars.
310 (doc-view-pdf->png-converter-ghostscript)
311 (doc-view-ps->png-converter-ghostscript)
312 (doc-view-pdf->png-converter-mupdf): New functions.
313 (doc-view-pdf/ps->png, doc-view-pdf->png-1): Use them.
314
3152013-01-09 Jürgen Hötzel <juergen@archlinux.org>
316
317 * net/tramp.el (tramp-eshell-directory-change): Check remote-path
318 first in session cache: When `tramp-own-remote-path' is in
319 `tramp-remote-path', the remote path is only set in the session
320 cache.
321
3222013-01-09 Glenn Morris <rgm@gnu.org>
323
324 * emacs-lisp/trace.el (trace-function-foreground)
325 (trace-function-background): Doc fix.
326
3272013-01-09 Juri Linkov <juri@jurta.org>
328
329 * international/mule-cmds.el (read-char-by-name): Move let-binding
330 of completion-ignore-case around completing-read to fix regression
331 exhibited by the test case `C-x 8 RET *acc TAB' and caused by
332 `string-match-p' using the nil value of `case-fold-search' and
333 `completion-ignore-case' in `completion-pcm--all-completions'.
334 (Bug#12615).
335
3362013-01-09 Glenn Morris <rgm@gnu.org>
337
338 * progmodes/compile.el (compilation-parse-errors):
339 Fix typo. (Bug#13369)
340
3412013-01-09 Vitalie Spinu <spinuvit@gmail.com> (tiny change)
342
343 * comint.el (comint-send-input): Check size of buffer before
344 waiting for process output, in case already accepted. (Bug#13290)
345
3462013-01-09 Paul Eggert <eggert@cs.ucla.edu>
347
348 Spelling fixes.
349 * net/tramp-adb.el (tramp-adb-get-toolbox):
350 Fix misspelling of 'unknown'.
351
3522013-01-08 Juri Linkov <juri@jurta.org>
353
354 * textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
355 * progmodes/flymake.el (flymake-errline, flymake-warnline):
356 Use underline style wave on terminals that support it. (Bug#13000)
357
3582013-01-08 Stefan Monnier <monnier@iro.umontreal.ca>
359
360 * emacs-lisp/pcase.el (pcase--split-equal): Also take advantage if
361 the predicate returns nil.
362
363 * simple.el: Use lexical-binding.
364 (primitive-undo): Use pcase.
365 (minibuffer-history-isearch-push-state): Use a closure.
366
3672013-01-08 Aaron S. Hawley <aaron.s.hawley@gmail.com>
368
369 * simple.el (primitive-undo): Move from undo.c.
370
3712013-01-08 Stefan Monnier <monnier@iro.umontreal.ca>
372
373 * vc/pcvs.el (cvs-cleanup-collection): Extend meaning of `rm-handled'.
374 (cvs-mode-remove-handled): Use it (bug#13380).
375
376 * emacs-lisp/nadvice.el (advice--tweak): New function.
377 (advice--remove-function, advice--subst-main): Use it.
378
379 * emacs-lisp/advice.el: Update commentary.
380
3812013-01-08 Michael Albinus <michael.albinus@gmx.de>
382
383 * net/tramp-adb.el (tramp-adb-file-name-handler-alist):
384 Remove spurious entry.
385
3862013-01-08 Glenn Morris <rgm@gnu.org>
387
388 * net/tramp.el (tramp-default-host-alist): Add :version.
389
3902013-01-08 Juri Linkov <juri@jurta.org>
391
392 * info.el (Info-read-node-name-2): Don't duplicate suffixes for
393 single completion. (Bug#12456)
394 (info--manual-names): Expand node completions into an explicit list
395 before appending it to another list. Filter out internal buffers
396 with the leading space in the buffer name. (Bug#10771)
397
3982013-01-08 Juri Linkov <juri@jurta.org>
399
400 * info.el (Info-read-node-name-1): Allow empty node name in (FILENAME)
401 that defaults to the Top node.
402 (Info-goto-node, Info-read-node-name): Doc fix to mention that
403 the short format (FILENAME) goes to the Top node.
404 (Info-build-node-completions): Rename arg `file' to `filename'.
405 (Bug#13365)
406
4072013-01-07 Bastien Guerry <bzg@gnu.org>
408
409 * menu-bar.el (menu-bar-search-documentation-menu):
410 Use `apropos-user-option' and fix the help message.
411
4122013-01-07 Bastien Guerry <bzg@gnu.org>
413
414 * apropos.el (apropos-do-all): Update docstring.
415 (apropos-user-option-button): New face.
416 (apropos-user-option): Rename from `apropos-variable' and update
417 docstring.
418 (apropos-variable): Rewrite, now show all variables by default.
419 (apropos-print): Mention "User option" instead of "Variable" when
420 printing doc for user options. (Bug#13276)
421
4222013-01-07 Jürgen Hötzel <juergen@archlinux.org>
423
424 * net/tramp-adb.el (tramp-do-parse-file-attributes-with-ls):
425 Handle filename correctly, when parsing "source -> target" symlink
426 output.
427 (tramp-adb-handle-set-file-times): New defun.
428
4292013-01-07 Stefan Monnier <monnier@iro.umontreal.ca>
430
431 * emacs-lisp/advice.el (ad-activate-advised-definition): Refresh the
432 advice list when the interactive-spec of ad-Advice-* changes.
433
4342013-01-07 Katsumi Yamaoka <yamaoka@jpl.org>
435
436 * wid-edit.el (widget-default-get): Work for inlined elements.
437 (Bug#12670)
438
4392013-01-07 Michael Albinus <michael.albinus@gmx.de>
440
441 * net/tramp.el (tramp-default-host-alist): New defcustom.
442 (tramp-find-host): Use it.
443 (tramp-eshell-directory-change): Move from tramp-sh.el. Add to
444 `eshell-directory-change-hook'.
445
446 * net/tramp-adb.el (top): Add adb specific entry in
447 `tramp-default-host-alist'.
448 (tramp-adb-file-name-host): Remove function.
449 (tramp-adb-execute-adb-command, tramp-adb-maybe-open-connection):
450 Use `tramp-file-name-host' instead of `tramp-adb-file-name-host'.
451
452 * net/tramp-sh.el: Move eshell integration code to tramp.el.
453
4542013-01-06 Jürgen Hötzel <juergen@archlinux.org>
455
456 * net/tramp-adb.el (tramp-methods): Add `tramp-tmpdir' entry.
457
4582013-01-06 Michael Albinus <michael.albinus@gmx.de>
459
460 * net/tramp-adb.el (tramp-adb-ls-toolbox-regexp): The file size can
461 consist of more than one digit.
462 (tramp-adb-file-name-handler-alist):
463 Use `tramp-handle-file-exists-p' consistently.
464 (tramp-adb-file-name-handler): Don't tweak `tramp-default-host'.
465 (tramp-adb-handle-file-exists-p): Remove function.
466 (tramp-adb-file-name-host): New defun.
467 (tramp-adb-execute-adb-command, tramp-adb-maybe-open-connection):
468 Use it.
469 (tramp-adb-maybe-open-connection): Set "remote-path" property.
470
4712013-01-06 Chong Yidong <cyd@gnu.org>
472
473 * vc/vc.el (vc-next-action): Detect buffer modifications
474 conflicting with locking VCS operation (Bug#11490).
475
476 * vc/vc-hooks.el (vc-after-save): DTRT for locking VCSes.
477
12013-01-05 Michael Albinus <michael.albinus@gmx.de> 4782013-01-05 Michael Albinus <michael.albinus@gmx.de>
2 479
3 * net/tramp-adb.el (tramp-do-parse-file-attributes-with-ls): 480 * net/tramp-adb.el (tramp-do-parse-file-attributes-with-ls):
@@ -117,8 +594,8 @@
117 (tramp-do-copy-or-rename-file): Ignore errors when calling 594 (tramp-do-copy-or-rename-file): Ignore errors when calling
118 `set-file-extended-attributes'. 595 `set-file-extended-attributes'.
119 596
120 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add 597 * net/tramp-smb.el (tramp-smb-file-name-handler-alist):
121 handler for `file-acl'. 598 Add handler for `file-acl'.
122 (tramp-smb-handle-file-acl): New defun. 599 (tramp-smb-handle-file-acl): New defun.
123 600
1242013-01-02 Jay Belanger <jay.p.belanger@gmail.com> 6012013-01-02 Jay Belanger <jay.p.belanger@gmail.com>
@@ -310,7 +787,7 @@
310 787
311 * net/tramp-adb.el (tramp-adb-get-ls-command): New defun. 788 * net/tramp-adb.el (tramp-adb-get-ls-command): New defun.
312 Suppress coloring, if possible (required for BusyBox based systems like 789 Suppress coloring, if possible (required for BusyBox based systems like
313 CynagenMod). 790 CyanogenMod).
314 (tramp-adb-handle-file-attributes) 791 (tramp-adb-handle-file-attributes)
315 (tramp-adb-handle-insert-directory) 792 (tramp-adb-handle-insert-directory)
316 (tramp-adb-handle-file-name-all-completions): Use it. 793 (tramp-adb-handle-file-name-all-completions): Use it.
@@ -5754,7 +6231,7 @@
5754 6231
57552012-08-08 Fabián Ezequiel Gallina <fgallina@cuca> 62322012-08-08 Fabián Ezequiel Gallina <fgallina@cuca>
5756 6233
5757 * progmodes/python.el Fixed defsubst warning. 6234 * progmodes/python.el: Fix defsubst warning.
5758 (python-syntax-context) Rename from python-info-ppss-context. 6235 (python-syntax-context) Rename from python-info-ppss-context.
5759 (python-syntax-context-type): Rename from 6236 (python-syntax-context-type): Rename from
5760 python-info-ppss-context-type. 6237 python-info-ppss-context-type.
@@ -11483,7 +11960,7 @@
11483 11960
114842012-03-16 Alan Mackenzie <acm@muc.de> 119612012-03-16 Alan Mackenzie <acm@muc.de>
11485 11962
11486 Further optimise the handling of large macros. 11963 Further optimize the handling of large macros.
11487 11964
11488 * progmodes/cc-engine.el (c-crosses-statement-barrier-p): Use a 11965 * progmodes/cc-engine.el (c-crosses-statement-barrier-p): Use a
11489 limit to a call of `c-literal-limits'. 11966 limit to a call of `c-literal-limits'.
@@ -13135,7 +13612,7 @@
13135 13612
131362012-01-08 Alan Mackenzie <acm@muc.de> 136132012-01-08 Alan Mackenzie <acm@muc.de>
13137 13614
13138 Optimise font locking in long enum definitions. 13615 Optimize font locking in long enum definitions.
13139 13616
13140 * progmodes/cc-fonts.el (c-font-lock-declarations): Add an extra 13617 * progmodes/cc-fonts.el (c-font-lock-declarations): Add an extra
13141 arm to a cond form to handle enums. 13618 arm to a cond form to handle enums.
diff --git a/lisp/apropos.el b/lisp/apropos.el
index 5f481f54e57..000d2d87d05 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -69,7 +69,7 @@
69 "Non nil means apropos commands will search more extensively. 69 "Non nil means apropos commands will search more extensively.
70This may be slower. This option affects the following commands: 70This may be slower. This option affects the following commands:
71 71
72`apropos-variable' will search all variables, not just user variables. 72`apropos-user-option' will search all variables, not just user options.
73`apropos-command' will also search non-interactive functions. 73`apropos-command' will also search non-interactive functions.
74`apropos' will search all symbols, not just functions, variables, faces, 74`apropos' will search all symbols, not just functions, variables, faces,
75and those with property lists. 75and those with property lists.
@@ -115,6 +115,12 @@ include key-binding information in its output."
115 :group 'apropos 115 :group 'apropos
116 :version "24.3") 116 :version "24.3")
117 117
118(defface apropos-user-option-button
119 '((t (:inherit (font-lock-variable-name-face button))))
120 "Button face indicating a user option in Apropos."
121 :group 'apropos
122 :version "24.4")
123
118(defface apropos-misc-button 124(defface apropos-misc-button
119 '((t (:inherit (font-lock-constant-face button)))) 125 '((t (:inherit (font-lock-constant-face button))))
120 "Button face indicating a miscellaneous object type in Apropos." 126 "Button face indicating a miscellaneous object type in Apropos."
@@ -261,6 +267,15 @@ term, and the rest of the words are alternative terms.")
261 'action (lambda (button) 267 'action (lambda (button)
262 (describe-variable (button-get button 'apropos-symbol)))) 268 (describe-variable (button-get button 'apropos-symbol))))
263 269
270(define-button-type 'apropos-user-option
271 'apropos-label "User option"
272 'apropos-short-label "o"
273 'face 'apropos-user-option-button
274 'help-echo "mouse-2, RET: Display more help on this user option"
275 'follow-link t
276 'action (lambda (button)
277 (describe-variable (button-get button 'apropos-symbol))))
278
264(define-button-type 'apropos-face 279(define-button-type 'apropos-face
265 'apropos-label "Face" 280 'apropos-label "Face"
266 'apropos-short-label "F" 281 'apropos-short-label "F"
@@ -461,15 +476,15 @@ This requires that at least 2 keywords (unless only one was given)."
461This is used to decide whether to print the result's type or not.") 476This is used to decide whether to print the result's type or not.")
462 477
463;;;###autoload 478;;;###autoload
464(defun apropos-variable (pattern &optional do-all) 479(defun apropos-user-option (pattern &optional do-all)
465 "Show user variables that match PATTERN. 480 "Show user options that match PATTERN.
466PATTERN can be a word, a list of words (separated by spaces), 481PATTERN can be a word, a list of words (separated by spaces),
467or a regexp (using some regexp special characters). If it is a word, 482or a regexp (using some regexp special characters). If it is a word,
468search for matches for that word as a substring. If it is a list of words, 483search for matches for that word as a substring. If it is a list of words,
469search for matches for any two (or more) of those words. 484search for matches for any two (or more) of those words.
470 485
471With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also show 486With \\[universal-argument] prefix, or if `apropos-do-all' is non-nil, also show
472normal variables." 487variables, not just user options."
473 (interactive (list (apropos-read-pattern 488 (interactive (list (apropos-read-pattern
474 (if (or current-prefix-arg apropos-do-all) 489 (if (or current-prefix-arg apropos-do-all)
475 "variable" "user option")) 490 "variable" "user option"))
@@ -481,6 +496,17 @@ normal variables."
481 (get symbol 'variable-documentation))) 496 (get symbol 'variable-documentation)))
482 'custom-variable-p))) 497 'custom-variable-p)))
483 498
499;;;###autoload
500(defun apropos-variable (pattern &optional do-not-all)
501 "Show variables that match PATTERN.
502When DO-NOT-ALL is not-nil, show user options only, i.e. behave
503like `apropos-user-option'."
504 (interactive (list (apropos-read-pattern
505 (if current-prefix-arg "user option" "variable"))
506 current-prefix-arg))
507 (let ((apropos-do-all (if do-not-all nil t)))
508 (apropos-user-option pattern)))
509
484;; For auld lang syne: 510;; For auld lang syne:
485;;;###autoload 511;;;###autoload
486(defalias 'command-apropos 'apropos-command) 512(defalias 'command-apropos 'apropos-command)
@@ -1099,7 +1125,11 @@ If non-nil TEXT is a string that will be printed as a heading."
1099 'apropos-macro 1125 'apropos-macro
1100 'apropos-function)) 1126 'apropos-function))
1101 (not nosubst)) 1127 (not nosubst))
1102 (apropos-print-doc 3 'apropos-variable (not nosubst)) 1128 (apropos-print-doc 3
1129 (if (custom-variable-p symbol)
1130 'apropos-user-option
1131 'apropos-variable)
1132 (not nosubst))
1103 (apropos-print-doc 7 'apropos-group t) 1133 (apropos-print-doc 7 'apropos-group t)
1104 (apropos-print-doc 6 'apropos-face t) 1134 (apropos-print-doc 6 'apropos-face t)
1105 (apropos-print-doc 5 'apropos-widget t) 1135 (apropos-print-doc 5 'apropos-widget t)
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index f491f2427be..c9180482cd9 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -48,6 +48,11 @@
48;; Emacs. You should never even notice that this package is active 48;; Emacs. You should never even notice that this package is active
49;; (except that your buffers will be reverted, of course). 49;; (except that your buffers will be reverted, of course).
50;; 50;;
51;; If Emacs is compiled with file watch support, notifications are
52;; used instead of checking the time stamp of the files. You can
53;; disable this by setting the user option `auto-revert-use-notify' to
54;; nil.
55;;
51;; After reverting a file buffer, Auto Revert Mode normally puts point 56;; After reverting a file buffer, Auto Revert Mode normally puts point
52;; at the same position that a regular manual revert would. However, 57;; at the same position that a regular manual revert would. However,
53;; there is one exception to this rule. If point is at the end of the 58;; there is one exception to this rule. If point is at the end of the
@@ -92,6 +97,7 @@
92 97
93;; Dependencies: 98;; Dependencies:
94 99
100(eval-when-compile (require 'cl-lib))
95(require 'timer) 101(require 'timer)
96 102
97;; Custom Group: 103;; Custom Group:
@@ -254,6 +260,28 @@ buffers. CPU usage depends on the version control system."
254This variable becomes buffer local when set in any fashion.") 260This variable becomes buffer local when set in any fashion.")
255(make-variable-buffer-local 'global-auto-revert-ignore-buffer) 261(make-variable-buffer-local 'global-auto-revert-ignore-buffer)
256 262
263(defconst auto-revert-notify-enabled
264 (or (featurep 'inotify) (featurep 'w32notify))
265 "Non-nil when Emacs has been compiled with file watch support.")
266
267(defcustom auto-revert-use-notify auto-revert-notify-enabled
268 "If non-nil Auto Revert Mode uses file watch functions.
269This requires Emacs being compiled with file watch support (see
270`auto-revert-notify-enabled'). You should set this variable
271through Custom only."
272 :group 'auto-revert
273 :type 'boolean
274 :set (lambda (variable value)
275 (set-default variable (and auto-revert-notify-enabled value))
276 (if (symbol-value variable)
277 (add-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)
278 (remove-hook 'kill-buffer-hook 'auto-revert-notify-rm-watch)
279 (when auto-revert-notify-enabled
280 (dolist (buf (buffer-list))
281 (with-current-buffer buf
282 (auto-revert-notify-rm-watch))))))
283 :version "24.4")
284
257;; Internal variables: 285;; Internal variables:
258 286
259(defvar auto-revert-buffer-list () 287(defvar auto-revert-buffer-list ()
@@ -276,6 +304,20 @@ the list of old buffers.")
276 (set (make-local-variable 'auto-revert-tail-pos) 304 (set (make-local-variable 'auto-revert-tail-pos)
277 (nth 7 (file-attributes buffer-file-name))))) 305 (nth 7 (file-attributes buffer-file-name)))))
278 306
307(defvar auto-revert-notify-watch-descriptor-hash-list
308 (make-hash-table :test 'equal)
309 "A hash table collecting all file watch descriptors.
310Hash key is a watch descriptor, hash value is the corresponding buffer.")
311
312(defvar auto-revert-notify-watch-descriptor nil
313 "The file watch descriptor active for the current buffer.")
314(put 'auto-revert-notify-watch-descriptor 'permanent-local t)
315
316(defvar auto-revert-notify-modified-p nil
317 "Non-nil when file has been modified on the file system.
318This has been reported by a file watch event.")
319(make-variable-buffer-local 'auto-revert-notify-modified-p)
320
279;; Functions: 321;; Functions:
280 322
281;;;###autoload 323;;;###autoload
@@ -296,6 +338,7 @@ without being changed in the part that is already in the buffer."
296 (if auto-revert-mode 338 (if auto-revert-mode
297 (if (not (memq (current-buffer) auto-revert-buffer-list)) 339 (if (not (memq (current-buffer) auto-revert-buffer-list))
298 (push (current-buffer) auto-revert-buffer-list)) 340 (push (current-buffer) auto-revert-buffer-list))
341 (when auto-revert-use-notify (auto-revert-notify-rm-watch))
299 (setq auto-revert-buffer-list 342 (setq auto-revert-buffer-list
300 (delq (current-buffer) auto-revert-buffer-list))) 343 (delq (current-buffer) auto-revert-buffer-list)))
301 (auto-revert-set-timer) 344 (auto-revert-set-timer)
@@ -399,9 +442,12 @@ It displays the text that `global-auto-revert-mode-text'
399specifies in the mode line." 442specifies in the mode line."
400 :global t :group 'auto-revert :lighter global-auto-revert-mode-text 443 :global t :group 'auto-revert :lighter global-auto-revert-mode-text
401 (auto-revert-set-timer) 444 (auto-revert-set-timer)
402 (when global-auto-revert-mode 445 (if global-auto-revert-mode
403 (auto-revert-buffers))) 446 (auto-revert-buffers)
404 447 (when auto-revert-use-notify
448 (dolist (buf (buffer-list))
449 (with-current-buffer buf
450 (auto-revert-notify-rm-watch))))))
405 451
406(defun auto-revert-set-timer () 452(defun auto-revert-set-timer ()
407 "Restart or cancel the timer used by Auto-Revert Mode. 453 "Restart or cancel the timer used by Auto-Revert Mode.
@@ -418,6 +464,83 @@ will use an up-to-date value of `auto-revert-interval'"
418 auto-revert-interval 464 auto-revert-interval
419 'auto-revert-buffers)))) 465 'auto-revert-buffers))))
420 466
467(defun auto-revert-notify-rm-watch ()
468 "Disable file watch for current buffer's associated file."
469 (when auto-revert-notify-watch-descriptor
470 (ignore-errors
471 (funcall (if (fboundp 'inotify-rm-watch)
472 'inotify-rm-watch 'w32notify-rm-watch)
473 auto-revert-notify-watch-descriptor))
474 (remhash auto-revert-notify-watch-descriptor
475 auto-revert-notify-watch-descriptor-hash-list))
476 (setq auto-revert-notify-watch-descriptor nil
477 auto-revert-notify-modified-p nil))
478
479(defun auto-revert-notify-add-watch ()
480 "Enable file watch for current buffer's associated file."
481 (when (and buffer-file-name auto-revert-use-notify)
482 (auto-revert-notify-rm-watch)
483 (let ((func (if (fboundp 'inotify-add-watch)
484 'inotify-add-watch 'w32notify-add-watch))
485 (aspect (if (fboundp 'inotify-add-watch)
486 '(modify) '(size last-write-time))))
487 (setq auto-revert-notify-watch-descriptor
488 (ignore-errors
489 (funcall
490 func buffer-file-name aspect 'auto-revert-notify-handler)))
491 (if auto-revert-notify-watch-descriptor
492 (puthash auto-revert-notify-watch-descriptor
493 (current-buffer)
494 auto-revert-notify-watch-descriptor-hash-list)
495 ;; Fallback to file checks.
496 (set (make-local-variable 'auto-revert-use-notify) nil)))))
497
498(defun auto-revert-notify-event-p (event)
499 "Check that event is a file watch event."
500 (cond ((featurep 'inotify)
501 (and (listp event) (= (length event) 4)))
502 ((featurep 'w32notify)
503 (and (listp event) (= (length event) 3) (stringp (nth 2 event))))))
504
505(defun auto-revert-notify-event-descriptor (event)
506 "Return watch descriptor of notification event, or nil."
507 (and (auto-revert-notify-event-p event) (car event)))
508
509(defun auto-revert-notify-event-action (event)
510 "Return action of notification event, or nil."
511 (and (auto-revert-notify-event-p event) (nth 1 event)))
512
513(defun auto-revert-notify-event-file-name (event)
514 "Return file name of notification event, or nil."
515 (and (auto-revert-notify-event-p event)
516 (cond ((featurep 'inotify) (nth 3 event))
517 ((featurep 'w32notify) (nth 2 event)))))
518
519(defun auto-revert-notify-handler (event)
520 "Handle an event returned from file watch."
521 (when (auto-revert-notify-event-p event)
522 (let* ((descriptor (auto-revert-notify-event-descriptor event))
523 (action (auto-revert-notify-event-action event))
524 (file (auto-revert-notify-event-file-name event))
525 (buffer (gethash descriptor
526 auto-revert-notify-watch-descriptor-hash-list)))
527 (ignore-errors
528 ;; Check, that event is meant for us.
529 ;; TODO: Filter events which stop watching, like `move' or `removed'.
530 (cl-assert descriptor)
531 (when (featurep 'inotify) (cl-assert (memq 'modify action)))
532 (when (featurep 'w32notify) (cl-assert (eq 'modified action)))
533 (cl-assert (bufferp buffer))
534 (with-current-buffer buffer
535 (when (and (stringp file) (stringp buffer-file-name))
536 ;; w32notify returns the basename of the file without its
537 ;; leading directories; inotify returns its full absolute
538 ;; file name.
539 (cl-assert (file-equal-p file buffer-file-name)))
540
541 ;; Mark buffer modified.
542 (setq auto-revert-notify-modified-p t))))))
543
421(defun auto-revert-active-p () 544(defun auto-revert-active-p ()
422 "Check if auto-revert is active (in current buffer or globally)." 545 "Check if auto-revert is active (in current buffer or globally)."
423 (or auto-revert-mode 546 (or auto-revert-mode
@@ -435,6 +558,8 @@ This is an internal function used by Auto-Revert Mode."
435 (let* ((buffer (current-buffer)) size 558 (let* ((buffer (current-buffer)) size
436 (revert 559 (revert
437 (or (and buffer-file-name 560 (or (and buffer-file-name
561 (or (not auto-revert-use-notify)
562 auto-revert-notify-modified-p)
438 (if auto-revert-tail-mode 563 (if auto-revert-tail-mode
439 ;; Tramp caches the file attributes. Setting 564 ;; Tramp caches the file attributes. Setting
440 ;; `remote-file-name-inhibit-cache' forces Tramp 565 ;; `remote-file-name-inhibit-cache' forces Tramp
@@ -456,6 +581,7 @@ This is an internal function used by Auto-Revert Mode."
456 (funcall buffer-stale-function t)))) 581 (funcall buffer-stale-function t))))
457 eob eoblist) 582 eob eoblist)
458 (when revert 583 (when revert
584 (setq auto-revert-notify-modified-p nil)
459 (when (and auto-revert-verbose 585 (when (and auto-revert-verbose
460 (not (eq revert 'fast))) 586 (not (eq revert 'fast)))
461 (message "Reverting buffer `%s'." (buffer-name))) 587 (message "Reverting buffer `%s'." (buffer-name)))
@@ -561,7 +687,12 @@ the timer when no buffers need to be checked."
561 (memq buf auto-revert-buffer-list)) 687 (memq buf auto-revert-buffer-list))
562 (setq auto-revert-buffer-list 688 (setq auto-revert-buffer-list
563 (delq buf auto-revert-buffer-list))) 689 (delq buf auto-revert-buffer-list)))
564 (when (auto-revert-active-p) (auto-revert-handler))) 690 (when (auto-revert-active-p)
691 ;; Enable file watches.
692 (when (and auto-revert-use-notify buffer-file-name
693 (not auto-revert-notify-watch-descriptor)
694 (auto-revert-notify-add-watch)))
695 (auto-revert-handler)))
565 ;; Remove dead buffer from `auto-revert-buffer-list'. 696 ;; Remove dead buffer from `auto-revert-buffer-list'.
566 (setq auto-revert-buffer-list 697 (setq auto-revert-buffer-list
567 (delq buf auto-revert-buffer-list)))) 698 (delq buf auto-revert-buffer-list))))
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 6f51be4b89b..c35e7650254 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -435,9 +435,9 @@ when converting units."
435(defcustom calc-highlight-selections-with-faces 435(defcustom calc-highlight-selections-with-faces
436 nil 436 nil
437 "If non-nil, use a separate face to indicate selected sub-formulas. 437 "If non-nil, use a separate face to indicate selected sub-formulas.
438If `calc-show-selections' is non-nil, then selected sub-formulas are shown 438If option `calc-show-selections' is non-nil, then selected sub-formulas are
439by displaying the rest of the formula in `calc-nonselected-face'. 439shown by displaying the rest of the formula in `calc-nonselected-face'.
440If `calc-show-selections' is nil, then selected sub-formulas are shown 440If option `calc-show-selections' is nil, then selected sub-formulas are shown
441by displaying the sub-formula in `calc-selected-face'." 441by displaying the sub-formula in `calc-selected-face'."
442 :version "24.1" 442 :version "24.1"
443 :group 'calc 443 :group 'calc
@@ -1183,7 +1183,7 @@ Used by `calc-user-invocation'.")
1183 1183
1184;;;###autoload 1184;;;###autoload
1185(defun calc-dispatch (&optional arg) 1185(defun calc-dispatch (&optional arg)
1186 "Invoke the GNU Emacs Calculator. See `calc-dispatch-help' for details." 1186 "Invoke the GNU Emacs Calculator. See \\[calc-dispatch-help] for details."
1187 (interactive "P") 1187 (interactive "P")
1188; (sit-for echo-keystrokes) 1188; (sit-for echo-keystrokes)
1189 (condition-case err ; look for other keys bound to calc-dispatch 1189 (condition-case err ; look for other keys bound to calc-dispatch
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 9b0eb3e9bff..74d3ce80338 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1562,11 +1562,13 @@ line."
1562(defun calendar-redraw () 1562(defun calendar-redraw ()
1563 "Redraw the calendar display, if `calendar-buffer' is live." 1563 "Redraw the calendar display, if `calendar-buffer' is live."
1564 (interactive) 1564 (interactive)
1565 (if (get-buffer calendar-buffer) 1565 (when (get-buffer calendar-buffer)
1566 (with-current-buffer calendar-buffer 1566 (with-current-buffer calendar-buffer
1567 (let ((cursor-date (calendar-cursor-to-nearest-date))) 1567 (let ((cursor-date (calendar-cursor-to-nearest-date)))
1568 (calendar-generate-window displayed-month displayed-year) 1568 (calendar-generate-window displayed-month displayed-year)
1569 (calendar-cursor-to-visible-date cursor-date))))) 1569 (calendar-cursor-to-visible-date cursor-date))
1570 (when (window-live-p (get-buffer-window))
1571 (set-window-point (get-buffer-window) (point))))))
1570 1572
1571(defvar calendar-mode-map 1573(defvar calendar-mode-map
1572 (let ((map (make-keymap))) 1574 (let ((map (make-keymap)))
diff --git a/lisp/color.el b/lisp/color.el
index 63326e7c5b3..50f6675bf4b 100644
--- a/lisp/color.el
+++ b/lisp/color.el
@@ -130,7 +130,7 @@ inclusive."
130 (max (max r g b)) 130 (max (max r g b))
131 (min (min r g b))) 131 (min (min r g b)))
132 (if (< (- max min) 1e-8) 132 (if (< (- max min) 1e-8)
133 (list 0.0 0.0 0.0) 133 (list 0.0 0.0 min)
134 (list 134 (list
135 (/ (* 2 float-pi 135 (/ (* 2 float-pi
136 (cond ((and (= r g) (= g b)) 0) 136 (cond ((and (= r g) (= g b)) 0)
@@ -146,7 +146,7 @@ inclusive."
146 (+ 240 (* 60 (/ (- r g) (- max min))))))) 146 (+ 240 (* 60 (/ (- r g) (- max min)))))))
147 360) 147 360)
148 (if (= max 0) 0 (- 1 (/ min max))) 148 (if (= max 0) 0 (- 1 (/ min max)))
149 (/ max 255.0))))) 149 max))))
150 150
151(defun color-rgb-to-hsl (red green blue) 151(defun color-rgb-to-hsl (red green blue)
152 "Convert RGB colors to their HSL representation. 152 "Convert RGB colors to their HSL representation.
diff --git a/lisp/comint.el b/lisp/comint.el
index e797fe841d3..21bd732b43c 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1521,7 +1521,7 @@ Intended to be added to `isearch-mode-hook' in `comint-mode'."
1521If there are no search errors, this function displays an overlay with 1521If there are no search errors, this function displays an overlay with
1522the Isearch prompt which replaces the original comint prompt. 1522the Isearch prompt which replaces the original comint prompt.
1523Otherwise, it displays the standard Isearch message returned from 1523Otherwise, it displays the standard Isearch message returned from
1524`isearch-message'." 1524the function `isearch-message'."
1525 (if (not (and isearch-success (not isearch-error))) 1525 (if (not (and isearch-success (not isearch-error)))
1526 ;; Use standard function `isearch-message' when not in comint prompt, 1526 ;; Use standard function `isearch-message' when not in comint prompt,
1527 ;; or search fails, or has an error (like incomplete regexp). 1527 ;; or search fails, or has an error (like incomplete regexp).
@@ -1847,9 +1847,9 @@ Similarly for Soar, Scheme, etc."
1847 (let ((echo-len (- comint-last-input-end 1847 (let ((echo-len (- comint-last-input-end
1848 comint-last-input-start))) 1848 comint-last-input-start)))
1849 ;; Wait for all input to be echoed: 1849 ;; Wait for all input to be echoed:
1850 (while (and (accept-process-output proc) 1850 (while (and (> (+ comint-last-input-end echo-len)
1851 (> (+ comint-last-input-end echo-len)
1852 (point-max)) 1851 (point-max))
1852 (accept-process-output proc)
1853 (zerop 1853 (zerop
1854 (compare-buffer-substrings 1854 (compare-buffer-substrings
1855 nil comint-last-input-start 1855 nil comint-last-input-start
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 9d2c2750987..62e91fafcbf 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -115,12 +115,12 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
115 (const :tag "On the right" (down . right)))) 115 (const :tag "On the right" (down . right))))
116 (other :tag "On left, no arrows" t))) 116 (other :tag "On left, no arrows" t)))
117 (scroll-up-aggressively windows 117 (scroll-up-aggressively windows
118 (choice (const :tag "off" nil) number) 118 (choice (const :tag "off" nil) float)
119 "21.1") 119 "21.1")
120 (scroll-down-aggressively windows 120 (scroll-down-aggressively windows
121 (choice (const :tag "off" nil) number) 121 (choice (const :tag "off" nil) float)
122 "21.1") 122 "21.1")
123 (line-spacing display (choice (const :tag "none" nil) integer) 123 (line-spacing display (choice (const :tag "none" nil) number)
124 "22.1") 124 "22.1")
125 (cursor-in-non-selected-windows 125 (cursor-in-non-selected-windows
126 cursor boolean nil 126 cursor boolean nil
@@ -513,6 +513,7 @@ since it could result in memory overflow and make Emacs crash."
513 (x-use-underline-position-properties display boolean "22.1") 513 (x-use-underline-position-properties display boolean "22.1")
514 (x-underline-at-descent-line display boolean "22.1") 514 (x-underline-at-descent-line display boolean "22.1")
515 (x-stretch-cursor display boolean "21.1") 515 (x-stretch-cursor display boolean "21.1")
516 (scroll-bar-adjust-thumb-portion windows boolean "24.4")
516 ;; xselect.c 517 ;; xselect.c
517 (x-select-enable-clipboard-manager killing boolean "24.1") 518 (x-select-enable-clipboard-manager killing boolean "24.1")
518 ;; xsettings.c 519 ;; xsettings.c
@@ -575,6 +576,9 @@ since it could result in memory overflow and make Emacs crash."
575 (symbol-name symbol)) 576 (symbol-name symbol))
576 ;; Any function from fontset.c will do. 577 ;; Any function from fontset.c will do.
577 (fboundp 'new-fontset)) 578 (fboundp 'new-fontset))
579 ((equal "scroll-bar-adjust-thumb-portion"
580 (symbol-name symbol))
581 (featurep 'x))
578 (t t)))) 582 (t t))))
579 (if (not (boundp symbol)) 583 (if (not (boundp symbol))
580 ;; If variables are removed from C code, give an error here! 584 ;; If variables are removed from C code, give an error here!
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 24434d294c6..fa54eef828d 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -145,7 +145,7 @@
145;;;; Customization Options 145;;;; Customization Options
146 146
147(defgroup doc-view nil 147(defgroup doc-view nil
148 "In-buffer viewer for PDF, PostScript and DVI files." 148 "In-buffer viewer for PDF, PostScript, DVI, and DJVU files."
149 :link '(function-link doc-view) 149 :link '(function-link doc-view)
150 :version "22.2" 150 :version "22.2"
151 :group 'applications 151 :group 'applications
@@ -158,6 +158,27 @@
158 :type 'file 158 :type 'file
159 :group 'doc-view) 159 :group 'doc-view)
160 160
161(defcustom doc-view-pdfdraw-program
162 (cond
163 ((executable-find "pdfdraw") "pdfdraw")
164 (t "mudraw"))
165 "Name of MuPDF's program to convert PDF files to PNG."
166 :type 'file
167 :version "24.4")
168
169(defcustom doc-view-pdf->png-converter-function
170 (if (executable-find doc-view-pdfdraw-program)
171 #'doc-view-pdf->png-converter-mupdf
172 #'doc-view-pdf->png-converter-ghostscript)
173 "Function to call to convert a PDF file into a PNG file."
174 :type '(radio
175 (function-item doc-view-pdf->png-converter-ghostscript
176 :doc "Use ghostscript")
177 (function-item doc-view-pdf->png-converter-mupdf
178 :doc "Use mupdf")
179 function)
180 :version "24.4")
181
161(defcustom doc-view-ghostscript-options 182(defcustom doc-view-ghostscript-options
162 '("-dSAFER" ;; Avoid security problems when rendering files from untrusted 183 '("-dSAFER" ;; Avoid security problems when rendering files from untrusted
163 ;; sources. 184 ;; sources.
@@ -320,6 +341,19 @@ the (uncompressed, extracted) file residing in
320 "The type of document in the current buffer. 341 "The type of document in the current buffer.
321Can be `dvi', `pdf', or `ps'.") 342Can be `dvi', `pdf', or `ps'.")
322 343
344(defvar doc-view-single-page-converter-function nil
345 "Function to call to convert a single page of the document to a bitmap file.
346May operate on the source document or on some intermediate (typically PDF)
347conversion of it.")
348
349(defvar-local doc-view--image-type nil
350 "The type of image in the current buffer.
351Can be `png' or `tiff'.")
352
353(defvar-local doc-view--image-file-pattern nil
354 "The `format' pattern of image file names.
355Typically \"page-%s.png\".")
356
323;;;; DocView Keymaps 357;;;; DocView Keymaps
324 358
325(defvar doc-view-mode-map 359(defvar doc-view-mode-map
@@ -458,24 +492,26 @@ Can be `dvi', `pdf', or `ps'.")
458 ;; We used to find the file name from doc-view-current-files but 492 ;; We used to find the file name from doc-view-current-files but
459 ;; that's not right if the pages are not generated sequentially 493 ;; that's not right if the pages are not generated sequentially
460 ;; or if the page isn't in doc-view-current-files yet. 494 ;; or if the page isn't in doc-view-current-files yet.
461 (let ((file (expand-file-name (format "page-%d.png" page) 495 (let ((file (expand-file-name
462 (doc-view-current-cache-dir)))) 496 (format doc-view--image-file-pattern page)
497 (doc-view-current-cache-dir))))
463 (doc-view-insert-image file :pointer 'arrow) 498 (doc-view-insert-image file :pointer 'arrow)
464 (set-window-hscroll (selected-window) hscroll) 499 (set-window-hscroll (selected-window) hscroll)
465 (when (and (not (file-exists-p file)) 500 (when (and (not (file-exists-p file))
466 doc-view-current-converter-processes) 501 doc-view-current-converter-processes)
467 ;; The PNG file hasn't been generated yet. 502 ;; The PNG file hasn't been generated yet.
468 (doc-view-pdf->png-1 doc-view-buffer-file-name file page 503 (funcall doc-view-single-page-converter-function
469 (let ((win (selected-window))) 504 doc-view-buffer-file-name file page
470 (lambda () 505 (let ((win (selected-window)))
471 (and (eq (current-buffer) (window-buffer win)) 506 (lambda ()
472 ;; If we changed page in the mean 507 (and (eq (current-buffer) (window-buffer win))
473 ;; time, don't mess things up. 508 ;; If we changed page in the mean
474 (eq (doc-view-current-page win) page) 509 ;; time, don't mess things up.
475 ;; Make sure we don't infloop. 510 (eq (doc-view-current-page win) page)
476 (file-readable-p file) 511 ;; Make sure we don't infloop.
477 (with-selected-window win 512 (file-readable-p file)
478 (doc-view-goto-page page)))))))) 513 (with-selected-window win
514 (doc-view-goto-page page))))))))
479 (overlay-put (doc-view-current-overlay) 515 (overlay-put (doc-view-current-overlay)
480 'help-echo (doc-view-current-info)))) 516 'help-echo (doc-view-current-info))))
481 517
@@ -659,14 +695,16 @@ OpenDocument format)."
659 (executable-find doc-view-dvipdf-program)) 695 (executable-find doc-view-dvipdf-program))
660 (and doc-view-dvipdfm-program 696 (and doc-view-dvipdfm-program
661 (executable-find doc-view-dvipdfm-program))))) 697 (executable-find doc-view-dvipdfm-program)))))
662 ((or (eq type 'postscript) (eq type 'ps) (eq type 'eps) 698 ((memq type '(postscript ps eps pdf))
663 (eq type 'pdf)) 699 ;; FIXME: allow mupdf here
664 (and doc-view-ghostscript-program 700 (and doc-view-ghostscript-program
665 (executable-find doc-view-ghostscript-program))) 701 (executable-find doc-view-ghostscript-program)))
666 ((eq type 'odf) 702 ((eq type 'odf)
667 (and doc-view-unoconv-program 703 (and doc-view-unoconv-program
668 (executable-find doc-view-unoconv-program) 704 (executable-find doc-view-unoconv-program)
669 (doc-view-mode-p 'pdf))) 705 (doc-view-mode-p 'pdf)))
706 ((eq type 'djvu)
707 (executable-find "ddjvu"))
670 (t ;; unknown image type 708 (t ;; unknown image type
671 nil)))) 709 nil))))
672 710
@@ -683,13 +721,13 @@ OpenDocument format)."
683 ;; ImageMagick supports on-the-fly-rescaling. 721 ;; ImageMagick supports on-the-fly-rescaling.
684 (let ((new (ceiling (* factor doc-view-image-width)))) 722 (let ((new (ceiling (* factor doc-view-image-width))))
685 (unless (equal new doc-view-image-width) 723 (unless (equal new doc-view-image-width)
686 (set (make-local-variable 'doc-view-image-width) new) 724 (setq-local doc-view-image-width new)
687 (doc-view-insert-image 725 (doc-view-insert-image
688 (plist-get (cdr (doc-view-current-image)) :file) 726 (plist-get (cdr (doc-view-current-image)) :file)
689 :width doc-view-image-width))) 727 :width doc-view-image-width)))
690 (let ((new (ceiling (* factor doc-view-resolution)))) 728 (let ((new (ceiling (* factor doc-view-resolution))))
691 (unless (equal new doc-view-resolution) 729 (unless (equal new doc-view-resolution)
692 (set (make-local-variable 'doc-view-resolution) new) 730 (setq-local doc-view-resolution new)
693 (doc-view-reconvert-doc))))) 731 (doc-view-reconvert-doc)))))
694 732
695(defun doc-view-shrink (factor) 733(defun doc-view-shrink (factor)
@@ -826,6 +864,45 @@ Should be invoked when the cached images aren't up-to-date."
826 (list "-o" pdf dvi) 864 (list "-o" pdf dvi)
827 callback))) 865 callback)))
828 866
867(defun doc-view-pdf->png-converter-ghostscript (pdf png page callback)
868 (doc-view-start-process
869 "pdf/ps->png" doc-view-ghostscript-program
870 `(,@doc-view-ghostscript-options
871 ,(format "-r%d" (round doc-view-resolution))
872 ,@(if page `(,(format "-dFirstPage=%d" page)))
873 ,@(if page `(,(format "-dLastPage=%d" page)))
874 ,(concat "-sOutputFile=" png)
875 ,pdf)
876 callback))
877
878(defalias 'doc-view-ps->png-converter-ghostscript
879 'doc-view-pdf->png-converter-ghostscript)
880
881(defun doc-view-djvu->tiff-converter-ddjvu (djvu tiff page callback)
882 "Convert PAGE of a DJVU file to bitmap(s) asynchronously.
883Call CALLBACK with no arguments when done.
884If PAGE is nil, convert the whole document."
885 (doc-view-start-process
886 "djvu->tiff" "ddjvu"
887 `("-format=tiff"
888 ;; ddjvu only accepts the range 1-999.
889 ,(format "-scale=%d" (round doc-view-resolution))
890 ;; -eachpage was only added after djvulibre-3.5.25.3!
891 ,@(unless page '("-eachpage"))
892 ,@(if page `(,(format "-page=%d" page)))
893 ,djvu
894 ,tiff)
895 callback))
896
897(defun doc-view-pdf->png-converter-mupdf (pdf png page callback)
898 (doc-view-start-process
899 "pdf->png" doc-view-pdfdraw-program
900 `(,(concat "-o" png)
901 ,(format "-r%d" (round doc-view-resolution))
902 ,pdf
903 ,@(if page `(,(format "%d" page))))
904 callback))
905
829(defun doc-view-odf->pdf (odf callback) 906(defun doc-view-odf->pdf (odf callback)
830 "Convert ODF to PDF asynchronously and call CALLBACK when finished. 907 "Convert ODF to PDF asynchronously and call CALLBACK when finished.
831The converted PDF is put into the current cache directory, and it 908The converted PDF is put into the current cache directory, and it
@@ -835,13 +912,14 @@ is named like ODF with the extension turned to pdf."
835 callback)) 912 callback))
836 913
837(defun doc-view-pdf/ps->png (pdf-ps png) 914(defun doc-view-pdf/ps->png (pdf-ps png)
915 ;; FIXME: Fix name and docstring to account for djvu&tiff.
838 "Convert PDF-PS to PNG asynchronously." 916 "Convert PDF-PS to PNG asynchronously."
839 (doc-view-start-process 917 (funcall
840 "pdf/ps->png" doc-view-ghostscript-program 918 (pcase doc-view-doc-type
841 (append doc-view-ghostscript-options 919 (`pdf doc-view-pdf->png-converter-function)
842 (list (format "-r%d" (round doc-view-resolution)) 920 (`djvu #'doc-view-djvu->tiff-converter-ddjvu)
843 (concat "-sOutputFile=" png) 921 (_ #'doc-view-ps->png-converter-ghostscript))
844 pdf-ps)) 922 pdf-ps png nil
845 (let ((resolution doc-view-resolution)) 923 (let ((resolution doc-view-resolution))
846 (lambda () 924 (lambda ()
847 ;; Only create the resolution file when it's all done, so it also 925 ;; Only create the resolution file when it's all done, so it also
@@ -854,6 +932,7 @@ is named like ODF with the extension turned to pdf."
854 (cancel-timer doc-view-current-timer) 932 (cancel-timer doc-view-current-timer)
855 (setq doc-view-current-timer nil)) 933 (setq doc-view-current-timer nil))
856 (doc-view-display (current-buffer) 'force)))) 934 (doc-view-display (current-buffer) 'force))))
935
857 ;; Update the displayed pages as soon as they're done generating. 936 ;; Update the displayed pages as soon as they're done generating.
858 (when doc-view-conversion-refresh-interval 937 (when doc-view-conversion-refresh-interval
859 (setq doc-view-current-timer 938 (setq doc-view-current-timer
@@ -861,25 +940,10 @@ is named like ODF with the extension turned to pdf."
861 'doc-view-display 940 'doc-view-display
862 (current-buffer))))) 941 (current-buffer)))))
863 942
864(defun doc-view-pdf->png-1 (pdf png page callback)
865 "Convert a PAGE of a PDF file to PNG asynchronously.
866Call CALLBACK with no arguments when done."
867 (doc-view-start-process
868 "pdf->png-1" doc-view-ghostscript-program
869 (append doc-view-ghostscript-options
870 (list (format "-r%d" (round doc-view-resolution))
871 ;; Sadly, `gs' only supports the page-range
872 ;; for PDF files.
873 (format "-dFirstPage=%d" page)
874 (format "-dLastPage=%d" page)
875 (concat "-sOutputFile=" png)
876 pdf))
877 callback))
878
879(declare-function clear-image-cache "image.c" (&optional filter)) 943(declare-function clear-image-cache "image.c" (&optional filter))
880 944
881(defun doc-view-pdf->png (pdf png pages) 945(defun doc-view-document->bitmap (pdf png pages)
882 "Convert a PDF file to PNG asynchronously. 946 "Convert a document file to bitmap images asynchronously.
883Start by converting PAGES, and then the rest." 947Start by converting PAGES, and then the rest."
884 (if (null pages) 948 (if (null pages)
885 (doc-view-pdf/ps->png pdf png) 949 (doc-view-pdf/ps->png pdf png)
@@ -888,11 +952,11 @@ Start by converting PAGES, and then the rest."
888 ;; a single page anyway, and of the remaining 1%, few cases will have 952 ;; a single page anyway, and of the remaining 1%, few cases will have
889 ;; consecutive pages, it's not worth the trouble. 953 ;; consecutive pages, it's not worth the trouble.
890 (let ((rest (cdr pages))) 954 (let ((rest (cdr pages)))
891 (doc-view-pdf->png-1 955 (funcall doc-view-single-page-converter-function
892 pdf (format png (car pages)) (car pages) 956 pdf (format png (car pages)) (car pages)
893 (lambda () 957 (lambda ()
894 (if rest 958 (if rest
895 (doc-view-pdf->png pdf png rest) 959 (doc-view-document->bitmap pdf png rest)
896 ;; Yippie, the important pages are done, update the display. 960 ;; Yippie, the important pages are done, update the display.
897 (clear-image-cache) 961 (clear-image-cache)
898 ;; For the windows that have a message (like "Welcome to 962 ;; For the windows that have a message (like "Welcome to
@@ -900,8 +964,8 @@ Start by converting PAGES, and then the rest."
900 ;; not sufficient. 964 ;; not sufficient.
901 (dolist (win (get-buffer-window-list (current-buffer) nil 'visible)) 965 (dolist (win (get-buffer-window-list (current-buffer) nil 'visible))
902 (with-selected-window win 966 (with-selected-window win
903 (when (stringp (get-char-property (point-min) 'display)) 967 (when (stringp (get-char-property (point-min) 'display))
904 (doc-view-goto-page (doc-view-current-page))))) 968 (doc-view-goto-page (doc-view-current-page)))))
905 ;; Convert the rest of the pages. 969 ;; Convert the rest of the pages.
906 (doc-view-pdf/ps->png pdf png))))))) 970 (doc-view-pdf/ps->png pdf png)))))))
907 971
@@ -971,8 +1035,9 @@ Those files are saved in the directory given by the function
971 ;; preserves the horizontal/vertical scroll settings (which are otherwise 1035 ;; preserves the horizontal/vertical scroll settings (which are otherwise
972 ;; resets during the redisplay). 1036 ;; resets during the redisplay).
973 (setq doc-view-pending-cache-flush t) 1037 (setq doc-view-pending-cache-flush t)
974 (let ((png-file (expand-file-name "page-%d.png" 1038 (let ((png-file (expand-file-name
975 (doc-view-current-cache-dir)))) 1039 (format doc-view--image-file-pattern "%d")
1040 (doc-view-current-cache-dir))))
976 (make-directory (doc-view-current-cache-dir) t) 1041 (make-directory (doc-view-current-cache-dir) t)
977 (pcase doc-view-doc-type 1042 (pcase doc-view-doc-type
978 (`dvi 1043 (`dvi
@@ -985,11 +1050,12 @@ Those files are saved in the directory given by the function
985 ;; ODF files have to be converted to PDF before Ghostscript can 1050 ;; ODF files have to be converted to PDF before Ghostscript can
986 ;; process it. 1051 ;; process it.
987 (let ((pdf (doc-view-current-cache-doc-pdf)) 1052 (let ((pdf (doc-view-current-cache-doc-pdf))
988 (opdf (expand-file-name (concat (file-name-base doc-view-buffer-file-name) 1053 (opdf (expand-file-name
989 ".pdf") 1054 (concat (file-name-base doc-view-buffer-file-name)
990 doc-view-current-cache-dir)) 1055 ".pdf")
1056 doc-view-current-cache-dir))
991 (png-file png-file)) 1057 (png-file png-file))
992 ;; The unoconv tool only supports a output directory, but no 1058 ;; The unoconv tool only supports an output directory, but no
993 ;; file name. It's named like the input file with the 1059 ;; file name. It's named like the input file with the
994 ;; extension replaced by pdf. 1060 ;; extension replaced by pdf.
995 (doc-view-odf->pdf doc-view-buffer-file-name 1061 (doc-view-odf->pdf doc-view-buffer-file-name
@@ -997,10 +1063,10 @@ Those files are saved in the directory given by the function
997 ;; Rename to doc.pdf 1063 ;; Rename to doc.pdf
998 (rename-file opdf pdf) 1064 (rename-file opdf pdf)
999 (doc-view-pdf/ps->png pdf png-file))))) 1065 (doc-view-pdf/ps->png pdf png-file)))))
1000 (`pdf 1066 ((or `pdf `djvu)
1001 (let ((pages (doc-view-active-pages))) 1067 (let ((pages (doc-view-active-pages)))
1002 ;; Convert PDF to PNG images starting with the active pages. 1068 ;; Convert doc to bitmap images starting with the active pages.
1003 (doc-view-pdf->png doc-view-buffer-file-name png-file pages))) 1069 (doc-view-document->bitmap doc-view-buffer-file-name png-file pages)))
1004 (_ 1070 (_
1005 ;; Convert to PNG images. 1071 ;; Convert to PNG images.
1006 (doc-view-pdf/ps->png doc-view-buffer-file-name png-file))))) 1072 (doc-view-pdf/ps->png doc-view-buffer-file-name png-file)))))
@@ -1111,9 +1177,10 @@ much more accurate than could be done manually using
1111 (let* ((is (image-size (doc-view-current-image) t)) 1177 (let* ((is (image-size (doc-view-current-image) t))
1112 (iw (car is)) 1178 (iw (car is))
1113 (ih (cdr is)) 1179 (ih (cdr is))
1114 (ps (or (and (null force-paper-size) (doc-view-guess-paper-size iw ih)) 1180 (ps (or (and (null force-paper-size)
1181 (doc-view-guess-paper-size iw ih))
1115 (intern (completing-read "Paper size: " 1182 (intern (completing-read "Paper size: "
1116 (mapcar #'car doc-view-paper-sizes) 1183 doc-view-paper-sizes
1117 nil t)))) 1184 nil t))))
1118 (bb (doc-view-scale-bounding-box ps iw ih bb)) 1185 (bb (doc-view-scale-bounding-box ps iw ih bb))
1119 (x1 (nth 0 bb)) 1186 (x1 (nth 0 bb))
@@ -1144,7 +1211,7 @@ ARGS is a list of image descriptors."
1144 (image (if (and file (file-readable-p file)) 1211 (image (if (and file (file-readable-p file))
1145 (if (not (and doc-view-scale-internally 1212 (if (not (and doc-view-scale-internally
1146 (fboundp 'imagemagick-types))) 1213 (fboundp 'imagemagick-types)))
1147 (apply 'create-image file 'png nil args) 1214 (apply 'create-image file doc-view--image-type nil args)
1148 (unless (member :width args) 1215 (unless (member :width args)
1149 (setq args `(,@args :width ,doc-view-image-width))) 1216 (setq args `(,@args :width ,doc-view-image-width)))
1150 (apply 'create-image file 'imagemagick nil args)))) 1217 (apply 'create-image file 'imagemagick nil args))))
@@ -1194,13 +1261,16 @@ have the page we want to view."
1194 (let ((prev-pages doc-view-current-files)) 1261 (let ((prev-pages doc-view-current-files))
1195 (setq doc-view-current-files 1262 (setq doc-view-current-files
1196 (sort (directory-files (doc-view-current-cache-dir) t 1263 (sort (directory-files (doc-view-current-cache-dir) t
1197 "page-[0-9]+\\.png" t) 1264 (format doc-view--image-file-pattern
1265 "[0-9]+")
1266 t)
1198 'doc-view-sort)) 1267 'doc-view-sort))
1199 (dolist (win (or (get-buffer-window-list buffer nil t) 1268 (dolist (win (or (get-buffer-window-list buffer nil t)
1200 (list t))) 1269 (list t)))
1201 (let* ((page (doc-view-current-page win)) 1270 (let* ((page (doc-view-current-page win))
1202 (pagefile (expand-file-name (format "page-%d.png" page) 1271 (pagefile (expand-file-name
1203 (doc-view-current-cache-dir)))) 1272 (format doc-view--image-file-pattern page)
1273 (doc-view-current-cache-dir))))
1204 (when (or force 1274 (when (or force
1205 (and (not (member pagefile prev-pages)) 1275 (and (not (member pagefile prev-pages))
1206 (member pagefile doc-view-current-files))) 1276 (member pagefile doc-view-current-files)))
@@ -1265,7 +1335,7 @@ For now these keys are useful:
1265 (doc-view-kill-proc) 1335 (doc-view-kill-proc)
1266 (setq buffer-read-only nil) 1336 (setq buffer-read-only nil)
1267 (remove-overlays (point-min) (point-max) 'doc-view t) 1337 (remove-overlays (point-min) (point-max) 'doc-view t)
1268 (set (make-local-variable 'image-mode-winprops-alist) t) 1338 (setq-local image-mode-winprops-alist t)
1269 ;; Switch to the previously used major mode or fall back to 1339 ;; Switch to the previously used major mode or fall back to
1270 ;; normal mode. 1340 ;; normal mode.
1271 (doc-view-fallback-mode) 1341 (doc-view-fallback-mode)
@@ -1393,12 +1463,13 @@ If BACKWARD is non-nil, jump to the previous match."
1393 ;; the conversion is incomplete. 1463 ;; the conversion is incomplete.
1394 (file-readable-p (expand-file-name "resolution.el" 1464 (file-readable-p (expand-file-name "resolution.el"
1395 (doc-view-current-cache-dir))) 1465 (doc-view-current-cache-dir)))
1396 (> (length (directory-files (doc-view-current-cache-dir) 1466 (> (length (directory-files
1397 nil "\\.png\\'")) 1467 (doc-view-current-cache-dir)
1468 nil (format doc-view--image-file-pattern "[0-9]+")))
1398 0))) 1469 0)))
1399 1470
1400(defun doc-view-initiate-display () 1471(defun doc-view-initiate-display ()
1401 ;; Switch to image display if possible 1472 ;; Switch to image display if possible.
1402 (if (doc-view-mode-p doc-view-doc-type) 1473 (if (doc-view-mode-p doc-view-doc-type)
1403 (progn 1474 (progn
1404 (doc-view-buffer-message) 1475 (doc-view-buffer-message)
@@ -1406,7 +1477,7 @@ If BACKWARD is non-nil, jump to the previous match."
1406 (if (doc-view-already-converted-p) 1477 (if (doc-view-already-converted-p)
1407 (progn 1478 (progn
1408 (message "DocView: using cached files!") 1479 (message "DocView: using cached files!")
1409 ;; Load the saved resolution 1480 ;; Load the saved resolution.
1410 (let* ((res-file (expand-file-name "resolution.el" 1481 (let* ((res-file (expand-file-name "resolution.el"
1411 (doc-view-current-cache-dir))) 1482 (doc-view-current-cache-dir)))
1412 (res 1483 (res
@@ -1415,7 +1486,7 @@ If BACKWARD is non-nil, jump to the previous match."
1415 (insert-file-contents res-file) 1486 (insert-file-contents res-file)
1416 (read (current-buffer)))))) 1487 (read (current-buffer))))))
1417 (when (numberp res) 1488 (when (numberp res)
1418 (set (make-local-variable 'doc-view-resolution) res))) 1489 (setq-local doc-view-resolution res)))
1419 (doc-view-display (current-buffer) 'force)) 1490 (doc-view-display (current-buffer) 'force))
1420 (doc-view-convert-current-doc)) 1491 (doc-view-convert-current-doc))
1421 (message 1492 (message
@@ -1467,6 +1538,8 @@ If BACKWARD is non-nil, jump to the previous match."
1467 ("pdf" pdf) ("epdf" pdf) 1538 ("pdf" pdf) ("epdf" pdf)
1468 ;; PostScript 1539 ;; PostScript
1469 ("ps" ps) ("eps" ps) 1540 ("ps" ps) ("eps" ps)
1541 ;; DjVu
1542 ("djvu" djvu)
1470 ;; OpenDocument formats 1543 ;; OpenDocument formats
1471 ("odt" odf) ("ods" odf) ("odp" odf) ("odg" odf) 1544 ("odt" odf) ("ods" odf) ("odp" odf) ("odg" odf)
1472 ("odc" odf) ("odi" odf) ("odm" odf) ("ott" odf) 1545 ("odc" odf) ("odi" odf) ("odm" odf) ("ott" odf)
@@ -1481,14 +1554,25 @@ If BACKWARD is non-nil, jump to the previous match."
1481 (cond 1554 (cond
1482 ((looking-at "%!") '(ps)) 1555 ((looking-at "%!") '(ps))
1483 ((looking-at "%PDF") '(pdf)) 1556 ((looking-at "%PDF") '(pdf))
1484 ((looking-at "\367\002") '(dvi)))))) 1557 ((looking-at "\367\002") '(dvi))
1485 (set (make-local-variable 'doc-view-doc-type) 1558 ((looking-at "AT&TFORM") '(djvu))))))
1486 (car (or (doc-view-intersection name-types content-types) 1559 (setq-local doc-view-doc-type
1487 (when (and name-types content-types) 1560 (car (or (doc-view-intersection name-types content-types)
1488 (error "Conflicting types: name says %s but content says %s" 1561 (when (and name-types content-types)
1489 name-types content-types)) 1562 (error "Conflicting types: name says %s but content says %s"
1490 name-types content-types 1563 name-types content-types))
1491 (error "Cannot determine the document type")))))) 1564 name-types content-types
1565 (error "Cannot determine the document type"))))))
1566
1567(defun doc-view-set-up-single-converter ()
1568 "Find the right single-page converter for the current document type"
1569 (pcase-let ((`(,conv-function ,type ,extension)
1570 (pcase doc-view-doc-type
1571 (`djvu (list #'doc-view-djvu->tiff-converter-ddjvu 'tiff "tif"))
1572 (_ (list doc-view-pdf->png-converter-function 'png "png")))))
1573 (setq-local doc-view-single-page-converter-function conv-function)
1574 (setq-local doc-view--image-type type)
1575 (setq-local doc-view--image-file-pattern (concat "page-%s." extension))))
1492 1576
1493;;;###autoload 1577;;;###autoload
1494(defun doc-view-mode () 1578(defun doc-view-mode ()
@@ -1513,8 +1597,7 @@ toggle between displaying the document or editing it as text.
1513 (unless (eq major-mode 'fundamental-mode) 1597 (unless (eq major-mode 'fundamental-mode)
1514 major-mode)))) 1598 major-mode))))
1515 (kill-all-local-variables) 1599 (kill-all-local-variables)
1516 (set (make-local-variable 'doc-view-previous-major-mode) 1600 (setq-local doc-view-previous-major-mode prev-major-mode))
1517 prev-major-mode))
1518 1601
1519 (dolist (var doc-view-saved-settings) 1602 (dolist (var doc-view-saved-settings)
1520 (set (make-local-variable (car var)) (cdr var))) 1603 (set (make-local-variable (car var)) (cdr var)))
@@ -1522,10 +1605,11 @@ toggle between displaying the document or editing it as text.
1522 ;; Figure out the document type. 1605 ;; Figure out the document type.
1523 (unless doc-view-doc-type 1606 (unless doc-view-doc-type
1524 (doc-view-set-doc-type)) 1607 (doc-view-set-doc-type))
1608 (doc-view-set-up-single-converter)
1525 1609
1526 (doc-view-make-safe-dir doc-view-cache-directory) 1610 (doc-view-make-safe-dir doc-view-cache-directory)
1527 ;; Handle compressed files, remote files, files inside archives 1611 ;; Handle compressed files, remote files, files inside archives
1528 (set (make-local-variable 'doc-view-buffer-file-name) 1612 (setq-local doc-view-buffer-file-name
1529 (cond 1613 (cond
1530 (jka-compr-really-do-compress 1614 (jka-compr-really-do-compress
1531 ;; FIXME: there's a risk of name conflicts here. 1615 ;; FIXME: there's a risk of name conflicts here.
@@ -1564,20 +1648,19 @@ toggle between displaying the document or editing it as text.
1564 'doc-view-new-window-function nil t) 1648 'doc-view-new-window-function nil t)
1565 (image-mode-setup-winprops) 1649 (image-mode-setup-winprops)
1566 1650
1567 (set (make-local-variable 'mode-line-position) 1651 (setq-local mode-line-position
1568 '(" P" (:eval (number-to-string (doc-view-current-page))) 1652 '(" P" (:eval (number-to-string (doc-view-current-page)))
1569 "/" (:eval (number-to-string (doc-view-last-page-number))))) 1653 "/" (:eval (number-to-string (doc-view-last-page-number)))))
1570 ;; Don't scroll unless the user specifically asked for it. 1654 ;; Don't scroll unless the user specifically asked for it.
1571 (set (make-local-variable 'auto-hscroll-mode) nil) 1655 (setq-local auto-hscroll-mode nil)
1572 (set (make-local-variable 'mwheel-scroll-up-function) 1656 (setq-local mwheel-scroll-up-function #'doc-view-scroll-up-or-next-page)
1573 'doc-view-scroll-up-or-next-page) 1657 (setq-local mwheel-scroll-down-function
1574 (set (make-local-variable 'mwheel-scroll-down-function) 1658 #'doc-view-scroll-down-or-previous-page)
1575 'doc-view-scroll-down-or-previous-page) 1659 (setq-local cursor-type nil)
1576 (set (make-local-variable 'cursor-type) nil)
1577 (use-local-map doc-view-mode-map) 1660 (use-local-map doc-view-mode-map)
1578 (set (make-local-variable 'after-revert-hook) 'doc-view-reconvert-doc) 1661 (add-hook 'after-revert-hook 'doc-view-reconvert-doc nil t)
1579 (set (make-local-variable 'bookmark-make-record-function) 1662 (setq-local bookmark-make-record-function
1580 'doc-view-bookmark-make-record) 1663 #'doc-view-bookmark-make-record)
1581 (setq mode-name "DocView" 1664 (setq mode-name "DocView"
1582 buffer-read-only t 1665 buffer-read-only t
1583 major-mode 'doc-view-mode) 1666 major-mode 'doc-view-mode)
@@ -1586,7 +1669,7 @@ toggle between displaying the document or editing it as text.
1586 ;; canonical view mode for PDF/PS/DVI files. This could be 1669 ;; canonical view mode for PDF/PS/DVI files. This could be
1587 ;; switched on automatically depending on the value of 1670 ;; switched on automatically depending on the value of
1588 ;; `view-read-only'. 1671 ;; `view-read-only'.
1589 (set (make-local-variable 'view-read-only) nil) 1672 (setq-local view-read-only nil)
1590 (run-mode-hooks 'doc-view-mode-hook))) 1673 (run-mode-hooks 'doc-view-mode-hook)))
1591 1674
1592(defun doc-view-fallback-mode () 1675(defun doc-view-fallback-mode ()
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 7917b769ab8..3d03e894534 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -589,13 +589,11 @@
589;; Advice implements forward advice mainly via the following: 1) Separation 589;; Advice implements forward advice mainly via the following: 1) Separation
590;; of advice definition and activation that makes it possible to accumulate 590;; of advice definition and activation that makes it possible to accumulate
591;; advice information without having the original function already defined, 591;; advice information without having the original function already defined,
592;; 2) special versions of the built-in functions `fset/defalias' which check 592;; 2) Use of the `defalias-fset-function' symbol property which lets
593;; for advice information whenever they define a function. If advice 593;; us advise the function when it gets defined.
594;; information was found then the advice will immediately get activated when
595;; the function gets defined.
596 594
597;; Automatic advice activation means, that whenever a function gets defined 595;; Automatic advice activation means, that whenever a function gets defined
598;; with either `defun', `defmacro', `fset' or by loading a byte-compiled 596;; with either `defun', `defmacro', `defalias' or by loading a byte-compiled
599;; file, and the function has some advice-info stored with it then that 597;; file, and the function has some advice-info stored with it then that
600;; advice will get activated right away. 598;; advice will get activated right away.
601 599
@@ -2868,10 +2866,8 @@ advised definition from scratch."
2868 2866
2869(defun ad-preactivate-advice (function advice class position) 2867(defun ad-preactivate-advice (function advice class position)
2870 "Preactivate FUNCTION and returns the constructed cache." 2868 "Preactivate FUNCTION and returns the constructed cache."
2871 (let* ((function-defined-p (fboundp function)) 2869 (let* ((advicefunname (ad-get-advice-info-field function 'advicefunname))
2872 (old-definition 2870 (old-advice (symbol-function advicefunname))
2873 (if function-defined-p
2874 (symbol-function function)))
2875 (old-advice-info (ad-copy-advice-info function)) 2871 (old-advice-info (ad-copy-advice-info function))
2876 (ad-advised-functions ad-advised-functions)) 2872 (ad-advised-functions ad-advised-functions))
2877 (unwind-protect 2873 (unwind-protect
@@ -2885,10 +2881,9 @@ advised definition from scratch."
2885 (list (ad-get-cache-definition function) 2881 (list (ad-get-cache-definition function)
2886 (ad-get-cache-id function)))) 2882 (ad-get-cache-id function))))
2887 (ad-set-advice-info function old-advice-info) 2883 (ad-set-advice-info function old-advice-info)
2888 ;; Don't `fset' function to nil if it was previously unbound: 2884 (advice-remove function advicefunname)
2889 (if function-defined-p 2885 (fset advicefunname old-advice)
2890 (fset function old-definition) 2886 (if old-advice (advice-add function :around advicefunname)))))
2891 (fmakunbound function)))))
2892 2887
2893 2888
2894;; @@ Activation and definition handling: 2889;; @@ Activation and definition handling:
@@ -2917,13 +2912,18 @@ If COMPILE is nil then the result depends on the value of
2917 "Redefine FUNCTION with its advised definition from cache or scratch. 2912 "Redefine FUNCTION with its advised definition from cache or scratch.
2918The resulting FUNCTION will be compiled if `ad-should-compile' returns t. 2913The resulting FUNCTION will be compiled if `ad-should-compile' returns t.
2919The current definition and its cache-id will be put into the cache." 2914The current definition and its cache-id will be put into the cache."
2920 (let ((verified-cached-definition 2915 (let* ((verified-cached-definition
2921 (if (ad-verify-cache-id function) 2916 (if (ad-verify-cache-id function)
2922 (ad-get-cache-definition function))) 2917 (ad-get-cache-definition function)))
2923 (advicefunname (ad-get-advice-info-field function 'advicefunname))) 2918 (advicefunname (ad-get-advice-info-field function 'advicefunname))
2919 (old-ispec (interactive-form advicefunname)))
2924 (fset advicefunname 2920 (fset advicefunname
2925 (or verified-cached-definition 2921 (or verified-cached-definition
2926 (ad-make-advised-definition function))) 2922 (ad-make-advised-definition function)))
2923 (unless (equal (interactive-form advicefunname) old-ispec)
2924 ;; If the interactive-spec of advicefunname has changed, force nadvice to
2925 ;; refresh its copy.
2926 (advice-remove function advicefunname))
2927 (advice-add function :around advicefunname) 2927 (advice-add function :around advicefunname)
2928 (if (ad-should-compile function compile) 2928 (if (ad-should-compile function compile)
2929 (ad-compile-function function)) 2929 (ad-compile-function function))
diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el
index 6741094aa55..270badd53cb 100644
--- a/lisp/emacs-lisp/authors.el
+++ b/lisp/emacs-lisp/authors.el
@@ -295,6 +295,14 @@ Changes to files matching one of the regexps in this list are not listed.")
295 "calc/INSTALL" "calc/Makefile" 295 "calc/INSTALL" "calc/Makefile"
296 "vms-pp.trans" "_emacs" "batcomp.com" "notes/cpp" ; admin/ 296 "vms-pp.trans" "_emacs" "batcomp.com" "notes/cpp" ; admin/
297 "emacsver.texi.in" 297 "emacsver.texi.in"
298 "vpath.sed"
299 "Cocoa/Emacs.base/Contents/Info.plist"
300 "Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings"
301 "GNUstep/Emacs.base/Resources/Info-gnustep.plist"
302 "GNUstep/Emacs.base/Resources/Emacs.desktop"
303 "Cocoa/Emacs.base/Contents/Resources/English.lproj"
304 ;; Only existed briefly, then deleted:
305 "coccinelle/overlay.cocci" "coccinelle/symbol.cocci"
298 ;; MH-E stuff not in Emacs: 306 ;; MH-E stuff not in Emacs:
299 "import-emacs" "release-utils" 307 "import-emacs" "release-utils"
300 ;; Erc stuff not in Emacs: 308 ;; Erc stuff not in Emacs:
@@ -540,6 +548,7 @@ Changes to files in this list are not listed.")
540 "makedist.bat" 548 "makedist.bat"
541 "makefile.def" 549 "makefile.def"
542 "makefile.nt" 550 "makefile.nt"
551 "ns.mk"
543 "debug.bat.in" "emacs.bat.in" 552 "debug.bat.in" "emacs.bat.in"
544 ".gdbinit-union" 553 ".gdbinit-union"
545 "alloca.s" 554 "alloca.s"
@@ -553,15 +562,17 @@ Changes to files in this list are not listed.")
553 "ymakefile" 562 "ymakefile"
554 "permute-index" "index.perm" 563 "permute-index" "index.perm"
555 "ibmrs6000.inp" 564 "ibmrs6000.inp"
556 "b2m.c" "b2m.1" "b2m.pl" 565 "b2m.c" "b2m.1" "b2m.pl" "rcs-checkin.1"
557 "emacs.bash" "emacs.csh" "ms-kermit" 566 "emacs.bash" "emacs.csh" "ms-kermit"
558 "emacs.ico" 567 "emacs.ico"
559 "emacs21.ico" 568 "emacs21.ico"
569 "emacs.py" "emacs2.py" "emacs3.py"
560 "BABYL" "LPF" "LEDIT" "OTHER.EMACSES" 570 "BABYL" "LPF" "LEDIT" "OTHER.EMACSES"
561 "emacs16_mac.png" "emacs24_mac.png" 571 "emacs16_mac.png" "emacs24_mac.png"
562 "emacs256_mac.png" "emacs32_mac.png" 572 "emacs256_mac.png" "emacs32_mac.png"
563 "emacs48_mac.png" "emacs512_mac.png" 573 "emacs48_mac.png" "emacs512_mac.png"
564 "revdiff" ; admin/ 574 "revdiff" ; admin/
575 "vcdiff" "rcs-checkin" "tindex.pl"
565 "mainmake" "sed1.inp" "sed2.inp" "sed3.inp" ; msdos/ 576 "mainmake" "sed1.inp" "sed2.inp" "sed3.inp" ; msdos/
566 "mac-fix-env.m" 577 "mac-fix-env.m"
567 ;; Deleted vms stuff: 578 ;; Deleted vms stuff:
@@ -580,6 +591,7 @@ in the repository.")
580 ("s/windowsnt.h" . "s/ms-w32.h") 591 ("s/windowsnt.h" . "s/ms-w32.h")
581 ("s/ms-w32.h" . "inc/ms-w32.h") 592 ("s/ms-w32.h" . "inc/ms-w32.h")
582 ("winnt.el" . "w32-fns.el") 593 ("winnt.el" . "w32-fns.el")
594 ("emacs.manifest" . "emacs-x86.manifest")
583 ("config.emacs" . "configure") 595 ("config.emacs" . "configure")
584 ("configure.in" . "configure.ac") 596 ("configure.in" . "configure.ac")
585 ("config.h.dist" . "config.in") 597 ("config.h.dist" . "config.in")
@@ -616,6 +628,8 @@ in the repository.")
616 ("build-install" . "build-ins.in") 628 ("build-install" . "build-ins.in")
617 ("build-install.in" . "build-ins.in") 629 ("build-install.in" . "build-ins.in")
618 ("unidata/Makefile" . "unidata/Makefile.in") 630 ("unidata/Makefile" . "unidata/Makefile.in")
631 ("move-if-change" . "build-aux/move-if-change")
632 ("update-subdirs" . "build-aux/update-subdirs")
619 ;; Not renamed, but we only have the latter in the Emacs repo. 633 ;; Not renamed, but we only have the latter in the Emacs repo.
620 ("trampver.texi.in" . "trampver.texi") 634 ("trampver.texi.in" . "trampver.texi")
621 ("e/eterm" . "e/eterm-color") 635 ("e/eterm" . "e/eterm-color")
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index 5607c9b0698..f88cb0ef9bb 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -30,12 +30,12 @@
30;; a single prompt, optionally using completion. 30;; a single prompt, optionally using completion.
31 31
32;; Multiple strings are specified by separating each of the strings 32;; Multiple strings are specified by separating each of the strings
33;; with a prespecified separator character. For example, if the 33;; with a prespecified separator regexp. For example, if the
34;; separator character is a comma, the strings 'alice', 'bob', and 34;; separator regexp is ",", the strings 'alice', 'bob', and
35;; 'eve' would be specified as 'alice,bob,eve'. 35;; 'eve' would be specified as 'alice,bob,eve'.
36 36
37;; The default value for the separator character is the value of 37;; The default value for the separator regexp is the value of
38;; `crm-default-separator' (comma). The separator character may be 38;; `crm-default-separator' (comma). The separator regexp may be
39;; changed by modifying the value of `crm-separator'. 39;; changed by modifying the value of `crm-separator'.
40 40
41;; Contiguous strings of non-separator-characters are referred to as 41;; Contiguous strings of non-separator-characters are referred to as
@@ -96,14 +96,14 @@
96;; first revamped version 96;; first revamped version
97 97
98;;; Code: 98;;; Code:
99(defconst crm-default-separator "," 99(defconst crm-default-separator "[ \t]*,[ \t]*"
100 "Default separator for `completing-read-multiple'.") 100 "Default separator regexp for `completing-read-multiple'.")
101 101
102(defvar crm-separator crm-default-separator 102(defvar crm-separator crm-default-separator
103 "Separator used for separating strings in `completing-read-multiple'. 103 "Separator regexp used for separating strings in `completing-read-multiple'.
104It should be a single character string that doesn't appear in the list of 104It should be a regexp that does not match the list of completion candidates.
105completion candidates. Modify this value to make `completing-read-multiple' 105Modify this value to make `completing-read-multiple' use a separator other
106use a separator other than `crm-default-separator'.") 106than `crm-default-separator'.")
107 107
108(defvar crm-local-completion-map 108(defvar crm-local-completion-map
109 (let ((map (make-sparse-keymap))) 109 (let ((map (make-sparse-keymap)))
@@ -173,13 +173,17 @@ Place an overlay on the element, with a `field' property, and return it."
173 (overlay-put ol 'field (make-symbol "crm")) 173 (overlay-put ol 'field (make-symbol "crm"))
174 ol)) 174 ol))
175 175
176(defmacro crm--completion-command (command)
177 "Make COMMAND a completion command for `completing-read-multiple'."
178 `(let ((ol (crm--select-current-element)))
179 (unwind-protect
180 ,command
181 (delete-overlay ol))))
182
176(defun crm-completion-help () 183(defun crm-completion-help ()
177 "Display a list of possible completions of the current minibuffer element." 184 "Display a list of possible completions of the current minibuffer element."
178 (interactive) 185 (interactive)
179 (let ((ol (crm--select-current-element))) 186 (crm--completion-command (minibuffer-completion-help))
180 (unwind-protect
181 (minibuffer-completion-help)
182 (delete-overlay ol)))
183 nil) 187 nil)
184 188
185(defun crm-complete () 189(defun crm-complete ()
@@ -188,19 +192,13 @@ If no characters can be completed, display a list of possible completions.
188 192
189Return t if the current element is now a valid match; otherwise return nil." 193Return t if the current element is now a valid match; otherwise return nil."
190 (interactive) 194 (interactive)
191 (let ((ol (crm--select-current-element))) 195 (crm--completion-command (minibuffer-complete)))
192 (unwind-protect
193 (minibuffer-complete)
194 (delete-overlay ol))))
195 196
196(defun crm-complete-word () 197(defun crm-complete-word ()
197 "Complete the current element at most a single word. 198 "Complete the current element at most a single word.
198Like `minibuffer-complete-word' but for `completing-read-multiple'." 199Like `minibuffer-complete-word' but for `completing-read-multiple'."
199 (interactive) 200 (interactive)
200 (let ((ol (crm--select-current-element))) 201 (crm--completion-command (minibuffer-complete-word)))
201 (unwind-protect
202 (minibuffer-complete-word)
203 (delete-overlay ol))))
204 202
205(defun crm-complete-and-exit () 203(defun crm-complete-and-exit ()
206 "If all of the minibuffer elements are valid completions then exit. 204 "If all of the minibuffer elements are valid completions then exit.
@@ -222,9 +220,10 @@ This function is modeled after `minibuffer-complete-and-exit'."
222 (setq doexit nil)) 220 (setq doexit nil))
223 (goto-char (overlay-end ol)) 221 (goto-char (overlay-end ol))
224 (delete-overlay ol)) 222 (delete-overlay ol))
225 (not (eobp)))) 223 (not (eobp)))
224 (looking-at crm-separator))
226 ;; Skip to the next element. 225 ;; Skip to the next element.
227 (forward-char 1)) 226 (goto-char (match-end 0)))
228 (if doexit (exit-minibuffer)))) 227 (if doexit (exit-minibuffer))))
229 228
230(defun crm--choose-completion-string (choice buffer base-position 229(defun crm--choose-completion-string (choice buffer base-position
@@ -248,12 +247,12 @@ By using this functionality, a user may specify multiple strings at a
248single prompt, optionally using completion. 247single prompt, optionally using completion.
249 248
250Multiple strings are specified by separating each of the strings with 249Multiple strings are specified by separating each of the strings with
251a prespecified separator character. For example, if the separator 250a prespecified separator regexp. For example, if the separator
252character is a comma, the strings 'alice', 'bob', and 'eve' would be 251regexp is \",\", the strings 'alice', 'bob', and 'eve' would be
253specified as 'alice,bob,eve'. 252specified as 'alice,bob,eve'.
254 253
255The default value for the separator character is the value of 254The default value for the separator regexp is the value of
256`crm-default-separator' (comma). The separator character may be 255`crm-default-separator' (comma). The separator regexp may be
257changed by modifying the value of `crm-separator'. 256changed by modifying the value of `crm-separator'.
258 257
259Contiguous strings of non-separator-characters are referred to as 258Contiguous strings of non-separator-characters are referred to as
@@ -282,8 +281,8 @@ INHERIT-INPUT-METHOD."
282 (map (if require-match 281 (map (if require-match
283 crm-local-must-match-map 282 crm-local-must-match-map
284 crm-local-completion-map)) 283 crm-local-completion-map))
285 ;; If the user enters empty input, read-from-minibuffer returns 284 ;; If the user enters empty input, `read-from-minibuffer'
286 ;; the empty string, not DEF. 285 ;; returns the empty string, not DEF.
287 (input (read-from-minibuffer 286 (input (read-from-minibuffer
288 prompt initial-input map 287 prompt initial-input map
289 nil hist def inherit-input-method))) 288 nil hist def inherit-input-method)))
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 378ba9db9f4..52e12013fd3 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -461,8 +461,8 @@ STREAM or the value of `standard-input' may be:
461 461
462This version, from Edebug, maybe instruments the expression. But the 462This version, from Edebug, maybe instruments the expression. But the
463STREAM must be the current buffer to do so. Whether it instruments is 463STREAM must be the current buffer to do so. Whether it instruments is
464also dependent on the values of `edebug-all-defs' and 464also dependent on the values of the option `edebug-all-defs' and
465`edebug-all-forms'." 465the option `edebug-all-forms'."
466 (or stream (setq stream standard-input)) 466 (or stream (setq stream standard-input))
467 (if (eq stream (current-buffer)) 467 (if (eq stream (current-buffer))
468 (edebug-read-and-maybe-wrap-form) 468 (edebug-read-and-maybe-wrap-form)
@@ -484,8 +484,8 @@ similarly. Reinitialize the face according to `defface' specification.
484 484
485With a prefix argument, instrument the code for Edebug. 485With a prefix argument, instrument the code for Edebug.
486 486
487Setting `edebug-all-defs' to a non-nil value reverses the meaning of 487Setting option `edebug-all-defs' to a non-nil value reverses the meaning
488the prefix argument. Code is then instrumented when this function is 488of the prefix argument. Code is then instrumented when this function is
489invoked without a prefix argument 489invoked without a prefix argument
490 490
491If acting on a `defun' for FUNCTION, and the function was instrumented, 491If acting on a `defun' for FUNCTION, and the function was instrumented,
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 70d6a6a4a5f..dd849362228 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -937,7 +937,7 @@ Returns the result and stores it in ERT-TEST's `most-recent-result' slot."
937 (cl-block error 937 (cl-block error
938 (let ((begin-marker 938 (let ((begin-marker
939 (with-current-buffer (get-buffer-create "*Messages*") 939 (with-current-buffer (get-buffer-create "*Messages*")
940 (set-marker (make-marker) (point-max))))) 940 (point-max-marker))))
941 (unwind-protect 941 (unwind-protect
942 (let ((info (make-ert--test-execution-info 942 (let ((info (make-ert--test-execution-info
943 :test ert-test 943 :test ert-test
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index b4d6fac92a2..b0711fed26c 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -167,20 +167,27 @@ WHERE is a symbol to select an entry in `advice--where-alist'."
167 (setq definition (advice--cdr definition)))) 167 (setq definition (advice--cdr definition))))
168 found)) 168 found))
169 169
170;;;###autoload 170(defun advice--tweak (flist tweaker)
171(defun advice--remove-function (flist function)
172 (if (not (advice--p flist)) 171 (if (not (advice--p flist))
173 flist 172 (funcall tweaker nil flist nil)
174 (let ((first (advice--car flist)) 173 (let ((first (advice--car flist))
174 (rest (advice--cdr flist))
175 (props (advice--props flist))) 175 (props (advice--props flist)))
176 (if (or (equal function first) 176 (let ((val (funcall tweaker first rest props)))
177 (equal function (cdr (assq 'name props)))) 177 (if val (car val)
178 (advice--cdr flist) 178 (let ((nrest (advice--tweak rest tweaker)))
179 (let* ((rest (advice--cdr flist)) 179 (if (eq rest nrest) flist
180 (nrest (advice--remove-function rest function))) 180 (advice--make-1 (aref flist 1) (aref flist 3)
181 (if (eq rest nrest) flist 181 first nrest props))))))))
182 (advice--make-1 (aref flist 1) (aref flist 3) 182
183 first nrest props))))))) 183;;;###autoload
184(defun advice--remove-function (flist function)
185 (advice--tweak flist
186 (lambda (first rest props)
187 (cond ((not first) rest)
188 ((or (equal function first)
189 (equal function (cdr (assq 'name props))))
190 (list rest))))))
184 191
185(defvar advice--buffer-local-function-sample nil) 192(defvar advice--buffer-local-function-sample nil)
186 193
@@ -269,15 +276,8 @@ of the piece of advice."
269;;;; Specific application of add-function to `symbol-function' for advice. 276;;;; Specific application of add-function to `symbol-function' for advice.
270 277
271(defun advice--subst-main (old new) 278(defun advice--subst-main (old new)
272 (if (not (advice--p old)) 279 (advice--tweak old
273 new 280 (lambda (first _rest _props) (if (not first) new))))
274 (let* ((first (advice--car old))
275 (rest (advice--cdr old))
276 (props (advice--props old))
277 (nrest (advice--subst-main rest new)))
278 (if (equal rest nrest) old
279 (advice--make-1 (aref old 1) (aref old 3)
280 first nrest props)))))
281 281
282(defun advice--normalize (symbol def) 282(defun advice--normalize (symbol def)
283 (cond 283 (cond
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 69834810d11..e000c343721 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -431,30 +431,31 @@ MATCH is the pattern that needs to be matched, of the form:
431 (match ,symd . ,(pcase--upat (cdr qpat)))) 431 (match ,symd . ,(pcase--upat (cdr qpat))))
432 :pcase--fail))) 432 :pcase--fail)))
433 ;; A QPattern but not for a cons, can only go to the `else' side. 433 ;; A QPattern but not for a cons, can only go to the `else' side.
434 ((eq (car-safe pat) '\`) (cons :pcase--fail nil)) 434 ((eq (car-safe pat) '\`) '(:pcase--fail . nil))
435 ((and (eq (car-safe pat) 'pred) 435 ((and (eq (car-safe pat) 'pred)
436 (or (member (cons 'consp (cadr pat)) 436 (or (member (cons 'consp (cadr pat))
437 pcase-mutually-exclusive-predicates) 437 pcase-mutually-exclusive-predicates)
438 (member (cons (cadr pat) 'consp) 438 (member (cons (cadr pat) 'consp)
439 pcase-mutually-exclusive-predicates))) 439 pcase-mutually-exclusive-predicates)))
440 (cons :pcase--fail nil)))) 440 '(:pcase--fail . nil))))
441 441
442(defun pcase--split-equal (elem pat) 442(defun pcase--split-equal (elem pat)
443 (cond 443 (cond
444 ;; The same match will give the same result. 444 ;; The same match will give the same result.
445 ((and (eq (car-safe pat) '\`) (equal (cadr pat) elem)) 445 ((and (eq (car-safe pat) '\`) (equal (cadr pat) elem))
446 (cons :pcase--succeed :pcase--fail)) 446 '(:pcase--succeed . :pcase--fail))
447 ;; A different match will fail if this one succeeds. 447 ;; A different match will fail if this one succeeds.
448 ((and (eq (car-safe pat) '\`) 448 ((and (eq (car-safe pat) '\`)
449 ;; (or (integerp (cadr pat)) (symbolp (cadr pat)) 449 ;; (or (integerp (cadr pat)) (symbolp (cadr pat))
450 ;; (consp (cadr pat))) 450 ;; (consp (cadr pat)))
451 ) 451 )
452 (cons :pcase--fail nil)) 452 '(:pcase--fail . nil))
453 ((and (eq (car-safe pat) 'pred) 453 ((and (eq (car-safe pat) 'pred)
454 (symbolp (cadr pat)) 454 (symbolp (cadr pat))
455 (get (cadr pat) 'side-effect-free) 455 (get (cadr pat) 'side-effect-free))
456 (funcall (cadr pat) elem)) 456 (if (funcall (cadr pat) elem)
457 (cons :pcase--succeed nil)))) 457 '(:pcase--succeed . nil)
458 '(:pcase--fail . nil)))))
458 459
459(defun pcase--split-member (elems pat) 460(defun pcase--split-member (elems pat)
460 ;; Based on pcase--split-equal. 461 ;; Based on pcase--split-equal.
@@ -462,7 +463,7 @@ MATCH is the pattern that needs to be matched, of the form:
462 ;; The same match (or a match of membership in a superset) will 463 ;; The same match (or a match of membership in a superset) will
463 ;; give the same result, but we don't know how to check it. 464 ;; give the same result, but we don't know how to check it.
464 ;; (??? 465 ;; (???
465 ;; (cons :pcase--succeed nil)) 466 ;; '(:pcase--succeed . nil))
466 ;; A match for one of the elements may succeed or fail. 467 ;; A match for one of the elements may succeed or fail.
467 ((and (eq (car-safe pat) '\`) (member (cadr pat) elems)) 468 ((and (eq (car-safe pat) '\`) (member (cadr pat) elems))
468 nil) 469 nil)
@@ -471,7 +472,7 @@ MATCH is the pattern that needs to be matched, of the form:
471 ;; (or (integerp (cadr pat)) (symbolp (cadr pat)) 472 ;; (or (integerp (cadr pat)) (symbolp (cadr pat))
472 ;; (consp (cadr pat))) 473 ;; (consp (cadr pat)))
473 ) 474 )
474 (cons :pcase--fail nil)) 475 '(:pcase--fail . nil))
475 ((and (eq (car-safe pat) 'pred) 476 ((and (eq (car-safe pat) 'pred)
476 (symbolp (cadr pat)) 477 (symbolp (cadr pat))
477 (get (cadr pat) 'side-effect-free) 478 (get (cadr pat) 'side-effect-free)
@@ -479,21 +480,21 @@ MATCH is the pattern that needs to be matched, of the form:
479 (dolist (elem elems) 480 (dolist (elem elems)
480 (unless (funcall p elem) (setq all nil))) 481 (unless (funcall p elem) (setq all nil)))
481 all)) 482 all))
482 (cons :pcase--succeed nil)))) 483 '(:pcase--succeed . nil))))
483 484
484(defun pcase--split-pred (upat pat) 485(defun pcase--split-pred (upat pat)
485 ;; FIXME: For predicates like (pred (> a)), two such predicates may 486 ;; FIXME: For predicates like (pred (> a)), two such predicates may
486 ;; actually refer to different variables `a'. 487 ;; actually refer to different variables `a'.
487 (let (test) 488 (let (test)
488 (cond 489 (cond
489 ((equal upat pat) (cons :pcase--succeed :pcase--fail)) 490 ((equal upat pat) '(:pcase--succeed . :pcase--fail))
490 ((and (eq 'pred (car upat)) 491 ((and (eq 'pred (car upat))
491 (eq 'pred (car-safe pat)) 492 (eq 'pred (car-safe pat))
492 (or (member (cons (cadr upat) (cadr pat)) 493 (or (member (cons (cadr upat) (cadr pat))
493 pcase-mutually-exclusive-predicates) 494 pcase-mutually-exclusive-predicates)
494 (member (cons (cadr pat) (cadr upat)) 495 (member (cons (cadr pat) (cadr upat))
495 pcase-mutually-exclusive-predicates))) 496 pcase-mutually-exclusive-predicates)))
496 (cons :pcase--fail nil)) 497 '(:pcase--fail . nil))
497 ((and (eq 'pred (car upat)) 498 ((and (eq 'pred (car upat))
498 (eq '\` (car-safe pat)) 499 (eq '\` (car-safe pat))
499 (symbolp (cadr upat)) 500 (symbolp (cadr upat))
@@ -502,8 +503,8 @@ MATCH is the pattern that needs to be matched, of the form:
502 (ignore-errors 503 (ignore-errors
503 (setq test (list (funcall (cadr upat) (cadr pat)))))) 504 (setq test (list (funcall (cadr upat) (cadr pat))))))
504 (if (car test) 505 (if (car test)
505 (cons nil :pcase--fail) 506 '(nil . :pcase--fail)
506 (cons :pcase--fail nil)))))) 507 '(:pcase--fail . nil))))))
507 508
508(defun pcase--fgrep (vars sexp) 509(defun pcase--fgrep (vars sexp)
509 "Check which of the symbols VARS appear in SEXP." 510 "Check which of the symbols VARS appear in SEXP."
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 3eaacd24ec8..8b019d0a785 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -307,13 +307,13 @@ This function is called, by name, directly by the C code."
307 ;; Run handler. 307 ;; Run handler.
308 ;; We do this after rescheduling so that the handler function 308 ;; We do this after rescheduling so that the handler function
309 ;; can cancel its own timer successfully with cancel-timer. 309 ;; can cancel its own timer successfully with cancel-timer.
310 (condition-case nil 310 (condition-case-unless-debug err
311 ;; Timer functions should not change the current buffer. 311 ;; Timer functions should not change the current buffer.
312 ;; If they do, all kinds of nasty surprises can happen, 312 ;; If they do, all kinds of nasty surprises can happen,
313 ;; and it can be hellish to track down their source. 313 ;; and it can be hellish to track down their source.
314 (save-current-buffer 314 (save-current-buffer
315 (apply (timer--function timer) (timer--args timer))) 315 (apply (timer--function timer) (timer--args timer)))
316 (error nil)) 316 (error (message "Error in timer: %S" err)))
317 (if retrigger 317 (if retrigger
318 (setf (timer--triggered timer) nil))) 318 (setf (timer--triggered timer) nil)))
319 (error "Bogus timer event")))) 319 (error "Bogus timer event"))))
diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el
index d2566b8cb9f..fb1b995be2b 100644
--- a/lisp/emacs-lisp/trace.el
+++ b/lisp/emacs-lisp/trace.el
@@ -38,11 +38,6 @@
38;; generation of trace output won't interfere with what you are currently 38;; generation of trace output won't interfere with what you are currently
39;; doing. 39;; doing.
40 40
41;; Requirement:
42;; ============
43;; trace.el needs advice.el version 2.0 or later which you can get from the
44;; same place from where you got trace.el.
45
46;; Restrictions: 41;; Restrictions:
47;; ============= 42;; =============
48;; - Traced subrs when called interactively will always show nil as the 43;; - Traced subrs when called interactively will always show nil as the
@@ -55,17 +50,6 @@
55;; + Macros that were expanded during compilation 50;; + Macros that were expanded during compilation
56;; - All the restrictions that apply to advice.el 51;; - All the restrictions that apply to advice.el
57 52
58;; Installation:
59;; =============
60;; Put this file together with advice.el (version 2.0 or later) somewhere
61;; into your Emacs `load-path', byte-compile it/them for efficiency, and
62;; put the following autoload declarations into your .emacs
63;;
64;; (autoload 'trace-function "trace" "Trace a function" t)
65;; (autoload 'trace-function-background "trace" "Trace a function" t)
66;;
67;; or explicitly load it with (require 'trace) or (load "trace").
68
69;; Usage: 53;; Usage:
70;; ====== 54;; ======
71;; - To trace a function say `M-x trace-function' which will ask you for the 55;; - To trace a function say `M-x trace-function' which will ask you for the
@@ -183,6 +167,8 @@ some global variables)."
183 (mapconcat 'char-to-string (make-string (1- level) ?|) " ") 167 (mapconcat 'char-to-string (make-string (1- level) ?|) " ")
184 (if (> level 1) " " "") 168 (if (> level 1) " " "")
185 level 169 level
170 ;; FIXME: Make it so we can click the function name to jump to its
171 ;; definition and/or untrace it.
186 (cons function args) 172 (cons function args)
187 context))) 173 context)))
188 174
@@ -282,21 +268,17 @@ and return values will be inserted into BUFFER. This function generates the
282trace advice for FUNCTION and activates it together with any other advice 268trace advice for FUNCTION and activates it together with any other advice
283there might be!! The trace BUFFER will popup whenever FUNCTION is called. 269there might be!! The trace BUFFER will popup whenever FUNCTION is called.
284Do not use this to trace functions that switch buffers or do any other 270Do not use this to trace functions that switch buffers or do any other
285display oriented stuff, use `trace-function-background' instead." 271display oriented stuff, use `trace-function-background' instead.
272
273To untrace a function, use `untrace-function' or `untrace-all'."
286 (interactive (trace--read-args "Trace function: ")) 274 (interactive (trace--read-args "Trace function: "))
287 (trace-function-internal function buffer nil context)) 275 (trace-function-internal function buffer nil context))
288 276
289;;;###autoload 277;;;###autoload
290(defun trace-function-background (function &optional buffer context) 278(defun trace-function-background (function &optional buffer context)
291 "Traces FUNCTION with trace output going quietly to BUFFER. 279 "Traces FUNCTION with trace output going quietly to BUFFER.
292When this tracing is enabled, every call to FUNCTION writes 280Like `trace-function-foreground' but without popping up the trace BUFFER or
293a Lisp-style trace message (showing the arguments and return value) 281changing the window configuration."
294into BUFFER. This function generates advice to trace FUNCTION
295and activates it together with any other advice there might be.
296The trace output goes to BUFFER quietly, without changing
297the window or buffer configuration.
298
299BUFFER defaults to `trace-buffer'."
300 (interactive (trace--read-args "Trace function in background: ")) 282 (interactive (trace--read-args "Trace function in background: "))
301 (trace-function-internal function buffer t context)) 283 (trace-function-internal function buffer t context))
302 284
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 3a625eb215e..bbe551c735d 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,8 @@
12013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * erc-dcc.el (erc-dcc-send-file): Use point-min-marker.
4 (erc-dcc-chat-setup): Use point-max-marker.
5
12013-01-04 Glenn Morris <rgm@gnu.org> 62013-01-04 Glenn Morris <rgm@gnu.org>
2 7
3 * erc-backend.el (312): Fix typo. (Bug#13235) 8 * erc-backend.el (312): Fix typo. (Bug#13235)
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index dc67d3b01df..c27bb629f9d 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -897,7 +897,7 @@ other client."
897 (let* ((buffer (erc-dcc-find-file file)) 897 (let* ((buffer (erc-dcc-find-file file))
898 (size (buffer-size buffer)) 898 (size (buffer-size buffer))
899 (start (with-current-buffer buffer 899 (start (with-current-buffer buffer
900 (set-marker (make-marker) (point-min)))) 900 (point-min-marker)))
901 (sproc (erc-dcc-server "dcc-send" 901 (sproc (erc-dcc-server "dcc-send"
902 'erc-dcc-send-filter 902 'erc-dcc-send-filter
903 'erc-dcc-send-sentinel)) 903 'erc-dcc-send-sentinel))
@@ -1166,7 +1166,7 @@ other client."
1166 (setq erc-dcc-from nick) 1166 (setq erc-dcc-from nick)
1167 (setq erc-dcc-entry-data entry) 1167 (setq erc-dcc-entry-data entry)
1168 (setq erc-dcc-unprocessed-output "") 1168 (setq erc-dcc-unprocessed-output "")
1169 (setq erc-insert-marker (set-marker (make-marker) (point-max))) 1169 (setq erc-insert-marker (point-max-marker))
1170 (setq erc-input-marker (make-marker)) 1170 (setq erc-input-marker (make-marker))
1171 (erc-display-prompt buffer (point-max)) 1171 (erc-display-prompt buffer (point-max))
1172 (set-process-buffer proc buffer) 1172 (set-process-buffer proc buffer)
diff --git a/lisp/faces.el b/lisp/faces.el
index f78a4cb9e3d..60410733514 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -929,27 +929,29 @@ of the default face. Value is FACE."
929;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 929;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
930 930
931(defun read-face-name (prompt &optional default multiple) 931(defun read-face-name (prompt &optional default multiple)
932 "Read a face, defaulting to the face or faces at point. 932 "Read one or more face names, defaulting to the face(s) at point.
933If the text at point has the property `read-face-name', that 933PROMPT should be a prompt string; it should not end in a space or
934overrides the `face' property for determining the default. 934a colon.
935 935
936PROMPT should be a string that describes what the caller will do 936The optional argument DEFAULT specifies the default face name(s)
937with the face; it should not end in a space. 937to return if the user just types RET. If its value is non-nil,
938it should be a list of face names (symbols); in that case, the
939default return value is the `car' of DEFAULT (if the argument
940MULTIPLE is non-nil), or DEFAULT (if MULTIPLE is nil). See below
941for the meaning of MULTIPLE.
938 942
943If DEFAULT is nil, the list of default face names is taken from
944the `read-face-name' property of the text at point, or, if that
945is nil, from the `face' property of the text at point.
939 946
940This function uses `completing-read-multiple' with \",\" as the 947This function uses `completing-read-multiple' with \",\" as the
941separator character, i.e. 948separator character. Thus, the user may enter multiple face
942 949names, separated by commas. The optional argument MULTIPLE
943 950specifies the form of the return value. If MULTIPLE is non-nil,
944 951return a list of face names; if the user entered just one face
945 952name, the return value would be a list of one face name.
946 953Otherwise, return a single face name; if the user entered more
947The optional argument DEFAULT provides the value to display in the 954than one face name, return only the first one."
948minibuffer prompt that is returned if the user just types RET
949unless DEFAULT is a string (in which case nil is returned).
950
951If MULTIPLE is non-nil, return a list of faces (possibly only one).
952Otherwise, return a single face."
953 (let ((faceprop (or (get-char-property (point) 'read-face-name) 955 (let ((faceprop (or (get-char-property (point) 'read-face-name)
954 (get-char-property (point) 'face))) 956 (get-char-property (point) 'face)))
955 (aliasfaces nil) 957 (aliasfaces nil)
diff --git a/lisp/ffap.el b/lisp/ffap.el
index dfb559f3f0d..c5b0784e5a2 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -321,7 +321,7 @@ disable FFAP most of the time."
321 "Last value returned by `ffap-next-guess'.") 321 "Last value returned by `ffap-next-guess'.")
322 322
323(defvar ffap-string-at-point-region '(1 1) 323(defvar ffap-string-at-point-region '(1 1)
324 "List (BEG END), last region returned by `ffap-string-at-point'.") 324 "List (BEG END), last region returned by the function `ffap-string-at-point'.")
325 325
326(defun ffap-next-guess (&optional back lim) 326(defun ffap-next-guess (&optional back lim)
327 "Move point to next file or URL, and return it as a string. 327 "Move point to next file or URL, and return it as a string.
@@ -346,7 +346,7 @@ Optional argument BACK says to search backwards.
346Optional argument WRAP says to try wrapping around if necessary. 346Optional argument WRAP says to try wrapping around if necessary.
347Interactively: use a single prefix to search backwards, 347Interactively: use a single prefix to search backwards,
348double prefix to wrap forward, triple to wrap backwards. 348double prefix to wrap forward, triple to wrap backwards.
349Actual search is done by `ffap-next-guess'." 349Actual search is done by the function `ffap-next-guess'."
350 (interactive 350 (interactive
351 (cdr (assq (prefix-numeric-value current-prefix-arg) 351 (cdr (assq (prefix-numeric-value current-prefix-arg)
352 '((1) (4 t) (16 nil t) (64 t t))))) 352 '((1) (4 t) (16 nil t) (64 t t)))))
@@ -1028,14 +1028,14 @@ If a given RFC isn't in these then `ffap-rfc-path' is offered."
1028 "Alist of \(MODE CHARS BEG END\), where MODE is a symbol, 1028 "Alist of \(MODE CHARS BEG END\), where MODE is a symbol,
1029possibly a major-mode name, or one of the symbol 1029possibly a major-mode name, or one of the symbol
1030`file', `url', `machine', and `nocolon'. 1030`file', `url', `machine', and `nocolon'.
1031`ffap-string-at-point' uses the data fields as follows: 1031Function `ffap-string-at-point' uses the data fields as follows:
10321. find a maximal string of CHARS around point, 10321. find a maximal string of CHARS around point,
10332. strip BEG chars before point from the beginning, 10332. strip BEG chars before point from the beginning,
10343. Strip END chars after point from the end.") 10343. Strip END chars after point from the end.")
1035 1035
1036(defvar ffap-string-at-point nil 1036(defvar ffap-string-at-point nil
1037 ;; Added at suggestion of RHOGEE (for ff-paths), 7/24/95. 1037 ;; Added at suggestion of RHOGEE (for ff-paths), 7/24/95.
1038 "Last string returned by `ffap-string-at-point'.") 1038 "Last string returned by the function `ffap-string-at-point'.")
1039 1039
1040(defun ffap-string-at-point (&optional mode) 1040(defun ffap-string-at-point (&optional mode)
1041 "Return a string of characters from around point. 1041 "Return a string of characters from around point.
@@ -1043,7 +1043,8 @@ MODE (defaults to value of `major-mode') is a symbol used to look up string
1043syntax parameters in `ffap-string-at-point-mode-alist'. 1043syntax parameters in `ffap-string-at-point-mode-alist'.
1044If MODE is not found, we use `file' instead of MODE. 1044If MODE is not found, we use `file' instead of MODE.
1045If the region is active, return a string from the region. 1045If the region is active, return a string from the region.
1046Sets `ffap-string-at-point' and `ffap-string-at-point-region'." 1046Sets the variable `ffap-string-at-point' and the variable
1047`ffap-string-at-point-region'."
1047 (let* ((args 1048 (let* ((args
1048 (cdr 1049 (cdr
1049 (or (assq (or mode major-mode) ffap-string-at-point-mode-alist) 1050 (or (assq (or mode major-mode) ffap-string-at-point-mode-alist)
@@ -1068,7 +1069,8 @@ Sets `ffap-string-at-point' and `ffap-string-at-point-region'."
1068 1069
1069(defun ffap-string-around () 1070(defun ffap-string-around ()
1070 ;; Sometimes useful to decide how to treat a string. 1071 ;; Sometimes useful to decide how to treat a string.
1071 "Return string of two chars around last `ffap-string-at-point'. 1072 "Return string of two chars around last result of function
1073`ffap-string-at-point'.
1072Assumes the buffer has not changed." 1074Assumes the buffer has not changed."
1073 (save-excursion 1075 (save-excursion
1074 (format "%c%c" 1076 (format "%c%c"
@@ -1082,7 +1084,7 @@ Assumes the buffer has not changed."
1082 1084
1083(defun ffap-copy-string-as-kill (&optional mode) 1085(defun ffap-copy-string-as-kill (&optional mode)
1084 ;; Requested by MCOOK. Useful? 1086 ;; Requested by MCOOK. Useful?
1085 "Call `ffap-string-at-point', and copy result to `kill-ring'." 1087 "Call function `ffap-string-at-point', and copy result to `kill-ring'."
1086 (interactive) 1088 (interactive)
1087 (let ((str (ffap-string-at-point mode))) 1089 (let ((str (ffap-string-at-point mode)))
1088 (if (equal "" str) 1090 (if (equal "" str)
@@ -1364,7 +1366,7 @@ which may actually result in an URL rather than a filename."
1364 :version "22.1") 1366 :version "22.1")
1365 1367
1366(defvar ffap-highlight-overlay nil 1368(defvar ffap-highlight-overlay nil
1367 "Overlay used by `ffap-highlight'.") 1369 "Overlay used by function `ffap-highlight'.")
1368 1370
1369(defun ffap-highlight (&optional remove) 1371(defun ffap-highlight (&optional remove)
1370 "If `ffap-highlight' is set, highlight the guess in this buffer. 1372 "If `ffap-highlight' is set, highlight the guess in this buffer.
@@ -1734,7 +1736,7 @@ Only intended for interactive use."
1734 (call-interactively 'ffap))) 1736 (call-interactively 'ffap)))
1735 1737
1736(defun ffap-literally () 1738(defun ffap-literally ()
1737 "Like `ffap' and `find-file-literally'. 1739 "Like `ffap' and command `find-file-literally'.
1738Only intended for interactive use." 1740Only intended for interactive use."
1739 (interactive) 1741 (interactive)
1740 (let ((ffap-file-finder 'find-file-literally)) 1742 (let ((ffap-file-finder 'find-file-literally))
diff --git a/lisp/files.el b/lisp/files.el
index ca5a415fb8e..b015b53db3c 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2357,7 +2357,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'" . archive-mode)
2357 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode) 2357 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode)
2358 ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MSDOG 2358 ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MSDOG
2359 ("\\.[eE]?[pP][sS]\\'" . ps-mode) 2359 ("\\.[eE]?[pP][sS]\\'" . ps-mode)
2360 ("\\.\\(?:PDF\\|DVI\\|OD[FGPST]\\|DOCX?\\|XLSX?\\|PPTX?\\|pdf\\|dvi\\|od[fgpst]\\|docx?\\|xlsx?\\|pptx?\\)\\'" . doc-view-mode-maybe) 2360 ("\\.\\(?:PDF\\|DVI\\|OD[FGPST]\\|DOCX?\\|XLSX?\\|PPTX?\\|pdf\\|djvu\\|dvi\\|od[fgpst]\\|docx?\\|xlsx?\\|pptx?\\)\\'" . doc-view-mode-maybe)
2361 ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode) 2361 ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode)
2362 ("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode) 2362 ("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
2363 ("BROWSE\\'" . ebrowse-tree-mode) 2363 ("BROWSE\\'" . ebrowse-tree-mode)
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 7a2577eabbb..f714eaab233 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -469,7 +469,7 @@ optimized.")
469 "Alist of additional `font-lock-keywords' elements for major modes. 469 "Alist of additional `font-lock-keywords' elements for major modes.
470 470
471Each element has the form (MODE KEYWORDS . HOW). 471Each element has the form (MODE KEYWORDS . HOW).
472`font-lock-set-defaults' adds the elements in the list KEYWORDS to 472Function `font-lock-set-defaults' adds the elements in the list KEYWORDS to
473`font-lock-keywords' when Font Lock is turned on in major mode MODE. 473`font-lock-keywords' when Font Lock is turned on in major mode MODE.
474 474
475If HOW is nil, KEYWORDS are added at the beginning of 475If HOW is nil, KEYWORDS are added at the beginning of
@@ -484,7 +484,7 @@ This is normally set via `font-lock-add-keywords' and
484(defvar font-lock-removed-keywords-alist nil 484(defvar font-lock-removed-keywords-alist nil
485 "Alist of `font-lock-keywords' elements to be removed for major modes. 485 "Alist of `font-lock-keywords' elements to be removed for major modes.
486 486
487Each element has the form (MODE . KEYWORDS). `font-lock-set-defaults' 487Each element has the form (MODE . KEYWORDS). Function `font-lock-set-defaults'
488removes the elements in the list KEYWORDS from `font-lock-keywords' 488removes the elements in the list KEYWORDS from `font-lock-keywords'
489when Font Lock is turned on in major mode MODE. 489when Font Lock is turned on in major mode MODE.
490 490
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index c1140c526f6..1f1b46c8532 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,62 @@
12013-01-16 Glenn Morris <rgm@gnu.org>
2
3 * smiley.el (smiley-style): Make the file loadable in batch mode.
4
52013-01-15 Stefan Monnier <monnier@iro.umontreal.ca>
6
7 * nnimap.el (nnimap-keepalive): Don't throw an error if there's no more
8 imap process running.
9
102013-01-14 Julien Danjou <julien@danjou.info>
11
12 * gnus-sum.el (gnus-summary-from-or-to-or-newsgroups):
13 Compare addresses against addresses, not against the full From field.
14
152013-01-13 Richard Stallman <rms@gnu.org>
16
17 * message.el (message-forward-make-body-mime): New args BEG, END
18 specify what part of FORWARD-BUFFER to use. Do the work directly
19 instead of calling `mml-insert-buffer'.
20
212013-01-11 Aaron S. Hawley <Aaron.Hawley@vtinfo.com>
22
23 * gnus-start.el (gnus-check-new-newsgroups): Fix ambiguous doc string
24 cross-reference(s).
25
26 * gnus-sum.el (gnus-summary-newsgroup-prefix): Fix ambiguous doc string
27 cross-reference(s).
28
292013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
30
31 * gnus-art.el (gnus-mime-display-security): Use point-min-marker
32 and point-max-marker.
33 * gnus-async.el (gnus-async-article-callback): Use point-max-marker.
34
352013-01-10 Uwe Brauer <oub@mat.ucm.es> (tiny change)
36
37 * mml-smime.el (mml-smime-encrypt-to-self): New user option analogous
38 to mml2015-encrypt-to-self.
39 (mml-smime-epg-encrypt): Respect mml-smime-encrypt-to-self.
40
412013-01-09 Daiki Ueno <ueno@gnu.org>
42
43 * mml-smime.el (epg-sub-key-fingerprint): Autoload for
44 mml-smime-epg-find-usable-secret-key.
45
462013-01-08 Glenn Morris <rgm@gnu.org>
47
48 * mml-smime.el (mml-smime-sign-with-sender): Add :version.
49
502013-01-07 Daiki Ueno <ueno@gnu.org>
51
52 * mml-smime.el: Support signing by sender.
53 Requested by Uwe Brauer.
54 (mml-smime-sign-with-sender): New user option analogous
55 to mml2015-sign-with-sender.
56 (mml-smime-epg-sign): Respect mml-smime-sign-with-sender.
57 (mml-smime-epg-find-usable-secret-key): New helper function copied from
58 mml2015.el.
59
12012-12-31 Lars Magne Ingebrigtsen <larsi@gnus.org> 602012-12-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 61
3 * gnus-msg.el (gnus-inews-insert-gcc): Don't insert Gcc headers if Gnus 62 * gnus-msg.el (gnus-inews-insert-gcc): Don't insert Gcc headers if Gnus
@@ -128,8 +187,8 @@
128 the `face' property with a list whose car is the face specified in the 187 the `face' property with a list whose car is the face specified in the
129 format string and whose cdr is (nil). 188 format string and whose cdr is (nil).
130 * lisp/gnus-util.el 189 * lisp/gnus-util.el
131 (gnus-put-text-property-excluding-characters-with-faces): Change 190 (gnus-put-text-property-excluding-characters-with-faces):
132 accordingly. 191 Change accordingly.
133 (gnus-get-text-property-excluding-characters-with-faces): New function. 192 (gnus-get-text-property-excluding-characters-with-faces): New function.
134 * lisp/gnus-sum.el (gnus-summary-highlight-line): 193 * lisp/gnus-sum.el (gnus-summary-highlight-line):
135 * lisp/gnus-salt.el (gnus-tree-highlight-node): 194 * lisp/gnus-salt.el (gnus-tree-highlight-node):
@@ -177,8 +236,8 @@
177 236
1782012-12-22 Philipp Haselwarter <philipp@haselwarter.org> 2372012-12-22 Philipp Haselwarter <philipp@haselwarter.org>
179 238
180 * gnus-sync.el (gnus-sync-file-encrypt-to, gnus-sync-save): Set 239 * gnus-sync.el (gnus-sync-file-encrypt-to, gnus-sync-save):
181 epa-file-encrypt-to from variable to avoid querying. 240 Set epa-file-encrypt-to from variable to avoid querying.
182 241
1832012-12-14 Akinori MUSHA <knu@iDaemons.org> (tiny change) 2422012-12-14 Akinori MUSHA <knu@iDaemons.org> (tiny change)
184 243
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 1b4cddc5009..25a555f3d8b 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -8688,9 +8688,7 @@ For example:
8688 gnus-mime-security-button-end-line-format)) 8688 gnus-mime-security-button-end-line-format))
8689 (gnus-insert-mime-security-button handle))) 8689 (gnus-insert-mime-security-button handle)))
8690 (mm-set-handle-multipart-parameter 8690 (mm-set-handle-multipart-parameter
8691 handle 'gnus-region 8691 handle 'gnus-region (cons (point-min-marker) (point-max-marker)))
8692 (cons (set-marker (make-marker) (point-min))
8693 (set-marker (make-marker) (point-max))))
8694 (goto-char (point-max)))) 8692 (goto-char (point-max))))
8695 8693
8696(defun gnus-mime-security-run-function (function) 8694(defun gnus-mime-security-run-function (function)
diff --git a/lisp/gnus/gnus-async.el b/lisp/gnus/gnus-async.el
index 41b0cc25006..c5d64332547 100644
--- a/lisp/gnus/gnus-async.el
+++ b/lisp/gnus/gnus-async.el
@@ -254,7 +254,7 @@ that was fetched."
254 gnus-async-article-alist 254 gnus-async-article-alist
255 (cons (list (intern (format "%s-%d" group article) 255 (cons (list (intern (format "%s-%d" group article)
256 gnus-async-hashtb) 256 gnus-async-hashtb)
257 mark (set-marker (make-marker) (point-max)) 257 mark (point-max-marker)
258 group article) 258 group article)
259 gnus-async-article-alist)))) 259 gnus-async-article-alist))))
260 (if (not (gnus-buffer-live-p summary)) 260 (if (not (gnus-buffer-live-p summary))
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index 42cc284a0ad..aa8b6bf2703 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -110,7 +110,7 @@ ask the servers (primary, secondary, and archive servers) to list new
110groups since the last time it checked: 110groups since the last time it checked:
111 1. This variable is `ask-server'. 111 1. This variable is `ask-server'.
112 2. This variable is a list of select methods (see below). 112 2. This variable is a list of select methods (see below).
113 3. `gnus-read-active-file' is nil or `some'. 113 3. Option `gnus-read-active-file' is nil or `some'.
114 4. A prefix argument is given to `gnus-find-new-newsgroups' interactively. 114 4. A prefix argument is given to `gnus-find-new-newsgroups' interactively.
115 115
116Thus, if this variable is `ask-server' or a list of select methods or 116Thus, if this variable is `ask-server' or a list of select methods or
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 49b7e5930f6..ea68a6a2fa5 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -1167,7 +1167,7 @@ using `gnus-ignored-from-addresses'."
1167 1167
1168(defcustom gnus-summary-newsgroup-prefix "=> " 1168(defcustom gnus-summary-newsgroup-prefix "=> "
1169 "*String prefixed to the Newsgroup field in the summary 1169 "*String prefixed to the Newsgroup field in the summary
1170line when using `gnus-ignored-from-addresses'." 1170line when using the option `gnus-ignored-from-addresses'."
1171 :version "22.1" 1171 :version "22.1"
1172 :group 'gnus-summary 1172 :group 'gnus-summary
1173 :type 'string) 1173 :type 'string)
@@ -3651,17 +3651,18 @@ buffer that was in action when the last article was fetched."
3651 (or (car (funcall gnus-extract-address-components from)) 3651 (or (car (funcall gnus-extract-address-components from))
3652 from)) 3652 from))
3653 3653
3654(defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from) 3654(defun gnus-summary-from-or-to-or-newsgroups (header from)
3655 (let ((mail-parse-charset gnus-newsgroup-charset) 3655 (let ((mail-parse-charset gnus-newsgroup-charset)
3656 (ignored-from-addresses (gnus-ignored-from-addresses)) 3656 (ignored-from-addresses (gnus-ignored-from-addresses))
3657 ; Is it really necessary to do this next part for each summary line? 3657 ;; Is it really necessary to do this next part for each summary line?
3658 ; Luckily, doesn't seem to slow things down much. 3658 ;; Luckily, doesn't seem to slow things down much.
3659 (mail-parse-ignored-charsets 3659 (mail-parse-ignored-charsets
3660 (with-current-buffer gnus-summary-buffer 3660 (with-current-buffer gnus-summary-buffer
3661 gnus-newsgroup-ignored-charsets))) 3661 gnus-newsgroup-ignored-charsets))
3662 (address (cadr (gnus-extract-address-components from))))
3662 (or 3663 (or
3663 (and ignored-from-addresses 3664 (and ignored-from-addresses
3664 (string-match ignored-from-addresses gnus-tmp-from) 3665 (string-match ignored-from-addresses address)
3665 (let ((extra-headers (mail-header-extra header)) 3666 (let ((extra-headers (mail-header-extra header))
3666 to 3667 to
3667 newsgroups) 3668 newsgroups)
@@ -3680,9 +3681,7 @@ buffer that was in action when the last article was fetched."
3680 gnus-newsgroup-name)) 'nntp) 3681 gnus-newsgroup-name)) 'nntp)
3681 (gnus-group-real-name gnus-newsgroup-name)))) 3682 (gnus-group-real-name gnus-newsgroup-name))))
3682 (concat gnus-summary-newsgroup-prefix newsgroups))))) 3683 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3683 (gnus-string-mark-left-to-right 3684 (gnus-string-mark-left-to-right (gnus-summary-extract-address-component from)))))
3684 (inline
3685 (gnus-summary-extract-address-component gnus-tmp-from))))))
3686 3685
3687(defun gnus-summary-insert-line (gnus-tmp-header 3686(defun gnus-summary-insert-line (gnus-tmp-header
3688 gnus-tmp-level gnus-tmp-current 3687 gnus-tmp-level gnus-tmp-current
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 8832899c55d..808e1edd6c3 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -7376,12 +7376,13 @@ Optional DIGEST will use digest to forward."
7376 (dolist (elem ignored) 7376 (dolist (elem ignored)
7377 (message-remove-header elem t)))))) 7377 (message-remove-header elem t))))))
7378 7378
7379(defun message-forward-make-body-mime (forward-buffer) 7379(defun message-forward-make-body-mime (forward-buffer &optional beg end)
7380 (let ((b (point))) 7380 (let ((b (point)))
7381 (insert "\n\n<#part type=message/rfc822 disposition=inline raw=t>\n") 7381 (insert "\n\n<#part type=message/rfc822 disposition=inline raw=t>\n")
7382 (save-restriction 7382 (save-restriction
7383 (narrow-to-region (point) (point)) 7383 (narrow-to-region (point) (point))
7384 (mml-insert-buffer forward-buffer) 7384 (insert-buffer-substring forward-buffer beg end)
7385 (mml-quote-region (point-min) (point-max))
7385 (goto-char (point-min)) 7386 (goto-char (point-min))
7386 (when (looking-at "From ") 7387 (when (looking-at "From ")
7387 (replace-match "X-From-Line: ")) 7388 (replace-match "X-From-Line: "))
diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el
index 3e769d396b0..6ea55377e02 100644
--- a/lisp/gnus/mml-smime.el
+++ b/lisp/gnus/mml-smime.el
@@ -74,6 +74,18 @@ Whether the passphrase is cached at all is controlled by
74 :group 'mime-security 74 :group 'mime-security
75 :type '(repeat (string :tag "Key ID"))) 75 :type '(repeat (string :tag "Key ID")))
76 76
77(defcustom mml-smime-sign-with-sender nil
78 "If t, use message sender so find a key to sign with."
79 :group 'mime-security
80 :version "24.4"
81 :type 'boolean)
82
83(defcustom mml-smime-encrypt-to-self nil
84 "If t, add your own key ID to recipient list when encryption."
85 :group 'mime-security
86 :version "24.4"
87 :type 'boolean)
88
77(defun mml-smime-sign (cont) 89(defun mml-smime-sign (cont)
78 (let ((func (nth 1 (assq mml-smime-use mml-smime-function-alist)))) 90 (let ((func (nth 1 (assq mml-smime-use mml-smime-function-alist))))
79 (if func 91 (if func
@@ -323,6 +335,7 @@ Whether the passphrase is cached at all is controlled by
323 (autoload 'epg-encrypt-string "epg") 335 (autoload 'epg-encrypt-string "epg")
324 (autoload 'epg-passphrase-callback-function "epg") 336 (autoload 'epg-passphrase-callback-function "epg")
325 (autoload 'epg-context-set-passphrase-callback "epg") 337 (autoload 'epg-context-set-passphrase-callback "epg")
338 (autoload 'epg-sub-key-fingerprint "epg")
326 (autoload 'epg-configuration "epg-config") 339 (autoload 'epg-configuration "epg-config")
327 (autoload 'epg-expand-group "epg-config") 340 (autoload 'epg-expand-group "epg-config")
328 (autoload 'epa-select-keys "epa")) 341 (autoload 'epa-select-keys "epa"))
@@ -366,6 +379,24 @@ Whether the passphrase is cached at all is controlled by
366 (setq pointer (cdr pointer)))) 379 (setq pointer (cdr pointer))))
367 (setq keys (cdr keys))))) 380 (setq keys (cdr keys)))))
368 381
382;; XXX: since gpg --list-secret-keys does not return validity of each
383;; key, `mml-smime-epg-find-usable-key' defined above is not enough for
384;; secret keys. The function `mml-smime-epg-find-usable-secret-key'
385;; below looks at appropriate public keys to check usability.
386(defun mml-smime-epg-find-usable-secret-key (context name usage)
387 (let ((secret-keys (epg-list-keys context name t))
388 secret-key)
389 (while (and (not secret-key) secret-keys)
390 (if (mml-smime-epg-find-usable-key
391 (epg-list-keys context (epg-sub-key-fingerprint
392 (car (epg-key-sub-key-list
393 (car secret-keys)))))
394 usage)
395 (setq secret-key (car secret-keys)
396 secret-keys nil)
397 (setq secret-keys (cdr secret-keys))))
398 secret-key))
399
369(autoload 'mml-compute-boundary "mml") 400(autoload 'mml-compute-boundary "mml")
370 401
371;; We require mm-decode, which requires mm-bodies, which autoloads 402;; We require mm-decode, which requires mm-bodies, which autoloads
@@ -376,29 +407,36 @@ Whether the passphrase is cached at all is controlled by
376 (let* ((inhibit-redisplay t) 407 (let* ((inhibit-redisplay t)
377 (context (epg-make-context 'CMS)) 408 (context (epg-make-context 'CMS))
378 (boundary (mml-compute-boundary cont)) 409 (boundary (mml-compute-boundary cont))
410 (sender (message-options-get 'message-sender))
411 (signer-names (or mml-smime-signers
412 (if (and mml-smime-sign-with-sender sender)
413 (list (concat "<" sender ">")))))
379 signer-key 414 signer-key
380 (signers 415 (signers
381 (or (message-options-get 'mml-smime-epg-signers) 416 (or (message-options-get 'mml-smime-epg-signers)
382 (message-options-set 417 (message-options-set
383 'mml-smime-epg-signers 418 'mml-smime-epg-signers
384 (if (eq mm-sign-option 'guided) 419 (if (eq mm-sign-option 'guided)
385 (epa-select-keys context "\ 420 (epa-select-keys context "\
386Select keys for signing. 421Select keys for signing.
387If no one is selected, default secret key is used. " 422If no one is selected, default secret key is used. "
388 mml-smime-signers t) 423 signer-names
389 (if mml-smime-signers 424 t)
390 (mapcar 425 (if (or sender mml-smime-signers)
391 (lambda (signer) 426 (delq nil
392 (setq signer-key (mml-smime-epg-find-usable-key 427 (mapcar
393 (epg-list-keys context signer t) 428 (lambda (signer)
394 'sign)) 429 (setq signer-key
395 (unless (or signer-key 430 (mml-smime-epg-find-usable-secret-key
396 (y-or-n-p 431 context signer 'sign))
397 (format "No secret key for %s; skip it? " 432 (unless (or signer-key
433 (y-or-n-p
434 (format
435 "No secret key for %s; skip it? "
398 signer))) 436 signer)))
399 (error "No secret key for %s" signer)) 437 (error "No secret key for %s" signer))
400 signer-key) 438 signer-key)
401 mml-smime-signers)))))) 439 signer-names)))))))
402 signature micalg) 440 signature micalg)
403 (epg-context-set-signers context signers) 441 (epg-context-set-signers context signers)
404 (if mml-smime-cache-passphrase 442 (if mml-smime-cache-passphrase
@@ -443,13 +481,17 @@ Content-Disposition: attachment; filename=smime.p7s
443 (goto-char (point-max)))) 481 (goto-char (point-max))))
444 482
445(defun mml-smime-epg-encrypt (cont) 483(defun mml-smime-epg-encrypt (cont)
446 (let ((inhibit-redisplay t) 484 (let* ((inhibit-redisplay t)
447 (context (epg-make-context 'CMS)) 485 (context (epg-make-context 'CMS))
448 (config (epg-configuration)) 486 (config (epg-configuration))
449 (recipients (message-options-get 'mml-smime-epg-recipients)) 487 (recipients (message-options-get 'mml-smime-epg-recipients))
450 cipher signers 488 cipher signers
451 (boundary (mml-compute-boundary cont)) 489 (sender (message-options-get 'message-sender))
452 recipient-key) 490 (signer-names (or mml-smime-signers
491 (if (and mml-smime-sign-with-sender sender)
492 (list (concat "<" sender ">")))))
493 (boundary (mml-compute-boundary cont))
494 recipient-key)
453 (unless recipients 495 (unless recipients
454 (setq recipients 496 (setq recipients
455 (apply #'nconc 497 (apply #'nconc
@@ -462,6 +504,10 @@ Content-Disposition: attachment; filename=smime.p7s
462 (message-options-set 'message-recipients 504 (message-options-set 'message-recipients
463 (read-string "Recipients: "))) 505 (read-string "Recipients: ")))
464 "[ \f\t\n\r\v,]+")))) 506 "[ \f\t\n\r\v,]+"))))
507 (when mml-smime-encrypt-to-self
508 (unless signer-names
509 (error "Neither message sender nor mml-smime-signers are set"))
510 (setq recipients (nconc recipients signer-names)))
465 (if (eq mm-encrypt-option 'guided) 511 (if (eq mm-encrypt-option 'guided)
466 (setq recipients 512 (setq recipients
467 (epa-select-keys context "\ 513 (epa-select-keys context "\
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index ea579fa3a2b..9c18bc2cff0 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -339,7 +339,8 @@ textual parts.")
339 (nnimap-last-command-time nnimap-object))) 339 (nnimap-last-command-time nnimap-object)))
340 ;; More than five minutes since the last command. 340 ;; More than five minutes since the last command.
341 (* 5 60))) 341 (* 5 60)))
342 (nnimap-send-command "NOOP"))))))) 342 (ignore-errors ;E.g. "buffer foo has no process".
343 (nnimap-send-command "NOOP"))))))))
343 344
344(defun nnimap-open-connection (buffer) 345(defun nnimap-open-connection (buffer)
345 ;; Be backwards-compatible -- the earlier value of nnimap-stream was 346 ;; Be backwards-compatible -- the earlier value of nnimap-stream was
@@ -367,7 +368,7 @@ textual parts.")
367(defun nnimap-open-connection-1 (buffer) 368(defun nnimap-open-connection-1 (buffer)
368 (unless nnimap-keepalive-timer 369 (unless nnimap-keepalive-timer
369 (setq nnimap-keepalive-timer (run-at-time (* 60 15) (* 60 15) 370 (setq nnimap-keepalive-timer (run-at-time (* 60 15) (* 60 15)
370 'nnimap-keepalive))) 371 #'nnimap-keepalive)))
371 (with-current-buffer (nnimap-make-process-buffer buffer) 372 (with-current-buffer (nnimap-make-process-buffer buffer)
372 (let* ((coding-system-for-read 'binary) 373 (let* ((coding-system-for-read 'binary)
373 (coding-system-for-write 'binary) 374 (coding-system-for-write 'binary)
diff --git a/lisp/gnus/smiley.el b/lisp/gnus/smiley.el
index 6381f5bf9d9..eb71134457c 100644
--- a/lisp/gnus/smiley.el
+++ b/lisp/gnus/smiley.el
@@ -59,7 +59,10 @@
59 59
60(defcustom smiley-style 60(defcustom smiley-style
61 (if (or (and (fboundp 'face-attribute) 61 (if (or (and (fboundp 'face-attribute)
62 (>= (face-attribute 'default :height) 160)) 62 ;; In batch mode, attributes can be unspecified.
63 (condition-case nil
64 (>= (face-attribute 'default :height) 160)
65 (error nil)))
63 (and (fboundp 'face-height) 66 (and (fboundp 'face-height)
64 (>= (face-height 'default) 14))) 67 (>= (face-height 'default) 14)))
65 'medium 68 'medium
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 662f431d3c3..b5aca1a4445 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -322,7 +322,7 @@ Commands:
322 322
323(defconst help-xref-symbol-regexp 323(defconst help-xref-symbol-regexp
324 (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|" ; Link to var 324 (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|" ; Link to var
325 "\\(function\\|command\\)\\|" ; Link to function 325 "\\(function\\|command\\|call\\)\\|" ; Link to function
326 "\\(face\\)\\|" ; Link to face 326 "\\(face\\)\\|" ; Link to face
327 "\\(symbol\\|program\\|property\\)\\|" ; Don't link 327 "\\(symbol\\|program\\|property\\)\\|" ; Don't link
328 "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)" 328 "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)"
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 90eb5dfaec5..a95dde1d999 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -63,8 +63,9 @@ otherwise it defaults to t, used for times when the buffer is not displayed."
63 (when cleanup 63 (when cleanup
64 (setq image-mode-winprops-alist 64 (setq image-mode-winprops-alist
65 (delq nil (mapcar (lambda (winprop) 65 (delq nil (mapcar (lambda (winprop)
66 (if (window-live-p (car-safe winprop)) 66 (let ((w (car-safe winprop)))
67 winprop)) 67 (if (or (not (windowp w)) (window-live-p w))
68 winprop)))
68 image-mode-winprops-alist)))) 69 image-mode-winprops-alist))))
69 (let ((winprops (assq window image-mode-winprops-alist))) 70 (let ((winprops (assq window image-mode-winprops-alist)))
70 ;; For new windows, set defaults from the latest. 71 ;; For new windows, set defaults from the latest.
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 0bfee770094..f64d1afe951 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -447,6 +447,8 @@ Don't move point."
447Simple elements in the alist look like (INDEX-NAME . POSITION). 447Simple elements in the alist look like (INDEX-NAME . POSITION).
448POSITION is the buffer position of the item; to go to the item 448POSITION is the buffer position of the item; to go to the item
449is simply to move point to that position. 449is simply to move point to that position.
450POSITION is passed to `imenu-default-goto-function', so it can be a non-number
451if that variable has been changed (e.g. Semantic uses overlays for POSITIONs).
450 452
451Special elements look like (INDEX-NAME POSITION FUNCTION ARGUMENTS...). 453Special elements look like (INDEX-NAME POSITION FUNCTION ARGUMENTS...).
452To \"go to\" a special element means applying FUNCTION 454To \"go to\" a special element means applying FUNCTION
diff --git a/lisp/info.el b/lisp/info.el
index 8408e01efb5..e230ed0f82c 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1703,7 +1703,9 @@ escaped (\\\",\\\\)."
1703If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file 1703If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file
1704FILENAME; otherwise, NODENAME should be in the current Info file (or one of 1704FILENAME; otherwise, NODENAME should be in the current Info file (or one of
1705its sub-files). 1705its sub-files).
1706Completion is available, but only for node names in the current Info file. 1706Completion is available for node names in the current Info file as well as
1707in the Info file FILENAME after the closing parenthesis in (FILENAME).
1708Empty NODENAME in (FILENAME) defaults to the Top node.
1707If FORK is non-nil (interactively with a prefix arg), show the node in 1709If FORK is non-nil (interactively with a prefix arg), show the node in
1708a new Info buffer. 1710a new Info buffer.
1709If FORK is a string, it is the name to use for the new buffer." 1711If FORK is a string, it is the name to use for the new buffer."
@@ -1740,6 +1742,7 @@ list of valid filename suffixes for Info files. See
1740 (when (file-name-absolute-p string) 1742 (when (file-name-absolute-p string)
1741 (setq dirs (list (file-name-directory string)))) 1743 (setq dirs (list (file-name-directory string))))
1742 (let ((names nil) 1744 (let ((names nil)
1745 (names-sans-suffix nil)
1743 (suffix (concat (regexp-opt suffixes t) "\\'")) 1746 (suffix (concat (regexp-opt suffixes t) "\\'"))
1744 (string-dir (file-name-directory string))) 1747 (string-dir (file-name-directory string)))
1745 (dolist (dir dirs) 1748 (dolist (dir dirs)
@@ -1762,7 +1765,14 @@ list of valid filename suffixes for Info files. See
1762 ;; add the unsuffixed name as a completion option. 1765 ;; add the unsuffixed name as a completion option.
1763 (when (string-match suffix file) 1766 (when (string-match suffix file)
1764 (setq file (substring file 0 (match-beginning 0))) 1767 (setq file (substring file 0 (match-beginning 0)))
1765 (push (if string-dir (concat string-dir file) file) names))))) 1768 (push (if string-dir (concat string-dir file) file)
1769 names-sans-suffix)))))
1770 ;; If there is just one file, don't duplicate it with suffixes,
1771 ;; so `Info-read-node-name-1' will be able to complete a single
1772 ;; candidate and to add the terminating ")".
1773 (if (and (= (length names) 1) (= (length names-sans-suffix) 1))
1774 (setq names names-sans-suffix)
1775 (setq names (append names-sans-suffix names)))
1766 (complete-with-action action names string pred))) 1776 (complete-with-action action names string pred)))
1767 1777
1768(defun Info-read-node-name-1 (string predicate code) 1778(defun Info-read-node-name-1 (string predicate code)
@@ -1784,16 +1794,19 @@ See `completing-read' for a description of arguments and usage."
1784 ((string-match "\\`(\\([^)]+\\))" string) 1794 ((string-match "\\`(\\([^)]+\\))" string)
1785 (let ((file0 (match-string 0 string)) 1795 (let ((file0 (match-string 0 string))
1786 (file1 (match-string 1 string)) 1796 (file1 (match-string 1 string))
1787 (node (substring string (match-end 0)))) 1797 (nodename (substring string (match-end 0))))
1788 (completion-table-with-context 1798 (if (and (equal nodename "") (eq code 'lambda))
1789 file0 1799 ;; Empty node name is permitted that means "Top".
1790 (apply-partially 1800 t
1791 (lambda (string pred action) 1801 (completion-table-with-context
1792 (complete-with-action 1802 file0
1793 action 1803 (apply-partially
1794 (Info-build-node-completions (Info-find-file file1)) 1804 (lambda (string pred action)
1795 string pred))) 1805 (complete-with-action
1796 node predicate code))) 1806 action
1807 (Info-build-node-completions (Info-find-file file1))
1808 string pred)))
1809 nodename predicate code))))
1797 ;; Otherwise use Info-read-node-completion-table. 1810 ;; Otherwise use Info-read-node-completion-table.
1798 (t (complete-with-action 1811 (t (complete-with-action
1799 code Info-read-node-completion-table string predicate)))) 1812 code Info-read-node-completion-table string predicate))))
@@ -1802,7 +1815,9 @@ See `completing-read' for a description of arguments and usage."
1802(defun Info-read-node-name (prompt) 1815(defun Info-read-node-name (prompt)
1803 "Read an Info node name with completion, prompting with PROMPT. 1816 "Read an Info node name with completion, prompting with PROMPT.
1804A node name can have the form \"NODENAME\", referring to a node 1817A node name can have the form \"NODENAME\", referring to a node
1805in the current Info file, or \"(FILENAME)NODENAME\"." 1818in the current Info file, or \"(FILENAME)NODENAME\", referring to
1819a node in FILENAME. \"(FILENAME)\" is a short format to go to
1820the Top node in FILENAME."
1806 (let* ((completion-ignore-case t) 1821 (let* ((completion-ignore-case t)
1807 (Info-read-node-completion-table (Info-build-node-completions)) 1822 (Info-read-node-completion-table (Info-build-node-completions))
1808 (nodename (completing-read prompt 'Info-read-node-name-1 nil t))) 1823 (nodename (completing-read prompt 'Info-read-node-name-1 nil t)))
@@ -1810,14 +1825,14 @@ in the current Info file, or \"(FILENAME)NODENAME\"."
1810 (Info-read-node-name prompt) 1825 (Info-read-node-name prompt)
1811 nodename))) 1826 nodename)))
1812 1827
1813(defun Info-build-node-completions (&optional file) 1828(defun Info-build-node-completions (&optional filename)
1814 (if file 1829 (if filename
1815 (or (cdr (assoc file Info-file-completions)) 1830 (or (cdr (assoc filename Info-file-completions))
1816 (with-temp-buffer 1831 (with-temp-buffer
1817 (Info-mode) 1832 (Info-mode)
1818 (Info-goto-node (format "(%s)Top" file)) 1833 (Info-goto-node (format "(%s)Top" filename))
1819 (Info-build-node-completions-1) 1834 (Info-build-node-completions-1)
1820 (push (cons file Info-current-file-completions) Info-file-completions) 1835 (push (cons filename Info-current-file-completions) Info-file-completions)
1821 Info-current-file-completions)) 1836 Info-current-file-completions))
1822 (or Info-current-file-completions 1837 (or Info-current-file-completions
1823 (Info-build-node-completions-1)))) 1838 (Info-build-node-completions-1))))
@@ -4298,7 +4313,7 @@ If the element is just a file name, the file name also serves as the prefix.")
4298The `info-file' property of COMMAND says which Info manual to search. 4313The `info-file' property of COMMAND says which Info manual to search.
4299If COMMAND has no property, the variable `Info-file-list-for-emacs' 4314If COMMAND has no property, the variable `Info-file-list-for-emacs'
4300defines heuristics for which Info manual to try. 4315defines heuristics for which Info manual to try.
4301The locations are of the format used in `Info-history', i.e. 4316The locations are of the format used in the variable `Info-history', i.e.
4302\(FILENAME NODENAME BUFFERPOS), where BUFFERPOS is the line number 4317\(FILENAME NODENAME BUFFERPOS), where BUFFERPOS is the line number
4303in the first element of the returned list (which is treated specially in 4318in the first element of the returned list (which is treated specially in
4304`Info-goto-emacs-command-node'), and 0 for the rest elements of a list." 4319`Info-goto-emacs-command-node'), and 0 for the rest elements of a list."
@@ -5167,13 +5182,16 @@ Otherwise, visit the manual in a new Info buffer."
5167 (with-current-buffer buffer 5182 (with-current-buffer buffer
5168 (and (eq major-mode 'Info-mode) 5183 (and (eq major-mode 'Info-mode)
5169 (stringp Info-current-file) 5184 (stringp Info-current-file)
5185 (not (string= (substring (buffer-name) 0 1) " "))
5170 (push (file-name-sans-extension 5186 (push (file-name-sans-extension
5171 (file-name-nondirectory Info-current-file)) 5187 (file-name-nondirectory Info-current-file))
5172 names)))) 5188 names))))
5173 (delete-dups (append (nreverse names) 5189 (delete-dups (append (nreverse names)
5174 (apply-partially 'Info-read-node-name-2 5190 (all-completions
5175 Info-directory-list 5191 ""
5176 (mapcar 'car Info-suffix-list)))))) 5192 (apply-partially 'Info-read-node-name-2
5193 Info-directory-list
5194 (mapcar 'car Info-suffix-list)))))))
5177 5195
5178(provide 'info) 5196(provide 'info)
5179 5197
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 03b88038dd7..35c303f0ea8 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -2946,14 +2946,14 @@ This function also accepts a hexadecimal number of Unicode code
2946point or a number in hash notation, e.g. #o21430 for octal, 2946point or a number in hash notation, e.g. #o21430 for octal,
2947#x2318 for hex, or #10r8984 for decimal." 2947#x2318 for hex, or #10r8984 for decimal."
2948 (let* ((enable-recursive-minibuffers t) 2948 (let* ((enable-recursive-minibuffers t)
2949 (completion-ignore-case t)
2949 (input 2950 (input
2950 (completing-read 2951 (completing-read
2951 prompt 2952 prompt
2952 (lambda (string pred action) 2953 (lambda (string pred action)
2953 (let ((completion-ignore-case t)) 2954 (if (eq action 'metadata)
2954 (if (eq action 'metadata) 2955 '(metadata (category . unicode-name))
2955 '(metadata (category . unicode-name)) 2956 (complete-with-action action (ucs-names) string pred)))))
2956 (complete-with-action action (ucs-names) string pred))))))
2957 (char 2957 (char
2958 (cond 2958 (cond
2959 ((string-match-p "\\`[0-9a-fA-F]+\\'" input) 2959 ((string-match-p "\\`[0-9a-fA-F]+\\'" input)
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 6fa589a9622..995df2fb9a7 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -891,7 +891,7 @@ or one is an alias of the other."
891 (and (vectorp eol-type-1) (vectorp eol-type-2))))))) 891 (and (vectorp eol-type-1) (vectorp eol-type-2)))))))
892 892
893(defun add-to-coding-system-list (coding-system) 893(defun add-to-coding-system-list (coding-system)
894 "Add CODING-SYSTEM to `coding-system-list' while keeping it sorted." 894 "Add CODING-SYSTEM to variable `coding-system-list' while keeping it sorted."
895 (if (or (null coding-system-list) 895 (if (or (null coding-system-list)
896 (coding-system-lessp coding-system (car coding-system-list))) 896 (coding-system-lessp coding-system (car coding-system-list)))
897 (setq coding-system-list (cons coding-system coding-system-list)) 897 (setq coding-system-list (cons coding-system coding-system-list))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index b13881b208b..e16e3840d0d 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -176,7 +176,7 @@ is non-nil if the user quits the search.")
176 176
177(defvar isearch-message-function nil 177(defvar isearch-message-function nil
178 "Function to call to display the search prompt. 178 "Function to call to display the search prompt.
179If nil, use `isearch-message'.") 179If nil, use function `isearch-message'.")
180 180
181(defvar isearch-wrap-function nil 181(defvar isearch-wrap-function nil
182 "Function to call to wrap the search when search is failed. 182 "Function to call to wrap the search when search is failed.
@@ -1101,7 +1101,7 @@ nonincremental search instead via `isearch-edit-string'."
1101 1101
1102(defun isearch-fail-pos (&optional msg) 1102(defun isearch-fail-pos (&optional msg)
1103 "Return position of first mismatch in search string, or nil if none. 1103 "Return position of first mismatch in search string, or nil if none.
1104If MSG is non-nil, use `isearch-message', otherwise `isearch-string'." 1104If MSG is non-nil, use variable `isearch-message', otherwise `isearch-string'."
1105 (let ((cmds isearch-cmds) 1105 (let ((cmds isearch-cmds)
1106 (curr-msg (if msg isearch-message isearch-string)) 1106 (curr-msg (if msg isearch-message isearch-string))
1107 succ-msg) 1107 succ-msg)
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 7be5df72c84..668f1ec963a 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -257,6 +257,47 @@ the variable `jit-lock-stealth-nice'."
257 (remove-hook 'after-change-functions 'jit-lock-after-change t) 257 (remove-hook 'after-change-functions 'jit-lock-after-change t)
258 (remove-hook 'fontification-functions 'jit-lock-function)))) 258 (remove-hook 'fontification-functions 'jit-lock-function))))
259 259
260(define-minor-mode jit-lock-debug-mode
261 "Minor mode to help debug code run from jit-lock.
262When this minor mode is enabled, jit-lock runs as little code as possible
263during redisplay and moves the rest to a timer, where things
264like `debug-on-error' and Edebug can be used."
265 :global t
266 (when jit-lock-defer-timer
267 (cancel-timer jit-lock-defer-timer)
268 (setq jit-lock-defer-timer nil))
269 (when jit-lock-debug-mode
270 (setq jit-lock-defer-timer
271 (run-with-idle-timer 0 t #'jit-lock--debug-fontify))))
272
273(defvar jit-lock--debug-fontifying nil)
274
275(defun jit-lock--debug-fontify ()
276 "Fontify what was deferred for debugging."
277 (when (and (not jit-lock--debug-fontifying)
278 jit-lock-defer-buffers (not memory-full))
279 (let ((jit-lock--debug-fontifying t)
280 (inhibit-debugger nil)) ;FIXME: Not sufficient!
281 ;; Mark the deferred regions back to `fontified = nil'
282 (dolist (buffer jit-lock-defer-buffers)
283 (when (buffer-live-p buffer)
284 (with-current-buffer buffer
285 ;; (message "Jit-Debug %s" (buffer-name))
286 (with-buffer-prepared-for-jit-lock
287 (let ((pos (point-min)))
288 (while
289 (progn
290 (when (eq (get-text-property pos 'fontified) 'defer)
291 (let ((beg pos)
292 (end (setq pos (next-single-property-change
293 pos 'fontified
294 nil (point-max)))))
295 (put-text-property beg end 'fontified nil)
296 (jit-lock-fontify-now beg end)))
297 (setq pos (next-single-property-change
298 pos 'fontified)))))))))
299 (setq jit-lock-defer-buffers nil))))
300
260(defun jit-lock-register (fun &optional contextual) 301(defun jit-lock-register (fun &optional contextual)
261 "Register FUN as a fontification function to be called in this buffer. 302 "Register FUN as a fontification function to be called in this buffer.
262FUN will be called with two arguments START and END indicating the region 303FUN will be called with two arguments START and END indicating the region
@@ -504,7 +545,8 @@ non-nil in a repeated invocation of this function."
504 pos (setq pos (next-single-property-change 545 pos (setq pos (next-single-property-change
505 pos 'fontified nil (point-max))) 546 pos 'fontified nil (point-max)))
506 'fontified nil)) 547 'fontified nil))
507 (setq pos (next-single-property-change pos 'fontified))))))))) 548 (setq pos (next-single-property-change
549 pos 'fontified)))))))))
508 (setq jit-lock-defer-buffers nil) 550 (setq jit-lock-defer-buffers nil)
509 ;; Force fontification of the visible parts. 551 ;; Force fontification of the visible parts.
510 (let ((jit-lock-defer-timer nil)) 552 (let ((jit-lock-defer-timer nil))
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index e32d3c608d4..c6385498dcd 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -4647,7 +4647,7 @@ With prefix argument N moves forward N messages with these labels.
4647 4647
4648;;;*** 4648;;;***
4649 4649
4650;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "1f33964668345a1a1f3119fece148227") 4650;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "93951f748e43e1015da1b485088970ca")
4651;;; Generated autoloads from rmailmm.el 4651;;; Generated autoloads from rmailmm.el
4652 4652
4653(autoload 'rmail-mime "rmailmm" "\ 4653(autoload 'rmail-mime "rmailmm" "\
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 566dec1ad39..350e3dacbcf 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -1365,14 +1365,15 @@ The arguments ARG and STATE have no effect in this case."
1365(defun rmail-insert-mime-forwarded-message (forward-buffer) 1365(defun rmail-insert-mime-forwarded-message (forward-buffer)
1366 "Insert the message in FORWARD-BUFFER as a forwarded message. 1366 "Insert the message in FORWARD-BUFFER as a forwarded message.
1367This is the usual value of `rmail-insert-mime-forwarded-message-function'." 1367This is the usual value of `rmail-insert-mime-forwarded-message-function'."
1368 (let ((message-buffer 1368 (let (contents-buffer start end)
1369 (with-current-buffer forward-buffer 1369 (with-current-buffer forward-buffer
1370 (if rmail-buffer-swapped 1370 (setq contents-buffer
1371 rmail-view-buffer 1371 (if rmail-buffer-swapped
1372 forward-buffer)))) 1372 rmail-view-buffer
1373 (save-restriction 1373 forward-buffer)
1374 (narrow-to-region (point) (point)) 1374 start (rmail-msgbeg rmail-current-message)
1375 (message-forward-make-body-mime message-buffer)))) 1375 end (rmail-msgend rmail-current-message)))
1376 (message-forward-make-body-mime contents-buffer start end)))
1376 1377
1377(setq rmail-insert-mime-forwarded-message-function 1378(setq rmail-insert-mime-forwarded-message-function
1378 'rmail-insert-mime-forwarded-message) 1379 'rmail-insert-mime-forwarded-message)
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index e86229a5cfb..e1dee3295f2 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -1493,6 +1493,9 @@ just append to the file, in Babyl format if necessary."
1493 (insert "\nMail-Followup-To: ")))) 1493 (insert "\nMail-Followup-To: "))))
1494 1494
1495(defun mail-position-on-field (field &optional soft) 1495(defun mail-position-on-field (field &optional soft)
1496 "Move to the start of the contents of header field FIELD.
1497If there is none, insert one, unless SOFT is non-nil.
1498If there are multiple FIELD fields, this goes to the first."
1496 (let (end 1499 (let (end
1497 (case-fold-search t)) 1500 (case-fold-search t))
1498 (setq end (mail-header-end)) 1501 (setq end (mail-header-end))
diff --git a/lisp/man.el b/lisp/man.el
index b6a6c179374..93a67128de4 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1,4 +1,4 @@
1;;; man.el --- browse UNIX manual pages -*- coding: iso-8859-1 -*- 1;;; man.el --- browse UNIX manual pages -*- coding: utf-8 -*-
2 2
3;; Copyright (C) 1993-1994, 1996-1997, 2001-2013 Free Software 3;; Copyright (C) 1993-1994, 1996-1997, 2001-2013 Free Software
4;; Foundation, Inc. 4;; Foundation, Inc.
@@ -276,7 +276,7 @@ Used in `bookmark-set' to get the default bookmark name."
276 :type 'hook 276 :type 'hook
277 :group 'man) 277 :group 'man)
278 278
279(defvar Man-name-regexp "[-a-zA-Z0-9_­+][-a-zA-Z0-9_.:­+]*" 279(defvar Man-name-regexp "[-a-zA-Z0-9_­+][-a-zA-Z0-9_.:­+]*"
280 "Regular expression describing the name of a manpage (without section).") 280 "Regular expression describing the name of a manpage (without section).")
281 281
282(defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]" 282(defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]"
@@ -780,6 +780,59 @@ POS defaults to `point'."
780 ;; but apparently that's not the case in all cases, so let's add a cache. 780 ;; but apparently that's not the case in all cases, so let's add a cache.
781 "Cache of completion table of the form (PREFIX . TABLE).") 781 "Cache of completion table of the form (PREFIX . TABLE).")
782 782
783(defvar Man-man-k-use-anchor
784 ;; man-db or man-1.*
785 (memq system-type '(gnu gnu/linux gnu/kfreebsd))
786 "If non-nil prepend ^ to the prefix passed to \"man -k\" for completion.
787The value should be nil if \"man -k ^PREFIX\" may omit some man
788pages whose names start with PREFIX.
789
790Currently, the default value depends on `system-type' and is
791non-nil where the standard man programs are known to behave
792properly. Setting the value to nil always gives correct results
793but computing the list of completions may take a bit longer.")
794
795(defun Man-parse-man-k ()
796 "Parse \"man -k\" output and return the list of page names.
797
798The current buffer should contain the output of a command of the
799form \"man -k keyword\", which is traditionally also available with
800apropos(1).
801
802While POSIX man(1p) is a bit vague about what to expect here,
803this function tries to parse some commonly used formats, which
804can be described in the following informal way, with square brackets
805indicating optional parts and whitespace being interpreted
806somewhat loosely.
807
808foo[, bar [, ...]] [other stuff] (sec) - description
809foo(sec)[, bar(sec) [, ...]] [other stuff] - description
810
811For more details and some regression tests, please see
812test/automated/man-tests.el in the emacs bzr repository."
813 (goto-char (point-min))
814 ;; See man-tests for data about which systems use which format (hopefully we
815 ;; will be able to simplify the code if/when some of those formats aren't
816 ;; used any more).
817 (let (table)
818 (while (search-forward-regexp "^\\([^ \t,\n]+\\)\\(.*?\\)\
819\\(?:[ \t]\\(([^ \t,\n]+?)\\)\\)?\\(?:[ \t]+- ?\\(.*\\)\\)?$" nil t)
820 (let ((section (match-string 3))
821 (description (match-string 4))
822 (bound (match-end 2)))
823 (goto-char (match-end 1))
824 (while
825 (progn
826 ;; The first regexp grouping may already match the section
827 ;; tacked on to the name, which is ok since for the formats we
828 ;; claim to support the third (non-shy) grouping does not
829 ;; match in this case, i.e., section is nil.
830 (push (propertize (concat (match-string 1) section)
831 'help-echo description)
832 table)
833 (search-forward-regexp "\\=, *\\([^ \t,]+\\)" bound t)))))
834 (nreverse table)))
835
783(defun Man-completion-table (string pred action) 836(defun Man-completion-table (string pred action)
784 (cond 837 (cond
785 ;; This ends up returning t for pretty much any string, and hence leads to 838 ;; This ends up returning t for pretty much any string, and hence leads to
@@ -811,16 +864,15 @@ POS defaults to `point'."
811 ;; run differently in Man-getpage-in-background, an error 864 ;; run differently in Man-getpage-in-background, an error
812 ;; here may not necessarily mean that we'll also get an 865 ;; here may not necessarily mean that we'll also get an
813 ;; error later. 866 ;; error later.
814 (ignore-errors 867 (ignore-errors
815 (call-process manual-program nil '(t nil) nil 868 (call-process manual-program nil '(t nil) nil
816 "-k" (concat "^" prefix)))) 869 "-k" (concat (when (or Man-man-k-use-anchor
817 (goto-char (point-min)) 870 (string-equal prefix ""))
818 (while (re-search-forward "^\\([^ \t\n]+\\)\\(?: ?\\((.+?)\\)\\(?:[ \t]+- \\(.*\\)\\)?\\)?" nil t) 871 "^")
819 (push (propertize (concat (match-string 1) (match-string 2)) 872 prefix))))
820 'help-echo (match-string 3)) 873 (setq table (Man-parse-man-k)))
821 table))) 874 ;; Cache the table for later reuse.
822 ;; Cache the table for later reuse. 875 (setq Man-completion-cache (cons prefix table)))
823 (setq Man-completion-cache (cons prefix table)))
824 ;; The table may contain false positives since the match is made 876 ;; The table may contain false positives since the match is made
825 ;; by "man -k" not just on the manpage's name. 877 ;; by "man -k" not just on the manpage's name.
826 (if section 878 (if section
@@ -891,6 +943,7 @@ names or descriptions. The pattern argument is usually an
891 ;; ("man -k" is case-insensitive similarly, so the 943 ;; ("man -k" is case-insensitive similarly, so the
892 ;; table has everything available to complete) 944 ;; table has everything available to complete)
893 (completion-ignore-case t) 945 (completion-ignore-case t)
946 Man-completion-cache ;Don't cache across calls.
894 (input (completing-read 947 (input (completing-read
895 (format "Manual entry%s" 948 (format "Manual entry%s"
896 (if (string= default-entry "") 949 (if (string= default-entry "")
@@ -1395,7 +1448,7 @@ The following key bindings are currently in effect in the buffer:
1395 ;; Update len, in case a reference spans 1448 ;; Update len, in case a reference spans
1396 ;; more than two lines (paranoia). 1449 ;; more than two lines (paranoia).
1397 len (1- (length word)))) 1450 len (1- (length word))))
1398 (if (memq (aref word len) '(?- ?­)) 1451 (if (memq (aref word len) '(?- ?­))
1399 (setq hyphenated (substring word 0 len))) 1452 (setq hyphenated (substring word 0 len)))
1400 (and (string-match Man-reference-regexp word) 1453 (and (string-match Man-reference-regexp word)
1401 (not (member word Man--refpages)) 1454 (not (member word Man--refpages))
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 024e2237cae..60f2bc2999f 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1637,8 +1637,8 @@ key, a click, or a menu-item"))
1637 '(menu-item "Find Options by Value..." apropos-value 1637 '(menu-item "Find Options by Value..." apropos-value
1638 :help "Find variables whose values match a regexp")) 1638 :help "Find variables whose values match a regexp"))
1639 (bindings--define-key menu [find-options-by-name] 1639 (bindings--define-key menu [find-options-by-name]
1640 '(menu-item "Find Options by Name..." apropos-variable 1640 '(menu-item "Find Options by Name..." apropos-user-option
1641 :help "Find variables whose names match a regexp")) 1641 :help "Find user options whose names match a regexp"))
1642 (bindings--define-key menu [find-commands-by-name] 1642 (bindings--define-key menu [find-commands-by-name]
1643 '(menu-item "Find Commands by Name..." apropos-command 1643 '(menu-item "Find Commands by Name..." apropos-command
1644 :help "Find commands whose names match a regexp")) 1644 :help "Find commands whose names match a regexp"))
diff --git a/lisp/misearch.el b/lisp/misearch.el
index 2584f8df77b..0c4cd4ea323 100644
--- a/lisp/misearch.el
+++ b/lisp/misearch.el
@@ -73,7 +73,7 @@ end of the search space).
73The first argument of this function is the current buffer where the 73The first argument of this function is the current buffer where the
74search is currently searching. It defines the base buffer relative to 74search is currently searching. It defines the base buffer relative to
75which this function should find the next buffer. When the isearch 75which this function should find the next buffer. When the isearch
76direction is backward (when `isearch-forward' is nil), this function 76direction is backward (when option `isearch-forward' is nil), this function
77should return the previous buffer to search. 77should return the previous buffer to search.
78 78
79If the second argument of this function WRAP is non-nil, then it 79If the second argument of this function WRAP is non-nil, then it
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index fd8fdb51796..ab13d4cf442 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -61,12 +61,17 @@
61 "^[[:space:]]*\\([-[:alpha:]]+\\)" ; \1 permissions 61 "^[[:space:]]*\\([-[:alpha:]]+\\)" ; \1 permissions
62 "[[:space:]]*\\([^[:space:]]+\\)" ; \2 username 62 "[[:space:]]*\\([^[:space:]]+\\)" ; \2 username
63 "[[:space:]]+\\([^[:space:]]+\\)" ; \3 group 63 "[[:space:]]+\\([^[:space:]]+\\)" ; \3 group
64 "[[:space:]]+\\([[:digit:]]\\)" ; \4 size 64 "[[:space:]]+\\([[:digit:]]+\\)" ; \4 size
65 "[[:space:]]+\\([-[:digit:]]+[[:space:]][:[:digit:]]+\\)" ; \5 date 65 "[[:space:]]+\\([-[:digit:]]+[[:space:]][:[:digit:]]+\\)" ; \5 date
66 "[[:space:]]+\\(.*\\)$")) ; \6 filename 66 "[[:space:]]+\\(.*\\)$")) ; \6 filename
67 67
68;;;###tramp-autoload 68;;;###tramp-autoload
69(add-to-list 'tramp-methods `(,tramp-adb-method)) 69(add-to-list 'tramp-methods
70 `(,tramp-adb-method
71 (tramp-tmpdir "/data/local/tmp")))
72
73;;;###tramp-autoload
74(add-to-list 'tramp-default-host-alist `(,tramp-adb-method nil ""))
70 75
71;;;###tramp-autoload 76;;;###tramp-autoload
72(eval-after-load 'tramp 77(eval-after-load 'tramp
@@ -95,8 +100,8 @@
95 (file-directory-p . tramp-adb-handle-file-directory-p) 100 (file-directory-p . tramp-adb-handle-file-directory-p)
96 (file-symlink-p . tramp-handle-file-symlink-p) 101 (file-symlink-p . tramp-handle-file-symlink-p)
97 ;; FIXME: This is too sloppy. 102 ;; FIXME: This is too sloppy.
98 (file-executable-p . file-exists-p) 103 (file-executable-p . tramp-handle-file-exists-p)
99 (file-exists-p . tramp-adb-handle-file-exists-p) 104 (file-exists-p . tramp-handle-file-exists-p)
100 (file-readable-p . tramp-handle-file-exists-p) 105 (file-readable-p . tramp-handle-file-exists-p)
101 (file-writable-p . tramp-adb-handle-file-writable-p) 106 (file-writable-p . tramp-adb-handle-file-writable-p)
102 (file-local-copy . tramp-adb-handle-file-local-copy) 107 (file-local-copy . tramp-adb-handle-file-local-copy)
@@ -106,7 +111,6 @@
106 (directory-files . tramp-handle-directory-files) 111 (directory-files . tramp-handle-directory-files)
107 (directory-files-and-attributes 112 (directory-files-and-attributes
108 . tramp-adb-handle-directory-files-and-attributes) 113 . tramp-adb-handle-directory-files-and-attributes)
109 (file-name-all-completions . tramp-sh-handle-file-name-all-completions)
110 (make-directory . tramp-adb-handle-make-directory) 114 (make-directory . tramp-adb-handle-make-directory)
111 (delete-directory . tramp-adb-handle-delete-directory) 115 (delete-directory . tramp-adb-handle-delete-directory)
112 (delete-file . tramp-adb-handle-delete-file) 116 (delete-file . tramp-adb-handle-delete-file)
@@ -118,7 +122,7 @@
118 (vc-registered . ignore) ;no vc control files on Android devices 122 (vc-registered . ignore) ;no vc control files on Android devices
119 (write-region . tramp-adb-handle-write-region) 123 (write-region . tramp-adb-handle-write-region)
120 (set-file-modes . tramp-adb-handle-set-file-modes) 124 (set-file-modes . tramp-adb-handle-set-file-modes)
121 (set-file-times . ignore) 125 (set-file-times . tramp-adb-handle-set-file-times)
122 (copy-file . tramp-adb-handle-copy-file) 126 (copy-file . tramp-adb-handle-copy-file)
123 (rename-file . tramp-adb-handle-rename-file) 127 (rename-file . tramp-adb-handle-rename-file)
124 (process-file . tramp-adb-handle-process-file) 128 (process-file . tramp-adb-handle-process-file)
@@ -139,13 +143,7 @@
139 "Invoke the ADB handler for OPERATION. 143 "Invoke the ADB handler for OPERATION.
140First arg specifies the OPERATION, second arg is a list of arguments to 144First arg specifies the OPERATION, second arg is a list of arguments to
141pass to the OPERATION." 145pass to the OPERATION."
142 (let ((fn (assoc operation tramp-adb-file-name-handler-alist)) 146 (let ((fn (assoc operation tramp-adb-file-name-handler-alist)))
143 ;; `tramp-default-host's default value is (system-name). Not
144 ;; useful for us.
145 (tramp-default-host
146 (unless (equal (eval (car (get 'tramp-default-host 'standard-value)))
147 tramp-default-host)
148 tramp-default-host)))
149 (if fn 147 (if fn
150 (save-match-data (apply (cdr fn) args)) 148 (save-match-data (apply (cdr fn) args))
151 (tramp-run-real-handler operation args)))) 149 (tramp-run-real-handler operation args))))
@@ -312,7 +310,9 @@ pass to the OPERATION."
312 (and is-symlink 310 (and is-symlink
313 (cadr (split-string name "\\( -> \\|\n\\)"))))) 311 (cadr (split-string name "\\( -> \\|\n\\)")))))
314 (push (list 312 (push (list
315 name 313 (if is-symlink
314 (car (split-string name "\\( -> \\|\n\\)"))
315 name)
316 (or is-dir symlink-target) 316 (or is-dir symlink-target)
317 1 ;link-count 317 1 ;link-count
318 ;; no way to handle numeric ids in Androids ash 318 ;; no way to handle numeric ids in Androids ash
@@ -372,14 +372,14 @@ pass to the OPERATION."
372 "ls"))) 372 "ls")))
373 373
374(defun tramp-adb-get-toolbox (vec) 374(defun tramp-adb-get-toolbox (vec)
375 "Get shell toolbox implementation: `toolbox' for orginal distributions 375 "Get shell toolbox implementation: `toolbox' for original distributions
376or `busybox' for CynagenMode based distributions" 376or `busybox' for CyanogenMod based distributions"
377 (with-tramp-connection-property vec "toolbox" 377 (with-tramp-connection-property vec "toolbox"
378 (tramp-message vec 5 "Checking shell toolbox implementation") 378 (tramp-message vec 5 "Checking shell toolbox implementation")
379 (cond 379 (cond
380 ((zerop (tramp-adb-command-exit-status vec "busybox")) 'busybox) 380 ((zerop (tramp-adb-command-exit-status vec "busybox")) 'busybox)
381 ((zerop (tramp-adb-command-exit-status vec "toolbox")) 'toolbox) 381 ((zerop (tramp-adb-command-exit-status vec "toolbox")) 'toolbox)
382 (t 'unkown)))) 382 (t 'unknown))))
383 383
384(defun tramp-adb--gnu-switches-to-ash 384(defun tramp-adb--gnu-switches-to-ash
385 (switches) 385 (switches)
@@ -616,6 +616,19 @@ But handle the case, if the \"test\" command is not available."
616 v (format "chmod %s %s" (tramp-compat-decimal-to-octal mode) localname) 616 v (format "chmod %s %s" (tramp-compat-decimal-to-octal mode) localname)
617 "Error while changing file's mode %s" filename))) 617 "Error while changing file's mode %s" filename)))
618 618
619(defun tramp-adb-handle-set-file-times (filename &optional time)
620 "Like `set-file-times' for Tramp files."
621 (with-parsed-tramp-file-name filename nil
622 (tramp-flush-file-property v localname)
623 (let ((time (if (or (null time) (equal time '(0 0)))
624 (current-time)
625 time)))
626 (tramp-adb-command-exit-status
627 ;; use shell arithmetic because of Emacs integer size limit
628 v (format "touch -t $(( %d * 65536 + %d )) %s"
629 (car time) (cadr time)
630 (tramp-shell-quote-argument localname))))))
631
619(defun tramp-adb-handle-copy-file 632(defun tramp-adb-handle-copy-file
620 (filename newname &optional ok-if-already-exists keep-date 633 (filename newname &optional ok-if-already-exists keep-date
621 preserve-uid-gid preserve-extended-attributes) 634 preserve-uid-gid preserve-extended-attributes)
@@ -940,19 +953,11 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
940 (tramp-set-connection-property v "process-name" nil) 953 (tramp-set-connection-property v "process-name" nil)
941 (tramp-set-connection-property v "process-buffer" nil))))) 954 (tramp-set-connection-property v "process-buffer" nil)))))
942 955
943;; Android < 4 doesn't provide test command.
944
945(defun tramp-adb-handle-file-exists-p (filename)
946 "Like `file-exists-p' for Tramp files."
947 (with-parsed-tramp-file-name filename nil
948 (with-tramp-file-property v localname "file-exists-p"
949 (file-attributes filename))))
950
951;; Helper functions. 956;; Helper functions.
952 957
953(defun tramp-adb-execute-adb-command (vec &rest args) 958(defun tramp-adb-execute-adb-command (vec &rest args)
954 "Returns nil on success error-output on failure." 959 "Returns nil on success error-output on failure."
955 (when (tramp-file-name-host vec) 960 (when (> (length (tramp-file-name-host vec)) 0)
956 (setq args (append (list "-s" (tramp-file-name-host vec)) args))) 961 (setq args (append (list "-s" (tramp-file-name-host vec)) args)))
957 (with-temp-buffer 962 (with-temp-buffer
958 (prog1 963 (prog1
@@ -1054,6 +1059,7 @@ Does not do anything if a connection is already open, but re-opens the
1054connection if a previous connection has died for some reason." 1059connection if a previous connection has died for some reason."
1055 (let* ((buf (tramp-get-connection-buffer vec)) 1060 (let* ((buf (tramp-get-connection-buffer vec))
1056 (p (get-buffer-process buf)) 1061 (p (get-buffer-process buf))
1062 (host (tramp-file-name-host vec))
1057 (devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))) 1063 (devices (mapcar 'cadr (tramp-adb-parse-device-names nil))))
1058 (unless 1064 (unless
1059 (and p (processp p) (memq (process-status p) '(run open))) 1065 (and p (processp p) (memq (process-status p) '(run open)))
@@ -1061,21 +1067,17 @@ connection if a previous connection has died for some reason."
1061 (when (and p (processp p)) (delete-process p)) 1067 (when (and p (processp p)) (delete-process p))
1062 (if (not devices) 1068 (if (not devices)
1063 (tramp-error vec 'file-error "No device connected")) 1069 (tramp-error vec 'file-error "No device connected"))
1064 (if (and (tramp-file-name-host vec) 1070 (if (and (> (length host) 0) (not (member host devices)))
1065 (not (member (tramp-file-name-host vec) devices))) 1071 (tramp-error vec 'file-error "Device %s not connected" host))
1066 (tramp-error 1072 (if (and (> (length devices) 1) (zerop (length host)))
1067 vec 'file-error
1068 "Device %s not connected" (tramp-file-name-host vec)))
1069 (if (and (not (eq (length devices) 1))
1070 (not (tramp-file-name-host vec)))
1071 (tramp-error 1073 (tramp-error
1072 vec 'file-error 1074 vec 'file-error
1073 "Multiple Devices connected: No Host/Device specified")) 1075 "Multiple Devices connected: No Host/Device specified"))
1074 (with-tramp-progress-reporter vec 3 "Opening adb shell connection" 1076 (with-tramp-progress-reporter vec 3 "Opening adb shell connection"
1075 (let* ((coding-system-for-read 'utf-8-dos) ;is this correct? 1077 (let* ((coding-system-for-read 'utf-8-dos) ;is this correct?
1076 (process-connection-type tramp-process-connection-type) 1078 (process-connection-type tramp-process-connection-type)
1077 (args (if (tramp-file-name-host vec) 1079 (args (if (> (length host) 0)
1078 (list "-s" (tramp-file-name-host vec) "shell") 1080 (list "-s" host "shell")
1079 (list "shell"))) 1081 (list "shell")))
1080 (p (let ((default-directory 1082 (p (let ((default-directory
1081 (tramp-compat-temporary-file-directory))) 1083 (tramp-compat-temporary-file-directory)))
@@ -1111,7 +1113,19 @@ connection if a previous connection has died for some reason."
1111 vec 3 1113 vec 3
1112 "Connection reset, because remote host changed from `%s' to `%s'" 1114 "Connection reset, because remote host changed from `%s' to `%s'"
1113 old-getprop new-getprop) 1115 old-getprop new-getprop)
1114 (tramp-adb-maybe-open-connection vec))))))))) 1116 (tramp-adb-maybe-open-connection vec)))
1117
1118 ;; Set "remote-path" connection property. This is needed
1119 ;; for eshell.
1120 (tramp-adb-send-command vec "echo \\\"$PATH\\\"")
1121 (tramp-set-connection-property
1122 vec "remote-path"
1123 (split-string
1124 (with-current-buffer (tramp-get-connection-buffer vec)
1125 ;; Read the expression.
1126 (goto-char (point-min))
1127 (read (current-buffer)))
1128 ":" 'omit-nulls))))))))
1115 1129
1116(provide 'tramp-adb) 1130(provide 'tramp-adb)
1117;;; tramp-adb.el ends here 1131;;; tramp-adb.el ends here
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 79f8d82b02b..d83599a6662 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -5181,34 +5181,6 @@ function cell is returned to be applied on a buffer."
5181 (t 5181 (t
5182 (format "%s <%%s" coding))))))) 5182 (format "%s <%%s" coding)))))))
5183 5183
5184;;; Integration of eshell.el:
5185
5186(eval-when-compile
5187 (defvar eshell-path-env))
5188
5189;; eshell.el keeps the path in `eshell-path-env'. We must change it
5190;; when `default-directory' points to another host.
5191(defun tramp-eshell-directory-change ()
5192 "Set `eshell-path-env' to $PATH of the host related to `default-directory'."
5193 (setq eshell-path-env
5194 (if (file-remote-p default-directory)
5195 (with-parsed-tramp-file-name default-directory nil
5196 (mapconcat
5197 'identity
5198 (tramp-get-remote-path v)
5199 ":"))
5200 (getenv "PATH"))))
5201
5202(eval-after-load "esh-util"
5203 '(progn
5204 (tramp-eshell-directory-change)
5205 (add-hook 'eshell-directory-change-hook
5206 'tramp-eshell-directory-change)
5207 (add-hook 'tramp-unload-hook
5208 (lambda ()
5209 (remove-hook 'eshell-directory-change-hook
5210 'tramp-eshell-directory-change)))))
5211
5212(add-hook 'tramp-unload-hook 5184(add-hook 'tramp-unload-hook
5213 (lambda () 5185 (lambda ()
5214 (unload-feature 'tramp-sh 'force))) 5186 (unload-feature 'tramp-sh 'force)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 7c393622ffc..2c4aac0ac8a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -381,6 +381,23 @@ Useful for su and sudo methods mostly."
381 :group 'tramp 381 :group 'tramp
382 :type 'string) 382 :type 'string)
383 383
384;;;###tramp-autoload
385(defcustom tramp-default-host-alist nil
386 "Default host to use for specific method/user pairs.
387This is an alist of items (METHOD USER HOST). The first matching item
388specifies the host to use for a file name which does not specify a
389host. METHOD and HOST are regular expressions or nil, which is
390interpreted as a regular expression which always matches. If no entry
391matches, the variable `tramp-default-host' takes effect.
392
393If the file name does not specify the method, lookup is done using the
394empty string for the method name."
395 :group 'tramp
396 :version "24.4"
397 :type '(repeat (list (choice :tag "Method regexp" regexp sexp)
398 (choice :tag " User regexp" regexp sexp)
399 (choice :tag " Host name" string (const nil)))))
400
384(defcustom tramp-default-proxies-alist nil 401(defcustom tramp-default-proxies-alist nil
385 "Route to be followed for specific host/user pairs. 402 "Route to be followed for specific host/user pairs.
386This is an alist of items (HOST USER PROXY). The first matching 403This is an alist of items (HOST USER PROXY). The first matching
@@ -918,7 +935,7 @@ See `tramp-file-name-structure' for more explanations.")
918This regexp should match partial Tramp file names only. 935This regexp should match partial Tramp file names only.
919 936
920Please note that the entry in `file-name-handler-alist' is made when 937Please note that the entry in `file-name-handler-alist' is made when
921this file (tramp.el) is loaded. This means that this variable must be set 938this file \(tramp.el\) is loaded. This means that this variable must be set
922before loading tramp.el. Alternatively, `file-name-handler-alist' can be 939before loading tramp.el. Alternatively, `file-name-handler-alist' can be
923updated after changing this variable. 940updated after changing this variable.
924 941
@@ -1163,6 +1180,15 @@ This is USER, if non-nil. Otherwise, do a lookup in
1163 "Return the right host string to use. 1180 "Return the right host string to use.
1164This is HOST, if non-nil. Otherwise, it is `tramp-default-host'." 1181This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
1165 (or (and (> (length host) 0) host) 1182 (or (and (> (length host) 0) host)
1183 (let ((choices tramp-default-host-alist)
1184 lhost item)
1185 (while choices
1186 (setq item (pop choices))
1187 (when (and (string-match (or (nth 0 item) "") (or method ""))
1188 (string-match (or (nth 1 item) "") (or user "")))
1189 (setq lhost (nth 2 item))
1190 (setq choices nil)))
1191 lhost)
1166 tramp-default-host)) 1192 tramp-default-host))
1167 1193
1168(defun tramp-dissect-file-name (name &optional nodefault) 1194(defun tramp-dissect-file-name (name &optional nodefault)
@@ -3861,6 +3887,39 @@ Only works for Bourne-like shells."
3861 t t result))) 3887 t t result)))
3862 result)))) 3888 result))))
3863 3889
3890;;; Integration of eshell.el:
3891
3892(eval-when-compile
3893 (defvar eshell-path-env))
3894
3895;; eshell.el keeps the path in `eshell-path-env'. We must change it
3896;; when `default-directory' points to another host.
3897(defun tramp-eshell-directory-change ()
3898 "Set `eshell-path-env' to $PATH of the host related to `default-directory'."
3899 (setq eshell-path-env
3900 (if (file-remote-p default-directory)
3901 (with-parsed-tramp-file-name default-directory nil
3902 (mapconcat
3903 'identity
3904 (or
3905 ;; When `tramp-own-remote-path' is in `tramp-remote-path',
3906 ;; the remote path is only set in the session cache.
3907 (tramp-get-connection-property
3908 (tramp-get-connection-process v) "remote-path" nil)
3909 (tramp-get-connection-property v "remote-path" nil))
3910 ":"))
3911 (getenv "PATH"))))
3912
3913(eval-after-load "esh-util"
3914 '(progn
3915 (tramp-eshell-directory-change)
3916 (add-hook 'eshell-directory-change-hook
3917 'tramp-eshell-directory-change)
3918 (add-hook 'tramp-unload-hook
3919 (lambda ()
3920 (remove-hook 'eshell-directory-change-hook
3921 'tramp-eshell-directory-change)))))
3922
3864;; Checklist for `tramp-unload-hook' 3923;; Checklist for `tramp-unload-hook'
3865;; - Unload all `tramp-*' packages 3924;; - Unload all `tramp-*' packages
3866;; - Reset `file-name-handler-alist' 3925;; - Reset `file-name-handler-alist'
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index d55feaa3c1a..bcb5f721ae8 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -1206,7 +1206,8 @@ changed with `comment-style'."
1206(defun comment-box (beg end &optional arg) 1206(defun comment-box (beg end &optional arg)
1207 "Comment out the BEG .. END region, putting it inside a box. 1207 "Comment out the BEG .. END region, putting it inside a box.
1208The numeric prefix ARG specifies how many characters to add to begin- and 1208The numeric prefix ARG specifies how many characters to add to begin- and
1209end- comment markers additionally to what `comment-add' already specifies." 1209end- comment markers additionally to what variable `comment-add' already
1210specifies."
1210 (interactive "*r\np") 1211 (interactive "*r\np")
1211 (comment-normalize-vars) 1212 (comment-normalize-vars)
1212 (let ((comment-style (if (cadr (assoc comment-style comment-styles)) 1213 (let ((comment-style (if (cadr (assoc comment-style comment-styles))
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index b348d22d6de..56a76c7d680 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -1,3 +1,380 @@
12013-01-13 Bastien Guerry <bzg@gnu.org>
2
3 * org-compat.el (org-condition-case-unless-debug): Delete.
4
5 * org-odt.el (org-odt-cleanup-xml-buffers): Use
6 `condition-case' instead of `org-condition-case-unless-debug',
7 which is now deleted.
8
9 * org-capture.el (org-capture-templates-contexts):
10 * org-agenda.el (org-agenda-custom-commands-contexts):
11 Docstring fix.
12
13 * org.el (org-get-tags-at): Remove duplicate inherited tags.
14
15 * org-agenda.el (org-agenda-show-inherited-tags): Allow to be set
16 to 'always or to a list of agenda types.
17 (org-agenda-finalize): Rework conditions under which inherited
18 tags should be made available even when not displayed.
19 (org-search-view, org-agenda-get-todos)
20 (org-agenda-get-timestamps, org-agenda-get-sexps)
21 (org-agenda-get-progress, org-agenda-get-scheduled)
22 (org-agenda-get-blocks): Use new possible values of
23 `org-agenda-show-inherited-tags'.
24
25 * org.el (org-open-at-point): Fix opening all links at point.
26
27 * org-agenda.el (org-get-entries-from-diary): Turn off
28 `diary-file-name-prefix' instead of
29 `diary-file-name-prefix-function', the former is checked before
30 the latter.
31
32 * org.el (org-edit-special): Check for table.el before checking
33 for Org tables.
34
352013-01-13 Michael Albinus <michael.albinus@gmx.de>
36
37 * ob-eval.el (org-babel-shell-command-on-region): Use
38 `executable-find' for local `shell-file-name'.
39
402013-01-09 Achim Gratz <Stromeko@Stromeko.de>
41
42 * org-faces.el: Define face alias mode-line for XEmacs (it's
43 called modeline there).
44
45 * org-compat.el (org-no-popups): New wrapper macro which let-binds
46 the correct variables to suppress popup windows depending on the
47 Emacs version in use. This is a compile-time decision when
48 byte-compiling.
49
50 * org.el (org-get-location, org-switch-to-buffer-other-window):
51 Use the wrapper `org-no-popups' to let-bind the correct variables
52 for suppression of popup windows.
53
54 * org-compat.el (user-error): Defalias to `error' for Emacsen that
55 don't have it.
56
57 * org-agenda.el (org-agenda-write): Use org-called-interactively-p
58 instead of called-interactively-p.
59
60 * org.el (org-find-invisible-foreground): Do not use the value of
61 variables `default-frame-alist', `initial-frame-alist' and
62 `window-system-default-frame-alist' when their symbol is not bound.
63
642013-01-09 Bastien Guerry <bzg@gnu.org>
65
66 * org-src.el (org-edit-src-code): Fix bug when trying to edit a
67 table.el table.
68
69 * org-agenda.el (org-agenda-finalize): Inhibit readonly for the
70 whole function.
71
72 * org.el (org-entry-get): Speed up by let-binding some variables
73 only if needed. Also fix a bug: consider an empty drawer as no drawer.
74
75 * org-agenda.el (org-search-view, org-agenda-get-todos)
76 (org-agenda-get-timestamps, org-agenda-get-sexps)
77 (org-agenda-get-progress, org-agenda-get-deadlines)
78 (org-agenda-get-scheduled, org-agenda-get-blocks)
79 (org-agenda-change-all-lines): Get local tags only.
80 (org-agenda-use-tag-inheritance): New option.
81 (org-agenda-finalize): When `org-agenda-use-tag-inheritance'
82 is non-nil, possibly reset tags in the agenda buffer.
83 (org-agenda-check-type): Enhance docstring.
84
85 * org.el (org-use-tag-inheritance): Fix typo in docstring.
86
87 * org-agenda.el (org-float): Don't alias `org-float'.
88
89 * org.el (org-scan-tags): The skipper already checks for archived
90 entries.
91
92 * org.el (org-refresh-properties): Rename from
93 `org-refresh-effort-properties' and use two new parameters.
94 (org-agenda-prepare-buffers): Use `org-refresh-properties'.
95 Also refresh the 'org-appt-warntime text property.
96
97 * org-clock.el (org-clock-in): Use the renamed defun.
98
99 * org-icalendar.el (org-icalendar-print-entries):
100 Refresh the 'org-appt-warntime property.
101 (org-icalendar-print-entries):
102 * org-agenda.el (org-agenda-get-timestamps)
103 (org-agenda-get-sexps, org-agenda-get-deadlines)
104 (org-agenda-get-scheduled): Do not use `org-entry-get' to get the
105 "APPT_WARNTIME" property value.
106
107 * org.el (org-id-link-to-org-use-id): Fix compiler warning.
108
109 * org-agenda.el (org-agenda-format-item): Do not use
110 `org-get-effort' to get the effort text property.
111 (org-agenda-get-sexps): Use `org-back-to-heading' when setting tags.
112
113 * org-clock.el (org-clock-in): Refresh effort properties.
114
115 * org.el (org-refresh-effort-properties): New defun.
116 (org-get-effort): Delete.
117 (org-set-effort):
118 (org-property-next-allowed-value): Set the 'org-effort text property.
119 (org-agenda-prepare-buffers): Refresh effort properties.
120
121 * org.el (org-read-date): Let-bind `mouse-autoselect-window' to
122 nil so that the mouse doesn't jump when the option is set to t globally.
123
124 * org-agenda.el (org-agenda-dim-blocked-tasks): Default to nil.
125 (org-agenda-dim-blocked-tasks): Make interactive and allow an
126 optional parameter 'invisible to hide blocked tasks instead of
127 just dimming them.
128 (org-agenda-mode-map): Bind `org-agenda-dim-blocked-tasks' to "#".
129
130 * org-agenda.el (org-agenda-finalize): Don't try to align tags
131 when there are no tags. Only try to draw the habit consistency
132 graph when there is a habit in the buffer. Only mark clocking
133 task when there is one.
134
135 * org.el (org-adaptive-fill-function): DTRT in `message-mode'.
136
137 * org.el (org-get-priority): Save match data even when using
138 `org-get-priority-function'.
139
140 * org-mobile.el (org-mobile-create-index-file):
141 Possibly normalize `org-todo-keywords'.
142
143 * org-mobile.el (org-mobile-push): Use the correct agenda buffer names.
144
145 * org.el (org-store-link): Use `org-id-link-to-org-use-id' instead
146 of the obsolete variable name.
147
148 * org.el (org-fontify-meta-lines-and-blocks-1):
149 Fix bug when fontifying keywords with no value.
150
151 * org.el (org-goto-auto-isearch): Enhance docstring.
152 (org-goto-map): Make a defun, so that the customized value of
153 org-goto-auto-isearch is correctly initialized.
154 (org-goto): Initialize the keymap with `org-goto-map'.
155 (org-get-location): Use *Org Help* as a temporary buffer.
156 Tell whether auto-isearch is on or off.
157
158 * org-exp.el (org-export-as-org): Remove useless argument.
159
160 * org-docbook.el (org-export-as-docbook-batch)
161 (org-export-region-as-docbook, org-export-as-docbook-pdf):
162 Fix the number of arguments.
163 (org-export-as-docbook): Remove useless argument.
164
165 * org.el (org-speed-commands-default): Use ":" instead of ";" for
166 `org-set-tags-command', which is consistent with ":" in agenda
167 view. Use "=" for `org-columns".
168
169 * org.el (org-sparse-tree): Fix redundant information in prompt.
170
171 * org-exp.el (org-export-string): Fix number of arguments passed
172 to the org-export-as-* functions.
173
174 * org-latex.el (org-export-as-latex): Fix typo in docstring.
175
176 * org-list.el (org-cycle-include-plain-lists): Docstring enhancement.
177
178 * org.el (org-fontify-meta-lines-and-blocks-1): Fix fontification
179 bug when fontifying a keyword with no associated value.
180 (org-cycle-internal-local): Don't run hooks when cycling a plain
181 list before first headline.
182 (org-ctrl-c-ctrl-c): Throw a user error when trying to toggle a
183 blocked checkbox.
184 (org-indent-line): Fix table formulas indenting.
185
186 * org-agenda.el (org-agenda-open-link): Fix bug when no link is
187 matched. Return a message instead of an error.
188 (org-agenda-priority): Remove useless parameter and fix showing
189 priority in agenda buffers.
190
191 * org-macs.el (org-with-buffer-modified-unmodified): New macro.
192
193 * org.el (org-entry-blocked-p): Use the new macro.
194
195 * org-src.el (org-edit-src-exit): Don't comma-escape the content
196 of a fixed width region.
197
198 * org.el (org-blocker-hook): Update the docstring to mention that
199 functions in this hook should not modify the buffer.
200 (org-trigger-hook): Small docstring fix.
201 (org-entry-blocked-p): Use `with-buffer-modified-unmodified'
202 so that the function never modifies the buffer.
203
204 * org-agenda.el (org-agenda-open-link): Allow to open an internal
205 link by using the new `org-offer-links-in-entry' function.
206
207 * org.el (org-offer-links-in-entry): Do not open the link directly
208 through `org-open-link-from-string', only offer to select a link
209 and return a cons with the link (as a string) and the end of entry.
210 (org-open-at-point): Use `org-offer-links-in-entry' correctly.
211
212 * org.el (org-cycle-internal-local):
213 Fix bug: allow headings with leading blank characters.
214
215 * org-clock.el (org-clock-persist):
216 Docstring fix: document the 'history value.
217
218 * org.el (org-insert-link): Fix bug when inserting links to
219 headlines containing the ">" character.
220
221 * org-crypt.el (org-at-encrypted-entry-p): Fix search boundary.
222
223 * org-compat.el (org-delete-directory): New compatibility function
224 for Emacs 22, where `delete-directory' does not support recursive
225 deletion.
226
227 * org-odt.el (org-odt-cleanup-xml-buffers):
228 Use the new compatibility function.
229
230 * org.el (org-table-map-tables): Fix allowed blocks.
231
232 * org.el (org-edit-special):
233 * org-src.el (org-edit-src-code): Fix regression: allow editing
234 HTML and LaTeX source blocks again.
235
236 * org.el (org-nonsticky-props): Add `htmlize-link'.
237 (org-nonsticky-props): Add `htmlize-link'.
238
239 * org.el (org-edit-special):
240 * org-src.el (org-edit-src-code): Don't edit in verbatim blocks.
241
242 * org-table.el (org-table-fedit-lisp-indent)
243 (orgtbl-self-insert-command): Use `org-delete-backward-char'
244 instead of `backward-delete-char'.
245
246 * org-src.el (org-edit-src-code): Fix another bug about editing
247 special blocks "example" and "verbatim".
248
249 * org.el (org-structure-template-alist): Add verbatim.
250 (org-edit-special): Fix bug about editing special blocks
251 "example" and "verbatim".
252
253 * org.el (org-delete-backward-char, org-delete-char):
254 Save match data, `delete-backward-char' and `delete-char' don't.
255
256 * org.el (org-enable-table-editor, org-insert-heading)
257 (org-remove-timestamp-with-keyword, org-self-insert-command):
258 * org-table.el (org-table-fedit-lisp-indent)
259 (orgtbl-self-insert-command):
260 * org-latex.el (org-export-latex-subcontent):
261 * org-clock.el (org-clocktable-write-default):
262 * org-ascii.el (org-export-ascii-preprocess):
263 Use `delete-backward-char' instead of `backward-delete-char'.
264
265 * org.el (org-todo): Ignore the comment string when changing the
266 TODO state of a headline.
267 (org-edit-special): Fix docstring.
268 (org-in-src-block-p): Small enhancement.
269
270 * org-publish.el (org-publish-org-to): Call `org-export-as-*'
271 functions with the correct list of arguments.
272
273 * org-html.el (org-export-as-html): Delete obsolete arg `hidden'.
274 (org-export-as-html-and-open, org-export-as-html-batch)
275 (org-export-region-as-html): Don't use obsolete arg.
276
277 * org-ascii.el (org-export-as-ascii): Delete obsolete arg `hidden'.
278 (org-export-as-ascii-to-buffer): Don't use obsolete arg.
279
280 * org.el (org-in-fixed-width-region-p): Save match data.
281 (org-in-src-block-p): Use case-folding for searching the block
282 boundaries.
283 (org-activate-plain-links, org-activate-angle-links)
284 (org-activate-bracket-links): Prevent link activation in
285 source code blocks.
286
287 * org-odt.el (org-odt-cleanup-xml-buffers): Fix Emacs Bug#13197 by
288 setting the correct buffer before marking it unmodified to
289 silently kill him.
290
291 * org.el (org-set-font-lock-defaults): Don't activate links in
292 source code blocks and fixed-width regions.
293
294 * org-agenda.el (org-agenda-finalize): Fix links activation.
295
296 * org.el (org-open-at-point): Throw the correct error on
297 non-links. Use `user-error' instead of `error'.
298
299 * org.el (org-in-fixed-width-region-p): Define before use.
300
301 * org-src.el (org-in-src-block-p): Declare function.
302
303 * org-compat.el: Fix bug: don't use `eval-when-compile' when
304 aliasing `user-error'.
305
306 * org-agenda.el (org-agenda-skip): Only check if point is
307 inside a code block, not at a code block.
308
309 * org.el (org-in-fixed-width-region-p):
310 Rewrite using org-element.el.
311
312 * org.el (org-fill-paragraph): Fill correctly in source code block.
313
314 * org.el (org-in-fixed-width-region-p): New function.
315 (org-edit-special): Fix bug: make sure to DTRT in every
316 special environment. Also use the new function to check
317 against fixed-width environment.
318
319 * org-src.el (org-edit-src-code): Check if we are in a source code
320 block with `org-in-src-block-p'. Slightly reformat the docstring.
321
322 * org.el (org-in-src-block-p): Return t when point is at the
323 #+BEGIN_SRC/#+END_SRC lines unless the new optional parameter
324 'inside is set to t.
325
326 * ob-exp.el (obe-marker): Delete useless var.
327
328 * org-src.el (org-edit-src-code): Fix bug triggered by the sexp
329 (copy-marker nil) on Emacs <24.1.
330
3312013-01-09 Dmitry Antipov <dmantipov@yandex.ru>
332
333 * org-agenda.el (org-agenda-get-restriction-and-command):
334 * org-capture.el (org-capture-place-template):
335 * org-colview.el (org-dblock-write:columnview):
336 * org-mobile.el (org-mobile-locate-entry):
337 * org-table.el (org-table-convert-region):
338 * org.el (org-update-statistics-cookies): Use `point-marker'.
339
3402013-01-09 Eric Schulte <eric.schulte@gmx.com>
341
342 * org-exp.el (org-export-string): Pass the dir option on through
343 to any subsequent export functions.
344
3452013-01-09 Henning Weiss <hdweiss@gmail.com> (tiny change)
346
347 * org-mobile.el (org-mobile-sumo-agenda-command): Remove match
348 description from block agendas when they have a title.
349
3502013-01-09 Jambunathan K <kjambunathan@gmail.com>
351
352 * org-odt.el (org-export-as-odt-batch): Init `org-odt-zip-dir'.
353 Fix Emacs Bug#13254.
354
355 * org-odt.el (org-odt-format-org-link): Add check for presence of
356 description in headline links.
357
3582013-01-09 Michael Gauland <mike_gauland@stanfordalumni.org> (tiny change)
359
360 * org-src.el: Create a marker to pass to copy-marker.
361
3622013-01-09 Nicolas Goaziou <n.goaziou@gmail.com>
363
364 * org.el (org-setup-filling): Set `auto-fill-inhibit-regexp' to
365 nil because `org-adaptive-fill-function' already determines which
366 lines should be filled.
367
368 * org.el (org-fill-paragraph): Small refactoring.
369
370 * org-element.el (org-element--parse-elements)
371 (org-element-at-point): Fix parsing of a list in a block in a list.
372
3732013-01-09 Sebastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
374
375 * org.el (org-copy-subtree, org-paste-subtree):
376 Fix whitespace handling when copying/pasting a subtree.
377
12012-12-20 Michael Albinus <michael.albinus@gmx.de> 3782012-12-20 Michael Albinus <michael.albinus@gmx.de>
2 379
3 * ob.el (org-babel-temp-file): Fix setting of 380 * ob.el (org-babel-temp-file): Fix setting of
@@ -129,9 +506,8 @@
129 * ob-haskell.el (org-export-as-latex): Don't use the obsoleted 506 * ob-haskell.el (org-export-as-latex): Don't use the obsoleted
130 argument `hidden'. 507 argument `hidden'.
131 508
132 * org.el (org-refile): Run within `with-demoted-errors' so 509 * org.el (org-refile): Run within `with-demoted-errors' so that a
133 that a corrupted bookmark file does not stop the refile 510 corrupted bookmark file does not stop the refile process.
134 process.
135 511
136 * org-capture.el (org-capture-bookmark-last-stored-position): 512 * org-capture.el (org-capture-bookmark-last-stored-position):
137 Ditto for the capture process. 513 Ditto for the capture process.
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
index afa880bd90c..22d2bcf288e 100644
--- a/lisp/org/ob-eval.el
+++ b/lisp/org/ob-eval.el
@@ -30,6 +30,7 @@
30(eval-when-compile (require 'cl)) 30(eval-when-compile (require 'cl))
31 31
32(defvar org-babel-error-buffer-name "*Org-Babel Error Output*") 32(defvar org-babel-error-buffer-name "*Org-Babel Error Output*")
33(declare-function org-babel-temp-file "ob-core" (prefix &optional suffix))
33 34
34(defun org-babel-eval-error-notify (exit-code stderr) 35(defun org-babel-eval-error-notify (exit-code stderr)
35 "Open a buffer to display STDERR and a message with the value of EXIT-CODE." 36 "Open a buffer to display STDERR and a message with the value of EXIT-CODE."
@@ -136,12 +137,23 @@ specifies the value of ERROR-BUFFER."
136 t))) 137 t)))
137 (let ((input-file (org-babel-temp-file "input-")) 138 (let ((input-file (org-babel-temp-file "input-"))
138 (error-file (if error-buffer (org-babel-temp-file "scor-") nil)) 139 (error-file (if error-buffer (org-babel-temp-file "scor-") nil))
140 ;; Unfortunately, `executable-find' does not support file name
141 ;; handlers. Therefore, we could use it in the local case
142 ;; only.
139 (shell-file-name 143 (shell-file-name
140 (if (file-executable-p 144 (cond ((and (not (file-remote-p default-directory))
141 (concat (file-remote-p default-directory) shell-file-name)) 145 (executable-find shell-file-name))
142 shell-file-name 146 shell-file-name)
143 "/bin/sh")) 147 ((file-executable-p
148 (concat (file-remote-p default-directory) shell-file-name))
149 shell-file-name)
150 ("/bin/sh")))
144 exit-status) 151 exit-status)
152 ;; There is an error in `process-file' when `error-file' exists.
153 ;; This is fixed in Emacs trunk as of 2012-12-21; let's use this
154 ;; workaround for now.
155 (unless (file-remote-p default-directory)
156 (delete-file error-file))
145 (if (or replace 157 (if (or replace
146 (and output-buffer 158 (and output-buffer
147 (not (or (bufferp output-buffer) (stringp output-buffer))))) 159 (not (or (bufferp output-buffer) (stringp output-buffer)))))
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el
index c62a6a8211d..37a9f71cf59 100644
--- a/lisp/org/ob-exp.el
+++ b/lisp/org/ob-exp.el
@@ -28,7 +28,6 @@
28(eval-when-compile 28(eval-when-compile
29 (require 'cl)) 29 (require 'cl))
30 30
31(defvar obe-marker nil)
32(defvar org-current-export-file) 31(defvar org-current-export-file)
33(defvar org-babel-lob-one-liner-regexp) 32(defvar org-babel-lob-one-liner-regexp)
34(defvar org-babel-ref-split-regexp) 33(defvar org-babel-ref-split-regexp)
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index e6e6166ffe2..ca8459ca33d 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -840,7 +840,7 @@ entry, the rest of the entry will not be searched."
840 :group 'org-agenda-daily/weekly 840 :group 'org-agenda-daily/weekly
841 :type 'boolean) 841 :type 'boolean)
842 842
843(defcustom org-agenda-dim-blocked-tasks t 843(defcustom org-agenda-dim-blocked-tasks nil
844 "Non-nil means dim blocked tasks in the agenda display. 844 "Non-nil means dim blocked tasks in the agenda display.
845This causes some overhead during agenda construction, but if you 845This causes some overhead during agenda construction, but if you
846have turned on `org-enforce-todo-dependencies', 846have turned on `org-enforce-todo-dependencies',
@@ -857,6 +857,7 @@ that is blocked because of checkboxes will never be made invisible, it
857will only be dimmed." 857will only be dimmed."
858 :group 'org-agenda-daily/weekly 858 :group 'org-agenda-daily/weekly
859 :group 'org-agenda-todo-list 859 :group 'org-agenda-todo-list
860 :version "24.3"
860 :type '(choice 861 :type '(choice
861 (const :tag "Do not dim" nil) 862 (const :tag "Do not dim" nil)
862 (const :tag "Dim to a gray face" t) 863 (const :tag "Dim to a gray face" t)
@@ -1647,9 +1648,53 @@ When non-nil, this must be the number of minutes, e.g. 60 for one hour."
1647 (const :tag "No default duration"))) 1648 (const :tag "No default duration")))
1648 1649
1649(defcustom org-agenda-show-inherited-tags t 1650(defcustom org-agenda-show-inherited-tags t
1650 "Non-nil means show inherited tags in each agenda line." 1651 "Non-nil means show inherited tags in each agenda line.
1652
1653When this option is set to 'always, it take precedences over
1654`org-agenda-use-tag-inheritance' and inherited tags are shown
1655in every agenda.
1656
1657When this option is set to t (the default), inherited tags are
1658shown when they are available, i.e. when the value of
1659`org-agenda-use-tag-inheritance' has been taken into account.
1660
1661This can be set to a list of agenda types in which the agenda
1662must display the inherited tags. Available types are 'todo,
1663'agenda, 'search and 'timeline.
1664
1665When set to nil, never show inherited tags in agenda lines."
1651 :group 'org-agenda-line-format 1666 :group 'org-agenda-line-format
1652 :type 'boolean) 1667 :group 'org-agenda
1668 :version "24.3"
1669 :type '(choice
1670 (const :tag "Show inherited tags when available" t)
1671 (const :tag "Always show inherited tags" 'always)
1672 (repeat :tag "Show inherited tags only in selected agenda types"
1673 (symbol :tag "Agenda type"))))
1674
1675(defcustom org-agenda-use-tag-inheritance '(todo search timeline agenda)
1676 "List of agenda view types where to use tag inheritance.
1677
1678In tags/tags-todo/tags-tree agenda views, tag inheritance is
1679controlled by `org-use-tag-inheritance'. In other agenda types,
1680`org-use-tag-inheritance' is not used for the selection of the
1681agenda entries. Still, you may want the agenda to be aware of
1682the inherited tags anyway, e.g. for later tag filtering.
1683
1684Allowed value are 'todo, 'search, 'timeline and 'agenda.
1685
1686This variable has no effect if `org-agenda-show-inherited-tags'
1687is set to 'always. In that case, the agenda is aware of those
1688tags.
1689
1690The default value sets tags in every agenda type. Setting this
1691option to nil will speed up non-tags agenda view a lot."
1692 :group 'org-agenda
1693 :version "24.3"
1694 :type '(choice
1695 (const :tag "Use tag inheritance in all agenda types" t)
1696 (repeat :tag "Use tag inheritance in selected agenda types"
1697 (symbol :tag "Agenda type"))))
1653 1698
1654(defcustom org-agenda-hide-tags-regexp nil 1699(defcustom org-agenda-hide-tags-regexp nil
1655 "Regular expression used to filter away specific tags in agenda views. 1700 "Regular expression used to filter away specific tags in agenda views.
@@ -2012,6 +2057,7 @@ The following commands are available:
2012(org-defkey org-agenda-mode-map "\C-c\C-w" 'org-agenda-refile) 2057(org-defkey org-agenda-mode-map "\C-c\C-w" 'org-agenda-refile)
2013(org-defkey org-agenda-mode-map "m" 'org-agenda-bulk-mark) 2058(org-defkey org-agenda-mode-map "m" 'org-agenda-bulk-mark)
2014(org-defkey org-agenda-mode-map "*" 'org-agenda-bulk-mark-all) 2059(org-defkey org-agenda-mode-map "*" 'org-agenda-bulk-mark-all)
2060(org-defkey org-agenda-mode-map "#" 'org-agenda-dim-blocked-tasks)
2015(org-defkey org-agenda-mode-map "%" 'org-agenda-bulk-mark-regexp) 2061(org-defkey org-agenda-mode-map "%" 'org-agenda-bulk-mark-regexp)
2016(org-defkey org-agenda-mode-map "u" 'org-agenda-bulk-unmark) 2062(org-defkey org-agenda-mode-map "u" 'org-agenda-bulk-unmark)
2017(org-defkey org-agenda-mode-map "U" 'org-agenda-bulk-unmark-all) 2063(org-defkey org-agenda-mode-map "U" 'org-agenda-bulk-unmark-all)
@@ -2344,7 +2390,7 @@ For example, if you have a custom agenda command \"p\" and you
2344want this command to be accessible only from plain text files, 2390want this command to be accessible only from plain text files,
2345use this: 2391use this:
2346 2392
2347 '((\"p\" (in-file . \"\\.txt\"))) 2393 '((\"p\" ((in-file . \"\\.txt\"))))
2348 2394
2349Here are the available contexts definitions: 2395Here are the available contexts definitions:
2350 2396
@@ -2360,7 +2406,7 @@ accessible if there is at least one valid check.
2360You can also bind a key to another agenda custom command 2406You can also bind a key to another agenda custom command
2361depending on contextual rules. 2407depending on contextual rules.
2362 2408
2363 '((\"p\" \"q\" (in-file . \"\\.txt\"))) 2409 '((\"p\" \"q\" ((in-file . \"\\.txt\"))))
2364 2410
2365Here it means: in .txt files, use \"p\" as the key for the 2411Here it means: in .txt files, use \"p\" as the key for the
2366agenda command otherwise associated with \"q\". (The command 2412agenda command otherwise associated with \"q\". (The command
@@ -2664,7 +2710,7 @@ L Timeline for current buffer # List stuck projects (!=configure)
2664 (add-text-properties (match-beginning 2) (match-end 2) 2710 (add-text-properties (match-beginning 2) (match-end 2)
2665 '(face bold) header)) 2711 '(face bold) header))
2666 header))) 2712 header)))
2667 (setq header-end (move-marker (make-marker) (point))) 2713 (setq header-end (point-marker))
2668 (while t 2714 (while t
2669 (setq custom1 custom) 2715 (setq custom1 custom)
2670 (when (eq rmheader t) 2716 (when (eq rmheader t)
@@ -3194,7 +3240,7 @@ If AGENDA-BUFFER-NAME, use this as the buffer name for the agenda to write."
3194 (kill-buffer (current-buffer)) 3240 (kill-buffer (current-buffer))
3195 (message "Plain text written to %s" file)))))))) 3241 (message "Plain text written to %s" file))))))))
3196 (set-buffer (or agenda-bufname 3242 (set-buffer (or agenda-bufname
3197 (and (called-interactively-p 'any) (buffer-name)) 3243 (and (org-called-interactively-p 'any) (buffer-name))
3198 org-agenda-buffer-name))) 3244 org-agenda-buffer-name)))
3199 (when open (org-open-file file))) 3245 (when open (org-open-file file)))
3200 3246
@@ -3514,44 +3560,66 @@ generating a new one."
3514 (save-excursion 3560 (save-excursion
3515 (let ((inhibit-read-only t)) 3561 (let ((inhibit-read-only t))
3516 (goto-char (point-min)) 3562 (goto-char (point-min))
3517 (while (org-activate-bracket-links (point-max)) 3563 (save-excursion
3518 (add-text-properties (match-beginning 0) (match-end 0) 3564 (while (org-activate-bracket-links (point-max))
3519 '(face org-link))) 3565 (add-text-properties (match-beginning 0) (match-end 0)
3520 (while (org-activate-plain-links (point-max)) 3566 '(face org-link))))
3521 (add-text-properties (match-beginning 0) (match-end 0) 3567 (save-excursion
3522 '(face org-link))) 3568 (while (org-activate-plain-links (point-max))
3523 (org-agenda-align-tags) 3569 (add-text-properties (match-beginning 0) (match-end 0)
3570 '(face org-link))))
3571 (unless (eq org-agenda-remove-tags t)
3572 (org-agenda-align-tags))
3524 (unless org-agenda-with-colors 3573 (unless org-agenda-with-colors
3525 (remove-text-properties (point-min) (point-max) '(face nil)))) 3574 (remove-text-properties (point-min) (point-max) '(face nil)))
3526 (if (and (boundp 'org-agenda-overriding-columns-format) 3575 (if (and (boundp 'org-agenda-overriding-columns-format)
3527 org-agenda-overriding-columns-format) 3576 org-agenda-overriding-columns-format)
3528 (org-set-local 'org-agenda-overriding-columns-format 3577 (org-set-local 'org-agenda-overriding-columns-format
3529 org-agenda-overriding-columns-format)) 3578 org-agenda-overriding-columns-format))
3530 (if (and (boundp 'org-agenda-view-columns-initially) 3579 (if (and (boundp 'org-agenda-view-columns-initially)
3531 org-agenda-view-columns-initially) 3580 org-agenda-view-columns-initially)
3532 (org-agenda-columns)) 3581 (org-agenda-columns))
3533 (when org-agenda-fontify-priorities 3582 (when org-agenda-fontify-priorities
3534 (org-agenda-fontify-priorities)) 3583 (org-agenda-fontify-priorities))
3535 (when (and org-agenda-dim-blocked-tasks org-blocker-hook) 3584 (when (and org-agenda-dim-blocked-tasks org-blocker-hook)
3536 (org-agenda-dim-blocked-tasks)) 3585 (org-agenda-dim-blocked-tasks))
3537 ;; We need to widen when `org-agenda-finalize' is called from 3586 ;; We need to widen when `org-agenda-finalize' is called from
3538 ;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in') 3587 ;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in')
3539 (save-restriction 3588 (when org-clock-current-task
3540 (widen) 3589 (save-restriction
3541 (org-agenda-mark-clocking-task)) 3590 (widen)
3542 (when org-agenda-entry-text-mode 3591 (org-agenda-mark-clocking-task)))
3543 (org-agenda-entry-text-hide) 3592 (when org-agenda-entry-text-mode
3544 (org-agenda-entry-text-show)) 3593 (org-agenda-entry-text-hide)
3545 (if (functionp 'org-habit-insert-consistency-graphs) 3594 (org-agenda-entry-text-show))
3546 (org-habit-insert-consistency-graphs)) 3595 (if (and (functionp 'org-habit-insert-consistency-graphs)
3547 (let ((inhibit-read-only t)) 3596 (save-excursion (next-single-property-change (point-min) 'org-habit-p)))
3548 (run-hooks 'org-agenda-finalize-hook)) 3597 (org-habit-insert-consistency-graphs))
3549 (setq org-agenda-type (org-get-at-bol 'org-agenda-type)) 3598 (setq org-agenda-type (org-get-at-bol 'org-agenda-type))
3550 (when (or org-agenda-tag-filter (get 'org-agenda-tag-filter :preset-filter)) 3599 (unless (or (eq org-agenda-show-inherited-tags 'always)
3551 (org-agenda-filter-apply org-agenda-tag-filter 'tag)) 3600 (and (listp org-agenda-show-inherited-tags)
3552 (when (or org-agenda-category-filter (get 'org-agenda-category-filter :preset-filter)) 3601 (memq org-agenda-type org-agenda-show-inherited-tags))
3553 (org-agenda-filter-apply org-agenda-category-filter 'category)) 3602 (and (eq org-agenda-show-inherited-tags t)
3554 (org-add-hook 'kill-buffer-hook 'org-agenda-reset-markers 'append 'local)))) 3603 (or (eq org-agenda-use-tag-inheritance t)
3604 (and (listp org-agenda-use-tag-inheritance)
3605 (not (memq org-agenda-type
3606 org-agenda-use-tag-inheritance))))))
3607 (let (mrk)
3608 (save-excursion
3609 (goto-char (point-min))
3610 (while (equal (forward-line) 0)
3611 (when (setq mrk (or (get-text-property (point) 'org-hd-marker)
3612 (get-text-property (point) 'org-hd-marker)))
3613 (put-text-property (point-at-bol) (point-at-eol)
3614 'tags (org-with-point-at mrk
3615 (delete-dups
3616 (mapcar 'downcase (org-get-tags-at))))))))))
3617 (run-hooks 'org-agenda-finalize-hook)
3618 (when (or org-agenda-tag-filter (get 'org-agenda-tag-filter :preset-filter))
3619 (org-agenda-filter-apply org-agenda-tag-filter 'tag))
3620 (when (or org-agenda-category-filter (get 'org-agenda-category-filter :preset-filter))
3621 (org-agenda-filter-apply org-agenda-category-filter 'category))
3622 (org-add-hook 'kill-buffer-hook 'org-agenda-reset-markers 'append 'local)))))
3555 3623
3556(defun org-agenda-mark-clocking-task () 3624(defun org-agenda-mark-clocking-task ()
3557 "Mark the current clock entry in the agenda if it is present." 3625 "Mark the current clock entry in the agenda if it is present."
@@ -3607,15 +3675,18 @@ generating a new one."
3607 ((equal p h) 'bold))) 3675 ((equal p h) 'bold)))
3608 (overlay-put ov 'org-type 'org-priority))))) 3676 (overlay-put ov 'org-type 'org-priority)))))
3609 3677
3610(defun org-agenda-dim-blocked-tasks () 3678(defun org-agenda-dim-blocked-tasks (&optional invisible)
3679 (interactive "P")
3611 "Dim currently blocked TODO's in the agenda display." 3680 "Dim currently blocked TODO's in the agenda display."
3681 (message "Dim or hide blocked tasks...")
3612 (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-blocked-todo) 3682 (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-blocked-todo)
3613 (delete-overlay o))) 3683 (delete-overlay o)))
3614 (overlays-in (point-min) (point-max))) 3684 (overlays-in (point-min) (point-max)))
3615 (save-excursion 3685 (save-excursion
3616 (let ((inhibit-read-only t) 3686 (let ((inhibit-read-only t)
3617 (org-depend-tag-blocked nil) 3687 (org-depend-tag-blocked nil)
3618 (invis (eq org-agenda-dim-blocked-tasks 'invisible)) 3688 (invis (or (not (null invisible))
3689 (eq org-agenda-dim-blocked-tasks 'invisible)))
3619 org-blocked-by-checkboxes 3690 org-blocked-by-checkboxes
3620 invis1 b e p ov h l) 3691 invis1 b e p ov h l)
3621 (goto-char (point-min)) 3692 (goto-char (point-min))
@@ -3636,7 +3707,8 @@ generating a new one."
3636 (if invis1 3707 (if invis1
3637 (overlay-put ov 'invisible t) 3708 (overlay-put ov 'invisible t)
3638 (overlay-put ov 'face 'org-agenda-dimmed-todo-face)) 3709 (overlay-put ov 'face 'org-agenda-dimmed-todo-face))
3639 (overlay-put ov 'org-type 'org-blocked-todo))))))) 3710 (overlay-put ov 'org-type 'org-blocked-todo))))))
3711 (message "Dim or hide blocked tasks...done"))
3640 3712
3641(defvar org-agenda-skip-function nil 3713(defvar org-agenda-skip-function nil
3642 "Function to be called at each match during agenda construction. 3714 "Function to be called at each match during agenda construction.
@@ -3656,7 +3728,7 @@ A good way to set it is through options in `org-agenda-custom-commands'.")
3656Also moves point to the end of the skipped region, so that search can 3728Also moves point to the end of the skipped region, so that search can
3657continue from there." 3729continue from there."
3658 (let ((p (point-at-bol)) to) 3730 (let ((p (point-at-bol)) to)
3659 (when (org-in-src-block-p) (throw :skip t)) 3731 (when (org-in-src-block-p t) (throw :skip t))
3660 (and org-agenda-skip-archived-trees (not org-agenda-archives-mode) 3732 (and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
3661 (get-text-property p :org-archived) 3733 (get-text-property p :org-archived)
3662 (org-end-of-subtree t) 3734 (org-end-of-subtree t)
@@ -4251,7 +4323,7 @@ in `org-agenda-text-search-extra-files'."
4251 'help-echo (format "mouse-2 or RET jump to location"))) 4323 'help-echo (format "mouse-2 or RET jump to location")))
4252 (full-words org-agenda-search-view-force-full-words) 4324 (full-words org-agenda-search-view-force-full-words)
4253 (org-agenda-text-search-extra-files org-agenda-text-search-extra-files) 4325 (org-agenda-text-search-extra-files org-agenda-text-search-extra-files)
4254 regexp rtn rtnall files file pos 4326 regexp rtn rtnall files file pos inherited-tags
4255 marker category category-pos tags c neg re boolean 4327 marker category category-pos tags c neg re boolean
4256 ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) 4328 ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str)
4257 (unless (and (not edit-at) 4329 (unless (and (not edit-at)
@@ -4405,7 +4477,13 @@ in `org-agenda-text-search-extra-files'."
4405 (setq marker (org-agenda-new-marker (point)) 4477 (setq marker (org-agenda-new-marker (point))
4406 category (org-get-category) 4478 category (org-get-category)
4407 category-pos (get-text-property (point) 'org-category-position) 4479 category-pos (get-text-property (point) 'org-category-position)
4408 tags (org-get-tags-at (point)) 4480 inherited-tags
4481 (or (eq org-agenda-show-inherited-tags 'always)
4482 (memq 'todo org-agenda-show-inherited-tags)
4483 (and (eq org-agenda-show-inherited-tags t)
4484 (or (eq org-agenda-use-tag-inheritance t)
4485 (memq 'todo org-agenda-use-tag-inheritance))))
4486 tags (org-get-tags-at nil (not inherited-tags))
4409 txt (org-agenda-format-item 4487 txt (org-agenda-format-item
4410 "" 4488 ""
4411 (buffer-substring-no-properties 4489 (buffer-substring-no-properties
@@ -4935,7 +5013,7 @@ of what a project is and how to check if it stuck, customize the variable
4935 (pop-up-frames nil) 5013 (pop-up-frames nil)
4936 (diary-list-entries-hook 5014 (diary-list-entries-hook
4937 (cons 'org-diary-default-entry diary-list-entries-hook)) 5015 (cons 'org-diary-default-entry diary-list-entries-hook))
4938 (diary-file-name-prefix-function nil) ; turn this feature off 5016 (diary-file-name-prefix nil) ; turn this feature off
4939 (diary-modify-entry-list-string-function 'org-modify-diary-entry-string) 5017 (diary-modify-entry-list-string-function 'org-modify-diary-entry-string)
4940 entries 5018 entries
4941 (org-disable-agenda-to-diary t)) 5019 (org-disable-agenda-to-diary t))
@@ -5211,7 +5289,7 @@ the documentation of `org-diary'."
5211 "\\|") "\\)")) 5289 "\\|") "\\)"))
5212 (t org-not-done-regexp)))) 5290 (t org-not-done-regexp))))
5213 marker priority category category-pos tags todo-state 5291 marker priority category category-pos tags todo-state
5214 ee txt beg end) 5292 ee txt beg end inherited-tags)
5215 (goto-char (point-min)) 5293 (goto-char (point-min))
5216 (while (re-search-forward regexp nil t) 5294 (while (re-search-forward regexp nil t)
5217 (catch :skip 5295 (catch :skip
@@ -5229,7 +5307,14 @@ the documentation of `org-diary'."
5229 category-pos (get-text-property (point) 'org-category-position) 5307 category-pos (get-text-property (point) 'org-category-position)
5230 txt (org-trim 5308 txt (org-trim
5231 (buffer-substring (match-beginning 2) (match-end 0))) 5309 (buffer-substring (match-beginning 2) (match-end 0)))
5232 tags (org-get-tags-at (point)) 5310 inherited-tags
5311 (or (eq org-agenda-show-inherited-tags 'always)
5312 (and (listp org-agenda-show-inherited-tags)
5313 (memq 'todo org-agenda-show-inherited-tags))
5314 (and (eq org-agenda-show-inherited-tags t)
5315 (or (eq org-agenda-use-tag-inheritance t)
5316 (memq 'todo org-agenda-use-tag-inheritance))))
5317 tags (org-get-tags-at nil (not inherited-tags))
5233 txt (org-agenda-format-item "" txt category tags t) 5318 txt (org-agenda-format-item "" txt category tags t)
5234 priority (1+ (org-get-priority txt)) 5319 priority (1+ (org-get-priority txt))
5235 todo-state (org-get-todo-state)) 5320 todo-state (org-get-todo-state))
@@ -5356,7 +5441,8 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
5356 "\\|\\(<%%\\(([^>\n]+)\\)>\\)")) 5441 "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
5357 marker hdmarker deadlinep scheduledp clockp closedp inactivep 5442 marker hdmarker deadlinep scheduledp clockp closedp inactivep
5358 donep tmp priority category category-pos ee txt timestr tags 5443 donep tmp priority category category-pos ee txt timestr tags
5359 b0 b3 e3 head todo-state end-of-match show-all warntime habitp) 5444 b0 b3 e3 head todo-state end-of-match show-all warntime habitp
5445 inherited-tags)
5360 (goto-char (point-min)) 5446 (goto-char (point-min))
5361 (while (setq end-of-match (re-search-forward regexp nil t)) 5447 (while (setq end-of-match (re-search-forward regexp nil t))
5362 (setq b0 (match-beginning 0) 5448 (setq b0 (match-beginning 0)
@@ -5389,7 +5475,7 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
5389 clockp (and org-agenda-include-inactive-timestamps 5475 clockp (and org-agenda-include-inactive-timestamps
5390 (or (string-match org-clock-string tmp) 5476 (or (string-match org-clock-string tmp)
5391 (string-match "]-+\\'" tmp))) 5477 (string-match "]-+\\'" tmp)))
5392 warntime (org-entry-get (point) "APPT_WARNTIME") 5478 warntime (get-text-property (point) 'org-appt-warntime)
5393 donep (member todo-state org-done-keywords)) 5479 donep (member todo-state org-done-keywords))
5394 (if (or scheduledp deadlinep closedp clockp 5480 (if (or scheduledp deadlinep closedp clockp
5395 (and donep org-agenda-skip-timestamp-if-done)) 5481 (and donep org-agenda-skip-timestamp-if-done))
@@ -5408,7 +5494,14 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
5408 (assoc (point) deadline-position-alist)) 5494 (assoc (point) deadline-position-alist))
5409 (throw :skip nil)) 5495 (throw :skip nil))
5410 (setq hdmarker (org-agenda-new-marker) 5496 (setq hdmarker (org-agenda-new-marker)
5411 tags (org-get-tags-at)) 5497 inherited-tags
5498 (or (eq org-agenda-show-inherited-tags 'always)
5499 (and (listp org-agenda-show-inherited-tags)
5500 (memq 'agenda org-agenda-show-inherited-tags))
5501 (and (eq org-agenda-show-inherited-tags t)
5502 (or (eq org-agenda-use-tag-inheritance t)
5503 (memq 'agenda org-agenda-use-tag-inheritance))))
5504 tags (org-get-tags-at nil (not inherited-tags)))
5412 (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") 5505 (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
5413 (setq head (or (match-string 1) "")) 5506 (setq head (or (match-string 1) ""))
5414 (setq txt (org-agenda-format-item 5507 (setq txt (org-agenda-format-item
@@ -5440,7 +5533,7 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
5440 (abbreviate-file-name buffer-file-name)))) 5533 (abbreviate-file-name buffer-file-name))))
5441 (regexp "^&?%%(") 5534 (regexp "^&?%%(")
5442 marker category extra category-pos ee txt tags entry 5535 marker category extra category-pos ee txt tags entry
5443 result beg b sexp sexp-entry todo-state warntime) 5536 result beg b sexp sexp-entry todo-state warntime inherited-tags)
5444 (goto-char (point-min)) 5537 (goto-char (point-min))
5445 (while (re-search-forward regexp nil t) 5538 (while (re-search-forward regexp nil t)
5446 (catch :skip 5539 (catch :skip
@@ -5458,10 +5551,16 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
5458 (setq marker (org-agenda-new-marker beg) 5551 (setq marker (org-agenda-new-marker beg)
5459 category (org-get-category beg) 5552 category (org-get-category beg)
5460 category-pos (get-text-property beg 'org-category-position) 5553 category-pos (get-text-property beg 'org-category-position)
5461 tags (save-excursion (org-backward-heading-same-level 0) 5554 inherited-tags
5462 (org-get-tags-at)) 5555 (or (eq org-agenda-show-inherited-tags 'always)
5556 (and (listp org-agenda-show-inherited-tags)
5557 (memq 'agenda org-agenda-show-inherited-tags))
5558 (and (eq org-agenda-show-inherited-tags t)
5559 (or (eq org-agenda-use-tag-inheritance t)
5560 (memq 'agenda org-agenda-use-tag-inheritance))))
5561 tags (org-get-tags-at nil (not inherited-tags))
5463 todo-state (org-get-todo-state) 5562 todo-state (org-get-todo-state)
5464 warntime (org-entry-get (point) "APPT_WARNTIME") 5563 warntime (get-text-property (point) 'org-appt-warntime)
5465 extra nil) 5564 extra nil)
5466 5565
5467 (dolist (r (if (stringp result) 5566 (dolist (r (if (stringp result)
@@ -5510,7 +5609,6 @@ Do we have a reason to ignore this TODO entry because it has a time stamp?
5510 (org-no-warnings 5609 (org-no-warnings
5511 (let ((calendar-date-style 'european) (european-calendar-style t)) 5610 (let ((calendar-date-style 'european) (european-calendar-style t))
5512 (diary-date day month year mark)))) 5611 (diary-date day month year mark))))
5513(defalias 'org-float 'diary-float)
5514 5612
5515;; Define the` org-class' function 5613;; Define the` org-class' function
5516(defun org-class (y1 m1 d1 y2 m2 d2 dayname &rest skip-weeks) 5614(defun org-class (y1 m1 d1 y2 m2 d2 dayname &rest skip-weeks)
@@ -5591,7 +5689,7 @@ please use `org-class' instead."
5591 1 11)))) 5689 1 11))))
5592 (org-agenda-search-headline-for-time nil) 5690 (org-agenda-search-headline-for-time nil)
5593 marker hdmarker priority category category-pos tags closedp 5691 marker hdmarker priority category category-pos tags closedp
5594 statep clockp state ee txt extra timestr rest clocked) 5692 statep clockp state ee txt extra timestr rest clocked inherited-tags)
5595 (goto-char (point-min)) 5693 (goto-char (point-min))
5596 (while (re-search-forward regexp nil t) 5694 (while (re-search-forward regexp nil t)
5597 (catch :skip 5695 (catch :skip
@@ -5629,7 +5727,14 @@ please use `org-class' instead."
5629 (setq txt org-agenda-no-heading-message) 5727 (setq txt org-agenda-no-heading-message)
5630 (goto-char (match-beginning 0)) 5728 (goto-char (match-beginning 0))
5631 (setq hdmarker (org-agenda-new-marker) 5729 (setq hdmarker (org-agenda-new-marker)
5632 tags (org-get-tags-at)) 5730 inherited-tags
5731 (or (eq org-agenda-show-inherited-tags 'always)
5732 (and (listp org-agenda-show-inherited-tags)
5733 (memq 'todo org-agenda-show-inherited-tags))
5734 (and (eq org-agenda-show-inherited-tags t)
5735 (or (eq org-agenda-use-tag-inheritance t)
5736 (memq 'todo org-agenda-use-tag-inheritance))))
5737 tags (org-get-tags-at nil (not inherited-tags)))
5633 (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") 5738 (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
5634 (setq txt (match-string 1)) 5739 (setq txt (match-string 1))
5635 (when extra 5740 (when extra
@@ -5833,13 +5938,13 @@ See also the user option `org-agenda-clock-consistency-checks'."
5833 (not (= diff 0)))) 5938 (not (= diff 0))))
5834 (setq txt nil) 5939 (setq txt nil)
5835 (setq category (org-get-category) 5940 (setq category (org-get-category)
5836 warntime (org-entry-get (point) "APPT_WARNTIME") 5941 warntime (get-text-property (point) 'org-appt-warntime)
5837 category-pos (get-text-property (point) 'org-category-position)) 5942 category-pos (get-text-property (point) 'org-category-position))
5838 (if (not (re-search-backward "^\\*+[ \t]+" nil t)) 5943 (if (not (re-search-backward "^\\*+[ \t]+" nil t))
5839 (setq txt org-agenda-no-heading-message) 5944 (setq txt org-agenda-no-heading-message)
5840 (goto-char (match-end 0)) 5945 (goto-char (match-end 0))
5841 (setq pos1 (match-beginning 0)) 5946 (setq pos1 (match-beginning 0))
5842 (setq tags (org-get-tags-at pos1)) 5947 (setq tags (org-get-tags-at pos1 t))
5843 (setq head (buffer-substring-no-properties 5948 (setq head (buffer-substring-no-properties
5844 (point) 5949 (point)
5845 (progn (skip-chars-forward "^\r\n") 5950 (progn (skip-chars-forward "^\r\n")
@@ -5907,7 +6012,7 @@ FRACTION is what fraction of the head-warning time has passed."
5907 deadline-results)) 6012 deadline-results))
5908 d2 diff pos pos1 category category-pos tags donep 6013 d2 diff pos pos1 category category-pos tags donep
5909 ee txt head pastschedp todo-state face timestr s habitp show-all 6014 ee txt head pastschedp todo-state face timestr s habitp show-all
5910 did-habit-check-p warntime) 6015 did-habit-check-p warntime inherited-tags)
5911 (goto-char (point-min)) 6016 (goto-char (point-min))
5912 (while (re-search-forward regexp nil t) 6017 (while (re-search-forward regexp nil t)
5913 (catch :skip 6018 (catch :skip
@@ -5923,7 +6028,7 @@ FRACTION is what fraction of the head-warning time has passed."
5923 (match-string 1) d1 'past show-all 6028 (match-string 1) d1 'past show-all
5924 (current-buffer) pos) 6029 (current-buffer) pos)
5925 diff (- d2 d1) 6030 diff (- d2 d1)
5926 warntime (org-entry-get (point) "APPT_WARNTIME")) 6031 warntime (get-text-property (point) 'org-appt-warntime))
5927 (setq pastschedp (and todayp (< diff 0))) 6032 (setq pastschedp (and todayp (< diff 0)))
5928 (setq did-habit-check-p nil) 6033 (setq did-habit-check-p nil)
5929 ;; When to show a scheduled item in the calendar: 6034 ;; When to show a scheduled item in the calendar:
@@ -5969,7 +6074,14 @@ FRACTION is what fraction of the head-warning time has passed."
5969 pastschedp)) 6074 pastschedp))
5970 (setq mm (assoc pos1 deadline-position-alist))) 6075 (setq mm (assoc pos1 deadline-position-alist)))
5971 (throw :skip nil))) 6076 (throw :skip nil)))
5972 (setq tags (org-get-tags-at)) 6077 (setq inherited-tags
6078 (or (eq org-agenda-show-inherited-tags 'always)
6079 (and (listp org-agenda-show-inherited-tags)
6080 (memq 'agenda org-agenda-show-inherited-tags))
6081 (and (eq org-agenda-show-inherited-tags t)
6082 (or (eq org-agenda-use-tag-inheritance t)
6083 (memq 'agenda org-agenda-use-tag-inheritance))))
6084 tags (org-get-tags-at nil (not inherited-tags)))
5973 (setq head (buffer-substring-no-properties 6085 (setq head (buffer-substring-no-properties
5974 (point) 6086 (point)
5975 (progn (skip-chars-forward "^\r\n") (point)))) 6087 (progn (skip-chars-forward "^\r\n") (point))))
@@ -6024,7 +6136,7 @@ FRACTION is what fraction of the head-warning time has passed."
6024 (regexp org-tr-regexp) 6136 (regexp org-tr-regexp)
6025 (d0 (calendar-absolute-from-gregorian date)) 6137 (d0 (calendar-absolute-from-gregorian date))
6026 marker hdmarker ee txt d1 d2 s1 s2 category category-pos 6138 marker hdmarker ee txt d1 d2 s1 s2 category category-pos
6027 todo-state tags pos head donep) 6139 todo-state tags pos head donep inherited-tags)
6028 (goto-char (point-min)) 6140 (goto-char (point-min))
6029 (while (re-search-forward regexp nil t) 6141 (while (re-search-forward regexp nil t)
6030 (catch :skip 6142 (catch :skip
@@ -6050,8 +6162,15 @@ FRACTION is what fraction of the head-warning time has passed."
6050 (if (not (re-search-backward org-outline-regexp-bol nil t)) 6162 (if (not (re-search-backward org-outline-regexp-bol nil t))
6051 (setq txt org-agenda-no-heading-message) 6163 (setq txt org-agenda-no-heading-message)
6052 (goto-char (match-beginning 0)) 6164 (goto-char (match-beginning 0))
6053 (setq hdmarker (org-agenda-new-marker (point))) 6165 (setq hdmarker (org-agenda-new-marker (point))
6054 (setq tags (org-get-tags-at)) 6166 inherited-tags
6167 (or (eq org-agenda-show-inherited-tags 'always)
6168 (and (listp org-agenda-show-inherited-tags)
6169 (memq 'agenda org-agenda-show-inherited-tags))
6170 (and (eq org-agenda-show-inherited-tags t)
6171 (or (eq org-agenda-use-tag-inheritance t)
6172 (memq 'agenda org-agenda-use-tag-inheritance))))
6173 tags (org-get-tags-at nil (not inherited-tags)))
6055 (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") 6174 (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
6056 (setq head (match-string 1)) 6175 (setq head (match-string 1))
6057 (let ((remove-re 6176 (let ((remove-re
@@ -6212,12 +6331,7 @@ Any match of REMOVE-RE will be removed from TXT."
6212 (match-string 2 txt)) 6331 (match-string 2 txt))
6213 t t txt)))) 6332 t t txt))))
6214 (when (derived-mode-p 'org-mode) 6333 (when (derived-mode-p 'org-mode)
6215 (setq effort 6334 (setq effort (ignore-errors (get-text-property 0 'org-effort txt)))
6216 (condition-case nil
6217 (org-get-effort
6218 (or (get-text-property 0 'org-hd-marker txt)
6219 (get-text-property 0 'org-marker txt)))
6220 (error nil)))
6221 (when effort 6335 (when effort
6222 (setq neffort (org-duration-string-to-minutes effort) 6336 (setq neffort (org-duration-string-to-minutes effort)
6223 effort (setq effort (concat "[" effort "]"))))) 6337 effort (setq effort (concat "[" effort "]")))))
@@ -6735,7 +6849,8 @@ in the file. Otherwise, restriction will be to the current subtree."
6735 6849
6736(defun org-agenda-check-type (error &rest types) 6850(defun org-agenda-check-type (error &rest types)
6737 "Check if agenda buffer is of allowed type. 6851 "Check if agenda buffer is of allowed type.
6738If ERROR is non-nil, throw an error, otherwise just return nil." 6852If ERROR is non-nil, throw an error, otherwise just return nil.
6853Allowed types are 'agenda 'timeline 'todo 'tags 'search."
6739 (if (not org-agenda-type) 6854 (if (not org-agenda-type)
6740 (error "No Org agenda currently displayed") 6855 (error "No Org agenda currently displayed")
6741 (if (memq org-agenda-type types) 6856 (if (memq org-agenda-type types)
@@ -7890,29 +8005,45 @@ If this information is not given, the function uses the tree at point."
7890 (unless no-update (org-agenda-redo)))) 8005 (unless no-update (org-agenda-redo))))
7891 8006
7892(defun org-agenda-open-link (&optional arg) 8007(defun org-agenda-open-link (&optional arg)
7893 "Follow the link in the current line, if any. 8008 "Open the link(s) in the current entry, if any.
7894This looks for a link in the displayed line in the agenda. It also looks 8009This looks for a link in the displayed line in the agenda.
7895at the text of the entry itself." 8010It also looks at the text of the entry itself."
7896 (interactive "P") 8011 (interactive "P")
7897 (let* ((marker (or (org-get-at-bol 'org-hd-marker) 8012 (let* ((marker (or (org-get-at-bol 'org-hd-marker)
7898 (org-get-at-bol 'org-marker))) 8013 (org-get-at-bol 'org-marker)))
7899 (buffer (and marker (marker-buffer marker))) 8014 (buffer (and marker (marker-buffer marker)))
7900 (prefix (buffer-substring 8015 (prefix (buffer-substring
7901 (point-at-bol) (point-at-eol)))) 8016 (point-at-bol) (point-at-eol)))
8017 (lkall (org-offer-links-in-entry buffer marker arg prefix))
8018 (lk (car lkall))
8019 (lkend (cdr lkall))
8020 trg)
7902 (cond 8021 (cond
7903 (buffer 8022 ((and buffer (stringp lk))
7904 (with-current-buffer buffer 8023 (with-current-buffer buffer
7905 (save-excursion 8024 (setq trg (and (string-match org-bracket-link-regexp lk)
7906 (save-restriction 8025 (match-string 1 lk)))
7907 (widen) 8026 (if (or (not trg) (string-match org-any-link-re trg))
7908 (goto-char marker) 8027 (save-excursion
7909 (org-offer-links-in-entry arg prefix))))) 8028 (save-restriction
8029 (widen)
8030 (goto-char marker)
8031 (when (search-forward lk nil lkend)
8032 (goto-char (match-beginning 0))
8033 (org-open-at-point))))
8034 ;; This is an internal link, widen the buffer
8035 (switch-to-buffer-other-window buffer)
8036 (widen)
8037 (goto-char marker)
8038 (when (search-forward lk nil lkend)
8039 (goto-char (match-beginning 0))
8040 (org-open-at-point)))))
7910 ((or (org-in-regexp (concat "\\(" org-bracket-link-regexp "\\)")) 8041 ((or (org-in-regexp (concat "\\(" org-bracket-link-regexp "\\)"))
7911 (save-excursion 8042 (save-excursion
7912 (beginning-of-line 1) 8043 (beginning-of-line 1)
7913 (looking-at (concat ".*?\\(" org-bracket-link-regexp "\\)")))) 8044 (looking-at (concat ".*?\\(" org-bracket-link-regexp "\\)"))))
7914 (org-open-link-from-string (match-string 1))) 8045 (org-open-link-from-string (match-string 1)))
7915 (t (error "No link to open here"))))) 8046 (t (message "No link to open here")))))
7916 8047
7917(defun org-agenda-copy-local-variable (var) 8048(defun org-agenda-copy-local-variable (var)
7918 "Get a variable from a referenced buffer and install it here." 8049 "Get a variable from a referenced buffer and install it here."
@@ -8313,35 +8444,37 @@ If FORCE-TAGS is non nil, the car of it returns the new tags."
8313 (interactive) 8444 (interactive)
8314 (org-agenda-priority 'down)) 8445 (org-agenda-priority 'down))
8315 8446
8316(defun org-agenda-priority (&optional force-direction show) 8447(defun org-agenda-priority (&optional force-direction)
8317 "Set the priority of line at point, also in Org-mode file. 8448 "Set the priority of line at point, also in Org-mode file.
8318This changes the line at point, all other lines in the agenda referring to 8449This changes the line at point, all other lines in the agenda referring to
8319the same tree node, and the headline of the tree node in the Org-mode file." 8450the same tree node, and the headline of the tree node in the Org-mode file.
8451Called with a universal prefix arg, show the priority instead of setting it."
8320 (interactive "P") 8452 (interactive "P")
8321 (if (equal force-direction '(4)) (setq show t)) 8453 (if (equal force-direction '(4))
8322 (unless org-enable-priority-commands 8454 (org-show-priority)
8323 (error "Priority commands are disabled")) 8455 (unless org-enable-priority-commands
8324 (org-agenda-check-no-diary) 8456 (error "Priority commands are disabled"))
8325 (let* ((marker (or (org-get-at-bol 'org-marker) 8457 (org-agenda-check-no-diary)
8326 (org-agenda-error))) 8458 (let* ((marker (or (org-get-at-bol 'org-marker)
8327 (hdmarker (org-get-at-bol 'org-hd-marker)) 8459 (org-agenda-error)))
8328 (buffer (marker-buffer hdmarker)) 8460 (hdmarker (org-get-at-bol 'org-hd-marker))
8329 (pos (marker-position hdmarker)) 8461 (buffer (marker-buffer hdmarker))
8330 (inhibit-read-only t) 8462 (pos (marker-position hdmarker))
8331 newhead) 8463 (inhibit-read-only t)
8332 (org-with-remote-undo buffer 8464 newhead)
8333 (with-current-buffer buffer 8465 (org-with-remote-undo buffer
8334 (widen) 8466 (with-current-buffer buffer
8335 (goto-char pos) 8467 (widen)
8336 (org-show-context 'agenda) 8468 (goto-char pos)
8337 (save-excursion 8469 (org-show-context 'agenda)
8338 (and (outline-next-heading) 8470 (save-excursion
8339 (org-flag-heading nil))) ; show the next heading 8471 (and (outline-next-heading)
8340 (funcall 'org-priority force-direction show) 8472 (org-flag-heading nil))) ; show the next heading
8341 (end-of-line 1) 8473 (funcall 'org-priority force-direction)
8342 (setq newhead (org-get-heading))) 8474 (end-of-line 1)
8343 (org-agenda-change-all-lines newhead hdmarker) 8475 (setq newhead (org-get-heading)))
8344 (beginning-of-line 1)))) 8476 (org-agenda-change-all-lines newhead hdmarker)
8477 (beginning-of-line 1)))))
8345 8478
8346;; FIXME: should fix the tags property of the agenda line. 8479;; FIXME: should fix the tags property of the agenda line.
8347(defun org-agenda-set-tags (&optional tag onoff) 8480(defun org-agenda-set-tags (&optional tag onoff)
diff --git a/lisp/org/org-ascii.el b/lisp/org/org-ascii.el
index cf3f2d14d1d..c5a4b3775e8 100644
--- a/lisp/org/org-ascii.el
+++ b/lisp/org/org-ascii.el
@@ -131,7 +131,7 @@ utf8 Use all UTF-8 characters")
131 "Call `org-export-as-ascii` with output to a temporary buffer. 131 "Call `org-export-as-ascii` with output to a temporary buffer.
132No file is created. The prefix ARG is passed through to `org-export-as-ascii'." 132No file is created. The prefix ARG is passed through to `org-export-as-ascii'."
133 (interactive "P") 133 (interactive "P")
134 (org-export-as-ascii arg nil nil "*Org ASCII Export*") 134 (org-export-as-ascii arg nil "*Org ASCII Export*")
135 (when org-export-show-temporary-export-buffer 135 (when org-export-show-temporary-export-buffer
136 (switch-to-buffer-other-window "*Org ASCII Export*"))) 136 (switch-to-buffer-other-window "*Org ASCII Export*")))
137 137
@@ -183,23 +183,19 @@ in a window. A non-interactive call will only return the buffer."
183 (goto-char end) 183 (goto-char end)
184 (set-mark (point)) ;; to activate the region 184 (set-mark (point)) ;; to activate the region
185 (goto-char beg) 185 (goto-char beg)
186 (setq rtn (org-export-as-ascii 186 (setq rtn (org-export-as-ascii nil ext-plist buffer body-only))
187 nil nil ext-plist
188 buffer body-only))
189 (if (fboundp 'deactivate-mark) (deactivate-mark)) 187 (if (fboundp 'deactivate-mark) (deactivate-mark))
190 (if (and (org-called-interactively-p 'any) (bufferp rtn)) 188 (if (and (org-called-interactively-p 'any) (bufferp rtn))
191 (switch-to-buffer-other-window rtn) 189 (switch-to-buffer-other-window rtn)
192 rtn))) 190 rtn)))
193 191
194;;;###autoload 192;;;###autoload
195(defun org-export-as-ascii (arg &optional hidden ext-plist 193(defun org-export-as-ascii (arg &optional ext-plist to-buffer body-only pub-dir)
196 to-buffer body-only pub-dir)
197 "Export the outline as a pretty ASCII file. 194 "Export the outline as a pretty ASCII file.
198If there is an active region, export only the region. 195If there is an active region, export only the region.
199The prefix ARG specifies how many levels of the outline should become 196The prefix ARG specifies how many levels of the outline should become
200underlined headlines, default is 3. Lower levels will become bulleted 197underlined headlines, default is 3. Lower levels will become bulleted
201lists. When HIDDEN is non-nil, don't display the ASCII buffer. 198lists. EXT-PLIST is a property list with external parameters overriding
202EXT-PLIST is a property list with external parameters overriding
203org-mode's default settings, but still inferior to file-local 199org-mode's default settings, but still inferior to file-local
204settings. When TO-BUFFER is non-nil, create a buffer with that 200settings. When TO-BUFFER is non-nil, create a buffer with that
205name and export to that buffer. If TO-BUFFER is the symbol 201name and export to that buffer. If TO-BUFFER is the symbol
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index 366dced717c..8a271b8d055 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -451,7 +451,7 @@ For example, if you have a capture template \"c\" and you want
451this template to be accessible only from `message-mode' buffers, 451this template to be accessible only from `message-mode' buffers,
452use this: 452use this:
453 453
454 '((\"c\" (in-mode . \"message-mode\"))) 454 '((\"c\" ((in-mode . \"message-mode\"))))
455 455
456Here are the available contexts definitions: 456Here are the available contexts definitions:
457 457
@@ -467,11 +467,11 @@ accessible if there is at least one valid check.
467You can also bind a key to another agenda custom command 467You can also bind a key to another agenda custom command
468depending on contextual rules. 468depending on contextual rules.
469 469
470 '((\"c\" \"d\" (in-mode . \"message-mode\"))) 470 '((\"c\" \"d\" ((in-mode . \"message-mode\"))))
471 471
472Here it means: in `message-mode buffers', use \"d\" as the 472Here it means: in `message-mode buffers', use \"c\" as the
473key for the capture template otherwise associated with \"d\". 473key for the capture template otherwise associated with \"d\".
474\(The template originally associated with \"q\" is not displayed 474\(The template originally associated with \"d\" is not displayed
475to avoid duplicates.)" 475to avoid duplicates.)"
476 :version "24.3" 476 :version "24.3"
477 :group 'org-capture 477 :group 'org-capture
@@ -979,7 +979,7 @@ it. When it is a variable, retrieve the value. Return whatever we get."
979 (show-all) 979 (show-all)
980 (goto-char (org-capture-get :pos)) 980 (goto-char (org-capture-get :pos))
981 (org-set-local 'org-capture-target-marker 981 (org-set-local 'org-capture-target-marker
982 (move-marker (make-marker) (point))) 982 (point-marker))
983 (org-set-local 'outline-level 'org-outline-level) 983 (org-set-local 'outline-level 'org-outline-level)
984 (let* ((template (org-capture-get :template)) 984 (let* ((template (org-capture-get :template))
985 (type (org-capture-get :type))) 985 (type (org-capture-get :type)))
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 9ff0ff3e6de..c043dd19e11 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -35,6 +35,7 @@
35(declare-function calendar-absolute-from-iso "cal-iso" (&optional date)) 35(declare-function calendar-absolute-from-iso "cal-iso" (&optional date))
36(declare-function notifications-notify "notifications" (&rest params)) 36(declare-function notifications-notify "notifications" (&rest params))
37(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) 37(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label))
38(declare-function org-refresh-properties "org" (dprop tprop))
38(defvar org-time-stamp-formats) 39(defvar org-time-stamp-formats)
39(defvar org-ts-what) 40(defvar org-ts-what)
40(defvar org-frame-title-format-backup frame-title-format) 41(defvar org-frame-title-format-backup frame-title-format)
@@ -159,12 +160,15 @@ the clock can be resumed from that point."
159The clock is resumed when Emacs restarts. 160The clock is resumed when Emacs restarts.
160When this is t, both the running clock, and the entire clock 161When this is t, both the running clock, and the entire clock
161history are saved. When this is the symbol `clock', only the 162history are saved. When this is the symbol `clock', only the
162running clock is saved. 163running clock is saved. When this is the symbol `history', only
164the clock history is saved.
163 165
164When Emacs restarts with saved clock information, the file containing the 166When Emacs restarts with saved clock information, the file containing
165running clock as well as all files mentioned in the clock history will 167the running clock as well as all files mentioned in the clock history
166be visited. 168will be visited.
167All this depends on running `org-clock-persistence-insinuate' in .emacs" 169
170All this depends on running `org-clock-persistence-insinuate' in your
171Emacs initialization file."
168 :group 'org-clock 172 :group 'org-clock
169 :type '(choice 173 :type '(choice
170 (const :tag "Just the running clock" clock) 174 (const :tag "Just the running clock" clock)
@@ -1078,6 +1082,7 @@ time as the start time \(see `org-clock-continuously' to
1078make this the default behavior.)" 1082make this the default behavior.)"
1079 (interactive "P") 1083 (interactive "P")
1080 (setq org-clock-notification-was-shown nil) 1084 (setq org-clock-notification-was-shown nil)
1085 (org-refresh-properties org-effort-property 'org-effort)
1081 (catch 'abort 1086 (catch 'abort
1082 (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness) 1087 (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness)
1083 (org-clocking-p))) 1088 (org-clocking-p)))
@@ -1199,7 +1204,7 @@ make this the default behavior.)"
1199 (setq org-clock-start-time 1204 (setq org-clock-start-time
1200 (apply 'encode-time 1205 (apply 'encode-time
1201 (org-parse-time-string (match-string 1)))) 1206 (org-parse-time-string (match-string 1))))
1202 (setq org-clock-effort (org-get-effort)) 1207 (setq org-clock-effort (get-text-property (point) 'org-effort))
1203 (setq org-clock-total-time (org-clock-sum-current-item 1208 (setq org-clock-total-time (org-clock-sum-current-item
1204 (org-clock-get-sum-start)))) 1209 (org-clock-get-sum-start))))
1205 ((eq org-clock-in-resume 'auto-restart) 1210 ((eq org-clock-in-resume 'auto-restart)
@@ -1219,7 +1224,7 @@ make this the default behavior.)"
1219 (beginning-of-line 1) 1224 (beginning-of-line 1)
1220 (org-indent-line-to (- (org-get-indentation) 2))) 1225 (org-indent-line-to (- (org-get-indentation) 2)))
1221 (insert org-clock-string " ") 1226 (insert org-clock-string " ")
1222 (setq org-clock-effort (org-get-effort)) 1227 (setq org-clock-effort (get-text-property (point) 'org-effort))
1223 (setq org-clock-total-time (org-clock-sum-current-item 1228 (setq org-clock-total-time (org-clock-sum-current-item
1224 (org-clock-get-sum-start))) 1229 (org-clock-get-sum-start)))
1225 (setq org-clock-start-time 1230 (setq org-clock-start-time
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 30adf6a3f72..5a59196baa1 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -1243,7 +1243,7 @@ PARAMS is a property list of parameters:
1243:skip-empty-rows 1243:skip-empty-rows
1244 When t, skip rows where all specifiers other than ITEM are empty. 1244 When t, skip rows where all specifiers other than ITEM are empty.
1245:format When non-nil, specify the column view format to use." 1245:format When non-nil, specify the column view format to use."
1246 (let ((pos (move-marker (make-marker) (point))) 1246 (let ((pos (point-marker))
1247 (hlines (plist-get params :hlines)) 1247 (hlines (plist-get params :hlines))
1248 (vlines (plist-get params :vlines)) 1248 (vlines (plist-get params :vlines))
1249 (maxlevel (plist-get params :maxlevel)) 1249 (maxlevel (plist-get params :maxlevel))
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index bc13fa2c737..9292b994367 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -195,9 +195,8 @@ passed through to `fit-window-to-buffer'. If SHRINK-ONLY is set, call
195ignored in this case." 195ignored in this case."
196 (cond ((if (fboundp 'window-full-width-p) 196 (cond ((if (fboundp 'window-full-width-p)
197 (not (window-full-width-p window)) 197 (not (window-full-width-p window))
198 (> (frame-width) (window-width window))) 198 ;; do nothing if another window would suffer
199 ;; do nothing if another window would suffer 199 (> (frame-width) (window-width window))))
200 )
201 ((and (fboundp 'fit-window-to-buffer) (not shrink-only)) 200 ((and (fboundp 'fit-window-to-buffer) (not shrink-only))
202 (fit-window-to-buffer window max-height min-height)) 201 (fit-window-to-buffer window max-height min-height))
203 ((fboundp 'shrink-window-if-larger-than-buffer) 202 ((fboundp 'shrink-window-if-larger-than-buffer)
@@ -257,7 +256,6 @@ Works on both Emacs and XEmacs."
257 (when (boundp 'zmacs-regions) 256 (when (boundp 'zmacs-regions)
258 (setq zmacs-regions t))))) 257 (setq zmacs-regions t)))))
259 258
260
261;; Invisibility compatibility 259;; Invisibility compatibility
262 260
263(defun org-remove-from-invisibility-spec (arg) 261(defun org-remove-from-invisibility-spec (arg)
@@ -372,6 +370,20 @@ TIME defaults to the current time."
372 (time-to-seconds (or time (current-time))) 370 (time-to-seconds (or time (current-time)))
373 (float-time time))) 371 (float-time time)))
374 372
373;; `user-error' is only available from 24.2.50 on
374(unless (fboundp 'user-error)
375 (defalias 'user-error 'error))
376
377(defmacro org-no-popups (&rest body)
378 "Suppress popup windows.
379Let-bind some variables to nil around BODY to achieve the desired
380effect, which variables to use depends on the Emacs version."
381 (if (org-version-check "24.2.50" "" :predicate)
382 `(let (pop-up-frames display-buffer-alist)
383 ,@body)
384 `(let (pop-up-frames special-display-buffer-names special-display-regexps special-display-function)
385 ,@body)))
386
375(if (fboundp 'string-match-p) 387(if (fboundp 'string-match-p)
376 (defalias 'org-string-match-p 'string-match-p) 388 (defalias 'org-string-match-p 'string-match-p)
377 (defun org-string-match-p (regexp string &optional start) 389 (defun org-string-match-p (regexp string &optional start)
@@ -384,7 +396,7 @@ TIME defaults to the current time."
384 (save-match-data 396 (save-match-data
385 (apply 'looking-at args)))) 397 (apply 'looking-at args))))
386 398
387 ; XEmacs does not have `looking-back'. 399;; XEmacs does not have `looking-back'.
388(if (fboundp 'looking-back) 400(if (fboundp 'looking-back)
389 (defalias 'org-looking-back 'looking-back) 401 (defalias 'org-looking-back 'looking-back)
390 (defun org-looking-back (regexp &optional limit greedy) 402 (defun org-looking-back (regexp &optional limit greedy)
@@ -433,14 +445,26 @@ With two arguments, return floor and remainder of their quotient."
433 'pop-to-buffer-same-window buffer-or-name norecord) 445 'pop-to-buffer-same-window buffer-or-name norecord)
434 (funcall 'switch-to-buffer buffer-or-name norecord))) 446 (funcall 'switch-to-buffer buffer-or-name norecord)))
435 447
436;; `condition-case-unless-debug' has been introduced in Emacs 24.1 448;; RECURSIVE has been introduced with Emacs 23.2.
437;; `condition-case-no-debug' has been introduced in Emacs 23.1 449;; This is copying and adapted from `tramp-compat-delete-directory'
438(defalias 'org-condition-case-unless-debug 450(defun org-delete-directory (directory &optional recursive)
439 (or (and (fboundp 'condition-case-unless-debug) 451 "Compatibility function for `delete-directory'."
440 'condition-case-unless-debug) 452 (if (null recursive)
441 (and (fboundp 'condition-case-no-debug) 453 (delete-directory directory)
442 'condition-case-no-debug) 454 (condition-case nil
443 'condition-case)) 455 (funcall 'delete-directory directory recursive)
456 ;; This Emacs version does not support the RECURSIVE flag. We
457 ;; use the implementation from Emacs 23.2.
458 (wrong-number-of-arguments
459 (setq directory (directory-file-name (expand-file-name directory)))
460 (if (not (file-symlink-p directory))
461 (mapc (lambda (file)
462 (if (eq t (car (file-attributes file)))
463 (org-delete-directory file recursive)
464 (delete-file file)))
465 (directory-files
466 directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
467 (delete-directory directory)))))
444 468
445;;;###autoload 469;;;###autoload
446(defmacro org-check-version () 470(defmacro org-check-version ()
diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el
index fdfd1d326da..2dfc4addcc2 100644
--- a/lisp/org/org-crypt.el
+++ b/lisp/org/org-crypt.el
@@ -1,6 +1,6 @@
1;;; org-crypt.el --- Public key encryption for org-mode entries 1;;; org-crypt.el --- Public key encryption for org-mode entries
2 2
3;; Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc. 3;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
4 4
5;; Emacs Lisp Archive Entry 5;; Emacs Lisp Archive Entry
6;; Filename: org-crypt.el 6;; Filename: org-crypt.el
@@ -258,7 +258,7 @@ See `org-crypt-disable-auto-save'."
258 (save-excursion 258 (save-excursion
259 (org-back-to-heading t) 259 (org-back-to-heading t)
260 (search-forward "-----BEGIN PGP MESSAGE-----" 260 (search-forward "-----BEGIN PGP MESSAGE-----"
261 (save-excursion (org-end-of-subtree t)) t)))) 261 (save-excursion (outline-next-heading)) t))))
262 262
263(defun org-crypt-use-before-save-magic () 263(defun org-crypt-use-before-save-magic ()
264 "Add a hook to automatically encrypt entries before a file is saved to disk." 264 "Add a hook to automatically encrypt entries before a file is saved to disk."
diff --git a/lisp/org/org-docbook.el b/lisp/org/org-docbook.el
index ba03e3160b1..5253d9100a5 100644
--- a/lisp/org/org-docbook.el
+++ b/lisp/org/org-docbook.el
@@ -274,14 +274,14 @@ For example:
274$ emacs --batch 274$ emacs --batch
275 --load=$HOME/lib/emacs/org.el 275 --load=$HOME/lib/emacs/org.el
276 --visit=MyOrgFile.org --funcall org-export-as-docbook-batch" 276 --visit=MyOrgFile.org --funcall org-export-as-docbook-batch"
277 (org-export-as-docbook 'hidden)) 277 (org-export-as-docbook))
278 278
279;;;###autoload 279;;;###autoload
280(defun org-export-as-docbook-to-buffer () 280(defun org-export-as-docbook-to-buffer ()
281 "Call `org-export-as-docbook' with output to a temporary buffer. 281 "Call `org-export-as-docbook' with output to a temporary buffer.
282No file is created." 282No file is created."
283 (interactive) 283 (interactive)
284 (org-export-as-docbook nil nil "*Org DocBook Export*") 284 (org-export-as-docbook nil "*Org DocBook Export*")
285 (when org-export-show-temporary-export-buffer 285 (when org-export-show-temporary-export-buffer
286 (switch-to-buffer-other-window "*Org DocBook Export*"))) 286 (switch-to-buffer-other-window "*Org DocBook Export*")))
287 287
@@ -334,17 +334,14 @@ in a window. A non-interactive call will only return the buffer."
334 (goto-char end) 334 (goto-char end)
335 (set-mark (point)) ;; To activate the region 335 (set-mark (point)) ;; To activate the region
336 (goto-char beg) 336 (goto-char beg)
337 (setq rtn (org-export-as-docbook 337 (setq rtn (org-export-as-docbook nil buffer body-only))
338 nil nil
339 buffer body-only))
340 (if (fboundp 'deactivate-mark) (deactivate-mark)) 338 (if (fboundp 'deactivate-mark) (deactivate-mark))
341 (if (and (org-called-interactively-p 'any) (bufferp rtn)) 339 (if (and (org-called-interactively-p 'any) (bufferp rtn))
342 (switch-to-buffer-other-window rtn) 340 (switch-to-buffer-other-window rtn)
343 rtn))) 341 rtn)))
344 342
345;;;###autoload 343;;;###autoload
346(defun org-export-as-docbook-pdf (&optional hidden ext-plist 344(defun org-export-as-docbook-pdf (&optional ext-plist to-buffer body-only pub-dir)
347 to-buffer body-only pub-dir)
348 "Export as DocBook XML file, and generate PDF file." 345 "Export as DocBook XML file, and generate PDF file."
349 (interactive "P") 346 (interactive "P")
350 (if (or (not org-export-docbook-xslt-proc-command) 347 (if (or (not org-export-docbook-xslt-proc-command)
@@ -360,8 +357,7 @@ in a window. A non-interactive call will only return the buffer."
360 (org-combine-plists (org-default-export-plist) 357 (org-combine-plists (org-default-export-plist)
361 ext-plist 358 ext-plist
362 (org-infile-export-plist)))) 359 (org-infile-export-plist))))
363 (docbook-buf (org-export-as-docbook hidden ext-plist 360 (docbook-buf (org-export-as-docbook ext-plist to-buffer body-only pub-dir))
364 to-buffer body-only pub-dir))
365 (filename (buffer-file-name docbook-buf)) 361 (filename (buffer-file-name docbook-buf))
366 (base (file-name-sans-extension filename)) 362 (base (file-name-sans-extension filename))
367 (fofile (concat base ".fo")) 363 (fofile (concat base ".fo"))
@@ -398,8 +394,7 @@ in a window. A non-interactive call will only return the buffer."
398(defvar org-heading-keyword-regexp-format) ; defined in org.el 394(defvar org-heading-keyword-regexp-format) ; defined in org.el
399 395
400;;;###autoload 396;;;###autoload
401(defun org-export-as-docbook (&optional hidden ext-plist 397(defun org-export-as-docbook (&optional ext-plist to-buffer body-only pub-dir)
402 to-buffer body-only pub-dir)
403 "Export the current buffer as a DocBook file. 398 "Export the current buffer as a DocBook file.
404If there is an active region, export only the region. When 399If there is an active region, export only the region. When
405HIDDEN is obsolete and does nothing. EXT-PLIST is a 400HIDDEN is obsolete and does nothing. EXT-PLIST is a
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 6b2a83de8bd..c8096aa3963 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -3808,7 +3808,8 @@ Elements are accumulated into ACC."
3808 'section)) 3808 'section))
3809 (plain-list 'item) 3809 (plain-list 'item)
3810 (table 'table-row)) 3810 (table 'table-row))
3811 (org-element-property :structure element) 3811 (and (memq type '(item plain-list))
3812 (org-element-property :structure element))
3812 granularity visible-only element)) 3813 granularity visible-only element))
3813 ;; ELEMENT has contents. Parse objects inside, if 3814 ;; ELEMENT has contents. Parse objects inside, if
3814 ;; GRANULARITY allows it. 3815 ;; GRANULARITY allows it.
@@ -4249,8 +4250,11 @@ first element of current section."
4249 (plain-list 4250 (plain-list
4250 (setq special-flag 'item 4251 (setq special-flag 'item
4251 struct (org-element-property :structure element))) 4252 struct (org-element-property :structure element)))
4252 (table (setq special-flag 'table-row)) 4253 (item (setq special-flag nil))
4253 (otherwise (setq special-flag nil))) 4254 (property-drawer
4255 (setq special-flag 'node-property struct nil))
4256 (table (setq special-flag 'table-row struct nil))
4257 (otherwise (setq special-flag nil struct nil)))
4254 (setq end cend) 4258 (setq end cend)
4255 (goto-char cbeg))))))))))) 4259 (goto-char cbeg)))))))))))
4256 4260
diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el
index 1cf4cb5e054..82b9003e4fd 100644
--- a/lisp/org/org-exp.el
+++ b/lisp/org/org-exp.el
@@ -3047,12 +3047,11 @@ to the value of `temporary-file-directory'."
3047 (eval ;; convert to fmt -- mimicking `org-run-like-in-org-mode' 3047 (eval ;; convert to fmt -- mimicking `org-run-like-in-org-mode'
3048 (list 'let org-local-vars 3048 (list 'let org-local-vars
3049 (list (intern (format "org-export-as-%s" fmt)) 3049 (list (intern (format "org-export-as-%s" fmt))
3050 nil nil nil ''string t)))) 3050 nil nil ''string t dir))))
3051 (delete-file tmp-file)))) 3051 (delete-file tmp-file))))
3052 3052
3053;;;###autoload 3053;;;###autoload
3054(defun org-export-as-org (arg &optional hidden ext-plist 3054(defun org-export-as-org (arg &optional ext-plist to-buffer body-only pub-dir)
3055 to-buffer body-only pub-dir)
3056 "Make a copy with not-exporting stuff removed. 3055 "Make a copy with not-exporting stuff removed.
3057The purpose of this function is to provide a way to export the source 3056The purpose of this function is to provide a way to export the source
3058Org file of a webpage in Org format, but with sensitive and/or irrelevant 3057Org file of a webpage in Org format, but with sensitive and/or irrelevant
diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el
index 80e81349f6a..606db0814c2 100644
--- a/lisp/org/org-faces.el
+++ b/lisp/org/org-faces.el
@@ -44,6 +44,9 @@
44 (set-face-doc-string new-face docstring))))) 44 (set-face-doc-string new-face docstring)))))
45(put 'org-copy-face 'lisp-indent-function 2) 45(put 'org-copy-face 'lisp-indent-function 2)
46 46
47(when (featurep 'xemacs)
48 (put 'mode-line 'face-alias 'modeline))
49
47(defgroup org-faces nil 50(defgroup org-faces nil
48 "Faces in Org-mode." 51 "Faces in Org-mode."
49 :tag "Org Faces" 52 :tag "Org Faces"
diff --git a/lisp/org/org-html.el b/lisp/org/org-html.el
index 91df2ebcc4e..493d8a28afb 100644
--- a/lisp/org/org-html.el
+++ b/lisp/org/org-html.el
@@ -328,7 +328,7 @@ You can also customize this for each buffer, using something like
328 * @licstart The following is the entire license notice for the 328 * @licstart The following is the entire license notice for the
329 * JavaScript code in %PATH. 329 * JavaScript code in %PATH.
330 * 330 *
331 * Copyright (C) 2012 MathJax 331 * Copyright (C) 2012-2013 MathJax
332 * 332 *
333 * Licensed under the Apache License, Version 2.0 (the \"License\"); 333 * Licensed under the Apache License, Version 2.0 (the \"License\");
334 * you may not use this file except in compliance with the License. 334 * you may not use this file except in compliance with the License.
@@ -793,7 +793,7 @@ If there is an active region, export only the region.
793The prefix ARG specifies how many levels of the outline should become 793The prefix ARG specifies how many levels of the outline should become
794headlines. The default is 3. Lower levels will become bulleted lists." 794headlines. The default is 3. Lower levels will become bulleted lists."
795 (interactive "P") 795 (interactive "P")
796 (org-export-as-html arg 'hidden) 796 (org-export-as-html arg)
797 (org-open-file buffer-file-name) 797 (org-open-file buffer-file-name)
798 (when org-export-kill-product-buffer-when-displayed 798 (when org-export-kill-product-buffer-when-displayed
799 (kill-buffer (current-buffer)))) 799 (kill-buffer (current-buffer))))
@@ -806,14 +806,14 @@ emacs --batch
806 --load=$HOME/lib/emacs/org.el 806 --load=$HOME/lib/emacs/org.el
807 --eval \"(setq org-export-headline-levels 2)\" 807 --eval \"(setq org-export-headline-levels 2)\"
808 --visit=MyFile --funcall org-export-as-html-batch" 808 --visit=MyFile --funcall org-export-as-html-batch"
809 (org-export-as-html org-export-headline-levels 'hidden)) 809 (org-export-as-html org-export-headline-levels))
810 810
811;;;###autoload 811;;;###autoload
812(defun org-export-as-html-to-buffer (arg) 812(defun org-export-as-html-to-buffer (arg)
813 "Call `org-export-as-html` with output to a temporary buffer. 813 "Call `org-export-as-html` with output to a temporary buffer.
814No file is created. The prefix ARG is passed through to `org-export-as-html'." 814No file is created. The prefix ARG is passed through to `org-export-as-html'."
815 (interactive "P") 815 (interactive "P")
816 (org-export-as-html arg nil nil "*Org HTML Export*") 816 (org-export-as-html arg nil "*Org HTML Export*")
817 (when org-export-show-temporary-export-buffer 817 (when org-export-show-temporary-export-buffer
818 (switch-to-buffer-other-window "*Org HTML Export*"))) 818 (switch-to-buffer-other-window "*Org HTML Export*")))
819 819
@@ -865,9 +865,7 @@ in a window. A non-interactive call will only return the buffer."
865 (goto-char end) 865 (goto-char end)
866 (set-mark (point)) ;; to activate the region 866 (set-mark (point)) ;; to activate the region
867 (goto-char beg) 867 (goto-char beg)
868 (setq rtn (org-export-as-html 868 (setq rtn (org-export-as-html nil ext-plist buffer body-only))
869 nil nil ext-plist
870 buffer body-only))
871 (if (fboundp 'deactivate-mark) (deactivate-mark)) 869 (if (fboundp 'deactivate-mark) (deactivate-mark))
872 (if (and (org-called-interactively-p 'any) (bufferp rtn)) 870 (if (and (org-called-interactively-p 'any) (bufferp rtn))
873 (switch-to-buffer-other-window rtn) 871 (switch-to-buffer-other-window rtn)
@@ -1171,14 +1169,12 @@ OPT-PLIST is the export options list."
1171(defvar org-heading-keyword-regexp-format) ; defined in org.el 1169(defvar org-heading-keyword-regexp-format) ; defined in org.el
1172 1170
1173;;;###autoload 1171;;;###autoload
1174(defun org-export-as-html (arg &optional hidden ext-plist 1172(defun org-export-as-html (arg &optional ext-plist to-buffer body-only pub-dir)
1175 to-buffer body-only pub-dir)
1176 "Export the outline as a pretty HTML file. 1173 "Export the outline as a pretty HTML file.
1177If there is an active region, export only the region. The prefix 1174If there is an active region, export only the region. The prefix
1178ARG specifies how many levels of the outline should become 1175ARG specifies how many levels of the outline should become
1179headlines. The default is 3. Lower levels will become bulleted 1176headlines. The default is 3. Lower levels will become bulleted
1180lists. HIDDEN is obsolete and does nothing. 1177lists. EXT-PLIST is a property list with external parameters overriding
1181EXT-PLIST is a property list with external parameters overriding
1182org-mode's default settings, but still inferior to file-local 1178org-mode's default settings, but still inferior to file-local
1183settings. When TO-BUFFER is non-nil, create a buffer with that 1179settings. When TO-BUFFER is non-nil, create a buffer with that
1184name and export to that buffer. If TO-BUFFER is the symbol 1180name and export to that buffer. If TO-BUFFER is the symbol
diff --git a/lisp/org/org-icalendar.el b/lisp/org/org-icalendar.el
index f13f46d68b9..12cd0584fa0 100644
--- a/lisp/org/org-icalendar.el
+++ b/lisp/org/org-icalendar.el
@@ -327,6 +327,7 @@ When COMBINE is non nil, add the category to each line."
327 tmp pri categories location summary desc uid alarm alarm-time 327 tmp pri categories location summary desc uid alarm alarm-time
328 (sexp-buffer (get-buffer-create "*ical-tmp*"))) 328 (sexp-buffer (get-buffer-create "*ical-tmp*")))
329 (org-refresh-category-properties) 329 (org-refresh-category-properties)
330 (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime)
330 (save-excursion 331 (save-excursion
331 (goto-char (point-min)) 332 (goto-char (point-min))
332 (while (re-search-forward re1 nil t) 333 (while (re-search-forward re1 nil t)
@@ -357,7 +358,7 @@ When COMBINE is non nil, add the category to each line."
357 (org-id-get-create) 358 (org-id-get-create)
358 (or (org-id-get) (org-id-new))) 359 (or (org-id-get) (org-id-new)))
359 categories (org-export-get-categories) 360 categories (org-export-get-categories)
360 alarm-time (org-entry-get nil "APPT_WARNTIME") 361 alarm-time (get-text-property (point) 'org-appt-warntime)
361 alarm-time (if alarm-time (string-to-number alarm-time) 0) 362 alarm-time (if alarm-time (string-to-number alarm-time) 0)
362 alarm "" 363 alarm ""
363 deadlinep nil scheduledp nil) 364 deadlinep nil scheduledp nil)
@@ -676,7 +677,7 @@ a time), or the day by one (if it does not contain a time)."
676 (setq fmt (if have-time 677 (setq fmt (if have-time
677 (replace-regexp-in-string "%Z" 678 (replace-regexp-in-string "%Z"
678 org-icalendar-timezone 679 org-icalendar-timezone
679 org-icalendar-date-time-format) 680 org-icalendar-date-time-format t)
680 ";VALUE=DATE:%Y%m%d")) 681 ";VALUE=DATE:%Y%m%d"))
681 (concat keyword (format-time-string fmt time 682 (concat keyword (format-time-string fmt time
682 (and (org-icalendar-use-UTC-date-timep) 683 (and (org-icalendar-use-UTC-date-timep)
diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el
index 3748d392b38..43913acacde 100644
--- a/lisp/org/org-inlinetask.el
+++ b/lisp/org/org-inlinetask.el
@@ -75,6 +75,9 @@
75;; Also, if you want to use refiling and archiving for inline tasks, 75;; Also, if you want to use refiling and archiving for inline tasks,
76;; The END line must be present to make things work properly. 76;; The END line must be present to make things work properly.
77;; 77;;
78;; Note that you should not try to use inline tasks within plain list,
79;; visibility cycling is known to be problematic when doing so.
80;;
78;; This package installs one new command: 81;; This package installs one new command:
79;; 82;;
80;; C-c C-x t Insert a new inline task with END line 83;; C-c C-x t Insert a new inline task with END line
diff --git a/lisp/org/org-install.el b/lisp/org/org-install.el
index a31d8b79209..aca019fb823 100644
--- a/lisp/org/org-install.el
+++ b/lisp/org/org-install.el
@@ -1,8 +1,10 @@
1;;; org-install.el --- autogenerated file, do not edit 1;;; org-install.el --- backward compatibility file for obsolete configuration
2;; 2;;
3;;; Code: 3;;; Code:
4(warn "The file org-install is obsolete. 4(warn "The file org-install is obsolete.
5Please change your configuration to (require 'org) instead.") 5It is provided here so that (require 'org-install) does not
6trigger an error for users with obsolete Emacs configuration.
7You can safely remove (require 'org-install) from your config.")
6 8
7(provide 'org-install) 9(provide 'org-install)
8 10
diff --git a/lisp/org/org-jsinfo.el b/lisp/org/org-jsinfo.el
index 9a4046fff8b..08c01108b98 100644
--- a/lisp/org/org-jsinfo.el
+++ b/lisp/org/org-jsinfo.el
@@ -112,7 +112,7 @@ means to use the maximum value consistent with other options."
112 * @licstart The following is the entire license notice for the 112 * @licstart The following is the entire license notice for the
113 * JavaScript code in %SCRIPT_PATH. 113 * JavaScript code in %SCRIPT_PATH.
114 * 114 *
115 * Copyright (C) 2012 Sebastian Rose 115 * Copyright (C) 2012-2013 Sebastian Rose
116 * 116 *
117 * 117 *
118 * The JavaScript code in this tag is free software: you can 118 * The JavaScript code in this tag is free software: you can
diff --git a/lisp/org/org-latex.el b/lisp/org/org-latex.el
index 490a49d06e0..609bcbee103 100644
--- a/lisp/org/org-latex.el
+++ b/lisp/org/org-latex.el
@@ -872,7 +872,7 @@ no LaTeX header.
872When BODY-ONLY is set, don't produce the file header and footer, 872When BODY-ONLY is set, don't produce the file header and footer,
873simply return the content of \\begin{document}...\\end{document}, 873simply return the content of \\begin{document}...\\end{document},
874without even the \\begin{document} and \\end{document} commands. 874without even the \\begin{document} and \\end{document} commands.
875when PUB-DIR is set, use this as the publishing directory." 875When PUB-DIR is set, use this as the publishing directory."
876 (interactive "P") 876 (interactive "P")
877 (when (and (not body-only) arg (listp arg)) (setq body-only t)) 877 (when (and (not body-only) arg (listp arg)) (setq body-only t))
878 (run-hooks 'org-export-first-hook) 878 (run-hooks 'org-export-first-hook)
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index d80e1717ce0..78cb2a621c7 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -144,15 +144,15 @@ item. When the cursor is on an outline heading, plain lists are
144treated as text. This is the most stable way of handling this, 144treated as text. This is the most stable way of handling this,
145which is why it is the default. 145which is why it is the default.
146 146
147When this is the symbol `integrate', then during cycling, plain 147When this is the symbol `integrate', then integrate plain list
148list items will *temporarily* be interpreted as outline headlines 148items when cycling, as if they were children of outline headings.
149with a level given by 1000+i where i is the indentation of the 149
150bullet. This setting can lead to strange effects when switching 150This setting can lead to strange effects when switching visibility
151visibility to `children', because the first \"child\" in a 151to `children', because the first \"child\" in a subtree decides
152subtree decides what children should be listed. If that first 152what children should be listed. If that first \"child\" is a
153\"child\" is a plain list item with an implied large level 153plain list item with an implied large level number, all true
154number, all true children and grand children of the outline 154children and grand children of the outline heading will be
155heading will be exposed in a children' view." 155exposed in a children' view."
156 :group 'org-plain-lists 156 :group 'org-plain-lists
157 :type '(choice 157 :type '(choice
158 (const :tag "Never" nil) 158 (const :tag "Never" nil)
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index 04e26708d69..a44bdbe30fd 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -126,6 +126,15 @@ Also, do not record undo information."
126 (org-move-to-column ,col))))) 126 (org-move-to-column ,col)))))
127(def-edebug-spec org-preserve-lc (body)) 127(def-edebug-spec org-preserve-lc (body))
128 128
129;; Copied from bookmark.el
130(defmacro org-with-buffer-modified-unmodified (&rest body)
131 "Run BODY while preserving the buffer's `buffer-modified-p' state."
132 (org-with-gensyms (was-modified)
133 `(let ((,was-modified (buffer-modified-p)))
134 (unwind-protect
135 (progn ,@body)
136 (set-buffer-modified-p ,was-modified)))))
137
129(defmacro org-without-partial-completion (&rest body) 138(defmacro org-without-partial-completion (&rest body)
130 `(if (and (boundp 'partial-completion-mode) 139 `(if (and (boundp 'partial-completion-mode)
131 partial-completion-mode 140 partial-completion-mode
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el
index 3f41d45f511..a410de0d775 100644
--- a/lisp/org/org-mobile.el
+++ b/lisp/org/org-mobile.el
@@ -304,12 +304,13 @@ Also exclude files matching `org-mobile-files-exclude-regexp'."
304 304
305;;;###autoload 305;;;###autoload
306(defun org-mobile-push () 306(defun org-mobile-push ()
307 "Push the current state of Org affairs to the WebDAV directory. 307 "Push the current state of Org affairs to the target directory.
308This will create the index file, copy all agenda files there, and also 308This will create the index file, copy all agenda files there, and also
309create all custom agenda views, for upload to the mobile phone." 309create all custom agenda views, for upload to the mobile phone."
310 (interactive) 310 (interactive)
311 (let ((a-buffer (get-buffer org-agenda-buffer-name))) 311 (let ((a-buffer (get-buffer org-agenda-buffer-name)))
312 (let ((org-agenda-buffer-name "*SUMO*") 312 (let ((org-agenda-curbuf-name org-agenda-buffer-name)
313 (org-agenda-buffer-name "*SUMO*")
313 (org-agenda-tag-filter org-agenda-tag-filter) 314 (org-agenda-tag-filter org-agenda-tag-filter)
314 (org-agenda-redo-command org-agenda-redo-command)) 315 (org-agenda-redo-command org-agenda-redo-command))
315 (save-excursion 316 (save-excursion
@@ -329,15 +330,17 @@ create all custom agenda views, for upload to the mobile phone."
329 (org-mobile-create-index-file) 330 (org-mobile-create-index-file)
330 (message "Writing checksums...") 331 (message "Writing checksums...")
331 (org-mobile-write-checksums) 332 (org-mobile-write-checksums)
332 (run-hooks 'org-mobile-post-push-hook)))) 333 (run-hooks 'org-mobile-post-push-hook)))
334 (setq org-agenda-buffer-name org-agenda-curbuf-name
335 org-agenda-this-buffer-name org-agenda-curbuf-name))
333 (redraw-display) 336 (redraw-display)
334 (when (and a-buffer (buffer-live-p a-buffer)) 337 (when (buffer-live-p a-buffer)
335 (if (not (get-buffer-window a-buffer)) 338 (if (not (get-buffer-window a-buffer))
336 (kill-buffer a-buffer) 339 (kill-buffer a-buffer)
337 (let ((cw (selected-window))) 340 (let ((cw (selected-window)))
338 (select-window (get-buffer-window a-buffer)) 341 (select-window (get-buffer-window a-buffer))
339 (org-agenda-redo) 342 (org-agenda-redo)
340 (select-window cw))))) 343 (select-window cw)))))
341 (message "Files for mobile viewer staged")) 344 (message "Files for mobile viewer staged"))
342 345
343(defvar org-mobile-before-process-capture-hook nil 346(defvar org-mobile-before-process-capture-hook nil
@@ -417,7 +420,8 @@ agenda view showing the flagged items."
417 (target-file (expand-file-name org-mobile-index-file 420 (target-file (expand-file-name org-mobile-index-file
418 org-mobile-directory)) 421 org-mobile-directory))
419 file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds) 422 file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds)
420 423 (when (stringp (car def-todo))
424 (setq def-todo (list (cons 'sequence def-todo))))
421 (org-agenda-prepare-buffers (mapcar 'car files-alist)) 425 (org-agenda-prepare-buffers (mapcar 'car files-alist))
422 (setq done-kwds (org-uniquify org-done-keywords-for-agenda)) 426 (setq done-kwds (org-uniquify org-done-keywords-for-agenda))
423 (setq todo-kwds (org-delete-all 427 (setq todo-kwds (org-delete-all
@@ -536,7 +540,7 @@ The table of checksums is written to the file mobile-checksums."
536 (t (cons (car x) (cons "" (cdr x)))))) 540 (t (cons (car x) (cons "" (cdr x))))))
537 org-agenda-custom-commands))) 541 org-agenda-custom-commands)))
538 (default-list '(("a" "Agenda" agenda) ("t" "All TODO" alltodo))) 542 (default-list '(("a" "Agenda" agenda) ("t" "All TODO" alltodo)))
539 thelist new e key desc type match settings cmds gkey gdesc gsettings cnt) 543 thelist atitle new e key desc type match settings cmds gkey gdesc gsettings cnt)
540 (cond 544 (cond
541 ((eq org-mobile-agendas 'custom) 545 ((eq org-mobile-agendas 'custom)
542 (setq thelist custom-list)) 546 (setq thelist custom-list))
@@ -588,12 +592,13 @@ The table of checksums is written to the file mobile-checksums."
588 (setq cnt 0) 592 (setq cnt 0)
589 (while (setq e (pop cmds)) 593 (while (setq e (pop cmds))
590 (setq type (car e) match (nth 1 e) settings (nth 2 e)) 594 (setq type (car e) match (nth 1 e) settings (nth 2 e))
595 (setq atitle (if (string= "" gdesc) match gdesc))
591 (setq settings (append gsettings settings)) 596 (setq settings (append gsettings settings))
592 (setq settings 597 (setq settings
593 (cons (list 'org-agenda-title-append 598 (cons (list 'org-agenda-title-append
594 (concat "<after>KEYS=" gkey "#" (number-to-string 599 (concat "<after>KEYS=" gkey "#" (number-to-string
595 (setq cnt (1+ cnt))) 600 (setq cnt (1+ cnt)))
596 " TITLE: " gdesc " " match "</after>")) 601 " TITLE: " atitle "</after>"))
597 settings)) 602 settings))
598 (push (list type match settings) new))))) 603 (push (list type match settings) new)))))
599 (and new (list "X" "SUMO" (reverse new) 604 (and new (list "X" "SUMO" (reverse new)
@@ -615,12 +620,10 @@ The table of checksums is written to the file mobile-checksums."
615 (delete-region (point) (point-at-eol))) 620 (delete-region (point) (point-at-eol)))
616 ((get-text-property (point) 'org-agenda-structural-header) 621 ((get-text-property (point) 'org-agenda-structural-header)
617 (setq in-date nil) 622 (setq in-date nil)
618 (setq app (get-text-property (point) 623 (setq app (get-text-property (point) 'org-agenda-title-append))
619 'org-agenda-title-append)) 624 (setq short (get-text-property (point) 'short-heading))
620 (setq short (get-text-property (point)
621 'short-heading))
622 (when (and short (looking-at ".+")) 625 (when (and short (looking-at ".+"))
623 (replace-match short) 626 (replace-match short nil t)
624 (beginning-of-line 1)) 627 (beginning-of-line 1))
625 (when app 628 (when app
626 (end-of-line 1) 629 (end-of-line 1)
@@ -983,7 +986,7 @@ is currently a noop.")
983 (goto-char (point-max)) 986 (goto-char (point-max))
984 (newline) 987 (newline)
985 (goto-char (point-max)) 988 (goto-char (point-max))
986 (move-marker (make-marker) (point))))) 989 (point-marker))))
987 (let ((file (match-string 1 link)) 990 (let ((file (match-string 1 link))
988 (path (match-string 2 link))) 991 (path (match-string 2 link)))
989 (setq file (org-link-unescape file)) 992 (setq file (org-link-unescape file))
diff --git a/lisp/org/org-odt.el b/lisp/org/org-odt.el
index 028554f5821..92228f37eb8 100644
--- a/lisp/org/org-odt.el
+++ b/lisp/org/org-odt.el
@@ -439,15 +439,15 @@ values. See Info node `(emacs) File Variables'."
439 "meta.xml" "styles.xml"))) 439 "meta.xml" "styles.xml")))
440 ;; kill all xml buffers 440 ;; kill all xml buffers
441 (mapc (lambda (file) 441 (mapc (lambda (file)
442 (let ((buf (find-file-noselect 442 (with-current-buffer
443 (expand-file-name file org-odt-zip-dir) t))) 443 (find-file-noselect
444 (when (buffer-name buf) 444 (expand-file-name file org-odt-zip-dir) t)
445 (set-buffer-modified-p nil) 445 (set-buffer-modified-p nil)
446 (kill-buffer buf)))) 446 (kill-buffer)))
447 xml-files)) 447 xml-files))
448 ;; delete temporary directory. 448 ;; delete temporary directory.
449 (delete-directory org-odt-zip-dir t))))) 449 (org-delete-directory org-odt-zip-dir t)))))
450 (org-condition-case-unless-debug err 450 (condition-case err
451 (prog1 (progn ,@body) 451 (prog1 (progn ,@body)
452 (funcall --cleanup-xml-buffers)) 452 (funcall --cleanup-xml-buffers))
453 ((quit error) 453 ((quit error)
@@ -474,7 +474,7 @@ emacs --batch
474 --load=$HOME/lib/emacs/org.el 474 --load=$HOME/lib/emacs/org.el
475 --eval \"(setq org-export-headline-levels 2)\" 475 --eval \"(setq org-export-headline-levels 2)\"
476 --visit=MyFile --funcall org-export-as-odt-batch" 476 --visit=MyFile --funcall org-export-as-odt-batch"
477 (org-lparse-batch "odt")) 477 (org-odt-cleanup-xml-buffers (org-lparse-batch "odt")))
478 478
479;;; org-export-as-odt 479;;; org-export-as-odt
480;;;###autoload 480;;;###autoload
@@ -1727,6 +1727,7 @@ ATTR is a string of other attributes of the a element."
1727 ((and (string= type "") 1727 ((and (string= type "")
1728 (or (not thefile) (string= thefile "")) 1728 (or (not thefile) (string= thefile ""))
1729 (plist-get org-lparse-opt-plist :section-numbers) 1729 (plist-get org-lparse-opt-plist :section-numbers)
1730 (get-text-property 0 'org-no-description fragment)
1730 (setq sec-frag fragment) 1731 (setq sec-frag fragment)
1731 (or (string-match "\\`sec\\(\\(-[0-9]+\\)+\\)" sec-frag) 1732 (or (string-match "\\`sec\\(\\(-[0-9]+\\)+\\)" sec-frag)
1732 (and (setq sec-frag 1733 (and (setq sec-frag
@@ -1756,7 +1757,11 @@ ATTR is a string of other attributes of the a element."
1756 (when (not (member type '("" "file"))) 1757 (when (not (member type '("" "file")))
1757 (setq thefile (concat type ":" thefile))) 1758 (setq thefile (concat type ":" thefile)))
1758 1759
1759 (let ((org-odt-suppress-xref nil)) 1760 (let ((org-odt-suppress-xref
1761 ;; Typeset link to headlines with description, as a
1762 ;; regular hyperlink.
1763 (and (string= type "")
1764 (not (get-text-property 0 'org-no-description fragment)))))
1760 (org-odt-format-link 1765 (org-odt-format-link
1761 (org-xml-format-desc desc) thefile attr))))))) 1766 (org-xml-format-desc desc) thefile attr)))))))
1762 1767
diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el
index 1388df47d97..20c6a6860aa 100644
--- a/lisp/org/org-publish.el
+++ b/lisp/org/org-publish.el
@@ -577,7 +577,7 @@ PUB-DIR is the publishing directory."
577 (setq export-buf-or-file 577 (setq export-buf-or-file
578 (funcall (intern (concat "org-export-as-" format)) 578 (funcall (intern (concat "org-export-as-" format))
579 (plist-get plist :headline-levels) 579 (plist-get plist :headline-levels)
580 nil plist nil 580 plist nil
581 (plist-get plist :body-only) 581 (plist-get plist :body-only)
582 pub-dir)) 582 pub-dir))
583 (when (and (bufferp export-buf-or-file) 583 (when (and (bufferp export-buf-or-file)
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 6dbf6d67fc5..501d30ab1d7 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -39,6 +39,8 @@
39 39
40(declare-function org-do-remove-indentation "org" (&optional n)) 40(declare-function org-do-remove-indentation "org" (&optional n))
41(declare-function org-at-table.el-p "org" ()) 41(declare-function org-at-table.el-p "org" ())
42(declare-function org-in-src-block-p "org" (&optional inside))
43(declare-function org-in-block-p "org" (names))
42(declare-function org-get-indentation "org" (&optional line)) 44(declare-function org-get-indentation "org" (&optional line))
43(declare-function org-switch-to-buffer-other-window "org" (&rest args)) 45(declare-function org-switch-to-buffer-other-window "org" (&rest args))
44(declare-function org-pop-to-buffer-same-window 46(declare-function org-pop-to-buffer-same-window
@@ -201,41 +203,40 @@ There is a mode hook, and keybindings for `org-edit-src-exit' and
201`org-edit-src-save'") 203`org-edit-src-save'")
202 204
203(defun org-edit-src-code (&optional context code edit-buffer-name) 205(defun org-edit-src-code (&optional context code edit-buffer-name)
204 "Edit the source CODE example at point. 206 "Edit the source CODE block at point.
205The example is copied to a separate buffer, and that buffer is 207The code is copied to a separate buffer and the appropriate mode
206switched to the correct language mode. When done, exit with 208is turned on. When done, exit with \\[org-edit-src-exit]. This will
207\\[org-edit-src-exit]. This will remove the original code in the 209remove the original code in the Org buffer, and replace it with the
208Org buffer, and replace it with the edited version. An optional 210edited version. An optional argument CONTEXT is used by \\[org-edit-src-save]
209argument CONTEXT is used by \\[org-edit-src-save] when calling 211when calling this function. See `org-src-window-setup' to configure
210this function. See `org-src-window-setup' to configure the 212the display of windows containing the Org buffer and the code buffer."
211display of windows containing the Org buffer and the code
212buffer."
213 (interactive) 213 (interactive)
214 (unless (eq context 'save) 214 (if (not (or (org-in-block-p '("src" "example" "latex" "html"))
215 (setq org-edit-src-saved-temp-window-config (current-window-configuration))) 215 (org-at-table.el-p)))
216 (let* ((mark (and (org-region-active-p) (mark))) 216 (user-error "Not in a source code or example block")
217 (case-fold-search t) 217 (unless (eq context 'save)
218 (info 218 (setq org-edit-src-saved-temp-window-config (current-window-configuration)))
219 ;; If the src region consists in no lines, we insert a blank 219 (let* ((mark (and (org-region-active-p) (mark)))
220 ;; line. 220 (case-fold-search t)
221 (let* ((temp (org-edit-src-find-region-and-lang)) 221 (info
222 (beg (nth 0 temp)) 222 ;; If the src region consists in no lines, we insert a blank
223 (end (nth 1 temp))) 223 ;; line.
224 (if (>= end beg) temp 224 (let* ((temp (org-edit-src-find-region-and-lang))
225 (goto-char beg) 225 (beg (nth 0 temp))
226 (insert "\n") 226 (end (nth 1 temp)))
227 (org-edit-src-find-region-and-lang)))) 227 (if (>= end beg) temp
228 (full-info (org-babel-get-src-block-info 'light)) 228 (goto-char beg)
229 (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive 229 (insert "\n")
230 (beg (make-marker)) 230 (org-edit-src-find-region-and-lang))))
231 ;; Move marker with inserted text for case when src block is 231 (full-info (org-babel-get-src-block-info 'light))
232 ;; just one empty line, i.e. beg == end. 232 (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive
233 (end (copy-marker nil t)) 233 (beg (make-marker))
234 (allow-write-back-p (null code)) 234 ;; Move marker with inserted text for case when src block is
235 block-nindent total-nindent ovl lang lang-f single lfmt buffer msg 235 ;; just one empty line, i.e. beg == end.
236 begline markline markcol line col transmitted-variables) 236 (end (copy-marker (make-marker) t))
237 (if (not info) 237 (allow-write-back-p (null code))
238 nil 238 block-nindent total-nindent ovl lang lang-f single lfmt buffer msg
239 begline markline markcol line col transmitted-variables)
239 (setq beg (move-marker beg (nth 0 info)) 240 (setq beg (move-marker beg (nth 0 info))
240 end (move-marker end (nth 1 info)) 241 end (move-marker end (nth 1 info))
241 msg (if allow-write-back-p 242 msg (if allow-write-back-p
@@ -244,7 +245,7 @@ buffer."
244 "Exit with C-c ' (C-c and single quote)") 245 "Exit with C-c ' (C-c and single quote)")
245 code (or code (buffer-substring-no-properties beg end)) 246 code (or code (buffer-substring-no-properties beg end))
246 lang (or (cdr (assoc (nth 2 info) org-src-lang-modes)) 247 lang (or (cdr (assoc (nth 2 info) org-src-lang-modes))
247 (nth 2 info)) 248 (nth 2 info))
248 lang (if (symbolp lang) (symbol-name lang) lang) 249 lang (if (symbolp lang) (symbol-name lang) lang)
249 single (nth 3 info) 250 single (nth 3 info)
250 block-nindent (nth 5 info) 251 block-nindent (nth 5 info)
@@ -527,6 +528,14 @@ the language, a switch telling if the content should be in a single line."
527 (pos (point)) 528 (pos (point))
528 re1 re2 single beg end lang lfmt match-re1 ind entry) 529 re1 re2 single beg end lang lfmt match-re1 ind entry)
529 (catch 'exit 530 (catch 'exit
531 (when (org-at-table.el-p)
532 (re-search-backward "^[\t]*[^ \t|\\+]" nil t)
533 (setq beg (1+ (point-at-eol)))
534 (goto-char beg)
535 (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
536 (progn (goto-char (point-max)) (newline)))
537 (setq end (1- (point-at-bol)))
538 (throw 'exit (list beg end 'table.el nil nil 0)))
530 (while (setq entry (pop re-list)) 539 (while (setq entry (pop re-list))
531 (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry) 540 (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry)
532 single (nth 3 entry)) 541 single (nth 3 entry))
@@ -557,16 +566,7 @@ the language, a switch telling if the content should be in a single line."
557 (throw 'exit 566 (throw 'exit
558 (list (match-end 0) end 567 (list (match-end 0) end
559 (org-edit-src-get-lang lang) 568 (org-edit-src-get-lang lang)
560 single lfmt ind))))))))) 569 single lfmt ind))))))))))))
561 (when (org-at-table.el-p)
562 (re-search-backward "^[\t]*[^ \t|\\+]" nil t)
563 (setq beg (1+ (point-at-eol)))
564 (goto-char beg)
565 (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
566 (progn (goto-char (point-max)) (newline)))
567 (setq end (point-at-bol))
568 (setq ind (org-edit-src-get-indentation beg))
569 (throw 'exit (list beg end 'table.el nil nil ind))))))
570 570
571(defun org-edit-src-get-lang (lang) 571(defun org-edit-src-get-lang (lang)
572 "Extract the src language." 572 "Extract the src language."
@@ -633,7 +633,8 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
633 (unless (org-bound-and-true-p org-edit-src-from-org-mode) 633 (unless (org-bound-and-true-p org-edit-src-from-org-mode)
634 (error "This is not a sub-editing buffer, something is wrong")) 634 (error "This is not a sub-editing buffer, something is wrong"))
635 (widen) 635 (widen)
636 (let* ((beg org-edit-src-beg-marker) 636 (let* ((fixed-width-p (string-match "Fixed Width" (buffer-name)))
637 (beg org-edit-src-beg-marker)
637 (end org-edit-src-end-marker) 638 (end org-edit-src-end-marker)
638 (ovl org-edit-src-overlay) 639 (ovl org-edit-src-overlay)
639 (bufstr (buffer-string)) 640 (bufstr (buffer-string))
@@ -670,7 +671,8 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
670 (goto-char (point-max)) (insert "\\n"))) 671 (goto-char (point-max)) (insert "\\n")))
671 (goto-char (point-min)) 672 (goto-char (point-min))
672 (if (looking-at "\\s-*") (replace-match " "))) 673 (if (looking-at "\\s-*") (replace-match " ")))
673 (when (org-bound-and-true-p org-edit-src-from-org-mode) 674 (when (and (org-bound-and-true-p org-edit-src-from-org-mode)
675 (not fixed-width-p))
674 (org-escape-code-in-region (point-min) (point-max)) 676 (org-escape-code-in-region (point-min) (point-max))
675 (setq delta (+ delta 677 (setq delta (+ delta
676 (save-excursion 678 (save-excursion
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index b024770ce78..00b2eb4d028 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -509,10 +509,10 @@ nil When nil, the command tries to be smart and figure out the
509 re) 509 re)
510 (goto-char beg) 510 (goto-char beg)
511 (beginning-of-line 1) 511 (beginning-of-line 1)
512 (setq beg (move-marker (make-marker) (point))) 512 (setq beg (point-marker))
513 (goto-char end) 513 (goto-char end)
514 (if (bolp) (backward-char 1) (end-of-line 1)) 514 (if (bolp) (backward-char 1) (end-of-line 1))
515 (setq end (move-marker (make-marker) (point))) 515 (setq end (point-marker))
516 ;; Get the right field separator 516 ;; Get the right field separator
517 (unless separator 517 (unless separator
518 (goto-char beg) 518 (goto-char beg)
@@ -1895,7 +1895,7 @@ it can be edited in place."
1895 (if (and (boundp 'font-lock-mode) font-lock-mode) 1895 (if (and (boundp 'font-lock-mode) font-lock-mode)
1896 (font-lock-fontify-block)))) 1896 (font-lock-fontify-block))))
1897 (t 1897 (t
1898 (let ((pos (move-marker (make-marker) (point))) 1898 (let ((pos (point-marker))
1899 (coord 1899 (coord
1900 (if (eq org-table-use-standard-references t) 1900 (if (eq org-table-use-standard-references t)
1901 (concat (org-number-to-letters (org-table-current-column)) 1901 (concat (org-number-to-letters (org-table-current-column))
@@ -3219,7 +3219,7 @@ Parameters get priority."
3219 (let ((key (org-table-current-field-formula 'key 'noerror)) 3219 (let ((key (org-table-current-field-formula 'key 'noerror))
3220 (eql (sort (org-table-get-stored-formulas 'noerror) 3220 (eql (sort (org-table-get-stored-formulas 'noerror)
3221 'org-table-formula-less-p)) 3221 'org-table-formula-less-p))
3222 (pos (move-marker (make-marker) (point))) 3222 (pos (point-marker))
3223 (startline 1) 3223 (startline 1)
3224 (wc (current-window-configuration)) 3224 (wc (current-window-configuration))
3225 (sel-win (selected-window)) 3225 (sel-win (selected-window))
@@ -3580,7 +3580,7 @@ With prefix ARG, apply the new formulas to the table."
3580 (beginning-of-line 1) 3580 (beginning-of-line 1)
3581 (insert ind)) 3581 (insert ind))
3582 (goto-char (point-max)) 3582 (goto-char (point-max))
3583 (backward-delete-char 1))) 3583 (org-delete-backward-char 1)))
3584 (goto-char beg)) 3584 (goto-char beg))
3585 (t nil)))) 3585 (t nil))))
3586 3586
@@ -4235,7 +4235,7 @@ overwritten, and the table is not marked as requiring realignment."
4235 (looking-at "[^|\n]* +|")) 4235 (looking-at "[^|\n]* +|"))
4236 (let (org-table-may-need-update) 4236 (let (org-table-may-need-update)
4237 (goto-char (1- (match-end 0))) 4237 (goto-char (1- (match-end 0)))
4238 (backward-delete-char 1) 4238 (org-delete-backward-char 1)
4239 (goto-char (match-beginning 0)) 4239 (goto-char (match-beginning 0))
4240 (self-insert-command N)) 4240 (self-insert-command N))
4241 (setq org-table-may-need-update t) 4241 (setq org-table-may-need-update t)
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index de434885b12..e62eba3cf83 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/org-version.el
@@ -5,13 +5,13 @@
5(defun org-release () 5(defun org-release ()
6 "The release version of org-mode. 6 "The release version of org-mode.
7 Inserted by installing org-mode or when a release is made." 7 Inserted by installing org-mode or when a release is made."
8 (let ((org-release "7.9.2+")) 8 (let ((org-release "7.9.3d"))
9 org-release)) 9 org-release))
10;;;###autoload 10;;;###autoload
11(defun org-git-version () 11(defun org-git-version ()
12 "The Git version of org-mode. 12 "The Git version of org-mode.
13 Inserted by installing org-mode or when a release is made." 13 Inserted by installing org-mode or when a release is made."
14 (let ((org-git-version "7.9.2+-GNU-Emacs-24-3 (commit 488eea)")) 14 (let ((org-git-version "7.9.3d-GNU-Emacs-24-3 (commit e8f5b0ad)"))
15 org-git-version)) 15 org-git-version))
16;;;###autoload 16;;;###autoload
17(defvar org-odt-data-dir "/usr/share/emacs/etc/org" 17(defvar org-odt-data-dir "/usr/share/emacs/etc/org"
diff --git a/lisp/org/org.el b/lisp/org/org.el
index d4120b4224e..9409feca178 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -1219,7 +1219,15 @@ See also the QUOTE keyword."
1219 :type 'boolean) 1219 :type 'boolean)
1220 1220
1221(defcustom org-goto-auto-isearch t 1221(defcustom org-goto-auto-isearch t
1222 "Non-nil means typing characters in `org-goto' starts incremental search." 1222 "Non-nil means typing characters in `org-goto' starts incremental search.
1223When nil, you can use these keybindings to navigate the buffer:
1224
1225 q Quit the org-goto interface
1226 n Go to the next visible heading
1227 p Go to the previous visible heading
1228 f Go one heading forward on same level
1229 b Go one heading backward on same level
1230 u Go one heading up"
1223 :group 'org-edit-structure 1231 :group 'org-edit-structure
1224 :type 'boolean) 1232 :type 'boolean)
1225 1233
@@ -2236,8 +2244,9 @@ Lisp variable `org-state'."
2236(defvar org-blocker-hook nil 2244(defvar org-blocker-hook nil
2237 "Hook for functions that are allowed to block a state change. 2245 "Hook for functions that are allowed to block a state change.
2238 2246
2239Each function gets as its single argument a property list, see 2247Functions in this hook should not modify the buffer.
2240`org-trigger-hook' for more information about this list. 2248Each function gets as its single argument a property list,
2249see `org-trigger-hook' for more information about this list.
2241 2250
2242If any of the functions in this hook returns nil, the state change 2251If any of the functions in this hook returns nil, the state change
2243is blocked.") 2252is blocked.")
@@ -2245,8 +2254,8 @@ is blocked.")
2245(defvar org-trigger-hook nil 2254(defvar org-trigger-hook nil
2246 "Hook for functions that are triggered by a state change. 2255 "Hook for functions that are triggered by a state change.
2247 2256
2248Each function gets as its single argument a property list with at least 2257Each function gets as its single argument a property list with at
2249the following elements: 2258least the following elements:
2250 2259
2251 (:type type-of-change :position pos-at-entry-start 2260 (:type type-of-change :position pos-at-entry-start
2252 :from old-state :to new-state) 2261 :from old-state :to new-state)
@@ -2979,7 +2988,7 @@ When nil, only the tags directly given in a specific line apply there.
2979This may also be a list of tags that should be inherited, or a regexp that 2988This may also be a list of tags that should be inherited, or a regexp that
2980matches tags that should be inherited. Additional control is possible 2989matches tags that should be inherited. Additional control is possible
2981with the variable `org-tags-exclude-from-inheritance' which gives an 2990with the variable `org-tags-exclude-from-inheritance' which gives an
2982explicit list of tags to be excluded from inheritance., even if the value of 2991explicit list of tags to be excluded from inheritance, even if the value of
2983`org-use-tag-inheritance' would select it for inheritance. 2992`org-use-tag-inheritance' would select it for inheritance.
2984 2993
2985If this option is t, a match early-on in a tree can lead to a large 2994If this option is t, a match early-on in a tree can lead to a large
@@ -3952,7 +3961,7 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
3952 (beginning-of-line 1) 3961 (beginning-of-line 1)
3953 (when (and (looking-at org-table-line-regexp) 3962 (when (and (looking-at org-table-line-regexp)
3954 ;; Exclude tables in src/example/verbatim/clocktable blocks 3963 ;; Exclude tables in src/example/verbatim/clocktable blocks
3955 (not (org-in-block-p '("src" "example")))) 3964 (not (org-in-block-p '("src" "example" "verbatim" "clocktable"))))
3956 (save-excursion (funcall function)) 3965 (save-excursion (funcall function))
3957 (or (looking-at org-table-line-regexp) 3966 (or (looking-at org-table-line-regexp)
3958 (forward-char 1))) 3967 (forward-char 1)))
@@ -5007,13 +5016,15 @@ The following commands are available:
5007(defun org-find-invisible-foreground () 5016(defun org-find-invisible-foreground ()
5008 (let ((candidates (remove 5017 (let ((candidates (remove
5009 "unspecified-bg" 5018 "unspecified-bg"
5010 (list 5019 (nconc
5011 (face-background 'default) 5020 (list (face-background 'default)
5012 (face-background 'org-default) 5021 (face-background 'org-default))
5013 (cdr (assoc 'background-color default-frame-alist)) 5022 (mapcar
5014 (cdr (assoc 'background-color initial-frame-alist)) 5023 (lambda (alist)
5015 (cdr (assoc 'background-color window-system-default-frame-alist)) 5024 (when (boundp alist)
5016 (face-foreground 'org-hide))))) 5025 (cdr (assoc 'background-color (symbol-value alist)))))
5026 '(default-frame-alist initial-frame-alist window-system-default-frame-alist))
5027 (list (face-foreground 'org-hide))))))
5017 (car (remove nil candidates)))) 5028 (car (remove nil candidates))))
5018 5029
5019(defun org-current-time () 5030(defun org-current-time ()
@@ -5284,7 +5295,7 @@ will be prompted for."
5284 (and move (backward-char 1)))) 5295 (and move (backward-char 1))))
5285 5296
5286(defconst org-nonsticky-props 5297(defconst org-nonsticky-props
5287 '(mouse-face highlight keymap invisible intangible help-echo org-linked-text)) 5298 '(mouse-face highlight keymap invisible intangible help-echo org-linked-text htmlize-link))
5288 5299
5289(defsubst org-rear-nonsticky-at (pos) 5300(defsubst org-rear-nonsticky-at (pos)
5290 (add-text-properties (1- pos) pos (list 'rear-nonsticky org-nonsticky-props))) 5301 (add-text-properties (1- pos) pos (list 'rear-nonsticky org-nonsticky-props)))
@@ -5293,12 +5304,13 @@ will be prompted for."
5293 "Run through the buffer and add overlays to links." 5304 "Run through the buffer and add overlays to links."
5294 (catch 'exit 5305 (catch 'exit
5295 (let (f) 5306 (let (f)
5296 (when (re-search-forward (concat org-plain-link-re) limit t) 5307 (when (and (re-search-forward (concat org-plain-link-re) limit t)
5308 (not (org-in-src-block-p)))
5297 (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) 5309 (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
5298 (setq f (get-text-property (match-beginning 0) 'face)) 5310 (setq f (get-text-property (match-beginning 0) 'face))
5299 (if (or (eq f 'org-tag) 5311 (unless (or (org-in-src-block-p)
5300 (and (listp f) (memq 'org-tag f))) 5312 (eq f 'org-tag)
5301 nil 5313 (and (listp f) (memq 'org-tag f)))
5302 (add-text-properties (match-beginning 0) (match-end 0) 5314 (add-text-properties (match-beginning 0) (match-end 0)
5303 (list 'mouse-face 'highlight 5315 (list 'mouse-face 'highlight
5304 'face 'org-link 5316 'face 'org-link
@@ -5410,9 +5422,9 @@ by a #."
5410 '(font-lock-fontified t invisible t) 5422 '(font-lock-fontified t invisible t)
5411 '(font-lock-fontified t face org-document-info-keyword))) 5423 '(font-lock-fontified t face org-document-info-keyword)))
5412 (add-text-properties 5424 (add-text-properties
5413 (match-beginning 6) (match-end 6) 5425 (match-beginning 6) (1+ (match-end 6))
5414 (if (string-equal dc1 "+title:") 5426 (if (string-equal dc1 "+title:")
5415 '(font-lock-fontified t face org-document-title) 5427 '(font-lock-fontified t face org-document-title)
5416 '(font-lock-fontified t face org-document-info)))) 5428 '(font-lock-fontified t face org-document-info))))
5417 ((or (equal dc1 "+results") 5429 ((or (equal dc1 "+results")
5418 (member dc1 '("+begin:" "+end:" "+caption:" "+label:" 5430 (member dc1 '("+begin:" "+end:" "+caption:" "+label:"
@@ -5437,7 +5449,8 @@ by a #."
5437 5449
5438(defun org-activate-angle-links (limit) 5450(defun org-activate-angle-links (limit)
5439 "Run through the buffer and add overlays to links." 5451 "Run through the buffer and add overlays to links."
5440 (if (re-search-forward org-angle-link-re limit t) 5452 (if (and (re-search-forward org-angle-link-re limit t)
5453 (not (org-in-src-block-p)))
5441 (progn 5454 (progn
5442 (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) 5455 (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
5443 (add-text-properties (match-beginning 0) (match-end 0) 5456 (add-text-properties (match-beginning 0) (match-end 0)
@@ -5465,7 +5478,8 @@ by a #."
5465 5478
5466(defun org-activate-bracket-links (limit) 5479(defun org-activate-bracket-links (limit)
5467 "Run through the buffer and add overlays to bracketed links." 5480 "Run through the buffer and add overlays to bracketed links."
5468 (if (re-search-forward org-bracket-link-regexp limit t) 5481 (if (and (re-search-forward org-bracket-link-regexp limit t)
5482 (not (org-in-src-block-p)))
5469 (let* ((help (concat "LINK: " 5483 (let* ((help (concat "LINK: "
5470 (org-match-string-no-properties 1))) 5484 (org-match-string-no-properties 1)))
5471 ;; FIXME: above we should remove the escapes. 5485 ;; FIXME: above we should remove the escapes.
@@ -6254,11 +6268,7 @@ in special contexts.
6254 (setq has-children (org-list-has-child-p (point) struct))) 6268 (setq has-children (org-list-has-child-p (point) struct)))
6255 (org-back-to-heading) 6269 (org-back-to-heading)
6256 (setq eoh (save-excursion (outline-end-of-heading) (point))) 6270 (setq eoh (save-excursion (outline-end-of-heading) (point)))
6257 (setq eos (save-excursion 6271 (setq eos (save-excursion (1- (org-end-of-subtree t t))))
6258 (org-end-of-subtree t)
6259 (unless (eobp)
6260 (skip-chars-forward " \t\n"))
6261 (if (eobp) (point) (1- (point)))))
6262 (setq has-children 6272 (setq has-children
6263 (or (save-excursion 6273 (or (save-excursion
6264 (let ((level (funcall outline-level))) 6274 (let ((level (funcall outline-level)))
@@ -6283,7 +6293,8 @@ in special contexts.
6283 (cond 6293 (cond
6284 ((= eos eoh) 6294 ((= eos eoh)
6285 ;; Nothing is hidden behind this heading 6295 ;; Nothing is hidden behind this heading
6286 (run-hook-with-args 'org-pre-cycle-hook 'empty) 6296 (unless (org-before-first-heading-p)
6297 (run-hook-with-args 'org-pre-cycle-hook 'empty))
6287 (message "EMPTY ENTRY") 6298 (message "EMPTY ENTRY")
6288 (setq org-cycle-subtree-status nil) 6299 (setq org-cycle-subtree-status nil)
6289 (save-excursion 6300 (save-excursion
@@ -6296,7 +6307,8 @@ in special contexts.
6296 (not (setq children-skipped 6307 (not (setq children-skipped
6297 org-cycle-skip-children-state-if-no-children)))) 6308 org-cycle-skip-children-state-if-no-children))))
6298 ;; Entire subtree is hidden in one line: children view 6309 ;; Entire subtree is hidden in one line: children view
6299 (run-hook-with-args 'org-pre-cycle-hook 'children) 6310 (unless (org-before-first-heading-p)
6311 (run-hook-with-args 'org-pre-cycle-hook 'children))
6300 (if (org-at-item-p) 6312 (if (org-at-item-p)
6301 (org-list-set-item-visibility (point-at-bol) struct 'children) 6313 (org-list-set-item-visibility (point-at-bol) struct 'children)
6302 (org-show-entry) 6314 (org-show-entry)
@@ -6324,24 +6336,28 @@ in special contexts.
6324 (outline-next-heading) 6336 (outline-next-heading)
6325 (if (outline-invisible-p) (org-flag-heading nil))) 6337 (if (outline-invisible-p) (org-flag-heading nil)))
6326 (setq org-cycle-subtree-status 'children) 6338 (setq org-cycle-subtree-status 'children)
6327 (run-hook-with-args 'org-cycle-hook 'children)) 6339 (unless (org-before-first-heading-p)
6340 (run-hook-with-args 'org-cycle-hook 'children)))
6328 ((or children-skipped 6341 ((or children-skipped
6329 (and (eq last-command this-command) 6342 (and (eq last-command this-command)
6330 (eq org-cycle-subtree-status 'children))) 6343 (eq org-cycle-subtree-status 'children)))
6331 ;; We just showed the children, or no children are there, 6344 ;; We just showed the children, or no children are there,
6332 ;; now show everything. 6345 ;; now show everything.
6333 (run-hook-with-args 'org-pre-cycle-hook 'subtree) 6346 (unless (org-before-first-heading-p)
6347 (run-hook-with-args 'org-pre-cycle-hook 'subtree))
6334 (outline-flag-region eoh eos nil) 6348 (outline-flag-region eoh eos nil)
6335 (message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE")) 6349 (message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE"))
6336 (setq org-cycle-subtree-status 'subtree) 6350 (setq org-cycle-subtree-status 'subtree)
6337 (run-hook-with-args 'org-cycle-hook 'subtree)) 6351 (unless (org-before-first-heading-p)
6352 (run-hook-with-args 'org-cycle-hook 'subtree)))
6338 (t 6353 (t
6339 ;; Default action: hide the subtree. 6354 ;; Default action: hide the subtree.
6340 (run-hook-with-args 'org-pre-cycle-hook 'folded) 6355 (run-hook-with-args 'org-pre-cycle-hook 'folded)
6341 (outline-flag-region eoh eos t) 6356 (outline-flag-region eoh eos t)
6342 (message "FOLDED") 6357 (message "FOLDED")
6343 (setq org-cycle-subtree-status 'folded) 6358 (setq org-cycle-subtree-status 'folded)
6344 (run-hook-with-args 'org-cycle-hook 'folded))))) 6359 (unless (org-before-first-heading-p)
6360 (run-hook-with-args 'org-cycle-hook 'folded))))))
6345 6361
6346;;;###autoload 6362;;;###autoload
6347(defun org-global-cycle (&optional arg) 6363(defun org-global-cycle (&optional arg)
@@ -6745,42 +6761,47 @@ Optional arguments START and END can be used to limit the range."
6745 6761
6746(defvar org-goto-window-configuration nil) 6762(defvar org-goto-window-configuration nil)
6747(defvar org-goto-marker nil) 6763(defvar org-goto-marker nil)
6748(defvar org-goto-map 6764(defvar org-goto-map)
6749 (let ((map (make-sparse-keymap))) 6765(defun org-goto-map ()
6750 (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command mouse-drag-region universal-argument org-occur)) cmd) 6766 "Set the keymap `org-goto'."
6751 (while (setq cmd (pop cmds)) 6767 (setq org-goto-map
6752 (substitute-key-definition cmd cmd map global-map))) 6768 (let ((map (make-sparse-keymap)))
6753 (suppress-keymap map) 6769 (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command
6754 (org-defkey map "\C-m" 'org-goto-ret) 6770 mouse-drag-region universal-argument org-occur))
6755 (org-defkey map [(return)] 'org-goto-ret) 6771 cmd)
6756 (org-defkey map [(left)] 'org-goto-left) 6772 (while (setq cmd (pop cmds))
6757 (org-defkey map [(right)] 'org-goto-right) 6773 (substitute-key-definition cmd cmd map global-map)))
6758 (org-defkey map [(control ?g)] 'org-goto-quit) 6774 (suppress-keymap map)
6759 (org-defkey map "\C-i" 'org-cycle) 6775 (org-defkey map "\C-m" 'org-goto-ret)
6760 (org-defkey map [(tab)] 'org-cycle) 6776 (org-defkey map [(return)] 'org-goto-ret)
6761 (org-defkey map [(down)] 'outline-next-visible-heading) 6777 (org-defkey map [(left)] 'org-goto-left)
6762 (org-defkey map [(up)] 'outline-previous-visible-heading) 6778 (org-defkey map [(right)] 'org-goto-right)
6763 (if org-goto-auto-isearch 6779 (org-defkey map [(control ?g)] 'org-goto-quit)
6764 (if (fboundp 'define-key-after) 6780 (org-defkey map "\C-i" 'org-cycle)
6765 (define-key-after map [t] 'org-goto-local-auto-isearch) 6781 (org-defkey map [(tab)] 'org-cycle)
6766 nil) 6782 (org-defkey map [(down)] 'outline-next-visible-heading)
6767 (org-defkey map "q" 'org-goto-quit) 6783 (org-defkey map [(up)] 'outline-previous-visible-heading)
6768 (org-defkey map "n" 'outline-next-visible-heading) 6784 (if org-goto-auto-isearch
6769 (org-defkey map "p" 'outline-previous-visible-heading) 6785 (if (fboundp 'define-key-after)
6770 (org-defkey map "f" 'outline-forward-same-level) 6786 (define-key-after map [t] 'org-goto-local-auto-isearch)
6771 (org-defkey map "b" 'outline-backward-same-level) 6787 nil)
6772 (org-defkey map "u" 'outline-up-heading)) 6788 (org-defkey map "q" 'org-goto-quit)
6773 (org-defkey map "/" 'org-occur) 6789 (org-defkey map "n" 'outline-next-visible-heading)
6774 (org-defkey map "\C-c\C-n" 'outline-next-visible-heading) 6790 (org-defkey map "p" 'outline-previous-visible-heading)
6775 (org-defkey map "\C-c\C-p" 'outline-previous-visible-heading) 6791 (org-defkey map "f" 'outline-forward-same-level)
6776 (org-defkey map "\C-c\C-f" 'outline-forward-same-level) 6792 (org-defkey map "b" 'outline-backward-same-level)
6777 (org-defkey map "\C-c\C-b" 'outline-backward-same-level) 6793 (org-defkey map "u" 'outline-up-heading))
6778 (org-defkey map "\C-c\C-u" 'outline-up-heading) 6794 (org-defkey map "/" 'org-occur)
6779 map)) 6795 (org-defkey map "\C-c\C-n" 'outline-next-visible-heading)
6796 (org-defkey map "\C-c\C-p" 'outline-previous-visible-heading)
6797 (org-defkey map "\C-c\C-f" 'outline-forward-same-level)
6798 (org-defkey map "\C-c\C-b" 'outline-backward-same-level)
6799 (org-defkey map "\C-c\C-u" 'outline-up-heading)
6800 map)))
6780 6801
6781(defconst org-goto-help 6802(defconst org-goto-help
6782 "Browse buffer copy, to find location or copy text. Just type for auto-isearch. 6803 "Browse buffer copy, to find location or copy text.%s
6783RET=jump to location [Q]uit and return to previous location 6804RET=jump to location C-g=quit and return to previous location
6784\[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur") 6805\[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur")
6785 6806
6786(defvar org-goto-start-pos) ; dynamically scoped parameter 6807(defvar org-goto-start-pos) ; dynamically scoped parameter
@@ -6806,6 +6827,7 @@ in the indirect buffer and expose the headline hierarchy above.
6806With a prefix argument, use the alternative interface: e.g. if 6827With a prefix argument, use the alternative interface: e.g. if
6807`org-goto-interface' is 'outline use 'outline-path-completion." 6828`org-goto-interface' is 'outline use 'outline-path-completion."
6808 (interactive "P") 6829 (interactive "P")
6830 (org-goto-map)
6809 (let* ((org-refile-targets `((nil . (:maxlevel . ,org-goto-max-level)))) 6831 (let* ((org-refile-targets `((nil . (:maxlevel . ,org-goto-max-level))))
6810 (org-refile-use-outline-path t) 6832 (org-refile-use-outline-path t)
6811 (org-refile-target-verify-function nil) 6833 (org-refile-target-verify-function nil)
@@ -6838,48 +6860,46 @@ With a prefix argument, use the alternative interface: e.g. if
6838 "Let the user select a location in the Org-mode buffer BUF. 6860 "Let the user select a location in the Org-mode buffer BUF.
6839This function uses a recursive edit. It returns the selected position 6861This function uses a recursive edit. It returns the selected position
6840or nil." 6862or nil."
6841 (let ((isearch-mode-map org-goto-local-auto-isearch-map) 6863 (org-no-popups
6842 (isearch-hide-immediately nil) 6864 (let ((isearch-mode-map org-goto-local-auto-isearch-map)
6843 (isearch-search-fun-function 6865 (isearch-hide-immediately nil)
6844 (lambda () 'org-goto-local-search-headings)) 6866 (isearch-search-fun-function
6845 (org-goto-selected-point org-goto-exit-command) 6867 (lambda () 'org-goto-local-search-headings))
6846 (pop-up-frames nil) 6868 (org-goto-selected-point org-goto-exit-command))
6847 (special-display-buffer-names nil) 6869 (save-excursion
6848 (special-display-regexps nil) 6870 (save-window-excursion
6849 (special-display-function nil)) 6871 (delete-other-windows)
6850 (save-excursion 6872 (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
6851 (save-window-excursion 6873 (org-pop-to-buffer-same-window
6852 (delete-other-windows) 6874 (condition-case nil
6853 (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*")) 6875 (make-indirect-buffer (current-buffer) "*org-goto*")
6854 (org-pop-to-buffer-same-window 6876 (error (make-indirect-buffer (current-buffer) "*org-goto*"))))
6855 (condition-case nil 6877 (with-output-to-temp-buffer "*Org Help*"
6856 (make-indirect-buffer (current-buffer) "*org-goto*") 6878 (princ (format help (if org-goto-auto-isearch
6857 (error (make-indirect-buffer (current-buffer) "*org-goto*")))) 6879 " Just type for auto-isearch."
6858 (with-output-to-temp-buffer "*Help*" 6880 " n/p/f/b/u to navigate, q to quit."))))
6859 (princ help)) 6881 (org-fit-window-to-buffer (get-buffer-window "*Org Help*"))
6860 (org-fit-window-to-buffer (get-buffer-window "*Help*")) 6882 (setq buffer-read-only nil)
6861 (setq buffer-read-only nil) 6883 (let ((org-startup-truncated t)
6862 (let ((org-startup-truncated t) 6884 (org-startup-folded nil)
6863 (org-startup-folded nil) 6885 (org-startup-align-all-tables nil))
6864 (org-startup-align-all-tables nil)) 6886 (org-mode)
6865 (org-mode) 6887 (org-overview))
6866 (org-overview)) 6888 (setq buffer-read-only t)
6867 (setq buffer-read-only t) 6889 (if (and (boundp 'org-goto-start-pos)
6868 (if (and (boundp 'org-goto-start-pos) 6890 (integer-or-marker-p org-goto-start-pos))
6869 (integer-or-marker-p org-goto-start-pos)) 6891 (let ((org-show-hierarchy-above t)
6870 (let ((org-show-hierarchy-above t) 6892 (org-show-siblings t)
6871 (org-show-siblings t) 6893 (org-show-following-heading t))
6872 (org-show-following-heading t)) 6894 (goto-char org-goto-start-pos)
6873 (goto-char org-goto-start-pos) 6895 (and (outline-invisible-p) (org-show-context)))
6874 (and (outline-invisible-p) (org-show-context))) 6896 (goto-char (point-min)))
6875 (goto-char (point-min))) 6897 (let (org-special-ctrl-a/e) (org-beginning-of-line))
6876 (let (org-special-ctrl-a/e) (org-beginning-of-line)) 6898 (message "Select location and press RET")
6877 (message "Select location and press RET") 6899 (use-local-map org-goto-map)
6878 (use-local-map org-goto-map) 6900 (recursive-edit)))
6879 (recursive-edit) 6901 (kill-buffer "*org-goto*")
6880 )) 6902 (cons org-goto-selected-point org-goto-exit-command))))
6881 (kill-buffer "*org-goto*")
6882 (cons org-goto-selected-point org-goto-exit-command)))
6883 6903
6884(defvar org-goto-local-auto-isearch-map (make-sparse-keymap)) 6904(defvar org-goto-local-auto-isearch-map (make-sparse-keymap))
6885(set-keymap-parent org-goto-local-auto-isearch-map isearch-mode-map) 6905(set-keymap-parent org-goto-local-auto-isearch-map isearch-mode-map)
@@ -7672,7 +7692,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
7672 (if (org-called-interactively-p 'any) 7692 (if (org-called-interactively-p 'any)
7673 (org-back-to-heading nil) ; take what looks like a subtree 7693 (org-back-to-heading nil) ; take what looks like a subtree
7674 (org-back-to-heading t)) ; take what is really there 7694 (org-back-to-heading t)) ; take what is really there
7675 (org-back-over-empty-lines)
7676 (setq beg (point)) 7695 (setq beg (point))
7677 (skip-chars-forward " \t\r\n") 7696 (skip-chars-forward " \t\r\n")
7678 (save-match-data 7697 (save-match-data
@@ -7682,7 +7701,6 @@ useful if the caller implements cut-and-paste as copy-then-paste-then-cut."
7682 (org-forward-heading-same-level (1- n) t) 7701 (org-forward-heading-same-level (1- n) t)
7683 (error nil)) 7702 (error nil))
7684 (org-end-of-subtree t t)) 7703 (org-end-of-subtree t t))
7685 (org-back-over-empty-lines)
7686 (setq end (point)) 7704 (setq end (point))
7687 (goto-char beg0) 7705 (goto-char beg0)
7688 (when (> end beg) 7706 (when (> end beg)
@@ -7773,7 +7791,6 @@ the inserted text when done."
7773 (delete-region (point-at-bol) (point))) 7791 (delete-region (point-at-bol) (point)))
7774 ;; Paste 7792 ;; Paste
7775 (beginning-of-line (if (bolp) 1 2)) 7793 (beginning-of-line (if (bolp) 1 2))
7776 (unless for-yank (org-back-over-empty-lines))
7777 (setq beg (point)) 7794 (setq beg (point))
7778 (and (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt)) 7795 (and (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt))
7779 (insert-before-markers txt) 7796 (insert-before-markers txt)
@@ -8630,6 +8647,24 @@ call CMD."
8630 (put-text-property beg end 'org-category-position beg) 8647 (put-text-property beg end 'org-category-position beg)
8631 (goto-char pos))))))) 8648 (goto-char pos)))))))
8632 8649
8650(defun org-refresh-properties (dprop tprop)
8651 "Refresh buffer text properties.
8652DPROP is the drawer property and TPROP is the corresponding text
8653property to set."
8654 (let ((case-fold-search t)
8655 (inhibit-read-only t) p)
8656 (org-unmodified
8657 (save-excursion
8658 (save-restriction
8659 (widen)
8660 (goto-char (point-min))
8661 (while (re-search-forward (concat "^[ \t]*:" dprop ": +\\(.*\\)[ \t]*$") nil t)
8662 (setq p (org-match-string-no-properties 1))
8663 (save-excursion
8664 (org-back-to-heading t)
8665 (put-text-property
8666 (point-at-bol) (point-at-eol) tprop p))))))))
8667
8633 8668
8634;;;; Link Stuff 8669;;;; Link Stuff
8635 8670
@@ -8723,7 +8758,7 @@ type. For a simple example of an export function, see `org-bbdb.el'."
8723 (push (list type follow export) org-link-protocols))) 8758 (push (list type follow export) org-link-protocols)))
8724 8759
8725(defvar org-agenda-buffer-name) ; Defined in org-agenda.el 8760(defvar org-agenda-buffer-name) ; Defined in org-agenda.el
8726(defvar org-link-to-org-use-id) ; Defined in org-id.el 8761(defvar org-id-link-to-org-use-id) ; Defined in org-id.el
8727 8762
8728;;;###autoload 8763;;;###autoload
8729(defun org-store-link (arg) 8764(defun org-store-link (arg)
@@ -8839,13 +8874,13 @@ For file links, arg negates `org-context-in-file-links'."
8839 "::" (match-string 1)) 8874 "::" (match-string 1))
8840 link cpltxt)) 8875 link cpltxt))
8841 ((and (featurep 'org-id) 8876 ((and (featurep 'org-id)
8842 (or (eq org-link-to-org-use-id t) 8877 (or (eq org-id-link-to-org-use-id t)
8843 (and (org-called-interactively-p 'any) 8878 (and (org-called-interactively-p 'any)
8844 (or (eq org-link-to-org-use-id 'create-if-interactive) 8879 (or (eq org-id-link-to-org-use-id 'create-if-interactive)
8845 (and (eq org-link-to-org-use-id 8880 (and (eq org-id-link-to-org-use-id
8846 'create-if-interactive-and-no-custom-id) 8881 'create-if-interactive-and-no-custom-id)
8847 (not custom-id)))) 8882 (not custom-id))))
8848 (and org-link-to-org-use-id (org-entry-get nil "ID")))) 8883 (and org-id-link-to-org-use-id (org-entry-get nil "ID"))))
8849 ;; We can make a link using the ID. 8884 ;; We can make a link using the ID.
8850 (setq link (condition-case nil 8885 (setq link (condition-case nil
8851 (prog1 (org-id-store-link) 8886 (prog1 (org-id-store-link)
@@ -9318,10 +9353,11 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
9318 ;; URL-like link, normalize the use of angular brackets. 9353 ;; URL-like link, normalize the use of angular brackets.
9319 (setq link (org-remove-angle-brackets link))) 9354 (setq link (org-remove-angle-brackets link)))
9320 9355
9321 ;; Check if we are linking to the current file with a search option 9356 ;; Check if we are linking to the current file with a search
9322 ;; If yes, simplify the link by using only the search option. 9357 ;; option If yes, simplify the link by using only the search
9358 ;; option.
9323 (when (and buffer-file-name 9359 (when (and buffer-file-name
9324 (string-match "^file:\\(.+?\\)::\\([^>]+\\)" link)) 9360 (string-match "^file:\\(.+?\\)::\\(.+\\)" link))
9325 (let* ((path (match-string 1 link)) 9361 (let* ((path (match-string 1 link))
9326 (case-fold-search nil) 9362 (case-fold-search nil)
9327 (search (match-string 2 link))) 9363 (search (match-string 2 link)))
@@ -9652,7 +9688,15 @@ application the system uses for this file type."
9652 org-angle-link-re "\\|" 9688 org-angle-link-re "\\|"
9653 "[ \t]:[^ \t\n]+:[ \t]*$"))) 9689 "[ \t]:[^ \t\n]+:[ \t]*$")))
9654 (not (get-text-property (point) 'org-linked-text))) 9690 (not (get-text-property (point) 'org-linked-text)))
9655 (or (org-offer-links-in-entry arg) 9691 (or (let* ((lkall (org-offer-links-in-entry (current-buffer) (point) arg))
9692 (lk0 (car lkall))
9693 (lk (if (stringp lk0) (list lk0) lk0))
9694 (lkend (cdr lkall)))
9695 (mapcar (lambda(l)
9696 (search-forward l nil lkend)
9697 (goto-char (match-beginning 0))
9698 (org-open-at-point))
9699 lk))
9656 (progn (require 'org-attach) (org-attach-reveal 'if-exists)))) 9700 (progn (require 'org-attach) (org-attach-reveal 'if-exists))))
9657 ((run-hook-with-args-until-success 'org-open-at-point-functions)) 9701 ((run-hook-with-args-until-success 'org-open-at-point-functions))
9658 ((and (org-at-timestamp-p t) 9702 ((and (org-at-timestamp-p t)
@@ -9695,12 +9739,13 @@ application the system uses for this file type."
9695 (throw 'match t)) 9739 (throw 'match t))
9696 9740
9697 (save-excursion 9741 (save-excursion
9698 (when (or (org-in-regexp org-angle-link-re) 9742 (let ((plinkpos (org-in-regexp org-plain-link-re)))
9699 (and (goto-char (car (org-in-regexp org-plain-link-re))) 9743 (when (or (org-in-regexp org-angle-link-re)
9700 (save-match-data (not (looking-back "\\[\\["))))) 9744 (and plinkpos (goto-char (car plinkpos))
9701 (setq type (match-string 1) 9745 (save-match-data (not (looking-back "\\[\\[")))))
9702 path (org-link-unescape (match-string 2))) 9746 (setq type (match-string 1)
9703 (throw 'match t))) 9747 path (org-link-unescape (match-string 2)))
9748 (throw 'match t))))
9704 (save-excursion 9749 (save-excursion
9705 (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ \t]*$")) 9750 (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ \t]*$"))
9706 (setq type "tags" 9751 (setq type "tags"
@@ -9713,7 +9758,7 @@ application the system uses for this file type."
9713 path (match-string 1)) 9758 path (match-string 1))
9714 (throw 'match t))) 9759 (throw 'match t)))
9715 (unless path 9760 (unless path
9716 (error "No link found")) 9761 (user-error "No link found"))
9717 9762
9718 ;; switch back to reference buffer 9763 ;; switch back to reference buffer
9719 ;; needed when if called in a temporary buffer through 9764 ;; needed when if called in a temporary buffer through
@@ -9847,68 +9892,67 @@ application the system uses for this file type."
9847 (move-marker org-open-link-marker nil) 9892 (move-marker org-open-link-marker nil)
9848 (run-hook-with-args 'org-follow-link-hook))) 9893 (run-hook-with-args 'org-follow-link-hook)))
9849 9894
9850(defun org-offer-links-in-entry (&optional nth zero) 9895(defun org-offer-links-in-entry (buffer marker &optional nth zero)
9851 "Offer links in the current entry and follow the selected link. 9896 "Offer links in the current entry and return the selected link.
9852If there is only one link, follow it immediately as well. 9897If there is only one link, return it.
9853If NTH is an integer, immediately pick the NTH link found. 9898If NTH is an integer, return the NTH link found.
9854If ZERO is a string, check also this string for a link, and if 9899If ZERO is a string, check also this string for a link, and if
9855there is one, offer it as link number zero." 9900there is one, return it."
9856 (let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|" 9901 (with-current-buffer buffer
9857 "\\(" org-angle-link-re "\\)\\|"
9858 "\\(" org-plain-link-re "\\)"))
9859 (cnt ?0)
9860 (in-emacs (if (integerp nth) nil nth))
9861 have-zero end links link c)
9862 (when (and (stringp zero) (string-match org-bracket-link-regexp zero))
9863 (push (match-string 0 zero) links)
9864 (setq cnt (1- cnt) have-zero t))
9865 (save-excursion 9902 (save-excursion
9866 (org-back-to-heading t) 9903 (save-restriction
9867 (setq end (save-excursion (outline-next-heading) (point))) 9904 (widen)
9868 (while (re-search-forward re end t) 9905 (goto-char marker)
9869 (push (match-string 0) links)) 9906 (let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|"
9870 (setq links (org-uniquify (reverse links)))) 9907 "\\(" org-angle-link-re "\\)\\|"
9871 9908 "\\(" org-plain-link-re "\\)"))
9872 (cond 9909 (cnt ?0)
9873 ((null links) 9910 (in-emacs (if (integerp nth) nil nth))
9874 (message "No links")) 9911 have-zero end links link c)
9875 ((equal (length links) 1) 9912 (when (and (stringp zero) (string-match org-bracket-link-regexp zero))
9876 (setq link (list (car links)))) 9913 (push (match-string 0 zero) links)
9877 ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) 9914 (setq cnt (1- cnt) have-zero t))
9878 (setq link (list (nth (if have-zero nth (1- nth)) links)))) 9915 (save-excursion
9879 (t ; we have to select a link 9916 (org-back-to-heading t)
9880 (save-excursion 9917 (setq end (save-excursion (outline-next-heading) (point)))
9881 (save-window-excursion 9918 (while (re-search-forward re end t)
9882 (delete-other-windows) 9919 (push (match-string 0) links))
9883 (with-output-to-temp-buffer "*Select Link*" 9920 (setq links (org-uniquify (reverse links))))
9884 (mapc (lambda (l) 9921 (cond
9885 (if (not (string-match org-bracket-link-regexp l)) 9922 ((null links)
9886 (princ (format "[%c] %s\n" (incf cnt) 9923 (message "No links"))
9887 (org-remove-angle-brackets l))) 9924 ((equal (length links) 1)
9888 (if (match-end 3) 9925 (setq link (car links)))
9889 (princ (format "[%c] %s (%s)\n" (incf cnt) 9926 ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth)))
9890 (match-string 3 l) (match-string 1 l))) 9927 (setq link (nth (if have-zero nth (1- nth)) links)))
9891 (princ (format "[%c] %s\n" (incf cnt) 9928 (t ; we have to select a link
9892 (match-string 1 l)))))) 9929 (save-excursion
9893 links)) 9930 (save-window-excursion
9894 (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) 9931 (delete-other-windows)
9895 (message "Select link to open, RET to open all:") 9932 (with-output-to-temp-buffer "*Select Link*"
9896 (setq c (read-char-exclusive)) 9933 (mapc (lambda (l)
9897 (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) 9934 (if (not (string-match org-bracket-link-regexp l))
9898 (when (equal c ?q) (error "Abort")) 9935 (princ (format "[%c] %s\n" (incf cnt)
9899 (if (equal c ?\C-m) 9936 (org-remove-angle-brackets l)))
9900 (setq link links) 9937 (if (match-end 3)
9901 (setq nth (- c ?0)) 9938 (princ (format "[%c] %s (%s)\n" (incf cnt)
9902 (if have-zero (setq nth (1+ nth))) 9939 (match-string 3 l) (match-string 1 l)))
9903 (unless (and (integerp nth) (>= (length links) nth)) 9940 (princ (format "[%c] %s\n" (incf cnt)
9904 (error "Invalid link selection")) 9941 (match-string 1 l))))))
9905 (setq link (list (nth (1- nth) links)))))) 9942 links))
9906 (if link 9943 (org-fit-window-to-buffer (get-buffer-window "*Select Link*"))
9907 (let ((buf (current-buffer))) 9944 (message "Select link to open, RET to open all:")
9908 (dolist (l link) 9945 (setq c (read-char-exclusive))
9909 (org-open-link-from-string l in-emacs buf)) 9946 (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*"))))
9910 t) 9947 (when (equal c ?q) (error "Abort"))
9911 nil))) 9948 (if (equal c ?\C-m)
9949 (setq link links)
9950 (setq nth (- c ?0))
9951 (if have-zero (setq nth (1+ nth)))
9952 (unless (and (integerp nth) (>= (length links) nth))
9953 (error "Invalid link selection"))
9954 (setq link (nth (1- nth) links)))))
9955 (cons link end))))))
9912 9956
9913;; Add special file links that specify the way of opening 9957;; Add special file links that specify the way of opening
9914 9958
@@ -9930,12 +9974,6 @@ there is one, offer it as link number zero."
9930 '(add-hook 'org-export-preprocess-before-normalizing-links-hook 9974 '(add-hook 'org-export-preprocess-before-normalizing-links-hook
9931 'org-remove-file-link-modifiers)) 9975 'org-remove-file-link-modifiers))
9932 9976
9933;;;; Time estimates
9934
9935(defun org-get-effort (&optional pom)
9936 "Get the effort estimate for the current entry."
9937 (org-entry-get pom org-effort-property))
9938
9939;;; File search 9977;;; File search
9940 9978
9941(defvar org-create-file-search-functions nil 9979(defvar org-create-file-search-functions nil
@@ -11259,8 +11297,7 @@ This function can be used in a hook."
11259 " +" t))) 11297 " +" t)))
11260 11298
11261(defcustom org-structure-template-alist 11299(defcustom org-structure-template-alist
11262 '( 11300 '(("s" "#+BEGIN_SRC ?\n\n#+END_SRC"
11263 ("s" "#+BEGIN_SRC ?\n\n#+END_SRC"
11264 "<src lang=\"?\">\n\n</src>") 11301 "<src lang=\"?\">\n\n</src>")
11265 ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE" 11302 ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE"
11266 "<example>\n?\n</example>") 11303 "<example>\n?\n</example>")
@@ -11268,6 +11305,8 @@ This function can be used in a hook."
11268 "<quote>\n?\n</quote>") 11305 "<quote>\n?\n</quote>")
11269 ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE" 11306 ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE"
11270 "<verse>\n?\n</verse>") 11307 "<verse>\n?\n</verse>")
11308 ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM"
11309 "<verbatim>\n?\n</verbatim>")
11271 ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER" 11310 ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER"
11272 "<center>\n?\n</center>") 11311 "<center>\n?\n</center>")
11273 ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX" 11312 ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX"
@@ -11283,8 +11322,7 @@ This function can be used in a hook."
11283 ("i" "#+INDEX: ?" 11322 ("i" "#+INDEX: ?"
11284 "#+INDEX: ?") 11323 "#+INDEX: ?")
11285 ("I" "#+INCLUDE: %file ?" 11324 ("I" "#+INCLUDE: %file ?"
11286 "<include file=%file markup=\"?\">") 11325 "<include file=%file markup=\"?\">"))
11287 )
11288 "Structure completion elements. 11326 "Structure completion elements.
11289This is a list of abbreviation keys and values. The value gets inserted 11327This is a list of abbreviation keys and values. The value gets inserted
11290if you type `<' followed by the key and then press the completion key, 11328if you type `<' followed by the key and then press the completion key,
@@ -11439,7 +11477,8 @@ For calling through lisp, arg is also interpreted in the following way:
11439 cl (if (outline-invisible-p) (org-end-of-subtree nil t)))) 11477 cl (if (outline-invisible-p) (org-end-of-subtree nil t))))
11440 (if (equal arg '(16)) (setq arg 'nextset)) 11478 (if (equal arg '(16)) (setq arg 'nextset))
11441 (let ((org-blocker-hook org-blocker-hook) 11479 (let ((org-blocker-hook org-blocker-hook)
11442 (case-fold-search nil)) 11480 commentp
11481 case-fold-search)
11443 (when (equal arg '(64)) 11482 (when (equal arg '(64))
11444 (setq arg nil org-blocker-hook nil)) 11483 (setq arg nil org-blocker-hook nil))
11445 (when (and org-blocker-hook 11484 (when (and org-blocker-hook
@@ -11449,6 +11488,9 @@ For calling through lisp, arg is also interpreted in the following way:
11449 (save-excursion 11488 (save-excursion
11450 (catch 'exit 11489 (catch 'exit
11451 (org-back-to-heading t) 11490 (org-back-to-heading t)
11491 (when (looking-at (concat "^\\*+ " org-comment-string))
11492 (org-toggle-comment)
11493 (setq commentp t))
11452 (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0)))) 11494 (if (looking-at org-outline-regexp) (goto-char (1- (match-end 0))))
11453 (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)")) 11495 (or (looking-at (concat " +" org-todo-regexp "\\( +\\|[ \t]*$\\)"))
11454 (looking-at "\\(?: *\\|[ \t]*$\\)")) 11496 (looking-at "\\(?: *\\|[ \t]*$\\)"))
@@ -11624,7 +11666,8 @@ For calling through lisp, arg is also interpreted in the following way:
11624 (and (looking-at " ") (just-one-space)))) 11666 (and (looking-at " ") (just-one-space))))
11625 (when org-trigger-hook 11667 (when org-trigger-hook
11626 (save-excursion 11668 (save-excursion
11627 (run-hook-with-args 'org-trigger-hook change-plist))))))))) 11669 (run-hook-with-args 'org-trigger-hook change-plist)))
11670 (when commentp (org-toggle-comment))))))))
11628 11671
11629(defun org-block-todo-from-children-or-siblings-or-parent (change-plist) 11672(defun org-block-todo-from-children-or-siblings-or-parent (change-plist)
11630 "Block turning an entry into a TODO, using the hierarchy. 11673 "Block turning an entry into a TODO, using the hierarchy.
@@ -11765,15 +11808,16 @@ changes because there are unchecked boxes in this entry."
11765 11808
11766(defun org-entry-blocked-p () 11809(defun org-entry-blocked-p ()
11767 "Is the current entry blocked?" 11810 "Is the current entry blocked?"
11768 (if (org-entry-get nil "NOBLOCKING") 11811 (org-with-buffer-modified-unmodified
11769 nil ;; Never block this entry 11812 (if (org-entry-get nil "NOBLOCKING")
11770 (not 11813 nil ;; Never block this entry
11771 (run-hook-with-args-until-failure 11814 (not
11772 'org-blocker-hook 11815 (run-hook-with-args-until-failure
11773 (list :type 'todo-state-change 11816 'org-blocker-hook
11774 :position (point) 11817 (list :type 'todo-state-change
11775 :from 'todo 11818 :position (point)
11776 :to 'done))))) 11819 :from 'todo
11820 :to 'done))))))
11777 11821
11778(defun org-update-statistics-cookies (all) 11822(defun org-update-statistics-cookies (all)
11779 "Update the statistics cookie, either from TODO or from checkboxes. 11823 "Update the statistics cookie, either from TODO or from checkboxes.
@@ -11785,7 +11829,7 @@ This should be called with the cursor in a line with a statistics cookie."
11785 (org-map-entries 'org-update-parent-todo-statistics)) 11829 (org-map-entries 'org-update-parent-todo-statistics))
11786 (if (not (org-at-heading-p)) 11830 (if (not (org-at-heading-p))
11787 (org-update-checkbox-count) 11831 (org-update-checkbox-count)
11788 (let ((pos (move-marker (make-marker) (point))) 11832 (let ((pos (point-marker))
11789 end l1 l2) 11833 end l1 l2)
11790 (ignore-errors (org-back-to-heading t)) 11834 (ignore-errors (org-back-to-heading t))
11791 (if (not (org-at-heading-p)) 11835 (if (not (org-at-heading-p))
@@ -12666,7 +12710,7 @@ D Show deadlines and scheduled items between a date range."
12666 (let (ans kwd value ts-type) 12710 (let (ans kwd value ts-type)
12667 (setq type (or type org-sparse-tree-default-date-type)) 12711 (setq type (or type org-sparse-tree-default-date-type))
12668 (setq org-ts-type type) 12712 (setq org-ts-type type)
12669 (message "Sparse tree: [r]egexp [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date [D]ates range\n [c]ycle through date types: %s" 12713 (message "Sparse tree: [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date [D]ates range\n [c]ycle through date types: %s"
12670 (cond ((eq type 'all) "all timestamps") 12714 (cond ((eq type 'all) "all timestamps")
12671 ((eq type 'scheduled) "only scheduled") 12715 ((eq type 'scheduled) "only scheduled")
12672 ((eq type 'deadline) "only deadline") 12716 ((eq type 'deadline) "only deadline")
@@ -12981,9 +13025,9 @@ and by additional input from the age of a schedules or deadline entry."
12981 13025
12982(defun org-get-priority (s) 13026(defun org-get-priority (s)
12983 "Find priority cookie and return priority." 13027 "Find priority cookie and return priority."
12984 (if (functionp org-get-priority-function) 13028 (save-match-data
12985 (funcall org-get-priority-function) 13029 (if (functionp org-get-priority-function)
12986 (save-match-data 13030 (funcall org-get-priority-function)
12987 (if (not (string-match org-priority-regexp s)) 13031 (if (not (string-match org-priority-regexp s))
12988 (* 1000 (- org-lowest-priority org-default-priority)) 13032 (* 1000 (- org-lowest-priority org-default-priority))
12989 (* 1000 (- org-lowest-priority 13033 (* 1000 (- org-lowest-priority
@@ -13113,18 +13157,9 @@ headlines matching this string."
13113 (or (not todo-only) 13157 (or (not todo-only)
13114 (and (member todo org-not-done-keywords) 13158 (and (member todo org-not-done-keywords)
13115 (or (not org-agenda-tags-todo-honor-ignore-options) 13159 (or (not org-agenda-tags-todo-honor-ignore-options)
13116 (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item))))) 13160 (not (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item))))))
13117
13118 ;; Extra check for the archive tag
13119 ;; FIXME: Does the skipper already do this????
13120 (or
13121 (not (member org-archive-tag tags-list))
13122 ;; we have an archive tag, should we use this anyway?
13123 (or (not org-agenda-skip-archived-trees)
13124 (and (eq action 'agenda) org-agenda-archives-mode))))
13125 13161
13126 ;; select this headline 13162 ;; select this headline
13127
13128 (cond 13163 (cond
13129 ((eq action 'sparse-tree) 13164 ((eq action 'sparse-tree)
13130 (and org-highlight-sparse-tree-matches 13165 (and org-highlight-sparse-tree-matches
@@ -13496,7 +13531,10 @@ ignore inherited ones."
13496 (error nil))))) 13531 (error nil)))))
13497 (if local 13532 (if local
13498 tags 13533 tags
13499 (append (org-remove-uninherited-tags org-file-tags) tags)))))) 13534 (reverse (delete-dups
13535 (reverse (append
13536 (org-remove-uninherited-tags
13537 org-file-tags) tags)))))))))
13500 13538
13501(defun org-add-prop-inherited (s) 13539(defun org-add-prop-inherited (s)
13502 (add-text-properties 0 (length s) '(inherited t) s) 13540 (add-text-properties 0 (length s) '(inherited t) s)
@@ -14276,6 +14314,9 @@ When INCREMENT is non-nil, set the property to the next allowed value."
14276 existing nil nil "" nil cur)))))) 14314 existing nil nil "" nil cur))))))
14277 (unless (equal (org-entry-get nil prop) val) 14315 (unless (equal (org-entry-get nil prop) val)
14278 (org-entry-put nil prop val)) 14316 (org-entry-put nil prop val))
14317 (save-excursion
14318 (org-back-to-heading t)
14319 (put-text-property (point-at-bol) (point-at-eol) 'org-effort val))
14279 (message "%s is now %s" prop val))) 14320 (message "%s is now %s" prop val)))
14280 14321
14281(defun org-at-property-p () 14322(defun org-at-property-p ()
@@ -14454,26 +14495,27 @@ when a \"nil\" value can supersede a non-nil value higher up the hierarchy."
14454 ;; We need a special property. Use `org-entry-properties' to 14495 ;; We need a special property. Use `org-entry-properties' to
14455 ;; retrieve it, but specify the wanted property 14496 ;; retrieve it, but specify the wanted property
14456 (cdr (assoc property (org-entry-properties nil 'special property))) 14497 (cdr (assoc property (org-entry-properties nil 'special property)))
14457 (let* ((range (org-get-property-block)) 14498 (let ((range (org-get-property-block)))
14458 (props (list (or (assoc property org-file-properties) 14499 (when (and range (not (eq (car range) (cdr range))))
14459 (assoc property org-global-properties) 14500 (let* ((props (list (or (assoc property org-file-properties)
14460 (assoc property org-global-properties-fixed)))) 14501 (assoc property org-global-properties)
14461 (ap (lambda (key) 14502 (assoc property org-global-properties-fixed))))
14462 (when (re-search-forward 14503 (ap (lambda (key)
14463 (org-re-property key) (cdr range) t) 14504 (when (re-search-forward
14464 (setq props 14505 (org-re-property key) (cdr range) t)
14465 (org-update-property-plist 14506 (setq props
14466 key 14507 (org-update-property-plist
14467 (if (match-end 1) 14508 key
14468 (org-match-string-no-properties 1) "") 14509 (if (match-end 1)
14469 props))))) 14510 (org-match-string-no-properties 1) "")
14470 val) 14511 props)))))
14471 (when (and range (goto-char (car range))) 14512 val)
14472 (funcall ap property) 14513 (goto-char (car range))
14473 (goto-char (car range)) 14514 (funcall ap property)
14474 (while (funcall ap (concat property "+"))) 14515 (goto-char (car range))
14475 (setq val (cdr (assoc property props))) 14516 (while (funcall ap (concat property "+")))
14476 (when val (if literal-nil val (org-not-nil val))))))))) 14517 (setq val (cdr (assoc property props)))
14518 (when val (if literal-nil val (org-not-nil val))))))))))
14477 14519
14478(defun org-property-or-variable-value (var &optional inherit) 14520(defun org-property-or-variable-value (var &optional inherit)
14479 "Check if there is a property fixing the value of VAR. 14521 "Check if there is a property fixing the value of VAR.
@@ -14996,7 +15038,8 @@ completion."
14996 (interactive) 15038 (interactive)
14997 (unless (org-at-property-p) 15039 (unless (org-at-property-p)
14998 (error "Not at a property")) 15040 (error "Not at a property"))
14999 (let* ((key (match-string 2)) 15041 (let* ((prop (car (save-match-data (org-split-string (match-string 1) ":"))))
15042 (key (match-string 2))
15000 (value (match-string 3)) 15043 (value (match-string 3))
15001 (allowed (or (org-property-get-allowed-values (point) key) 15044 (allowed (or (org-property-get-allowed-values (point) key)
15002 (and (member value '("[ ]" "[-]" "[X]")) 15045 (and (member value '("[ ]" "[-]" "[X]"))
@@ -15015,6 +15058,10 @@ completion."
15015 (org-indent-line) 15058 (org-indent-line)
15016 (beginning-of-line 1) 15059 (beginning-of-line 1)
15017 (skip-chars-forward " \t") 15060 (skip-chars-forward " \t")
15061 (when (equal prop org-effort-property)
15062 (save-excursion
15063 (org-back-to-heading t)
15064 (put-text-property (point-at-bol) (point-at-eol) 'org-effort nval)))
15018 (run-hook-with-args 'org-property-changed-functions key nval))) 15065 (run-hook-with-args 'org-property-changed-functions key nval)))
15019 15066
15020(defun org-find-olp (path &optional this-buffer) 15067(defun org-find-olp (path &optional this-buffer)
@@ -15060,7 +15107,7 @@ only headings."
15060 (setq lmin (1+ flevel) lmax (+ lmin (if org-odd-levels-only 1 0))) 15107 (setq lmin (1+ flevel) lmax (+ lmin (if org-odd-levels-only 1 0)))
15061 (setq end (save-excursion (org-end-of-subtree t t)))) 15108 (setq end (save-excursion (org-end-of-subtree t t))))
15062 (when (org-at-heading-p) 15109 (when (org-at-heading-p)
15063 (move-marker (make-marker) (point)))))))) 15110 (point-marker)))))))
15064 15111
15065(defun org-find-exact-headline-in-buffer (heading &optional buffer pos-only) 15112(defun org-find-exact-headline-in-buffer (heading &optional buffer pos-only)
15066 "Find node HEADING in BUFFER. 15113 "Find node HEADING in BUFFER.
@@ -15307,6 +15354,7 @@ user."
15307 (setcar (nthcdr 1 org-defdecode) 59) 15354 (setcar (nthcdr 1 org-defdecode) 59)
15308 (setq org-def (apply 'encode-time org-defdecode) 15355 (setq org-def (apply 'encode-time org-defdecode)
15309 org-defdecode (decode-time org-def))))) 15356 org-defdecode (decode-time org-def)))))
15357 (mouse-autoselect-window nil) ; Don't let the mouse jump
15310 (calendar-frame-setup nil) 15358 (calendar-frame-setup nil)
15311 (calendar-setup nil) 15359 (calendar-setup nil)
15312 (calendar-move-hook nil) 15360 (calendar-move-hook nil)
@@ -16966,6 +17014,8 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
16966 (widen) 17014 (widen)
16967 (setq bmp (buffer-modified-p)) 17015 (setq bmp (buffer-modified-p))
16968 (org-refresh-category-properties) 17016 (org-refresh-category-properties)
17017 (org-refresh-properties org-effort-property 'org-effort)
17018 (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime)
16969 (setq org-todo-keywords-for-agenda 17019 (setq org-todo-keywords-for-agenda
16970 (append org-todo-keywords-for-agenda org-todo-keywords-1)) 17020 (append org-todo-keywords-for-agenda org-todo-keywords-1))
16971 (setq org-done-keywords-for-agenda 17021 (setq org-done-keywords-for-agenda
@@ -18053,7 +18103,7 @@ BEG and END default to the buffer boundaries."
18053 ("c" . org-cycle) 18103 ("c" . org-cycle)
18054 ("C" . org-shifttab) 18104 ("C" . org-shifttab)
18055 (" " . org-display-outline-path) 18105 (" " . org-display-outline-path)
18056 (":" . org-columns) 18106 ("=" . org-columns)
18057 ("Outline Structure Editing") 18107 ("Outline Structure Editing")
18058 ("U" . org-shiftmetaup) 18108 ("U" . org-shiftmetaup)
18059 ("D" . org-shiftmetadown) 18109 ("D" . org-shiftmetadown)
@@ -18078,7 +18128,7 @@ BEG and END default to the buffer boundaries."
18078 ("1" . (org-priority ?A)) 18128 ("1" . (org-priority ?A))
18079 ("2" . (org-priority ?B)) 18129 ("2" . (org-priority ?B))
18080 ("3" . (org-priority ?C)) 18130 ("3" . (org-priority ?C))
18081 (";" . org-set-tags-command) 18131 (":" . org-set-tags-command)
18082 ("e" . org-set-effort) 18132 ("e" . org-set-effort)
18083 ("E" . org-inc-effort) 18133 ("E" . org-inc-effort)
18084 ("W" . (lambda(m) (interactive "sMinutes before warning: ") 18134 ("W" . (lambda(m) (interactive "sMinutes before warning: ")
@@ -18296,25 +18346,26 @@ front of the next \"|\" separator, to keep the table aligned. The table will
18296still be marked for re-alignment if the field did fill the entire column, 18346still be marked for re-alignment if the field did fill the entire column,
18297because, in this case the deletion might narrow the column." 18347because, in this case the deletion might narrow the column."
18298 (interactive "p") 18348 (interactive "p")
18299 (org-check-before-invisible-edit 'delete-backward) 18349 (save-match-data
18300 (if (and (org-table-p) 18350 (org-check-before-invisible-edit 'delete-backward)
18301 (eq N 1) 18351 (if (and (org-table-p)
18302 (string-match "|" (buffer-substring (point-at-bol) (point))) 18352 (eq N 1)
18303 (looking-at ".*?|")) 18353 (string-match "|" (buffer-substring (point-at-bol) (point)))
18304 (let ((pos (point)) 18354 (looking-at ".*?|"))
18305 (noalign (looking-at "[^|\n\r]* |")) 18355 (let ((pos (point))
18306 (c org-table-may-need-update)) 18356 (noalign (looking-at "[^|\n\r]* |"))
18307 (backward-delete-char N) 18357 (c org-table-may-need-update))
18308 (if (not overwrite-mode) 18358 (backward-delete-char N)
18309 (progn 18359 (if (not overwrite-mode)
18310 (skip-chars-forward "^|") 18360 (progn
18311 (insert " ") 18361 (skip-chars-forward "^|")
18312 (goto-char (1- pos)))) 18362 (insert " ")
18313 ;; noalign: if there were two spaces at the end, this field 18363 (goto-char (1- pos))))
18314 ;; does not determine the width of the column. 18364 ;; noalign: if there were two spaces at the end, this field
18315 (if noalign (setq org-table-may-need-update c))) 18365 ;; does not determine the width of the column.
18316 (backward-delete-char N) 18366 (if noalign (setq org-table-may-need-update c)))
18317 (org-fix-tags-on-the-fly))) 18367 (backward-delete-char N)
18368 (org-fix-tags-on-the-fly))))
18318 18369
18319(defun org-delete-char (N) 18370(defun org-delete-char (N)
18320 "Like `delete-char', but insert whitespace at field end in tables. 18371 "Like `delete-char', but insert whitespace at field end in tables.
@@ -18323,25 +18374,26 @@ front of the next \"|\" separator, to keep the table aligned. The table will
18323still be marked for re-alignment if the field did fill the entire column, 18374still be marked for re-alignment if the field did fill the entire column,
18324because, in this case the deletion might narrow the column." 18375because, in this case the deletion might narrow the column."
18325 (interactive "p") 18376 (interactive "p")
18326 (org-check-before-invisible-edit 'delete) 18377 (save-match-data
18327 (if (and (org-table-p) 18378 (org-check-before-invisible-edit 'delete)
18328 (not (bolp)) 18379 (if (and (org-table-p)
18329 (not (= (char-after) ?|)) 18380 (not (bolp))
18330 (eq N 1)) 18381 (not (= (char-after) ?|))
18331 (if (looking-at ".*?|") 18382 (eq N 1))
18332 (let ((pos (point)) 18383 (if (looking-at ".*?|")
18333 (noalign (looking-at "[^|\n\r]* |")) 18384 (let ((pos (point))
18334 (c org-table-may-need-update)) 18385 (noalign (looking-at "[^|\n\r]* |"))
18335 (replace-match (concat 18386 (c org-table-may-need-update))
18336 (substring (match-string 0) 1 -1) 18387 (replace-match (concat
18337 " |")) 18388 (substring (match-string 0) 1 -1)
18338 (goto-char pos) 18389 " |"))
18339 ;; noalign: if there were two spaces at the end, this field 18390 (goto-char pos)
18340 ;; does not determine the width of the column. 18391 ;; noalign: if there were two spaces at the end, this field
18341 (if noalign (setq org-table-may-need-update c))) 18392 ;; does not determine the width of the column.
18342 (delete-char N)) 18393 (if noalign (setq org-table-may-need-update c)))
18343 (delete-char N) 18394 (delete-char N))
18344 (org-fix-tags-on-the-fly))) 18395 (delete-char N)
18396 (org-fix-tags-on-the-fly))))
18345 18397
18346;; Make `delete-selection-mode' work with org-mode and orgtbl-mode 18398;; Make `delete-selection-mode' work with org-mode and orgtbl-mode
18347(put 'org-self-insert-command 'delete-selection t) 18399(put 'org-self-insert-command 'delete-selection t)
@@ -18956,15 +19008,22 @@ See the individual commands for more information."
18956 (org-table-paste-rectangle) 19008 (org-table-paste-rectangle)
18957 (org-paste-subtree arg))) 19009 (org-paste-subtree arg)))
18958 19010
19011(defsubst org-in-fixed-width-region-p ()
19012 "Is point in a fixed-width region?"
19013 (save-match-data
19014 (eq 'fixed-width (org-element-type (org-element-at-point)))))
19015
18959(defun org-edit-special (&optional arg) 19016(defun org-edit-special (&optional arg)
18960 "Call a special editor for the stuff at point. 19017 "Call a special editor for the stuff at point.
18961When at a table, call the formula editor with `org-table-edit-formulas'. 19018When at a table, call the formula editor with `org-table-edit-formulas'.
18962When at the first line of an src example, call `org-edit-src-code'. 19019When in a source code block, call `org-edit-src-code'.
18963When in an #+include line, visit the include file. Otherwise call 19020When in a fixed-width region, call `org-edit-fixed-width-region'.
18964`ffap' to visit the file at point." 19021When in an #+include line, visit the included file.
19022On a link, call `ffap' to visit the link at point.
19023Otherwise, return a user error."
18965 (interactive) 19024 (interactive)
18966 ;; possibly prep session before editing source 19025 ;; possibly prep session before editing source
18967 (when arg 19026 (when (and (org-in-src-block-p) arg)
18968 (let* ((info (org-babel-get-src-block-info)) 19027 (let* ((info (org-babel-get-src-block-info))
18969 (lang (nth 0 info)) 19028 (lang (nth 0 info))
18970 (params (nth 2 info)) 19029 (params (nth 2 info))
@@ -18977,16 +19036,16 @@ When in an #+include line, visit the include file. Otherwise call
18977 (beginning-of-line 1) 19036 (beginning-of-line 1)
18978 (looking-at "\\(?:#\\+\\(?:setupfile\\|include\\):?[ \t]+\"?\\|[ \t]*<include\\>.*?file=\"\\)\\([^\"\n>]+\\)")) 19037 (looking-at "\\(?:#\\+\\(?:setupfile\\|include\\):?[ \t]+\"?\\|[ \t]*<include\\>.*?file=\"\\)\\([^\"\n>]+\\)"))
18979 (find-file (org-trim (match-string 1)))) 19038 (find-file (org-trim (match-string 1))))
18980 ((org-edit-src-code)) 19039 ((org-at-table.el-p) (org-edit-src-code))
18981 ((org-edit-fixed-width-region))
18982 ((org-at-table.el-p)
18983 (org-edit-src-code))
18984 ((or (org-at-table-p) 19040 ((or (org-at-table-p)
18985 (save-excursion 19041 (save-excursion
18986 (beginning-of-line 1) 19042 (beginning-of-line 1)
18987 (let ((case-fold-search )) (looking-at "[ \t]*#\\+tblfm:")))) 19043 (let ((case-fold-search )) (looking-at "[ \t]*#\\+tblfm:"))))
18988 (call-interactively 'org-table-edit-formulas)) 19044 (call-interactively 'org-table-edit-formulas))
18989 (t (call-interactively 'ffap)))) 19045 ((org-in-block-p '("src" "example" "latex" "html")) (org-edit-src-code))
19046 ((org-in-fixed-width-region-p) (org-edit-fixed-width-region))
19047 ((org-at-regexp-p org-any-link-re) (call-interactively 'ffap))
19048 (t (user-error "No special environment to edit here"))))
18990 19049
18991(defvar org-table-coordinate-overlays) ; defined in org-table.el 19050(defvar org-table-coordinate-overlays) ; defined in org-table.el
18992(defun org-ctrl-c-ctrl-c (&optional arg) 19051(defun org-ctrl-c-ctrl-c (&optional arg)
@@ -19103,8 +19162,10 @@ This command does many different things, depending on context:
19103 (org-list-struct-fix-ind struct parents) 19162 (org-list-struct-fix-ind struct parents)
19104 (setq block-item 19163 (setq block-item
19105 (org-list-struct-fix-box struct parents prevs orderedp))) 19164 (org-list-struct-fix-box struct parents prevs orderedp)))
19106 (org-list-struct-apply-struct struct old-struct) 19165 (if (equal struct old-struct)
19107 (org-update-checkbox-count-maybe) 19166 (user-error "Cannot toggle this checkbox (unchecked subitems?)")
19167 (org-list-struct-apply-struct struct old-struct)
19168 (org-update-checkbox-count-maybe))
19108 (when block-item 19169 (when block-item
19109 (message 19170 (message
19110 "Checkboxes were removed due to unchecked box at line %d" 19171 "Checkboxes were removed due to unchecked box at line %d"
@@ -20238,13 +20299,19 @@ and end of string."
20238 "Is S an ID created by UUIDGEN?" 20299 "Is S an ID created by UUIDGEN?"
20239 (string-match "\\`[0-9a-f]\\{8\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{12\\}\\'" (downcase s))) 20300 (string-match "\\`[0-9a-f]\\{8\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{4\\}-[0-9a-f]\\{12\\}\\'" (downcase s)))
20240 20301
20241(defun org-in-src-block-p nil 20302(defun org-in-src-block-p (&optional inside)
20242 "Whether point is in a code source block." 20303 "Whether point is in a code source block.
20243 (let (ov) 20304When INSIDE is non-nil, don't consider we are within a src block
20244 (when (setq ov (overlays-at (point))) 20305when point is at #+BEGIN_SRC or #+END_SRC."
20245 (memq 'org-block-background 20306 (let ((case-fold-search t) ov)
20246 (overlay-properties 20307 (or (and (setq ov (overlays-at (point)))
20247 (car ov)))))) 20308 (memq 'org-block-background
20309 (overlay-properties (car ov))))
20310 (and (not inside)
20311 (save-match-data
20312 (save-excursion
20313 (beginning-of-line)
20314 (looking-at ".*#\\+\\(begin\\|end\\)_src")))))))
20248 20315
20249(defun org-context () 20316(defun org-context ()
20250 "Return a list of contexts of the current cursor position. 20317 "Return a list of contexts of the current cursor position.
@@ -20587,9 +20654,8 @@ return nil."
20587 "Switch to buffer in a second window on the current frame. 20654 "Switch to buffer in a second window on the current frame.
20588In particular, do not allow pop-up frames. 20655In particular, do not allow pop-up frames.
20589Returns the newly created buffer." 20656Returns the newly created buffer."
20590 (let (pop-up-frames special-display-buffer-names special-display-regexps 20657 (org-no-popups
20591 special-display-function) 20658 (apply 'switch-to-buffer-other-window args)))
20592 (apply 'switch-to-buffer-other-window args)))
20593 20659
20594(defun org-combine-plists (&rest plists) 20660(defun org-combine-plists (&rest plists)
20595 "Create a single property list from all plists in PLISTS. 20661 "Create a single property list from all plists in PLISTS.
@@ -20768,6 +20834,7 @@ hierarchy of headlines by UP levels before marking the subtree."
20768 (t 20834 (t
20769 (beginning-of-line 0) 20835 (beginning-of-line 0)
20770 (while (and (not (bobp)) 20836 (while (and (not (bobp))
20837 (not (looking-at org-table-line-regexp))
20771 (not (looking-at org-drawer-regexp)) 20838 (not (looking-at org-drawer-regexp))
20772 ;; When point started in an inline task, do not move 20839 ;; When point started in an inline task, do not move
20773 ;; above task starting line. 20840 ;; above task starting line.
@@ -20898,6 +20965,7 @@ hierarchy of headlines by UP levels before marking the subtree."
20898 '(org-fill-paragraph-separate-nobreak-p 20965 '(org-fill-paragraph-separate-nobreak-p
20899 org-fill-line-break-nobreak-p))))) 20966 org-fill-line-break-nobreak-p)))))
20900 (org-set-local 'fill-paragraph-function 'org-fill-paragraph) 20967 (org-set-local 'fill-paragraph-function 'org-fill-paragraph)
20968 (org-set-local 'auto-fill-inhibit-regexp nil)
20901 (org-set-local 'adaptive-fill-function 'org-adaptive-fill-function) 20969 (org-set-local 'adaptive-fill-function 'org-adaptive-fill-function)
20902 (org-set-local 'normal-auto-fill-function 'org-auto-fill-function) 20970 (org-set-local 'normal-auto-fill-function 'org-auto-fill-function)
20903 (org-set-local 'comment-line-break-function 'org-comment-line-break-function)) 20971 (org-set-local 'comment-line-break-function 'org-comment-line-break-function))
@@ -20920,48 +20988,54 @@ hierarchy of headlines by UP levels before marking the subtree."
20920 "Compute a fill prefix for the current line. 20988 "Compute a fill prefix for the current line.
20921Return fill prefix, as a string, or nil if current line isn't 20989Return fill prefix, as a string, or nil if current line isn't
20922meant to be filled." 20990meant to be filled."
20923 (org-with-wide-buffer 20991 (let (prefix)
20924 (unless (and (derived-mode-p 'message-mode) (not (message-in-body-p))) 20992 (when (and (derived-mode-p 'message-mode) (message-in-body-p))
20925 ;; FIXME: This is really the job of orgstruct++-mode 20993 (save-excursion
20926 (let* ((p (line-beginning-position)) 20994 (beginning-of-line)
20927 (element (save-excursion (beginning-of-line) 20995 (cond ((looking-at message-cite-prefix-regexp)
20928 (org-element-at-point))) 20996 (setq prefix (match-string-no-properties 0)))
20929 (type (org-element-type element)) 20997 ((looking-at org-outline-regexp)
20930 (post-affiliated 20998 (setq prefix "")))))
20931 (save-excursion 20999 (or prefix
20932 (goto-char (org-element-property :begin element)) 21000 (org-with-wide-buffer
20933 (while (looking-at org-element--affiliated-re) (forward-line)) 21001 (let* ((p (line-beginning-position))
20934 (point)))) 21002 (element (save-excursion (beginning-of-line) (org-element-at-point)))
20935 (unless (< p post-affiliated) 21003 (type (org-element-type element))
20936 (case type 21004 (post-affiliated
20937 (comment (looking-at "[ \t]*# ?") (match-string 0)) 21005 (save-excursion
20938 (footnote-definition "") 21006 (goto-char (org-element-property :begin element))
20939 ((item plain-list) 21007 (while (looking-at org-element--affiliated-re) (forward-line))
20940 (make-string (org-list-item-body-column post-affiliated) ? )) 21008 (point))))
20941 (paragraph 21009 (unless (< p post-affiliated)
20942 ;; Fill prefix is usually the same as the current line, 21010 (case type
20943 ;; except if the paragraph is at the beginning of an item. 21011 (comment (looking-at "[ \t]*# ?") (match-string 0))
20944 (let ((parent (org-element-property :parent element))) 21012 (footnote-definition "")
20945 (cond ((eq (org-element-type parent) 'item) 21013 ((item plain-list)
20946 (make-string (org-list-item-body-column 21014 (make-string (org-list-item-body-column post-affiliated) ? ))
20947 (org-element-property :begin parent)) 21015 (paragraph
20948 ? )) 21016 ;; Fill prefix is usually the same as the current line,
20949 ((save-excursion (beginning-of-line) (looking-at "[ \t]+")) 21017 ;; except if the paragraph is at the beginning of an item.
20950 (match-string 0)) 21018 (let ((parent (org-element-property :parent element)))
20951 (t "")))) 21019 (cond ((eq (org-element-type parent) 'item)
20952 (comment-block 21020 (make-string (org-list-item-body-column
20953 ;; Only fill contents if P is within block boundaries. 21021 (org-element-property :begin parent))
20954 (let* ((cbeg (save-excursion (goto-char post-affiliated) 21022 ? ))
20955 (forward-line) 21023 ((save-excursion (beginning-of-line) (looking-at "[ \t]+"))
20956 (point))) 21024 (match-string 0))
20957 (cend (save-excursion 21025 (t ""))))
20958 (goto-char (org-element-property :end element)) 21026 (comment-block
20959 (skip-chars-backward " \r\t\n") 21027 ;; Only fill contents if P is within block boundaries.
20960 (line-beginning-position)))) 21028 (let* ((cbeg (save-excursion (goto-char post-affiliated)
20961 (when (and (>= p cbeg) (< p cend)) 21029 (forward-line)
20962 (if (save-excursion (beginning-of-line) (looking-at "[ \t]+")) 21030 (point)))
20963 (match-string 0) 21031 (cend (save-excursion
20964 "")))))))))) 21032 (goto-char (org-element-property :end element))
21033 (skip-chars-backward " \r\t\n")
21034 (line-beginning-position))))
21035 (when (and (>= p cbeg) (< p cend))
21036 (if (save-excursion (beginning-of-line) (looking-at "[ \t]+"))
21037 (match-string 0)
21038 "")))))))))))
20965 21039
20966(declare-function message-goto-body "message" ()) 21040(declare-function message-goto-body "message" ())
20967(defvar message-cite-prefix-regexp) ; From message.el 21041(defvar message-cite-prefix-regexp) ; From message.el
@@ -20981,12 +21055,12 @@ width for filling.
20981 21055
20982For convenience, when point is at a plain list, an item or 21056For convenience, when point is at a plain list, an item or
20983a footnote definition, try to fill the first paragraph within." 21057a footnote definition, try to fill the first paragraph within."
20984 ;; Falls back on message-fill-paragraph when necessary
20985 (interactive) 21058 (interactive)
20986 (if (and (derived-mode-p 'message-mode) 21059 (if (and (derived-mode-p 'message-mode)
20987 (or (not (message-in-body-p)) 21060 (or (not (message-in-body-p))
20988 (save-excursion (move-beginning-of-line 1) 21061 (save-excursion (move-beginning-of-line 1)
20989 (looking-at message-cite-prefix-regexp)))) 21062 (looking-at message-cite-prefix-regexp))))
21063 ;; First ensure filling is correct in message-mode.
20990 (let ((fill-paragraph-function 21064 (let ((fill-paragraph-function
20991 (cadadr (assoc 'fill-paragraph-function org-fb-vars))) 21065 (cadadr (assoc 'fill-paragraph-function org-fb-vars)))
20992 (fill-prefix (cadadr (assoc 'fill-prefix org-fb-vars))) 21066 (fill-prefix (cadadr (assoc 'fill-prefix org-fb-vars)))
@@ -21003,6 +21077,8 @@ a footnote definition, try to fill the first paragraph within."
21003 ;; the buffer. In that case, ignore filling. 21077 ;; the buffer. In that case, ignore filling.
21004 (if (< (point) (org-element-property :begin element)) t 21078 (if (< (point) (org-element-property :begin element)) t
21005 (case (org-element-type element) 21079 (case (org-element-type element)
21080 ;; Use major mode filling function is src blocks.
21081 (src-block (org-babel-do-key-sequence-in-edit-buffer (kbd "M-q")))
21006 ;; Align Org tables, leave table.el tables as-is. 21082 ;; Align Org tables, leave table.el tables as-is.
21007 (table-row (org-table-align) t) 21083 (table-row (org-table-align) t)
21008 (table 21084 (table
diff --git a/lisp/printing.el b/lisp/printing.el
index a8eed066a15..bf50aa8f679 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -1800,7 +1800,7 @@ The alist element has the form:
1800Where: 1800Where:
1801 1801
1802SYMBOL It's a symbol to identify a text printer. It's for 1802SYMBOL It's a symbol to identify a text printer. It's for
1803 `pr-txt-name' variable setting and for menu selection. 1803 setting option `pr-txt-name' and for menu selection.
1804 Examples: 1804 Examples:
1805 'prt_06a 1805 'prt_06a
1806 'my_printer 1806 'my_printer
@@ -1951,7 +1951,7 @@ The alist element has the form:
1951Where: 1951Where:
1952 1952
1953SYMBOL It's a symbol to identify a PostScript printer. It's for 1953SYMBOL It's a symbol to identify a PostScript printer. It's for
1954 `pr-ps-name' variable setting and for menu selection. 1954 setting option `pr-ps-name' and for menu selection.
1955 Examples: 1955 Examples:
1956 'prt_06a 1956 'prt_06a
1957 'my_printer 1957 'my_printer
@@ -2935,9 +2935,9 @@ INHERITS Specify the inheritance for SYMBOL group. It's a symbol name
2935 2935
2936 The example above has two setting groups: no-duplex and 2936 The example above has two setting groups: no-duplex and
2937 no-duplex-and-landscape. When setting no-duplex is activated 2937 no-duplex-and-landscape. When setting no-duplex is activated
2938 through `inherits-from:' (see `pr-ps-utility', `pr-mode-alist' 2938 through `inherits-from:' (see option `pr-ps-utility',
2939 and `pr-ps-printer-alist'), the variables pr-file-duplex and 2939 `pr-mode-alist' and `pr-ps-printer-alist'), the variables
2940 pr-file-tumble are both set to nil. 2940 pr-file-duplex and pr-file-tumble are both set to nil.
2941 2941
2942 Now when setting no-duplex-and-landscape is activated through 2942 Now when setting no-duplex-and-landscape is activated through
2943 `inherits-from:', the variable pr-file-landscape is set to nil 2943 `inherits-from:', the variable pr-file-landscape is set to nil
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 6ffa67f59c1..560b66bf3b0 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -2464,8 +2464,12 @@ comment at the start of cc-engine.el for more info."
2464 2464
2465;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2465;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2466;; Variables which keep track of preprocessor constructs. 2466;; Variables which keep track of preprocessor constructs.
2467(defvar c-state-old-cpp-beg-marker nil)
2468(make-variable-buffer-local 'c-state-old-cpp-beg-marker)
2467(defvar c-state-old-cpp-beg nil) 2469(defvar c-state-old-cpp-beg nil)
2468(make-variable-buffer-local 'c-state-old-cpp-beg) 2470(make-variable-buffer-local 'c-state-old-cpp-beg)
2471(defvar c-state-old-cpp-end-marker nil)
2472(make-variable-buffer-local 'c-state-old-cpp-end-marker)
2469(defvar c-state-old-cpp-end nil) 2473(defvar c-state-old-cpp-end nil)
2470(make-variable-buffer-local 'c-state-old-cpp-end) 2474(make-variable-buffer-local 'c-state-old-cpp-end)
2471;; These are the limits of the macro containing point at the previous call of 2475;; These are the limits of the macro containing point at the previous call of
@@ -2653,13 +2657,21 @@ comment at the start of cc-engine.el for more info."
2653 ;; reduce the time wasted in repeated fruitless searches in brace deserts. 2657 ;; reduce the time wasted in repeated fruitless searches in brace deserts.
2654 (save-excursion 2658 (save-excursion
2655 (save-restriction 2659 (save-restriction
2656 (let ((bra from) ce ; Positions of "{" and "}". 2660 (let* (new-cons
2657 new-cons 2661 (cache-pos (c-state-cache-top-lparen)) ; might be nil.
2658 (cache-pos (c-state-cache-top-lparen)) ; might be nil. 2662 (macro-start-or-from
2659 (macro-start-or-from 2663 (progn (goto-char from)
2660 (progn (goto-char from) 2664 (c-beginning-of-macro)
2661 (c-beginning-of-macro) 2665 (point)))
2662 (point)))) 2666 (bra ; Position of "{".
2667 ;; Don't start scanning in the middle of a CPP construct unless
2668 ;; it contains HERE - these constructs, in Emacs, are "commented
2669 ;; out" with category properties.
2670 (if (eq (c-get-char-property macro-start-or-from 'category)
2671 'c-cpp-delimiter)
2672 macro-start-or-from
2673 from))
2674 ce) ; Position of "}"
2663 (or upper-lim (setq upper-lim from)) 2675 (or upper-lim (setq upper-lim from))
2664 2676
2665 ;; If we're essentially repeating a fruitless search, just give up. 2677 ;; If we're essentially repeating a fruitless search, just give up.
@@ -2899,7 +2911,9 @@ comment at the start of cc-engine.el for more info."
2899 (point-max) 2911 (point-max)
2900 (min (point-max) c-state-old-cpp-beg))) 2912 (min (point-max) c-state-old-cpp-beg)))
2901 (while (and c-state-cache (>= (c-state-cache-top-lparen) upper-lim)) 2913 (while (and c-state-cache (>= (c-state-cache-top-lparen) upper-lim))
2914 (setq scan-back-pos (car-safe (car c-state-cache)))
2902 (setq c-state-cache (cdr c-state-cache))) 2915 (setq c-state-cache (cdr c-state-cache)))
2916
2903 ;; If `upper-lim' is inside the last recorded brace pair, remove its 2917 ;; If `upper-lim' is inside the last recorded brace pair, remove its
2904 ;; RBrace and indicate we'll need to search backwards for a previous 2918 ;; RBrace and indicate we'll need to search backwards for a previous
2905 ;; brace pair. 2919 ;; brace pair.
@@ -3324,6 +3338,13 @@ comment at the start of cc-engine.el for more info."
3324 (c-with-cpps-commented-out 3338 (c-with-cpps-commented-out
3325 (c-invalidate-state-cache-1 here))))) 3339 (c-invalidate-state-cache-1 here)))))
3326 3340
3341(defmacro c-state-maybe-marker (place marker)
3342 ;; If PLACE is non-nil, return a marker marking it, otherwise nil.
3343 ;; We (re)use MARKER.
3344 `(and ,place
3345 (or ,marker (setq ,marker (make-marker)))
3346 (set-marker ,marker ,place)))
3347
3327(defun c-parse-state () 3348(defun c-parse-state ()
3328 ;; This is a wrapper over `c-parse-state-1'. See that function for a 3349 ;; This is a wrapper over `c-parse-state-1'. See that function for a
3329 ;; description of the functionality and return value. 3350 ;; description of the functionality and return value.
@@ -3350,9 +3371,10 @@ comment at the start of cc-engine.el for more info."
3350 (c-parse-state-1)) 3371 (c-parse-state-1))
3351 (c-with-cpps-commented-out 3372 (c-with-cpps-commented-out
3352 (c-parse-state-1)))) 3373 (c-parse-state-1))))
3353 (setq c-state-old-cpp-beg (and here-cpp-beg (copy-marker here-cpp-beg t)) 3374 (setq c-state-old-cpp-beg
3354 c-state-old-cpp-end (and here-cpp-end (copy-marker here-cpp-end t))) 3375 (c-state-maybe-marker here-cpp-beg c-state-old-cpp-beg-marker)
3355 ))) 3376 c-state-old-cpp-end
3377 (c-state-maybe-marker here-cpp-end c-state-old-cpp-end-marker)))))
3356 3378
3357;; Debug tool to catch cache inconsistencies. This is called from 3379;; Debug tool to catch cache inconsistencies. This is called from
3358;; 000tests.el. 3380;; 000tests.el.
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 376edcdc76b..f6c47f5bb4d 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -2049,7 +2049,7 @@ styles specified by `c-doc-comment-style'.")
2049 2049
2050(defconst c-font-lock-keywords-3 (c-lang-const c-matchers-3 c) 2050(defconst c-font-lock-keywords-3 (c-lang-const c-matchers-3 c)
2051 "Accurate normal font locking for C mode. 2051 "Accurate normal font locking for C mode.
2052Like `c-font-lock-keywords-2' but detects declarations in a more 2052Like the variable `c-font-lock-keywords-2' but detects declarations in a more
2053accurate way that works in most cases for arbitrary types without the 2053accurate way that works in most cases for arbitrary types without the
2054need for `c-font-lock-extra-types'.") 2054need for `c-font-lock-extra-types'.")
2055 2055
@@ -2207,7 +2207,7 @@ styles specified by `c-doc-comment-style'.")
2207 2207
2208(defconst c++-font-lock-keywords-3 (c-lang-const c-matchers-3 c++) 2208(defconst c++-font-lock-keywords-3 (c-lang-const c-matchers-3 c++)
2209 "Accurate normal font locking for C++ mode. 2209 "Accurate normal font locking for C++ mode.
2210Like `c++-font-lock-keywords-2' but detects declarations in a more 2210Like the variable `c++-font-lock-keywords-2' but detects declarations in a more
2211accurate way that works in most cases for arbitrary types without the 2211accurate way that works in most cases for arbitrary types without the
2212need for `c++-font-lock-extra-types'.") 2212need for `c++-font-lock-extra-types'.")
2213 2213
@@ -2313,7 +2313,7 @@ comment styles specified by `c-doc-comment-style'.")
2313 2313
2314(defconst objc-font-lock-keywords-3 (c-lang-const c-matchers-3 objc) 2314(defconst objc-font-lock-keywords-3 (c-lang-const c-matchers-3 objc)
2315 "Accurate normal font locking for Objective-C mode. 2315 "Accurate normal font locking for Objective-C mode.
2316Like `objc-font-lock-keywords-2' but detects declarations in a more 2316Like the variable `objc-font-lock-keywords-2' but detects declarations in a more
2317accurate way that works in most cases for arbitrary types without the 2317accurate way that works in most cases for arbitrary types without the
2318need for `objc-font-lock-extra-types'.") 2318need for `objc-font-lock-extra-types'.")
2319 2319
@@ -2356,7 +2356,7 @@ comment styles specified by `c-doc-comment-style'.")
2356 2356
2357(defconst java-font-lock-keywords-3 (c-lang-const c-matchers-3 java) 2357(defconst java-font-lock-keywords-3 (c-lang-const c-matchers-3 java)
2358 "Accurate normal font locking for Java mode. 2358 "Accurate normal font locking for Java mode.
2359Like `java-font-lock-keywords-2' but detects declarations in a more 2359Like variable `java-font-lock-keywords-2' but detects declarations in a more
2360accurate way that works in most cases for arbitrary types without the 2360accurate way that works in most cases for arbitrary types without the
2361need for `java-font-lock-extra-types'.") 2361need for `java-font-lock-extra-types'.")
2362 2362
@@ -2389,7 +2389,7 @@ styles specified by `c-doc-comment-style'.")
2389 2389
2390(defconst idl-font-lock-keywords-3 (c-lang-const c-matchers-3 idl) 2390(defconst idl-font-lock-keywords-3 (c-lang-const c-matchers-3 idl)
2391 "Accurate normal font locking for CORBA IDL mode. 2391 "Accurate normal font locking for CORBA IDL mode.
2392Like `idl-font-lock-keywords-2' but detects declarations in a more 2392Like the variable `idl-font-lock-keywords-2' but detects declarations in a more
2393accurate way that works in most cases for arbitrary types without the 2393accurate way that works in most cases for arbitrary types without the
2394need for `idl-font-lock-extra-types'.") 2394need for `idl-font-lock-extra-types'.")
2395 2395
@@ -2422,7 +2422,7 @@ comment styles specified by `c-doc-comment-style'.")
2422 2422
2423(defconst pike-font-lock-keywords-3 (c-lang-const c-matchers-3 pike) 2423(defconst pike-font-lock-keywords-3 (c-lang-const c-matchers-3 pike)
2424 "Accurate normal font locking for Pike mode. 2424 "Accurate normal font locking for Pike mode.
2425Like `pike-font-lock-keywords-2' but detects declarations in a more 2425Like the variable `pike-font-lock-keywords-2' but detects declarations in a more
2426accurate way that works in most cases for arbitrary types without the 2426accurate way that works in most cases for arbitrary types without the
2427need for `pike-font-lock-extra-types'.") 2427need for `pike-font-lock-extra-types'.")
2428 2428
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 4194d363a3d..eb73b77bf52 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -134,6 +134,7 @@ and a string describing how the process finished.")
134 134
135;; If you make any changes to `compilation-error-regexp-alist-alist', 135;; If you make any changes to `compilation-error-regexp-alist-alist',
136;; be sure to run the ERT test in test/automated/compile-tests.el. 136;; be sure to run the ERT test in test/automated/compile-tests.el.
137;; emacs -batch -l compile-tests.el -f ert-run-tests-batch-and-exit
137 138
138(defvar compilation-error-regexp-alist-alist 139(defvar compilation-error-regexp-alist-alist
139 '((absoft 140 '((absoft
@@ -261,11 +262,11 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
261 ;; The "in \\|from " exception was added to handle messages from Ruby. 262 ;; The "in \\|from " exception was added to handle messages from Ruby.
262 "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\|[ \t]+\\(?:in \\|from \\)\\)?\ 263 "^\\(?:[[:alpha:]][-[:alnum:].]+: ?\\|[ \t]+\\(?:in \\|from \\)\\)?\
263\\([0-9]*[^0-9\n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\): ?\ 264\\([0-9]*[^0-9\n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\): ?\
264\\([0-9]+\\)\\(?:[.:]\\([0-9]+\\)\\)?\ 265\\([0-9]+\\)\\(?:-\\(?4:[0-9]+\\)\\(?:\\.\\(?5:[0-9]+\\)\\)?\
265\\(?:-\\([0-9]+\\)?\\(?:\\.\\([0-9]+\\)\\)?\\)?:\ 266\\|[.:]\\(?3:[0-9]+\\)\\(?:-\\(?:\\(?4:[0-9]+\\)\\.\\)?\\(?5:[0-9]+\\)\\)?\\)?:\
266\\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\ 267\\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\
267 *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\|[Nn]ote\\)\\|\ 268 *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\|[Nn]ote\\)\\|\
268 *[Ee]rror\\|\[0-9]?\\(?:[^0-9\n]\\|$\\)\\|[0-9][0-9][0-9]\\)" 269 *[Ee]rror\\|[0-9]?\\(?:[^0-9\n]\\|$\\)\\|[0-9][0-9][0-9]\\)"
269 1 (2 . 4) (3 . 5) (6 . 7)) 270 1 (2 . 4) (3 . 5) (6 . 7))
270 271
271 (lcc 272 (lcc
@@ -1280,7 +1281,7 @@ to `compilation-error-regexp-alist' if RULES is nil."
1280 ;; whether or not omake's own error messages are recognized. 1281 ;; whether or not omake's own error messages are recognized.
1281 (cond 1282 (cond
1282 ((not (memq 'omake compilation-error-regexp-alist)) nil) 1283 ((not (memq 'omake compilation-error-regexp-alist)) nil)
1283 ((string-match "\\`\\([^^]\\|^\\( \\*\\|\\[\\)\\)" pat) 1284 ((string-match "\\`\\([^^]\\|\\^\\( \\*\\|\\[\\)\\)" pat)
1284 nil) ;; Not anchored or anchored but already allows empty spaces. 1285 nil) ;; Not anchored or anchored but already allows empty spaces.
1285 (t (setq pat (concat "^ *" (substring pat 1))))) 1286 (t (setq pat (concat "^ *" (substring pat 1)))))
1286 1287
@@ -1427,8 +1428,9 @@ and move to the source code that caused it.
1427If optional second arg COMINT is t the buffer will be in Comint mode with 1428If optional second arg COMINT is t the buffer will be in Comint mode with
1428`compilation-shell-minor-mode'. 1429`compilation-shell-minor-mode'.
1429 1430
1430Interactively, prompts for the command if `compilation-read-command' is 1431Interactively, prompts for the command if the variable
1431non-nil; otherwise uses `compile-command'. With prefix arg, always prompts. 1432`compilation-read-command' is non-nil; otherwise uses`compile-command'.
1433With prefix arg, always prompts.
1432Additionally, with universal prefix arg, compilation buffer will be in 1434Additionally, with universal prefix arg, compilation buffer will be in
1433comint mode, i.e. interactive. 1435comint mode, i.e. interactive.
1434 1436
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 81dc31792c3..92f9447652e 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -199,7 +199,8 @@ Pop back to the last location with \\[negative-argument] \\[find-tag].")
199 199
200(defvar tags-table-files nil 200(defvar tags-table-files nil
201 "List of file names covered by current tags table. 201 "List of file names covered by current tags table.
202nil means it has not yet been computed; use `tags-table-files' to do so.") 202nil means it has not yet been computed;
203use function `tags-table-files' to do so.")
203 204
204(defvar tags-completion-table nil 205(defvar tags-completion-table nil
205 "Obarray of tag names defined in current tags table.") 206 "Obarray of tag names defined in current tags table.")
@@ -224,7 +225,7 @@ of the format-parsing tags function variables if successful.")
224One optional argument, a boolean specifying to return complete path (nil) or 225One optional argument, a boolean specifying to return complete path (nil) or
225relative path (non-nil).") 226relative path (non-nil).")
226(defvar tags-table-files-function nil 227(defvar tags-table-files-function nil
227 "Function to do the work of `tags-table-files' (which see).") 228 "Function to do the work of function `tags-table-files' (which see).")
228(defvar tags-completion-table-function nil 229(defvar tags-completion-table-function nil
229 "Function to build the `tags-completion-table'.") 230 "Function to build the `tags-completion-table'.")
230(defvar snarf-tag-function nil 231(defvar snarf-tag-function nil
@@ -251,7 +252,7 @@ One argument, the tag info returned by `snarf-tag-function'.")
251(defvar tags-apropos-function nil 252(defvar tags-apropos-function nil
252 "Function to do the work of `tags-apropos' (which see).") 253 "Function to do the work of `tags-apropos' (which see).")
253(defvar tags-included-tables-function nil 254(defvar tags-included-tables-function nil
254 "Function to do the work of `tags-included-tables' (which see).") 255 "Function to do the work of function `tags-included-tables' (which see).")
255(defvar verify-tags-table-function nil 256(defvar verify-tags-table-function nil
256 "Function to return t if current buffer contains valid tags file.") 257 "Function to return t if current buffer contains valid tags file.")
257 258
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 7ca0ececa78..0f92df95a9d 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -844,13 +844,21 @@ Return t if it has at least one flymake overlay, nil if no overlay."
844 has-flymake-overlays)) 844 has-flymake-overlays))
845 845
846(defface flymake-errline 846(defface flymake-errline
847 '((t :inherit error)) 847 '((((supports :underline (:style wave)))
848 :underline (:style wave :color "Red1"))
849 (t
850 :inherit error))
848 "Face used for marking error lines." 851 "Face used for marking error lines."
852 :version "24.4"
849 :group 'flymake) 853 :group 'flymake)
850 854
851(defface flymake-warnline 855(defface flymake-warnline
852 '((t :inherit warning)) 856 '((((supports :underline (:style wave)))
857 :underline (:style wave :color "DarkOrange"))
858 (t
859 :inherit warning))
853 "Face used for marking warning lines." 860 "Face used for marking warning lines."
861 :version "24.4"
854 :group 'flymake) 862 :group 'flymake)
855 863
856(defun flymake-highlight-line (line-no line-err-info-list) 864(defun flymake-highlight-line (line-no line-err-info-list)
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index fc3d336cf99..90c7cfc5008 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -607,12 +607,12 @@ executable followed by command-line options. The command-line
607options should include \"-i=mi\" to use gdb's MI text interface. 607options should include \"-i=mi\" to use gdb's MI text interface.
608Note that the old \"--annotate\" option is no longer supported. 608Note that the old \"--annotate\" option is no longer supported.
609 609
610If `gdb-many-windows' is nil (the default value) then gdb just 610If option `gdb-many-windows' is nil (the default value) then gdb just
611pops up the GUD buffer unless `gdb-show-main' is t. In this case 611pops up the GUD buffer unless `gdb-show-main' is t. In this case
612it starts with two windows: one displaying the GUD buffer and the 612it starts with two windows: one displaying the GUD buffer and the
613other with the source file with the main routine of the inferior. 613other with the source file with the main routine of the inferior.
614 614
615If `gdb-many-windows' is t, regardless of the value of 615If option `gdb-many-windows' is t, regardless of the value of
616`gdb-show-main', the layout below will appear. Keybindings are 616`gdb-show-main', the layout below will appear. Keybindings are
617shown in some of the buffers. 617shown in some of the buffers.
618 618
@@ -4069,7 +4069,7 @@ window is dedicated."
4069 (set-window-dedicated-p window t)) 4069 (set-window-dedicated-p window t))
4070 4070
4071(defun gdb-setup-windows () 4071(defun gdb-setup-windows ()
4072 "Layout the window pattern for `gdb-many-windows'." 4072 "Layout the window pattern for option `gdb-many-windows'."
4073 (gdb-get-buffer-create 'gdb-locals-buffer) 4073 (gdb-get-buffer-create 'gdb-locals-buffer)
4074 (gdb-get-buffer-create 'gdb-stack-buffer) 4074 (gdb-get-buffer-create 'gdb-stack-buffer)
4075 (gdb-get-buffer-create 'gdb-breakpoints-buffer) 4075 (gdb-get-buffer-create 'gdb-breakpoints-buffer)
@@ -4120,7 +4120,7 @@ of the debugged program. Non-nil means display the layout shown for
4120 4120
4121(defun gdb-restore-windows () 4121(defun gdb-restore-windows ()
4122 "Restore the basic arrangement of windows used by gdb. 4122 "Restore the basic arrangement of windows used by gdb.
4123This arrangement depends on the value of `gdb-many-windows'." 4123This arrangement depends on the value of option `gdb-many-windows'."
4124 (interactive) 4124 (interactive)
4125 (switch-to-buffer gud-comint-buffer) ;Select the right window and frame. 4125 (switch-to-buffer gud-comint-buffer) ;Select the right window and frame.
4126 (delete-other-windows) 4126 (delete-other-windows)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 683b3927ae3..96e6039a8c2 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1680,12 +1680,15 @@ This performs fontification according to `js--class-styles'."
1680 "each")) 1680 "each"))
1681 "Regexp matching keywords optionally followed by an opening brace.") 1681 "Regexp matching keywords optionally followed by an opening brace.")
1682 1682
1683(defconst js--declaration-keyword-re
1684 (regexp-opt '("var" "let" "const") 'words)
1685 "Regular expression matching variable declaration keywords.")
1686
1683(defconst js--indent-operator-re 1687(defconst js--indent-operator-re
1684 (concat "[-+*/%<>=&^|?:.]\\([^-+*/]\\|$\\)\\|" 1688 (concat "[-+*/%<>=&^|?:.]\\([^-+*/]\\|$\\)\\|"
1685 (js--regexp-opt-symbol '("in" "instanceof"))) 1689 (js--regexp-opt-symbol '("in" "instanceof")))
1686 "Regexp matching operators that affect indentation of continued expressions.") 1690 "Regexp matching operators that affect indentation of continued expressions.")
1687 1691
1688
1689(defun js--looking-at-operator-p () 1692(defun js--looking-at-operator-p ()
1690 "Return non-nil if point is on a JavaScript operator, other than a comma." 1693 "Return non-nil if point is on a JavaScript operator, other than a comma."
1691 (save-match-data 1694 (save-match-data
@@ -1764,6 +1767,37 @@ nil."
1764 (list (cons 'c js-comment-lineup-func)))) 1767 (list (cons 'c js-comment-lineup-func))))
1765 (c-get-syntactic-indentation (list (cons symbol anchor))))) 1768 (c-get-syntactic-indentation (list (cons symbol anchor)))))
1766 1769
1770(defun js--multi-line-declaration-indentation ()
1771 "Helper function for `js--proper-indentation'.
1772Return the proper indentation of the current line if it belongs to a declaration
1773statement spanning multiple lines; otherwise, return nil."
1774 (let (at-opening-bracket)
1775 (save-excursion
1776 (back-to-indentation)
1777 (when (not (looking-at js--declaration-keyword-re))
1778 (when (looking-at js--indent-operator-re)
1779 (goto-char (match-end 0)))
1780 (while (and (not at-opening-bracket)
1781 (not (bobp))
1782 (let ((pos (point)))
1783 (save-excursion
1784 (js--backward-syntactic-ws)
1785 (or (eq (char-before) ?,)
1786 (and (not (eq (char-before) ?\;))
1787 (prog2
1788 (skip-chars-backward "[[:punct:]]")
1789 (looking-at js--indent-operator-re)
1790 (js--backward-syntactic-ws))
1791 (not (eq (char-before) ?\;)))
1792 (and (>= pos (point-at-bol))
1793 (<= pos (point-at-eol)))))))
1794 (condition-case err
1795 (backward-sexp)
1796 (scan-error (setq at-opening-bracket t))))
1797 (when (looking-at js--declaration-keyword-re)
1798 (goto-char (match-end 0))
1799 (1+ (current-column)))))))
1800
1767(defun js--proper-indentation (parse-status) 1801(defun js--proper-indentation (parse-status)
1768 "Return the proper indentation for the current line." 1802 "Return the proper indentation for the current line."
1769 (save-excursion 1803 (save-excursion
@@ -1772,6 +1806,7 @@ nil."
1772 (js--get-c-offset 'c (nth 8 parse-status))) 1806 (js--get-c-offset 'c (nth 8 parse-status)))
1773 ((nth 8 parse-status) 0) ; inside string 1807 ((nth 8 parse-status) 0) ; inside string
1774 ((js--ctrl-statement-indentation)) 1808 ((js--ctrl-statement-indentation))
1809 ((js--multi-line-declaration-indentation))
1775 ((eq (char-after) ?#) 0) 1810 ((eq (char-after) ?#) 0)
1776 ((save-excursion (js--beginning-of-macro)) 4) 1811 ((save-excursion (js--beginning-of-macro)) 4)
1777 ((nth 1 parse-status) 1812 ((nth 1 parse-status)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 172193266ca..0e5f4c82090 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1198,7 +1198,16 @@ of the statement."
1198 (not (eobp)) 1198 (not (eobp))
1199 (cond ((setq string-start (python-syntax-context 'string)) 1199 (cond ((setq string-start (python-syntax-context 'string))
1200 (goto-char string-start) 1200 (goto-char string-start)
1201 (python-nav-end-of-statement t)) 1201 (if (python-syntax-context 'paren)
1202 ;; Ended up inside a paren, roll again.
1203 (python-nav-end-of-statement t)
1204 ;; This is not inside a paren, move to the
1205 ;; end of this string.
1206 (goto-char (+ (point)
1207 (python-syntax-count-quotes
1208 (char-after (point)) (point))))
1209 (or (re-search-forward (rx (syntax string-delimiter)) nil t)
1210 (goto-char (point-max)))))
1202 ((python-syntax-context 'paren) 1211 ((python-syntax-context 'paren)
1203 ;; The statement won't end before we've escaped 1212 ;; The statement won't end before we've escaped
1204 ;; at least one level of parenthesis. 1213 ;; at least one level of parenthesis.
@@ -1312,7 +1321,7 @@ backward to previous block."
1312 "Safe version of standard `forward-sexp'. 1321 "Safe version of standard `forward-sexp'.
1313When ARG > 0 move forward, else if ARG is < 0." 1322When ARG > 0 move forward, else if ARG is < 0."
1314 (or arg (setq arg 1)) 1323 (or arg (setq arg 1))
1315 (let ((forward-sexp-function nil) 1324 (let ((forward-sexp-function)
1316 (paren-regexp 1325 (paren-regexp
1317 (if (> arg 0) (python-rx close-paren) (python-rx open-paren))) 1326 (if (> arg 0) (python-rx close-paren) (python-rx open-paren)))
1318 (search-fn 1327 (search-fn
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 453386cdba5..781aa241802 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -723,15 +723,15 @@ this variable is nil, that buffer is shown using
723 723
724(defvar sql-imenu-generic-expression 724(defvar sql-imenu-generic-expression
725 ;; Items are in reverse order because they are rendered in reverse. 725 ;; Items are in reverse order because they are rendered in reverse.
726 '(("Rules/Defaults" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*\\(?:rule\\|default\\)\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\s-+\\(\\w+\\)" 1) 726 '(("Rules/Defaults" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*\\(?:rule\\|default\\)\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\s-+\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
727 ("Sequences" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*sequence\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\w+\\)" 1) 727 ("Sequences" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*sequence\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
728 ("Triggers" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*trigger\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\w+\\)" 1) 728 ("Triggers" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*trigger\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
729 ("Functions" "^\\s-*\\(?:create\\s-+\\(?:\\w+\\s-+\\)*\\)?function\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\w+\\)" 1) 729 ("Functions" "^\\s-*\\(?:create\\s-+\\(?:\\w+\\s-+\\)*\\)?function\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
730 ("Procedures" "^\\s-*\\(?:create\\s-+\\(?:\\w+\\s-+\\)*\\)?proc\\(?:edure\\)?\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\w+\\)" 1) 730 ("Procedures" "^\\s-*\\(?:create\\s-+\\(?:\\w+\\s-+\\)*\\)?proc\\(?:edure\\)?\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
731 ("Packages" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*package\\s-+\\(?:body\\s-+\\)?\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\w+\\)" 1) 731 ("Packages" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*package\\s-+\\(?:body\\s-+\\)?\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
732 ("Types" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*type\\s-+\\(?:body\\s-+\\)?\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\w+\\)" 1) 732 ("Types" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*type\\s-+\\(?:body\\s-+\\)?\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
733 ("Indexes" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*index\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\w+\\)" 1) 733 ("Indexes" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*index\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1)
734 ("Tables/Views" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*\\(?:table\\|view\\)\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\w+\\)" 1)) 734 ("Tables/Views" "^\\s-*create\\s-+\\(?:\\w+\\s-+\\)*\\(?:table\\|view\\)\\s-+\\(?:if\\s-+not\\s-+exists\\s-+\\)?\\(\\(?:\\w+\\s-*[.]\\s-*\\)*\\w+\\)" 1))
735 "Define interesting points in the SQL buffer for `imenu'. 735 "Define interesting points in the SQL buffer for `imenu'.
736 736
737This is used to set `imenu-generic-expression' when SQL mode is 737This is used to set `imenu-generic-expression' when SQL mode is
@@ -1313,7 +1313,7 @@ Based on `comint-mode-map'.")
1313 "\\(?:table\\|view\\|\\(?:package\\|type\\)\\(?:\\s-+body\\)?\\|proc\\(?:edure\\)?" 1313 "\\(?:table\\|view\\|\\(?:package\\|type\\)\\(?:\\s-+body\\)?\\|proc\\(?:edure\\)?"
1314 "\\|function\\|trigger\\|sequence\\|rule\\|default\\)\\s-+" 1314 "\\|function\\|trigger\\|sequence\\|rule\\|default\\)\\s-+"
1315 "\\(?:if\\s-+not\\s-+exists\\s-+\\)?" ;; IF NOT EXISTS 1315 "\\(?:if\\s-+not\\s-+exists\\s-+\\)?" ;; IF NOT EXISTS
1316 "\\(\\w+\\)") 1316 "\\(\\w+\\(?:\\s-*[.]\\s-*\\w+\\)*\\)")
1317 1 'font-lock-function-name-face)) 1317 1 'font-lock-function-name-face))
1318 1318
1319 "Pattern to match the names of top-level objects. 1319 "Pattern to match the names of top-level objects.
@@ -3219,9 +3219,6 @@ Every newline in STRING will be preceded with a space and a backslash."
3219 3219
3220Allows the suppression of continuation prompts.") 3220Allows the suppression of continuation prompts.")
3221 3221
3222(defvar sql-output-by-send nil
3223 "Non-nil if the command in the input was generated by `sql-send-string'.")
3224
3225(defun sql-input-sender (proc string) 3222(defun sql-input-sender (proc string)
3226 "Send STRING to PROC after applying filters." 3223 "Send STRING to PROC after applying filters."
3227 3224
@@ -3288,8 +3285,7 @@ to avoid deleting non-prompt output."
3288 3285
3289 (if (= sql-output-newline-count 0) 3286 (if (= sql-output-newline-count 0)
3290 (setq sql-output-newline-count nil 3287 (setq sql-output-newline-count nil
3291 oline (concat "\n" oline) 3288 oline (concat "\n" oline))
3292 sql-output-by-send nil)
3293 3289
3294 (setq sql-preoutput-hold oline 3290 (setq sql-preoutput-hold oline
3295 oline "")) 3291 oline ""))
@@ -3383,8 +3379,7 @@ to avoid deleting non-prompt output."
3383 (setq sql-output-newline-count 3379 (setq sql-output-newline-count
3384 (if sql-output-newline-count 3380 (if sql-output-newline-count
3385 (1+ sql-output-newline-count) 3381 (1+ sql-output-newline-count)
3386 1))) 3382 1)))))
3387 (setq sql-output-by-send t)))
3388 3383
3389(defun sql-remove-tabs-filter (str) 3384(defun sql-remove-tabs-filter (str)
3390 "Replace tab characters with spaces." 3385 "Replace tab characters with spaces."
@@ -3857,7 +3852,6 @@ you entered, right above the output it created.
3857 (sql-get-product-feature sql-product :prompt-cont-regexp)) 3852 (sql-get-product-feature sql-product :prompt-cont-regexp))
3858 (make-local-variable 'sql-output-newline-count) 3853 (make-local-variable 'sql-output-newline-count)
3859 (make-local-variable 'sql-preoutput-hold) 3854 (make-local-variable 'sql-preoutput-hold)
3860 (make-local-variable 'sql-output-by-send)
3861 (add-hook 'comint-preoutput-filter-functions 3855 (add-hook 'comint-preoutput-filter-functions
3862 'sql-interactive-remove-continuation-prompt nil t) 3856 'sql-interactive-remove-continuation-prompt nil t)
3863 (make-local-variable 'sql-input-ring-separator) 3857 (make-local-variable 'sql-input-ring-separator)
@@ -3930,7 +3924,7 @@ is specified in the connection settings."
3930 ;; Was one selected 3924 ;; Was one selected
3931 (when connection 3925 (when connection
3932 ;; Get connection settings 3926 ;; Get connection settings
3933 (let ((connect-set (assoc connection sql-connection-alist))) 3927 (let ((connect-set (assoc-string connection sql-connection-alist t)))
3934 ;; Settings are defined 3928 ;; Settings are defined
3935 (if connect-set 3929 (if connect-set
3936 ;; Set the desired parameters 3930 ;; Set the desired parameters
@@ -4134,9 +4128,17 @@ the call to \\[sql-product-interactive] with
4134 (setq sql-buffer (buffer-name new-sqli-buffer)) 4128 (setq sql-buffer (buffer-name new-sqli-buffer))
4135 (run-hooks 'sql-set-sqli-hook))) 4129 (run-hooks 'sql-set-sqli-hook)))
4136 4130
4131 ;; Make sure the connection is complete
4132 ;; (Sometimes start up can be slow)
4133 ;; and call the login hook
4134 (let ((proc (get-buffer-process new-sqli-buffer)))
4135 (while (and (memq (process-status proc) '(open run))
4136 (accept-process-output proc 2.5)
4137 (progn (goto-char (point-max))
4138 (not (looking-back sql-prompt-regexp))))))
4139 (run-hooks 'sql-login-hook)
4137 ;; All done. 4140 ;; All done.
4138 (message "Login...done") 4141 (message "Login...done")
4139 (run-hooks 'sql-login-hook)
4140 (pop-to-buffer new-sqli-buffer))))) 4142 (pop-to-buffer new-sqli-buffer)))))
4141 (message "No default SQL product defined. Set `sql-product'."))) 4143 (message "No default SQL product defined. Set `sql-product'.")))
4142 4144
@@ -4202,7 +4204,7 @@ The default comes from `process-coding-system-alist' and
4202 ;; is meaningless; database without user/password is meaningless, 4204 ;; is meaningless; database without user/password is meaningless,
4203 ;; because "@param" will ask sqlplus to interpret the script 4205 ;; because "@param" will ask sqlplus to interpret the script
4204 ;; "param". 4206 ;; "param".
4205 (let ((parameter nil)) 4207 (let (parameter nlslang coding)
4206 (if (not (string= "" sql-user)) 4208 (if (not (string= "" sql-user))
4207 (if (not (string= "" sql-password)) 4209 (if (not (string= "" sql-password))
4208 (setq parameter (concat sql-user "/" sql-password)) 4210 (setq parameter (concat sql-user "/" sql-password))
@@ -4212,7 +4214,29 @@ The default comes from `process-coding-system-alist' and
4212 (if parameter 4214 (if parameter
4213 (setq parameter (nconc (list parameter) options)) 4215 (setq parameter (nconc (list parameter) options))
4214 (setq parameter options)) 4216 (setq parameter options))
4215 (sql-comint product parameter))) 4217 (sql-comint product parameter)
4218 ;; Set process coding system to agree with the interpreter
4219 (setq nlslang (or (getenv "NLS_LANG") "")
4220 coding (dolist (cs
4221 ;; Are we missing any common NLS character sets
4222 '(("US8PC437" . cp437)
4223 ("EL8PC737" . cp737)
4224 ("WE8PC850" . cp850)
4225 ("EE8PC852" . cp852)
4226 ("TR8PC857" . cp857)
4227 ("WE8PC858" . cp858)
4228 ("IS8PC861" . cp861)
4229 ("IW8PC1507" . cp862)
4230 ("N8PC865" . cp865)
4231 ("RU8PC866" . cp866)
4232 ("US7ASCII" . us-ascii)
4233 ("UTF8" . utf-8)
4234 ("AL32UTF8" . utf-8)
4235 ("AL16UTF16" . utf-16))
4236 (or coding 'utf-8))
4237 (when (string-match (format "\\.%s\\'" (car cs)) nlslang)
4238 (setq coding (cdr cs)))))
4239 (set-buffer-process-coding-system coding coding)))
4216 4240
4217(defun sql-oracle-save-settings (sqlbuf) 4241(defun sql-oracle-save-settings (sqlbuf)
4218 "Save most SQL*Plus settings so they may be reset by \\[sql-redirect]." 4242 "Save most SQL*Plus settings so they may be reset by \\[sql-redirect]."
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 0279319cc89..edfe368479c 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -290,7 +290,7 @@ If no function name is found, return nil."
290 (when (and (null name) 290 (when (and (null name)
291 (boundp 'imenu--index-alist) (null imenu--index-alist) 291 (boundp 'imenu--index-alist) (null imenu--index-alist)
292 (null which-function-imenu-failed)) 292 (null which-function-imenu-failed))
293 (imenu--make-index-alist t) 293 (ignore-errors (imenu--make-index-alist t))
294 (unless imenu--index-alist 294 (unless imenu--index-alist
295 (set (make-local-variable 'which-function-imenu-failed) t))) 295 (set (make-local-variable 'which-function-imenu-failed) t)))
296 ;; If we have an index alist, use it. 296 ;; If we have an index alist, use it.
@@ -319,7 +319,9 @@ If no function name is found, return nil."
319 namestack (cons (car pair) namestack) 319 namestack (cons (car pair) namestack)
320 alist (cdr pair))) 320 alist (cdr pair)))
321 321
322 ((number-or-marker-p (setq mark (cdr pair))) 322 ((or (number-or-marker-p (setq mark (cdr pair)))
323 (and (overlayp mark)
324 (setq mark (overlay-start mark))))
323 (when (and (>= (setq offset (- (point) mark)) 0) 325 (when (and (>= (setq offset (- (point) mark)) 0)
324 (< offset minoffset)) ; Find the closest item. 326 (< offset minoffset)) ; Find the closest item.
325 (setq minoffset offset 327 (setq minoffset offset
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 99f22df4107..f7c03c2de85 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -1959,13 +1959,13 @@ Valid values are:
1959 1959
1960Any other value is treated as nil. 1960Any other value is treated as nil.
1961 1961
1962If you set `ps-selected-pages' (see it for documentation), first the pages are 1962If you set option `ps-selected-pages', first the pages are
1963filtered by `ps-selected-pages' and then by `ps-even-or-odd-pages'. For 1963filtered by option `ps-selected-pages' and then by `ps-even-or-odd-pages'.
1964example, if we have: 1964For example, if we have:
1965 1965
1966 (setq ps-selected-pages '(1 4 (6 . 10) (12 . 16) 20)) 1966 (setq ps-selected-pages '(1 4 (6 . 10) (12 . 16) 20))
1967 1967
1968Combining with `ps-even-or-odd-pages' and `ps-n-up-printing', we have: 1968Combining with `ps-even-or-odd-pages' and option `ps-n-up-printing', we have:
1969 1969
1970`ps-n-up-printing' = 1: 1970`ps-n-up-printing' = 1:
1971 `ps-even-or-odd-pages' PAGES PRINTED 1971 `ps-even-or-odd-pages' PAGES PRINTED
@@ -3566,9 +3566,9 @@ Use the command `ps-despool' to send the spooled images to the printer."
3566;;;###autoload 3566;;;###autoload
3567(defun ps-spool-buffer-with-faces () 3567(defun ps-spool-buffer-with-faces ()
3568 "Generate and spool a PostScript image of the buffer. 3568 "Generate and spool a PostScript image of the buffer.
3569Like `ps-spool-buffer', but includes font, color, and underline information in 3569Like the command `ps-spool-buffer', but includes font, color, and underline
3570the generated image. This command works only if you are using a window system, 3570information in the generated image. This command works only if you are using
3571so it has a way to determine color values. 3571a window system, so it has a way to determine color values.
3572 3572
3573Use the command `ps-despool' to send the spooled images to the printer." 3573Use the command `ps-despool' to send the spooled images to the printer."
3574 (interactive) 3574 (interactive)
@@ -5369,7 +5369,7 @@ Each element has the following form:
5369 (KIND XCOL YCOL XLIN YLIN REPEAT END XSTART YSTART) 5369 (KIND XCOL YCOL XLIN YLIN REPEAT END XSTART YSTART)
5370 5370
5371Where: 5371Where:
5372KIND is a valid value of `ps-n-up-filling'. 5372KIND is a valid value of the variable `ps-n-up-filling'.
5373XCOL YCOL are the relative position for the next column. 5373XCOL YCOL are the relative position for the next column.
5374XLIN YLIN are the relative position for the beginning of next line. 5374XLIN YLIN are the relative position for the beginning of next line.
5375REPEAT is the number of repetitions for external loop. 5375REPEAT is the number of repetitions for external loop.
diff --git a/lisp/server.el b/lisp/server.el
index 03d4bfc33df..64224d2a310 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -361,7 +361,7 @@ Updates `server-clients'."
361 361
362(defconst server-buffer " *server*" 362(defconst server-buffer " *server*"
363 "Buffer used internally by Emacs's server. 363 "Buffer used internally by Emacs's server.
364One use is to log the I/O for debugging purposes (see `server-log'), 364One use is to log the I/O for debugging purposes (see option `server-log'),
365the other is to provide a current buffer in which the process filter can 365the other is to provide a current buffer in which the process filter can
366safely let-bind buffer-local variables like `default-directory'.") 366safely let-bind buffer-local variables like `default-directory'.")
367 367
@@ -369,7 +369,7 @@ safely let-bind buffer-local variables like `default-directory'.")
369 "If non-nil, log the server's inputs and outputs in the `server-buffer'.") 369 "If non-nil, log the server's inputs and outputs in the `server-buffer'.")
370 370
371(defun server-log (string &optional client) 371(defun server-log (string &optional client)
372 "If `server-log' is non-nil, log STRING to `server-buffer'. 372 "If option `server-log' is non-nil, log STRING to `server-buffer'.
373If CLIENT is non-nil, add a description of it to the logged message." 373If CLIENT is non-nil, add a description of it to the logged message."
374 (when server-log 374 (when server-log
375 (with-current-buffer (get-buffer-create server-buffer) 375 (with-current-buffer (get-buffer-create server-buffer)
diff --git a/lisp/simple.el b/lisp/simple.el
index 19140cba496..847c07a5c26 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1,4 +1,4 @@
1;;; simple.el --- basic editing commands for Emacs 1;;; simple.el --- basic editing commands for Emacs -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1985-1987, 1993-2013 Free Software Foundation, Inc. 3;; Copyright (C) 1985-1987, 1993-2013 Free Software Foundation, Inc.
4 4
@@ -401,7 +401,7 @@ Other major modes are defined by comparison with this one."
401 401
402(defun newline (&optional arg) 402(defun newline (&optional arg)
403 "Insert a newline, and move to left margin of the new line if it's blank. 403 "Insert a newline, and move to left margin of the new line if it's blank.
404If `use-hard-newlines' is non-nil, the newline is marked with the 404If option `use-hard-newlines' is non-nil, the newline is marked with the
405text-property `hard'. 405text-property `hard'.
406With ARG, insert that many newlines. 406With ARG, insert that many newlines.
407Call `auto-fill-function' if the current column number is greater 407Call `auto-fill-function' if the current column number is greater
@@ -752,7 +752,7 @@ If N is negative, delete newlines as well, leaving -N spaces."
752 (n (abs n))) 752 (n (abs n)))
753 (skip-chars-backward skip-characters) 753 (skip-chars-backward skip-characters)
754 (constrain-to-field nil orig-pos) 754 (constrain-to-field nil orig-pos)
755 (dotimes (i n) 755 (dotimes (_ n)
756 (if (= (following-char) ?\s) 756 (if (= (following-char) ?\s)
757 (forward-char 1) 757 (forward-char 1)
758 (insert ?\s))) 758 (insert ?\s)))
@@ -837,7 +837,7 @@ instead of deleted."
837 "Delete the previous N characters (following if N is negative). 837 "Delete the previous N characters (following if N is negative).
838If Transient Mark mode is enabled, the mark is active, and N is 1, 838If Transient Mark mode is enabled, the mark is active, and N is 1,
839delete the text in the region and deactivate the mark instead. 839delete the text in the region and deactivate the mark instead.
840To disable this, set `delete-active-region' to nil. 840To disable this, set option `delete-active-region' to nil.
841 841
842Optional second arg KILLFLAG, if non-nil, means to kill (save in 842Optional second arg KILLFLAG, if non-nil, means to kill (save in
843kill ring) instead of delete. Interactively, N is the prefix 843kill ring) instead of delete. Interactively, N is the prefix
@@ -873,7 +873,7 @@ the end of the line."
873 "Delete the following N characters (previous if N is negative). 873 "Delete the following N characters (previous if N is negative).
874If Transient Mark mode is enabled, the mark is active, and N is 1, 874If Transient Mark mode is enabled, the mark is active, and N is 1,
875delete the text in the region and deactivate the mark instead. 875delete the text in the region and deactivate the mark instead.
876To disable this, set `delete-active-region' to nil. 876To disable this, set variable `delete-active-region' to nil.
877 877
878Optional second arg KILLFLAG non-nil means to kill (save in kill 878Optional second arg KILLFLAG non-nil means to kill (save in kill
879ring) instead of delete. Interactively, N is the prefix arg, and 879ring) instead of delete. Interactively, N is the prefix arg, and
@@ -1391,14 +1391,16 @@ If the value is non-nil and not a number, we wait 2 seconds."
1391 ;; Aaron S. Hawley <aaron.s.hawley(at)gmail.com> 2009-08-24 1391 ;; Aaron S. Hawley <aaron.s.hawley(at)gmail.com> 2009-08-24
1392 "Read function name, then read its arguments and call it. 1392 "Read function name, then read its arguments and call it.
1393 1393
1394To pass a numeric argument to the command you are invoking with, specify 1394To pass a numeric argument to the command you are invoking, specify
1395the numeric argument to this command. 1395the numeric argument to this command.
1396 1396
1397Noninteractively, the argument PREFIXARG is the prefix argument to 1397Noninteractively, the argument PREFIXARG is the prefix argument to
1398give to the command you invoke, if it asks for an argument." 1398give to the command you invoke, if it asks for an argument."
1399 (interactive (list current-prefix-arg (read-extended-command))) 1399 (interactive (list current-prefix-arg (read-extended-command)))
1400 ;; Emacs<24 calling-convention was with a single `prefixarg' argument. 1400 ;; Emacs<24 calling-convention was with a single `prefixarg' argument.
1401 (if (null command-name) (setq command-name (read-extended-command))) 1401 (if (null command-name)
1402 (setq command-name (let ((current-prefix-arg prefixarg)) ; for prompt
1403 (read-extended-command))))
1402 (let* ((function (and (stringp command-name) (intern-soft command-name))) 1404 (let* ((function (and (stringp command-name) (intern-soft command-name)))
1403 (binding (and suggest-key-bindings 1405 (binding (and suggest-key-bindings
1404 (not executing-kbd-macro) 1406 (not executing-kbd-macro)
@@ -1776,7 +1778,7 @@ Intended to be added to `minibuffer-setup-hook'."
1776If there are no search errors, this function displays an overlay with 1778If there are no search errors, this function displays an overlay with
1777the isearch prompt which replaces the original minibuffer prompt. 1779the isearch prompt which replaces the original minibuffer prompt.
1778Otherwise, it displays the standard isearch message returned from 1780Otherwise, it displays the standard isearch message returned from
1779`isearch-message'." 1781the function `isearch-message'."
1780 (if (not (and (minibufferp) isearch-success (not isearch-error))) 1782 (if (not (and (minibufferp) isearch-success (not isearch-error)))
1781 ;; Use standard function `isearch-message' when not in the minibuffer, 1783 ;; Use standard function `isearch-message' when not in the minibuffer,
1782 ;; or search fails, or has an error (like incomplete regexp). 1784 ;; or search fails, or has an error (like incomplete regexp).
@@ -1813,8 +1815,9 @@ or to the last history element for a backward search."
1813 "Save a function restoring the state of minibuffer history search. 1815 "Save a function restoring the state of minibuffer history search.
1814Save `minibuffer-history-position' to the additional state parameter 1816Save `minibuffer-history-position' to the additional state parameter
1815in the search status stack." 1817in the search status stack."
1816 `(lambda (cmd) 1818 (let ((pos minibuffer-history-position))
1817 (minibuffer-history-isearch-pop-state cmd ,minibuffer-history-position))) 1819 (lambda (cmd)
1820 (minibuffer-history-isearch-pop-state cmd pos))))
1818 1821
1819(defun minibuffer-history-isearch-pop-state (_cmd hist-pos) 1822(defun minibuffer-history-isearch-pop-state (_cmd hist-pos)
1820 "Restore the minibuffer history search state. 1823 "Restore the minibuffer history search state.
@@ -1979,6 +1982,117 @@ then call `undo-more' one or more times to undo them."
1979 (if (null pending-undo-list) 1982 (if (null pending-undo-list)
1980 (setq pending-undo-list t)))) 1983 (setq pending-undo-list t))))
1981 1984
1985(defun primitive-undo (n list)
1986 "Undo N records from the front of the list LIST.
1987Return what remains of the list."
1988
1989 ;; This is a good feature, but would make undo-start
1990 ;; unable to do what is expected.
1991 ;;(when (null (car (list)))
1992 ;; ;; If the head of the list is a boundary, it is the boundary
1993 ;; ;; preceding this command. Get rid of it and don't count it.
1994 ;; (setq list (cdr list))))
1995
1996 (let ((arg n)
1997 ;; In a writable buffer, enable undoing read-only text that is
1998 ;; so because of text properties.
1999 (inhibit-read-only t)
2000 ;; Don't let `intangible' properties interfere with undo.
2001 (inhibit-point-motion-hooks t)
2002 ;; We use oldlist only to check for EQ. ++kfs
2003 (oldlist buffer-undo-list)
2004 (did-apply nil)
2005 (next nil))
2006 (while (> arg 0)
2007 (while (setq next (pop list)) ;Exit inner loop at undo boundary.
2008 ;; Handle an integer by setting point to that value.
2009 (pcase next
2010 ((pred integerp) (goto-char next))
2011 ;; Element (t . TIME) records previous modtime.
2012 ;; Preserve any flag of NONEXISTENT_MODTIME_NSECS or
2013 ;; UNKNOWN_MODTIME_NSECS.
2014 (`(t . ,time)
2015 ;; If this records an obsolete save
2016 ;; (not matching the actual disk file)
2017 ;; then don't mark unmodified.
2018 (when (or (equal time (visited-file-modtime))
2019 (and (consp time)
2020 (equal (list (car time) (cdr time))
2021 (visited-file-modtime))))
2022 (when (fboundp 'unlock-buffer)
2023 (unlock-buffer))
2024 (set-buffer-modified-p nil)))
2025 ;; Element (nil PROP VAL BEG . END) is property change.
2026 (`(nil . ,(or `(,prop ,val ,beg . ,end) pcase--dontcare))
2027 (when (or (> (point-min) beg) (< (point-max) end))
2028 (error "Changes to be undone are outside visible portion of buffer"))
2029 (put-text-property beg end prop val))
2030 ;; Element (BEG . END) means range was inserted.
2031 (`(,(and beg (pred integerp)) . ,(and end (pred integerp)))
2032 ;; (and `(,beg . ,end) `(,(pred integerp) . ,(pred integerp)))
2033 ;; Ideally: `(,(pred integerp beg) . ,(pred integerp end))
2034 (when (or (> (point-min) beg) (< (point-max) end))
2035 (error "Changes to be undone are outside visible portion of buffer"))
2036 ;; Set point first thing, so that undoing this undo
2037 ;; does not send point back to where it is now.
2038 (goto-char beg)
2039 (delete-region beg end))
2040 ;; Element (apply FUN . ARGS) means call FUN to undo.
2041 (`(apply . ,fun-args)
2042 (let ((currbuff (current-buffer)))
2043 (if (integerp (car fun-args))
2044 ;; Long format: (apply DELTA START END FUN . ARGS).
2045 (pcase-let* ((`(,delta ,start ,end ,fun . ,args) fun-args)
2046 (start-mark (copy-marker start nil))
2047 (end-mark (copy-marker end t)))
2048 (when (or (> (point-min) start) (< (point-max) end))
2049 (error "Changes to be undone are outside visible portion of buffer"))
2050 (apply fun args) ;; Use `save-current-buffer'?
2051 ;; Check that the function did what the entry
2052 ;; said it would do.
2053 (unless (and (= start start-mark)
2054 (= (+ delta end) end-mark))
2055 (error "Changes to be undone by function different than announced"))
2056 (set-marker start-mark nil)
2057 (set-marker end-mark nil))
2058 (apply fun-args))
2059 (unless (eq currbuff (current-buffer))
2060 (error "Undo function switched buffer"))
2061 (setq did-apply t)))
2062 ;; Element (STRING . POS) means STRING was deleted.
2063 (`(,(and string (pred stringp)) . ,(and pos (pred integerp)))
2064 (when (let ((apos (abs pos)))
2065 (or (< apos (point-min)) (> apos (point-max))))
2066 (error "Changes to be undone are outside visible portion of buffer"))
2067 (if (< pos 0)
2068 (progn
2069 (goto-char (- pos))
2070 (insert string))
2071 (goto-char pos)
2072 ;; Now that we record marker adjustments
2073 ;; (caused by deletion) for undo,
2074 ;; we should always insert after markers,
2075 ;; so that undoing the marker adjustments
2076 ;; put the markers back in the right place.
2077 (insert string)
2078 (goto-char pos)))
2079 ;; (MARKER . OFFSET) means a marker MARKER was adjusted by OFFSET.
2080 (`(,(and marker (pred markerp)) . ,(and offset (pred integerp)))
2081 (when (marker-buffer marker)
2082 (set-marker marker
2083 (- marker offset)
2084 (marker-buffer marker))))
2085 (_ (error "Unrecognized entry in undo list %S" next))))
2086 (setq arg (1- arg)))
2087 ;; Make sure an apply entry produces at least one undo entry,
2088 ;; so the test in `undo' for continuing an undo series
2089 ;; will work right.
2090 (if (and did-apply
2091 (eq oldlist buffer-undo-list))
2092 (setq buffer-undo-list
2093 (cons (list 'apply 'cdr nil) buffer-undo-list))))
2094 list)
2095
1982;; Deep copy of a list 2096;; Deep copy of a list
1983(defun undo-copy-list (list) 2097(defun undo-copy-list (list)
1984 "Make a copy of undo list LIST." 2098 "Make a copy of undo list LIST."
@@ -3691,7 +3805,7 @@ If `show-trailing-whitespace' is non-nil, this command will just
3691kill the rest of the current line, even if there are only 3805kill the rest of the current line, even if there are only
3692nonblanks there. 3806nonblanks there.
3693 3807
3694If `kill-whole-line' is non-nil, then this command kills the whole line 3808If option `kill-whole-line' is non-nil, then this command kills the whole line
3695including its terminating newline, when used at the beginning of a line 3809including its terminating newline, when used at the beginning of a line
3696with no argument. As a consequence, you can always kill a whole line 3810with no argument. As a consequence, you can always kill a whole line
3697by typing \\[move-beginning-of-line] \\[kill-line]. 3811by typing \\[move-beginning-of-line] \\[kill-line].
@@ -4461,13 +4575,13 @@ to use and more reliable (no dependence on goal column, etc.)."
4461 "Non-nil means vertical motion starting at end of line keeps to ends of lines. 4575 "Non-nil means vertical motion starting at end of line keeps to ends of lines.
4462This means moving to the end of each line moved onto. 4576This means moving to the end of each line moved onto.
4463The beginning of a blank line does not count as the end of a line. 4577The beginning of a blank line does not count as the end of a line.
4464This has no effect when `line-move-visual' is non-nil." 4578This has no effect when the variable `line-move-visual' is non-nil."
4465 :type 'boolean 4579 :type 'boolean
4466 :group 'editing-basics) 4580 :group 'editing-basics)
4467 4581
4468(defcustom goal-column nil 4582(defcustom goal-column nil
4469 "Semipermanent goal column for vertical motion, as set by \\[set-goal-column], or nil. 4583 "Semipermanent goal column for vertical motion, as set by \\[set-goal-column], or nil.
4470A non-nil setting overrides `line-move-visual', which see." 4584A non-nil setting overrides the variable `line-move-visual', which see."
4471 :type '(choice integer 4585 :type '(choice integer
4472 (const :tag "None" nil)) 4586 (const :tag "None" nil))
4473 :group 'editing-basics) 4587 :group 'editing-basics)
@@ -4478,7 +4592,7 @@ A non-nil setting overrides `line-move-visual', which see."
4478It is the column where point was at the start of the current run 4592It is the column where point was at the start of the current run
4479of vertical motion commands. 4593of vertical motion commands.
4480 4594
4481When moving by visual lines via `line-move-visual', it is a cons 4595When moving by visual lines via the function `line-move-visual', it is a cons
4482cell (COL . HSCROLL), where COL is the x-position, in pixels, 4596cell (COL . HSCROLL), where COL is the x-position, in pixels,
4483divided by the default column width, and HSCROLL is the number of 4597divided by the default column width, and HSCROLL is the number of
4484columns by which window is scrolled from left margin. 4598columns by which window is scrolled from left margin.
diff --git a/lisp/subr.el b/lisp/subr.el
index 7e3c181e878..9f19268c864 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3367,16 +3367,17 @@ If BODY finishes, `while-no-input' returns whatever value BODY produced."
3367 (progn ,@body))))))) 3367 (progn ,@body)))))))
3368 3368
3369(defmacro condition-case-unless-debug (var bodyform &rest handlers) 3369(defmacro condition-case-unless-debug (var bodyform &rest handlers)
3370 "Like `condition-case' except that it does not catch anything when debugging. 3370 "Like `condition-case' except that it does not prevent debugging.
3371More specifically if `debug-on-error' is set, then it does not catch any signal." 3371More specifically if `debug-on-error' is set then the debugger will be invoked
3372even if this catches the signal."
3372 (declare (debug condition-case) (indent 2)) 3373 (declare (debug condition-case) (indent 2))
3373 (let ((bodysym (make-symbol "body"))) 3374 `(condition-case ,var
3374 `(let ((,bodysym (lambda () ,bodyform))) 3375 ,bodyform
3375 (if debug-on-error 3376 ,@(mapcar (lambda (handler)
3376 (funcall ,bodysym) 3377 `((debug ,@(if (listp (car handler)) (car handler)
3377 (condition-case ,var 3378 (list (car handler))))
3378 (funcall ,bodysym) 3379 ,@(cdr handler)))
3379 ,@handlers))))) 3380 handlers)))
3380 3381
3381(define-obsolete-function-alias 'condition-case-no-debug 3382(define-obsolete-function-alias 'condition-case-no-debug
3382 'condition-case-unless-debug "24.1") 3383 'condition-case-unless-debug "24.1")
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 7e692960dbc..6ab3e3d3f16 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -63,7 +63,7 @@ Non-nil means use highlight, nil means use minibuffer messages."
63 "Non-nil means Flyspell reports a repeated word as an error. 63 "Non-nil means Flyspell reports a repeated word as an error.
64See `flyspell-mark-duplications-exceptions' to add exceptions to this rule. 64See `flyspell-mark-duplications-exceptions' to add exceptions to this rule.
65Detection of repeated words is not implemented in 65Detection of repeated words is not implemented in
66\"large\" regions; see `flyspell-large-region'." 66\"large\" regions; see variable `flyspell-large-region'."
67 :group 'flyspell 67 :group 'flyspell
68 :type 'boolean) 68 :type 'boolean)
69 69
@@ -145,9 +145,10 @@ whose length is specified by `flyspell-delay'."
145(defcustom flyspell-default-deplacement-commands 145(defcustom flyspell-default-deplacement-commands
146 '(next-line previous-line 146 '(next-line previous-line
147 handle-switch-frame handle-select-window 147 handle-switch-frame handle-select-window
148 scroll-up scroll-down) 148 scroll-up
149 scroll-down)
149 "The standard list of deplacement commands for Flyspell. 150 "The standard list of deplacement commands for Flyspell.
150See `flyspell-deplacement-commands'." 151See variable `flyspell-deplacement-commands'."
151 :group 'flyspell 152 :group 'flyspell
152 :version "21.1" 153 :version "21.1"
153 :type '(repeat (symbol))) 154 :type '(repeat (symbol)))
@@ -445,13 +446,23 @@ like <img alt=\"Some thing.\">."
445;;*---------------------------------------------------------------------*/ 446;;*---------------------------------------------------------------------*/
446;;* Highlighting */ 447;;* Highlighting */
447;;*---------------------------------------------------------------------*/ 448;;*---------------------------------------------------------------------*/
448(defface flyspell-incorrect '((t :underline t :inherit error)) 449(defface flyspell-incorrect
450 '((((supports :underline (:style wave)))
451 :underline (:style wave :color "Red1"))
452 (t
453 :underline t :inherit error))
449 "Flyspell face for misspelled words." 454 "Flyspell face for misspelled words."
455 :version "24.4"
450 :group 'flyspell) 456 :group 'flyspell)
451 457
452(defface flyspell-duplicate '((t :underline t :inherit warning)) 458(defface flyspell-duplicate
459 '((((supports :underline (:style wave)))
460 :underline (:style wave :color "DarkOrange"))
461 (t
462 :underline t :inherit warning))
453 "Flyspell face for words that appear twice in a row. 463 "Flyspell face for words that appear twice in a row.
454See also `flyspell-duplicate-distance'." 464See also `flyspell-duplicate-distance'."
465 :version "24.4"
455 :group 'flyspell) 466 :group 'flyspell)
456 467
457(defvar flyspell-overlay nil) 468(defvar flyspell-overlay nil)
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 067ffdaa1f0..52e97b8248d 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1594,8 +1594,8 @@ You can set this variable in hooks in your init file -- eg:
1594 1594
1595(defun ispell-accept-output (&optional timeout-secs timeout-msecs) 1595(defun ispell-accept-output (&optional timeout-secs timeout-msecs)
1596 "Wait for output from ispell process, or TIMEOUT-SECS and TIMEOUT-MSECS. 1596 "Wait for output from ispell process, or TIMEOUT-SECS and TIMEOUT-MSECS.
1597If asynchronous subprocesses are not supported, call `ispell-filter' and 1597If asynchronous subprocesses are not supported, call function `ispell-filter'
1598pass it the output of the last ispell invocation." 1598and pass it the output of the last ispell invocation."
1599 (if ispell-async-processp 1599 (if ispell-async-processp
1600 (accept-process-output ispell-process timeout-secs timeout-msecs) 1600 (accept-process-output ispell-process timeout-secs timeout-msecs)
1601 (if (null ispell-process) 1601 (if (null ispell-process)
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index a7e44402a26..b7288772034 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1926,7 +1926,7 @@ This takes effect when first loading the library.")
1926 ("ul" . "Unordered list") 1926 ("ul" . "Unordered list")
1927 ("var" . "Math variable face") 1927 ("var" . "Math variable face")
1928 ("wbr" . "Enable <br> within <nobr>")) 1928 ("wbr" . "Enable <br> within <nobr>"))
1929 "Value of `sgml-tag-help' for HTML mode.") 1929 "Value of variable `sgml-tag-help' for HTML mode.")
1930 1930
1931(defvar outline-regexp) 1931(defvar outline-regexp)
1932(defvar outline-heading-end-regexp) 1932(defvar outline-heading-end-regexp)
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el
index 2423d322460..fa451ccbe20 100644
--- a/lisp/vc/compare-w.el
+++ b/lisp/vc/compare-w.el
@@ -53,13 +53,13 @@ whitespace is considered to match, and is skipped."
53 :group 'compare-windows) 53 :group 'compare-windows)
54 54
55(defcustom compare-ignore-whitespace nil 55(defcustom compare-ignore-whitespace nil
56 "Non-nil means `compare-windows' ignores whitespace." 56 "Non-nil means command `compare-windows' ignores whitespace."
57 :type 'boolean 57 :type 'boolean
58 :group 'compare-windows 58 :group 'compare-windows
59 :version "22.1") 59 :version "22.1")
60 60
61(defcustom compare-ignore-case nil 61(defcustom compare-ignore-case nil
62 "Non-nil means `compare-windows' ignores case differences." 62 "Non-nil means command `compare-windows' ignores case differences."
63 :type 'boolean 63 :type 'boolean
64 :group 'compare-windows) 64 :group 'compare-windows)
65 65
@@ -379,7 +379,7 @@ on third call it again advances points to the next difference and so on."
379 (delete-overlay compare-windows-overlay2))))) 379 (delete-overlay compare-windows-overlay2)))))
380 380
381(defun compare-windows-dehighlight () 381(defun compare-windows-dehighlight ()
382 "Remove highlighting created by `compare-windows-highlight'." 382 "Remove highlighting created by function `compare-windows-highlight'."
383 (interactive) 383 (interactive)
384 (remove-hook 'pre-command-hook 'compare-windows-dehighlight) 384 (remove-hook 'pre-command-hook 'compare-windows-dehighlight)
385 (mapc 'delete-overlay compare-windows-overlays1) 385 (mapc 'delete-overlay compare-windows-overlays1)
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index d0e496d2d21..8b4ff792969 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -86,7 +86,7 @@ exists. If NO-ASYNC is non-nil, call diff synchronously.
86 86
87When called interactively with a prefix argument, prompt 87When called interactively with a prefix argument, prompt
88interactively for diff switches. Otherwise, the switches 88interactively for diff switches. Otherwise, the switches
89specified in `diff-switches' are passed to the diff command." 89specified in the variable `diff-switches' are passed to the diff command."
90 (interactive 90 (interactive
91 (let* ((newf (if (and buffer-file-name (file-exists-p buffer-file-name)) 91 (let* ((newf (if (and buffer-file-name (file-exists-p buffer-file-name))
92 (read-file-name 92 (read-file-name
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index f8e753772e4..dfc7eee81a6 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -953,13 +953,14 @@ line of MSG."
953 (while (re-search-forward (concat "^" (car header) 953 (while (re-search-forward (concat "^" (car header)
954 ":" log-edit-header-contents-regexp) 954 ":" log-edit-header-contents-regexp)
955 nil t) 955 nil t)
956 (if (eq t (cdr header)) 956 (let ((txt (match-string 1)))
957 (setq summary (match-string 1)) 957 (replace-match "" t t)
958 (if (functionp (cdr header)) 958 (if (eq t (cdr header))
959 (setq res (nconc res (funcall (cdr header) (match-string 1)))) 959 (setq summary txt)
960 (push (match-string 1) res) 960 (if (functionp (cdr header))
961 (push (or (cdr header) (car header)) res))) 961 (setq res (nconc res (funcall (cdr header) txt)))
962 (replace-match "" t t))) 962 (push txt res)
963 (push (or (cdr header) (car header)) res))))))
963 ;; Remove header separator if the header is empty. 964 ;; Remove header separator if the header is empty.
964 (widen) 965 (widen)
965 (goto-char (point-min)) 966 (goto-char (point-min))
diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el
index 52dc7edfa2d..208b93d9670 100644
--- a/lisp/vc/pcvs.el
+++ b/lisp/vc/pcvs.el
@@ -856,7 +856,8 @@ the problem."
856(defun cvs-cleanup-collection (c rm-handled rm-dirs rm-msgs) 856(defun cvs-cleanup-collection (c rm-handled rm-dirs rm-msgs)
857 "Remove undesired entries. 857 "Remove undesired entries.
858C is the collection 858C is the collection
859RM-HANDLED if non-nil means remove handled entries. 859RM-HANDLED if non-nil means remove handled entries (if file is currently
860 visited, only remove if value is `all').
860RM-DIRS behaves like `cvs-auto-remove-directories'. 861RM-DIRS behaves like `cvs-auto-remove-directories'.
861RM-MSGS if non-nil means remove messages." 862RM-MSGS if non-nil means remove messages."
862 (let (last-fi first-dir (rerun t)) 863 (let (last-fi first-dir (rerun t))
@@ -870,16 +871,17 @@ RM-MSGS if non-nil means remove messages."
870 (subtype (cvs-fileinfo->subtype fi)) 871 (subtype (cvs-fileinfo->subtype fi))
871 (keep 872 (keep
872 (pcase type 873 (pcase type
873 ;; remove temp messages and keep the others 874 ;; Remove temp messages and keep the others.
874 (`MESSAGE (not (or rm-msgs (eq subtype 'TEMP)))) 875 (`MESSAGE (not (or rm-msgs (eq subtype 'TEMP))))
875 ;; remove entries 876 ;; Remove dead entries.
876 (`DEAD nil) 877 (`DEAD nil)
877 ;; handled also? 878 ;; Handled also?
878 (`UP-TO-DATE 879 (`UP-TO-DATE
879 (if (find-buffer-visiting (cvs-fileinfo->full-name fi)) 880 (not
880 t 881 (if (find-buffer-visiting (cvs-fileinfo->full-name fi))
881 (not rm-handled))) 882 (eq rm-handled 'all)
882 ;; keep the rest 883 rm-handled)))
884 ;; Keep the rest.
883 (_ (not (run-hook-with-args-until-success 885 (_ (not (run-hook-with-args-until-success
884 'cvs-cleanup-functions fi)))))) 886 'cvs-cleanup-functions fi))))))
885 887
@@ -2121,7 +2123,7 @@ if you are convinced that the process that created the lock is dead."
2121Empty directories are removed." 2123Empty directories are removed."
2122 (interactive) 2124 (interactive)
2123 (cvs-cleanup-collection cvs-cookies 2125 (cvs-cleanup-collection cvs-cookies
2124 t (or cvs-auto-remove-directories 'handled) t)) 2126 'all (or cvs-auto-remove-directories 'handled) t))
2125 2127
2126 2128
2127(defun-cvs-mode cvs-mode-acknowledge () 2129(defun-cvs-mode cvs-mode-acknowledge ()
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index f436d300089..0968c83ae5f 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -620,15 +620,24 @@ or a superior directory.")
620 620
621(declare-function log-edit-extract-headers "log-edit" (headers string)) 621(declare-function log-edit-extract-headers "log-edit" (headers string))
622 622
623(defun vc-bzr--sanitize-header (arg)
624 ;; Newlines in --fixes (and probably other fields as well) trigger a nasty
625 ;; Bazaar bug; see https://bugs.launchpad.net/bzr/+bug/1094180.
626 (lambda (str) (list arg
627 (replace-regexp-in-string "\\`[ \t]+\\|[ \t]+\\'"
628 "" (replace-regexp-in-string
629 "\n[ \t]?" " " str)))))
630
623(defun vc-bzr-checkin (files rev comment) 631(defun vc-bzr-checkin (files rev comment)
624 "Check FILES in to bzr with log message COMMENT. 632 "Check FILES in to bzr with log message COMMENT.
625REV non-nil gets an error." 633REV non-nil gets an error."
626 (if rev (error "Can't check in a specific revision with bzr")) 634 (if rev (error "Can't check in a specific revision with bzr"))
627 (apply 'vc-bzr-command "commit" nil 0 635 (apply 'vc-bzr-command "commit" nil 0 files
628 files (cons "-m" (log-edit-extract-headers '(("Author" . "--author") 636 (cons "-m" (log-edit-extract-headers
629 ("Date" . "--commit-time") 637 `(("Author" . ,(vc-bzr--sanitize-header "--author"))
630 ("Fixes" . "--fixes")) 638 ("Date" . ,(vc-bzr--sanitize-header "--commit-time"))
631 comment)))) 639 ("Fixes" . ,(vc-bzr--sanitize-header "--fixes")))
640 comment))))
632 641
633(defun vc-bzr-find-revision (file rev buffer) 642(defun vc-bzr-find-revision (file rev buffer)
634 "Fetch revision REV of file FILE and put it into BUFFER." 643 "Fetch revision REV of file FILE and put it into BUFFER."
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 5a2b47bb34f..99436303fa2 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -703,19 +703,21 @@ Before doing that, check if there are any old backups and get rid of them."
703 ;; the state to 'edited and redisplay the mode line. 703 ;; the state to 'edited and redisplay the mode line.
704 (let* ((file buffer-file-name) 704 (let* ((file buffer-file-name)
705 (backend (vc-backend file))) 705 (backend (vc-backend file)))
706 (and backend 706 (cond
707 (or (and (equal (vc-file-getprop file 'vc-checkout-time) 707 ((null backend))
708 (nth 5 (file-attributes file))) 708 ((eq (vc-checkout-model backend (list file)) 'implicit)
709 ;; File has been saved in the same second in which 709 ;; If the file was saved in the same second in which it was
710 ;; it was checked out. Clear the checkout-time 710 ;; checked out, clear the checkout-time to avoid confusion.
711 ;; to avoid confusion. 711 (if (equal (vc-file-getprop file 'vc-checkout-time)
712 (vc-file-setprop file 'vc-checkout-time nil)) 712 (nth 5 (file-attributes file)))
713 t) 713 (vc-file-setprop file 'vc-checkout-time nil))
714 (eq (vc-checkout-model backend (list file)) 'implicit) 714 (if (vc-state-refresh file backend)
715 (vc-state-refresh file backend) 715 (vc-mode-line file backend)))
716 (vc-mode-line file backend)) 716 ;; If we saved an unlocked file on a locking based VCS, that
717 ;; Try to avoid unnecessary work, a *vc-dir* buffer is 717 ;; file is not longer up-to-date.
718 ;; present if this is true. 718 ((eq (vc-file-getprop file 'vc-state) 'up-to-date)
719 (vc-file-setprop file 'vc-state nil)))
720 ;; Resynch *vc-dir* buffers, if any are present.
719 (when vc-dir-buffers 721 (when vc-dir-buffers
720 (vc-dir-resynch-file file)))) 722 (vc-dir-resynch-file file))))
721 723
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index fe259806267..9b8b94916c4 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -659,6 +659,10 @@
659(eval-when-compile 659(eval-when-compile
660 (require 'dired)) 660 (require 'dired))
661 661
662(declare-function dired-get-filename "dired" (&optional localp noerror))
663(declare-function dired-move-to-filename "dired" (&optional err eol))
664(declare-function dired-marker-regexp "dired" ())
665
662(unless (assoc 'vc-parent-buffer minor-mode-alist) 666(unless (assoc 'vc-parent-buffer minor-mode-alist)
663 (setq minor-mode-alist 667 (setq minor-mode-alist
664 (cons '(vc-parent-buffer vc-parent-buffer-name) 668 (cons '(vc-parent-buffer vc-parent-buffer-name)
@@ -1072,6 +1076,17 @@ For old-style locking-based version control systems, like RCS:
1072 ;; among all the `files'. 1076 ;; among all the `files'.
1073 (model (nth 4 vc-fileset))) 1077 (model (nth 4 vc-fileset)))
1074 1078
1079 ;; If a buffer has unsaved changes, a checkout would discard those
1080 ;; changes, so treat the buffer as having unlocked changes.
1081 (when (and (not (eq model 'implicit)) (eq state 'up-to-date))
1082 (let ((files files))
1083 (while files
1084 (let ((buffer (get-file-buffer (car files))))
1085 (and buffer
1086 (buffer-modified-p buffer)
1087 (setq state 'unlocked-changes
1088 files nil))))))
1089
1075 ;; Do the right thing 1090 ;; Do the right thing
1076 (cond 1091 (cond
1077 ((eq state 'missing) 1092 ((eq state 'missing)
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index e2a726f4264..ed7edbc5a68 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1271,19 +1271,19 @@ SYMBOL is a valid symbol associated with CHAR.
1271 1271
1272(defvar whitespace-point (point) 1272(defvar whitespace-point (point)
1273 "Used to save locally current point value. 1273 "Used to save locally current point value.
1274Used by `whitespace-trailing-regexp' function (which see).") 1274Used by function `whitespace-trailing-regexp' (which see).")
1275 1275
1276(defvar whitespace-font-lock-refontify nil 1276(defvar whitespace-font-lock-refontify nil
1277 "Used to save locally the font-lock refontify state. 1277 "Used to save locally the font-lock refontify state.
1278Used by `whitespace-post-command-hook' function (which see).") 1278Used by function `whitespace-post-command-hook' (which see).")
1279 1279
1280(defvar whitespace-bob-marker nil 1280(defvar whitespace-bob-marker nil
1281 "Used to save locally the bob marker value. 1281 "Used to save locally the bob marker value.
1282Used by `whitespace-post-command-hook' function (which see).") 1282Used by function `whitespace-post-command-hook' (which see).")
1283 1283
1284(defvar whitespace-eob-marker nil 1284(defvar whitespace-eob-marker nil
1285 "Used to save locally the eob marker value. 1285 "Used to save locally the eob marker value.
1286Used by `whitespace-post-command-hook' function (which see).") 1286Used by function `whitespace-post-command-hook' (which see).")
1287 1287
1288(defvar whitespace-buffer-changed nil 1288(defvar whitespace-buffer-changed nil
1289 "Used to indicate locally if buffer changed. 1289 "Used to indicate locally if buffer changed.
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 5402b0ec204..fb62b039d79 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -526,7 +526,16 @@ Otherwise, just return the value."
526 "Extract the default external value of WIDGET." 526 "Extract the default external value of WIDGET."
527 (widget-apply widget :value-to-external 527 (widget-apply widget :value-to-external
528 (or (widget-get widget :value) 528 (or (widget-get widget :value)
529 (widget-apply widget :default-get)))) 529 (progn
530 (when (widget-get widget :args)
531 (let (args)
532 (dolist (arg (widget-get widget :args))
533 (setq args (append args
534 (if (widget-get arg :inline)
535 (widget-get arg :args)
536 (list arg)))))
537 (widget-put widget :args args)))
538 (widget-apply widget :default-get)))))
530 539
531(defun widget-match-inline (widget vals) 540(defun widget-match-inline (widget vals)
532 "In WIDGET, match the start of VALS." 541 "In WIDGET, match the start of VALS."
diff --git a/m4/largefile.m4 b/m4/largefile.m4
index 62f2b1403c4..1e605e3d829 100644
--- a/m4/largefile.m4
+++ b/m4/largefile.m4
@@ -5,9 +5,10 @@
5# gives unlimited permission to copy and/or distribute it, 5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved. 6# with or without modifications, as long as this notice is preserved.
7 7
8# The following implementation works around a problem in autoconf <= 2.68; 8# The following implementation works around a problem in autoconf <= 2.69;
9# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5. 9# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5,
10m4_version_prereq([2.69], [] ,[ 10# or configures them incorrectly in some cases.
11m4_version_prereq([2.70], [] ,[
11 12
12# _AC_SYS_LARGEFILE_TEST_INCLUDES 13# _AC_SYS_LARGEFILE_TEST_INCLUDES
13# ------------------------------- 14# -------------------------------
@@ -25,9 +26,9 @@ m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
25 26
26 27
27# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, 28# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
28# CACHE-VAR, 29# CACHE-VAR,
29# DESCRIPTION, 30# DESCRIPTION,
30# PROLOGUE, [FUNCTION-BODY]) 31# PROLOGUE, [FUNCTION-BODY])
31# -------------------------------------------------------- 32# --------------------------------------------------------
32m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], 33m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
33[AC_CACHE_CHECK([for $1 value needed for large files], [$3], 34[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
@@ -93,15 +94,11 @@ if test "$enable_largefile" != no; then
93 [_AC_SYS_LARGEFILE_TEST_INCLUDES]) 94 [_AC_SYS_LARGEFILE_TEST_INCLUDES])
94 fi 95 fi
95 96
96 AH_VERBATIM([_DARWIN_USE_64_BIT_INODE], 97 AC_DEFINE([_DARWIN_USE_64_BIT_INODE], [1],
97[/* Enable large inode numbers on Mac OS X. */ 98 [Enable large inode numbers on Mac OS X 10.5.])
98#ifndef _DARWIN_USE_64_BIT_INODE
99# define _DARWIN_USE_64_BIT_INODE 1
100#endif])
101fi 99fi
102])# AC_SYS_LARGEFILE 100])# AC_SYS_LARGEFILE
103 101])# m4_version_prereq 2.70
104])# m4_version_prereq 2.69
105 102
106# Enable large files on systems where this is implemented by Gnulib, not by the 103# Enable large files on systems where this is implemented by Gnulib, not by the
107# system headers. 104# system headers.
diff --git a/make-dist b/make-dist
index 60afb0c618f..788dca3462c 100755
--- a/make-dist
+++ b/make-dist
@@ -87,6 +87,13 @@ while [ $# -gt 0 ]; do
87 "--lzma") 87 "--lzma")
88 default_gzip="lzma" 88 default_gzip="lzma"
89 ;; 89 ;;
90 ## Same with xz.
91 "--xz")
92 default_gzip="xz"
93 ;;
94 "--no-compress")
95 default_gzip="cat"
96 ;;
90 97
91 "--snapshot") 98 "--snapshot")
92 clean_up=yes 99 clean_up=yes
@@ -101,6 +108,8 @@ while [ $# -gt 0 ]; do
101 echo " --bzip2 use bzip2 instead of gzip" 108 echo " --bzip2 use bzip2 instead of gzip"
102 echo " --clean-up delete staging directories when done" 109 echo " --clean-up delete staging directories when done"
103 echo " --lzma use lzma instead of gzip" 110 echo " --lzma use lzma instead of gzip"
111 echo " --xz use xz instead of gzip"
112 echo " --no-compress don't compress"
104 echo " --newer=TIME don't include files older than TIME" 113 echo " --newer=TIME don't include files older than TIME"
105 echo " --no-check don't check for bad file names etc." 114 echo " --no-check don't check for bad file names etc."
106 echo " --no-update don't recompile or do analogous things" 115 echo " --no-update don't recompile or do analogous things"
@@ -510,6 +519,7 @@ if [ "${make_tar}" = yes ]; then
510 case "${default_gzip}" in 519 case "${default_gzip}" in
511 bzip2) gzip_extension=.bz2 ;; 520 bzip2) gzip_extension=.bz2 ;;
512 lzma) gzip_extension=.lzma ;; 521 lzma) gzip_extension=.lzma ;;
522 xz) gzip_extension=.xz ;;
513 gzip) gzip_extension=.gz ; default_gzip="gzip --best";; 523 gzip) gzip_extension=.gz ; default_gzip="gzip --best";;
514 *) gzip_extension= ;; 524 *) gzip_extension= ;;
515 esac 525 esac
diff --git a/nt/ChangeLog b/nt/ChangeLog
index b44a4121b36..aca1236657b 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,13 @@
12013-01-11 Eli Zaretskii <eliz@gnu.org>
2
3 * inc/unistd.h (O_IGNORE_CTTY): Define, as it is unconditionally
4 used in term.c. (Bug#13387)
5
62013-01-09 Juanma Barranquero <lekktu@gmail.com>
7
8 * config.nt: Sync with autogen/config.in.
9 (HAVE_GTK_HANDLE_BOX_NEW, HAVE_GTK_TEAROFF_MENU_ITEM_NEW): New macros.
10
12012-12-24 Eli Zaretskii <eliz@gnu.org> 112012-12-24 Eli Zaretskii <eliz@gnu.org>
2 12
3 * inc/sys/stat.h (S_ISMPX): Define to zero, to accommodate changes 13 * inc/sys/stat.h (S_ISMPX): Define to zero, to accommodate changes
diff --git a/nt/config.nt b/nt/config.nt
index 24bf6814829..2a8c54baa47 100644
--- a/nt/config.nt
+++ b/nt/config.nt
@@ -485,12 +485,18 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
485/* Define to 1 if you have the `gtk_file_selection_new' function. */ 485/* Define to 1 if you have the `gtk_file_selection_new' function. */
486#undef HAVE_GTK_FILE_SELECTION_NEW 486#undef HAVE_GTK_FILE_SELECTION_NEW
487 487
488/* Define to 1 if you have the `gtk_handle_box_new' function. */
489#undef HAVE_GTK_HANDLE_BOX_NEW
490
488/* Define to 1 if you have the `gtk_main' function. */ 491/* Define to 1 if you have the `gtk_main' function. */
489#undef HAVE_GTK_MAIN 492#undef HAVE_GTK_MAIN
490 493
491/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */ 494/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */
492#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION 495#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
493 496
497/* Define to 1 if you have the `gtk_tearoff_menu_item_new' function. */
498#undef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
499
494/* Define to 1 if you have the `gtk_widget_get_mapped' function. */ 500/* Define to 1 if you have the `gtk_widget_get_mapped' function. */
495#undef HAVE_GTK_WIDGET_GET_MAPPED 501#undef HAVE_GTK_WIDGET_GET_MAPPED
496 502
diff --git a/nt/inc/unistd.h b/nt/inc/unistd.h
index 5fdd9c8eb88..9c8a64d5ed2 100644
--- a/nt/inc/unistd.h
+++ b/nt/inc/unistd.h
@@ -27,6 +27,7 @@ extern int faccessat (int, char const *, int, int);
27#define AT_SYMLINK_NOFOLLOW 4096 27#define AT_SYMLINK_NOFOLLOW 4096
28 28
29#define O_NOCTTY 0 29#define O_NOCTTY 0
30#define O_IGNORE_CTTY 0
30 31
31/* This is normally on stdlib.h, but we don't override that header. */ 32/* This is normally on stdlib.h, but we don't override that header. */
32extern int unsetenv (const char *); 33extern int unsetenv (const char *);
diff --git a/src/ChangeLog b/src/ChangeLog
index c0c85c15ee9..115b8d42915 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,9 +1,249 @@
12013-01-15 Paul Eggert <eggert@cs.ucla.edu>
2
3 * alloc.c (free_save_value): Now static.
4
52013-01-15 Dmitry Antipov <dmantipov@yandex.ru>
6
7 * keymap.c (map_keymap_internal): Use format_save_value.
8 (map_keymap_char_table_item): Adjust accordingly.
9 * fileio.c (non_regular_fd, non_regular_inserted)
10 (non_regular_nbytes): Remove.
11 (Finsert_file_contents): Convert trytry to ptrdiff_t. Use
12 format_save_value to pass parameters to read_non_regular.
13 (read_non_regular): Use XSAVE_ macros to extract parameters.
14 Adjust comment.
15 * xmenu.c (xmenu_show) [!USE_X_TOOLKIT && !USE_GTK]: Use
16 format_save_value.
17 (pop_down_menu) [!USE_X_TOOLKIT && !USE_GTK]: Adjust user.
18
192013-01-15 Dmitry Antipov <dmantipov@yandex.ru>
20
21 * lisp.h (XSAVE_POINTER, XSAVE_INTEGER): Change to allow
22 extraction from any Lisp_Save_Value slot. Add type checking.
23 * alloc.c, dired.c, editfns.c, fileio.c, ftfont.c, gtkutil.c:
24 * keymap.c, lread.c, nsterm.h, nsmenu.c, xfns.c, xmenu.c:
25 * xselect.c: All users changed.
26
272013-01-15 Dmitry Antipov <dmantipov@yandex.ru>
28
29 Some convenient bits to deal with Lisp_Save_Values.
30 * lisp.h (XSAVE_OBJECT): New macro to extract saved objects.
31 (allocate_misc): Remove prototype.
32 (format_save_value): New prototype.
33 * alloc.c (allocate_misc): Revert back to static.
34 (format_save_value): New function to build Lisp_Save_Value
35 object with the specified internal structure.
36 (make_save_value): Reimplement using format_save_value.
37 * editfns.c (save_excursion_save): Use format_save_value.
38 (save_excursion_restore): Use XSAVE_OBJECT.
39
402013-01-14 Paul Eggert <eggert@cs.ucla.edu>
41
42 Avoid needless casts with XSAVE_POINTER.
43 * alloc.c (mark_object) [GC_MARK_STACK]:
44 * dired.c (directory_files_internal_unwind):
45 * fileio.c (do_auto_save_unwind):
46 * gtkutil.c (pop_down_dialog):
47 * keymap.c (map_keymap_char_table_item):
48 * lread.c (load_unwind):
49 * nsmenu.m (pop_down_menu):
50 * print.c (print_object) [GC_MARK_STACK]:
51 * xfns.c (clean_up_file_dialog):
52 * xmenu.c (cleanup_widget_value_tree):
53 Omit casts between XSAVE_POINTER and a pointer type.
54
552013-01-14 Dmitry Antipov <dmantipov@yandex.ru>
56
57 Fix compilation with GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE.
58 * eval.c (eval_sub): Protect `form' from being GCed before its
59 car and cdr becomes protected with the backtrace entry.
60
612013-01-14 Dmitry Antipov <dmantipov@yandex.ru>
62
63 Make Lisp_Save_Value more versatile storage for up to four objects.
64 * lisp.h (toplevel): Enumeration to describe types of saved objects.
65 (struct Lisp_Save_Value): New layout. Adjust comments.
66 (XSAVE_POINTER): New macro.
67 (XSAVE_INTEGER): Likewise.
68 (allocate_misc): Add prototype.
69 (free_misc): Likewise.
70 * alloc.c (allocate_misc): Now global.
71 (free_misc): Likewise. Adjust comment.
72 (make_save_value): Use new Lisp_Save_Value layout. Adjust comment.
73 (free_save_value): Likewise.
74 (mark_object): Likewise.
75 * editfns.c (save_excursion_save): Pack everything within
76 Lisp_Save_Value and so avoid xmalloc.
77 (save_excursion_restore): Adjust to match new layout. Use free_misc
78 because we do not allocate extra memory any more. Add eassert.
79 * print.c (print_object): New code to print Lisp_Save_Value. Do not
80 rely on valid_lisp_object_p if !GC_MARK_STACK. Adjust comments.
81 * dired.c, fileio.c, font.c, ftfont.c, gtkutil.c, keymap.c,
82 * lread.c, nsmenu.m, nsterm.h, xfns.c, xmenu.c, xselect.c:
83 Use XSAVE_POINTER and XSAVE_INTEGER where appropriate.
84
852013-01-13 Jan Djärv <jan.h.d@swipnet.se>
86
87 * nsfont.m (LCD_SMOOTHING_MARGIN): New define.
88 (nsfont_draw): Remove disabling of LCD smoothing.
89 (ns_glyph_metrics): Add LCD_SMOOTHING_MARGIN to bearings to fix
90 Bug#11484 with LCD smoothing on.
91
922013-01-13 Paul Eggert <eggert@cs.ucla.edu>
93
94 Fix SIGDANGER handlers, for AIX (Bug#13408).
95 * sysdep.c.c (handle_danger_signal, deliver_danger_signal) [SIGDANGER]:
96 Move handlers here from emacs.c; they were out of place.
97
982013-01-11 Jan Djärv <jan.h.d@swipnet.se>
99
100 * xterm.c (syms_of_xterm): Adjust documentation for
101 scroll-bar-adjust-thumb-portion.
102
1032012-12-31 Adam Sjøgren <asjo@koldfront.dk> (tiny change)
104
105 * xterm.c (scroll-bar-adjust-thumb-portion): New variable to
106 determine whether scroll bar thumb size should be adjusted or
107 not. Use variable for MOTIF.
108
109 * gtkutil.c (scroll-bar-adjust-thumb-portion): Use variable for
110 GTK.
111
1122013-01-13 Jan Djärv <jan.h.d@swipnet.se>
113
114 * nsterm.m (keyDown:): Set processingCompose to NO if an emacs key
115 event is generated.
116 (doCommandBySelector:): Set processingCompose to NO.
117
118 * nsfont.m (ns_findfonts): Add block/unblock_input calls.
119 Remove check for fkeys count > zero, block/unblock fixes the real bug.
120 (nsfont_list_family): Add block/unblock_input calls.
121 (nsfont_open): Move block_input earlier. Add unblock_input before early
122 return.
123 (nsfont_draw): Add block/unblock_input calls.
124
1252013-01-12 Dmitry Antipov <dmantipov@yandex.ru>
126
127 * indent.c (Fvertical_motion): Remove now-incorrect GCPROs
128 for old_charpos and old_bytepos.
129
1302013-01-12 Paul Eggert <eggert@cs.ucla.edu>
131
132 Fix bug with set-time-zone-rule and LOCALTIME_CACHE (Bug#13415).
133 * editfns.c (set_time_zone_rule) [LOCALTIME_CACHE]:
134 Clear tzvalbuf_in_environ if this workaround is in effect.
135 Problem and fix reported by Kazuhiro Ito.
136
1372013-01-11 Aaron S. Hawley <Aaron.Hawley@vtinfo.com>
138
139 * insdel.c (Fcombine_after_change_execute, syms_of_insdel): Fix
140 ambiguous doc string cross-reference(s).
141
142 * keyboard.c (Fcommand_execute, syms_of_keyboard): Fix ambiguous
143 doc string cross-reference(s).
144
145 * window.c (Fwindow_point, syms_of_window): Fix ambiguous doc
146 string cross-reference(s).
147
1482013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
149
150 Avoid unnecessary byte position calculation for the gap movement.
151 Since all users of move_gap do CHAR_TO_BYTE for other purposes
152 anyway, all of them should use move_gap_both instead.
153 * lisp.h (move_gap): Remove prototype.
154 * insdel.c (move_gap): Remove.
155 (move_gap_both): Add eassert.
156 * editfns.c (Ftranspose_regions): Tweak to use move_gap_both.
157 * xml.c (parse_region): Likewise.
158
1592013-01-11 Paul Eggert <eggert@cs.ucla.edu>
160
161 emacsclient -t should not suspend Emacs server (Bug#13387)
162 * lisp.h, sysdep.c (block_tty_out_signal, unblock_tty_out_signal):
163 New functions.
164 * term.c (init_tty): Use them instead of rolling our own code.
165 * sysdep.c (tcsetpgrp_without_stopping): Likewise. Here, this
166 switches from 'signal' to 'pthread_sigmask', which is safer in
167 multithreaded applications.
168 * term.c (Fresume_tty): Don't bother dissociating if O_IGNORE_CTTY,
169 which has already arranged for that.
170 (dissociate_if_controlling_tty): If setsid fails, fall back on TIOCNOTTY.
171 This is the main part of the bug fix.
172
1732013-01-10 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> (tiny change)
174
175 * gtkutil.c (xg_initialize): Add ifdef HAVE_FREETYPE around
176 x_last_font_name (Bug#13403).
177
1782013-01-10 Dmitry Antipov <dmantipov@yandex.ru>
179
180 Omit buffer_slot_type_mismatch and use generic predicates to enforce
181 the type of per-buffer values where appropriate.
182 * lisp.h (struct Lisp_Buffer_Objfwd): Rename slottype member to
183 predicate, which is how it's really used now. Adjust comment.
184 * buffer.h (buffer_slot_type_mismatch): Remove prototype.
185 * buffer.c (buffer_slot_type_mismatch): Remove.
186 (DEFVAR_PER_BUFFER, defvar_per_buffer): Rename type argument to
187 predicate. Adjust comment.
188 (syms_of_buffer): Use Qsymbolp for major-mode. Use Qintegerp for
189 fill-column, left-margin, tab-width, buffer-saved-size,
190 left-margin-width, right-margin-width, left-fringe-width,
191 right-fringe-width, scroll-bar-width and buffer-display-count.
192 Use Qstringp for default-directory, buffer-file-name,
193 buffer-file-truename and buffer-auto-save-file-name. Use Qfloatp for
194 scroll-up-aggressively and scroll-down-aggressively. Use Qnumberp for
195 line-spacing.
196 * data.c (store_symval_forwarding): Adjust to call the predicate.
197
1982013-01-09 Juanma Barranquero <lekktu@gmail.com>
199
200 * w32.c (get_name_and_id, acl_set_file):
201 * w32term.c (w32fullscreen_hook): Remove unused local variables.
202
2032013-01-09 Dmitry Antipov <dmantipov@yandex.ru>
204
205 * lisp.h (make_gap_1): New prototype.
206 * buffer.h (GAP_BYTES_DFL, GAP_BYTES_MIN): New macros for the special
207 gap size values.
208 * editfns.c (Fbuffer_size): Rename from Fbufsize to fit the common
209 naming convention.
210 (syms_of_editfns): Adjust defsubr. Drop commented-out obsolete code.
211 * insdel.c (make_gap_larger): Use GAP_BYTES_DFL. Adjust comment.
212 (make_gap_smaller): Use GAP_BYTES_MIN. Adjust comment.
213 (make_gap_1): New function to adjust the gap of any buffer.
214 * coding.c (coding_alloc_by_making_gap): Use it.
215 * buffer.c (compact_buffer): Likewise. Use BUF_Z_BYTE, BUF_GAP_SIZE,
216 GAP_BYTES_DFL and GAP_BYTES_MIN. Adjust comment.
217
2182013-01-08 Juri Linkov <juri@jurta.org>
219
220 * xfaces.c (tty_supports_face_attributes_p): Return 0 for the case
221 of (supports :underline (:style wave)). (Bug#13000)
222
2232013-01-08 Aaron S. Hawley <aaron.s.hawley@gmail.com>
224
225 * undo.c (Fprimitive_undo): Move to simple.el.
226 (syms_of_undo): Remove declarations for Sprimitive_undo.
227
2282013-01-08 Stefan Monnier <monnier@iro.umontreal.ca>
229
230 * keyboard.c (echo_add_key): Rename from echo_add_char.
231
2322013-01-06 Chong Yidong <cyd@gnu.org>
233
234 * keyboard.c (echo_add_char): New function, factored out from
235 echo_char. Don't add a space if the previous echo string was
236 empty (Bug#13255).
237 (echo_char): Use it.
238 (read_key_sequence): When echoing mock input, ensure that the
239 trailing dash is properly added.
240
12013-01-05 Eli Zaretskii <eliz@gnu.org> 2412013-01-05 Eli Zaretskii <eliz@gnu.org>
2 242
3 * xdisp.c (dump_glyph): Align glyph data better. Use "pD" instead 243 * xdisp.c (dump_glyph): Align glyph data better. Use "pD" instead
4 of a non-portable "t" to print ptrdiff_t values. Allow up to 9 244 of a non-portable "t" to print ptrdiff_t values. Allow up to 9
5 digits for buffer positions, before misalignment starts. Display 245 digits for buffer positions, before misalignment starts.
6 "0" for integer "object" field. 246 Display "0" for integer "object" field.
7 (dump_glyph_row): Adapt the header line to changes in dump_glyph. 247 (dump_glyph_row): Adapt the header line to changes in dump_glyph.
8 Display the newline glyph more unambiguously. 248 Display the newline glyph more unambiguously.
9 249
@@ -44,8 +284,8 @@
442012-12-31 Eli Zaretskii <eliz@gnu.org> 2842012-12-31 Eli Zaretskii <eliz@gnu.org>
45 285
46 * w32.c (unsetenv): Set up the string passed to _putenv 286 * w32.c (unsetenv): Set up the string passed to _putenv
47 correctly. See 287 correctly.
48 http://lists.gnu.org/archive/html/emacs-devel/2012-12/msg00863.html 288 See http://lists.gnu.org/archive/html/emacs-devel/2012-12/msg00863.html
49 for the bug this caused. 289 for the bug this caused.
50 290
512012-12-30 Paul Eggert <eggert@cs.ucla.edu> 2912012-12-30 Paul Eggert <eggert@cs.ucla.edu>
@@ -117,8 +357,8 @@
117 357
1182012-12-27 Eli Zaretskii <eliz@gnu.org> 3582012-12-27 Eli Zaretskii <eliz@gnu.org>
119 359
120 * fileio.c (file_name_as_directory, directory_file_name): Accept 360 * fileio.c (file_name_as_directory, directory_file_name):
121 an additional argument MULTIBYTE to indicate whether the input C 361 Accept an additional argument MULTIBYTE to indicate whether the input C
122 came from a multibyte or a unibyte Lisp string; all callers 362 came from a multibyte or a unibyte Lisp string; all callers
123 adjusted. Don't assume the input string is always multibyte. 363 adjusted. Don't assume the input string is always multibyte.
124 (Bug#13262) 364 (Bug#13262)
@@ -202,8 +442,8 @@
202 * w32.c (sys_close): Do not call delete_child on a subprocess 442 * w32.c (sys_close): Do not call delete_child on a subprocess
203 whose handle is not yet closed. Instead, set its file descriptor 443 whose handle is not yet closed. Instead, set its file descriptor
204 to a negative value, so that reap_subprocess will call 444 to a negative value, so that reap_subprocess will call
205 delete_child on that subprocess when its SIGCHLD arrives. This 445 delete_child on that subprocess when its SIGCHLD arrives.
206 avoids closing handles used for communications between sys_select 446 This avoids closing handles used for communications between sys_select
207 and reader_thread, which doesn't give sys_select a chance to 447 and reader_thread, which doesn't give sys_select a chance to
208 notice that the process exited and invoke the SIGCHLD handler for 448 notice that the process exited and invoke the SIGCHLD handler for
209 it. 449 it.
@@ -1642,7 +1882,7 @@
1642 * image.c (xpm_make_color_table_h): Fix compiler error because 1882 * image.c (xpm_make_color_table_h): Fix compiler error because
1643 make_hash_table changed. 1883 make_hash_table changed.
1644 1884
16452012-11-08 Thomas Kappler <tkappler@gmail.com> (tiny change) 18852012-11-08 Thomas Kappler <tkappler@gmail.com> (tiny change)
1646 1886
1647 * nsfont.m (ns_findfonts): Handle empty matchingDescs (Bug#11541). 1887 * nsfont.m (ns_findfonts): Handle empty matchingDescs (Bug#11541).
1648 1888
diff --git a/src/alloc.c b/src/alloc.c
index c2b2a4c1ed7..b7c17fbd6fb 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -209,6 +209,7 @@ Lisp_Object Qchar_table_extra_slots;
209 209
210static Lisp_Object Qpost_gc_hook; 210static Lisp_Object Qpost_gc_hook;
211 211
212static void free_save_value (Lisp_Object);
212static void mark_terminals (void); 213static void mark_terminals (void);
213static void gc_sweep (void); 214static void gc_sweep (void);
214static Lisp_Object make_pure_vector (ptrdiff_t); 215static Lisp_Object make_pure_vector (ptrdiff_t);
@@ -219,7 +220,6 @@ static void refill_memory_reserve (void);
219#endif 220#endif
220static void compact_small_strings (void); 221static void compact_small_strings (void);
221static void free_large_strings (void); 222static void free_large_strings (void);
222static void free_misc (Lisp_Object);
223extern Lisp_Object which_symbols (Lisp_Object, EMACS_INT) EXTERNALLY_VISIBLE; 223extern Lisp_Object which_symbols (Lisp_Object, EMACS_INT) EXTERNALLY_VISIBLE;
224 224
225/* When scanning the C stack for live Lisp objects, Emacs keeps track of 225/* When scanning the C stack for live Lisp objects, Emacs keeps track of
@@ -3337,9 +3337,9 @@ allocate_misc (enum Lisp_Misc_Type type)
3337 return val; 3337 return val;
3338} 3338}
3339 3339
3340/* Free a Lisp_Misc object */ 3340/* Free a Lisp_Misc object. */
3341 3341
3342static void 3342void
3343free_misc (Lisp_Object misc) 3343free_misc (Lisp_Object misc)
3344{ 3344{
3345 XMISCTYPE (misc) = Lisp_Misc_Free; 3345 XMISCTYPE (misc) = Lisp_Misc_Free;
@@ -3349,34 +3349,77 @@ free_misc (Lisp_Object misc)
3349 total_free_markers++; 3349 total_free_markers++;
3350} 3350}
3351 3351
3352/* Return a Lisp_Misc_Save_Value object containing POINTER and 3352/* Return a Lisp_Save_Value object with the data saved according to
3353 INTEGER. This is used to package C values to call record_unwind_protect. 3353 FMT. Format specifiers are `i' for an integer, `p' for a pointer
3354 The unwind function can get the C values back using XSAVE_VALUE. */ 3354 and `o' for Lisp_Object. Up to 4 objects can be specified. */
3355 3355
3356Lisp_Object 3356Lisp_Object
3357make_save_value (void *pointer, ptrdiff_t integer) 3357format_save_value (const char *fmt, ...)
3358{ 3358{
3359 register Lisp_Object val; 3359 va_list ap;
3360 register struct Lisp_Save_Value *p; 3360 int len = strlen (fmt);
3361 Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value);
3362 struct Lisp_Save_Value *p = XSAVE_VALUE (val);
3363
3364 eassert (0 < len && len < 5);
3365 va_start (ap, fmt);
3366
3367#define INITX(index) \
3368 do { \
3369 if (len <= index) \
3370 p->type ## index = SAVE_UNUSED; \
3371 else \
3372 { \
3373 if (fmt[index] == 'i') \
3374 { \
3375 p->type ## index = SAVE_INTEGER; \
3376 p->data[index].integer = va_arg (ap, ptrdiff_t); \
3377 } \
3378 else if (fmt[index] == 'p') \
3379 { \
3380 p->type ## index = SAVE_POINTER; \
3381 p->data[index].pointer = va_arg (ap, void *); \
3382 } \
3383 else if (fmt[index] == 'o') \
3384 { \
3385 p->type ## index = SAVE_OBJECT; \
3386 p->data[index].object = va_arg (ap, Lisp_Object); \
3387 } \
3388 else \
3389 emacs_abort (); \
3390 } \
3391 } while (0)
3392
3393 INITX (0);
3394 INITX (1);
3395 INITX (2);
3396 INITX (3);
3361 3397
3362 val = allocate_misc (Lisp_Misc_Save_Value); 3398#undef INITX
3363 p = XSAVE_VALUE (val); 3399
3364 p->pointer = pointer; 3400 va_end (ap);
3365 p->integer = integer; 3401 p->area = 0;
3366 p->dogc = 0;
3367 return val; 3402 return val;
3368} 3403}
3369 3404
3370/* Free a Lisp_Misc_Save_Value object. */ 3405/* Return a Lisp_Save_Value object containing POINTER and INTEGER.
3406 Most code should use this to package C integers and pointers
3407 to call record_unwind_protect. The unwind function can get the
3408 C values back using XSAVE_POINTER and XSAVE_INTEGER. */
3371 3409
3372void 3410Lisp_Object
3373free_save_value (Lisp_Object save) 3411make_save_value (void *pointer, ptrdiff_t integer)
3374{ 3412{
3375 register struct Lisp_Save_Value *p = XSAVE_VALUE (save); 3413 return format_save_value ("pi", pointer, integer);
3414}
3415
3416/* Free a Lisp_Save_Value object. Do not use this function
3417 if SAVE contains pointer other than returned by xmalloc. */
3376 3418
3377 p->dogc = 0; 3419static void
3378 xfree (p->pointer); 3420free_save_value (Lisp_Object save)
3379 p->pointer = NULL; 3421{
3422 xfree (XSAVE_POINTER (save, 0));
3380 free_misc (save); 3423 free_misc (save);
3381} 3424}
3382 3425
@@ -4444,11 +4487,6 @@ mark_memory (void *start, void *end)
4444 } 4487 }
4445} 4488}
4446 4489
4447/* setjmp will work with GCC unless NON_SAVING_SETJMP is defined in
4448 the GCC system configuration. In gcc 3.2, the only systems for
4449 which this is so are i386-sco5 non-ELF, i386-sysv3 (maybe included
4450 by others?) and ns32k-pc532-min. */
4451
4452#if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS 4490#if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS
4453 4491
4454static bool setjmp_tested_p; 4492static bool setjmp_tested_p;
@@ -5913,20 +5951,33 @@ mark_object (Lisp_Object arg)
5913 5951
5914 case Lisp_Misc_Save_Value: 5952 case Lisp_Misc_Save_Value:
5915 XMISCANY (obj)->gcmarkbit = 1; 5953 XMISCANY (obj)->gcmarkbit = 1;
5916#if GC_MARK_STACK
5917 { 5954 {
5918 register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj); 5955 register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj);
5919 /* If DOGC is set, POINTER is the address of a memory 5956 /* If `area' is nonzero, `data[0].pointer' is the address
5920 area containing INTEGER potential Lisp_Objects. */ 5957 of a memory area containing `data[1].integer' potential
5921 if (ptr->dogc) 5958 Lisp_Objects. */
5959#if GC_MARK_STACK
5960 if (ptr->area)
5922 { 5961 {
5923 Lisp_Object *p = (Lisp_Object *) ptr->pointer; 5962 Lisp_Object *p = ptr->data[0].pointer;
5924 ptrdiff_t nelt; 5963 ptrdiff_t nelt;
5925 for (nelt = ptr->integer; nelt > 0; nelt--, p++) 5964 for (nelt = ptr->data[1].integer; nelt > 0; nelt--, p++)
5926 mark_maybe_object (*p); 5965 mark_maybe_object (*p);
5927 } 5966 }
5967 else
5968#endif /* GC_MARK_STACK */
5969 {
5970 /* Find Lisp_Objects in `data[N]' slots and mark them. */
5971 if (ptr->type0 == SAVE_OBJECT)
5972 mark_object (ptr->data[0].object);
5973 if (ptr->type1 == SAVE_OBJECT)
5974 mark_object (ptr->data[1].object);
5975 if (ptr->type2 == SAVE_OBJECT)
5976 mark_object (ptr->data[2].object);
5977 if (ptr->type3 == SAVE_OBJECT)
5978 mark_object (ptr->data[3].object);
5979 }
5928 } 5980 }
5929#endif
5930 break; 5981 break;
5931 5982
5932 case Lisp_Misc_Overlay: 5983 case Lisp_Misc_Overlay:
diff --git a/src/buffer.c b/src/buffer.c
index 61b457e4558..a06868ec6c3 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1680,17 +1680,13 @@ compact_buffer (struct buffer *buffer)
1680 if (!buffer->text->inhibit_shrinking) 1680 if (!buffer->text->inhibit_shrinking)
1681 { 1681 {
1682 /* If a buffer's gap size is more than 10% of the buffer 1682 /* If a buffer's gap size is more than 10% of the buffer
1683 size, or larger than 2000 bytes, then shrink it 1683 size, or larger than GAP_BYTES_DFL bytes, then shrink it
1684 accordingly. Keep a minimum size of 20 bytes. */ 1684 accordingly. Keep a minimum size of GAP_BYTES_MIN bytes. */
1685 int size = min (2000, max (20, (buffer->text->z_byte / 10))); 1685 ptrdiff_t size = clip_to_bounds (GAP_BYTES_MIN,
1686 1686 BUF_Z_BYTE (buffer) / 10,
1687 if (buffer->text->gap_size > size) 1687 GAP_BYTES_DFL);
1688 { 1688 if (BUF_GAP_SIZE (buffer) > size)
1689 struct buffer *save_current = current_buffer; 1689 make_gap_1 (buffer, -(BUF_GAP_SIZE (buffer) - size));
1690 current_buffer = buffer;
1691 make_gap (-(buffer->text->gap_size - size));
1692 current_buffer = save_current;
1693 }
1694 } 1690 }
1695 BUF_COMPACT (buffer) = BUF_MODIFF (buffer); 1691 BUF_COMPACT (buffer) = BUF_MODIFF (buffer);
1696 } 1692 }
@@ -4578,27 +4574,7 @@ evaporate_overlays (ptrdiff_t pos)
4578 for (; CONSP (hit_list); hit_list = XCDR (hit_list)) 4574 for (; CONSP (hit_list); hit_list = XCDR (hit_list))
4579 Fdelete_overlay (XCAR (hit_list)); 4575 Fdelete_overlay (XCAR (hit_list));
4580} 4576}
4581
4582/* Somebody has tried to store a value with an unacceptable type
4583 in the slot with offset OFFSET. */
4584
4585void
4586buffer_slot_type_mismatch (Lisp_Object newval, int type)
4587{
4588 Lisp_Object predicate;
4589
4590 switch (type)
4591 {
4592 case_Lisp_Int: predicate = Qintegerp; break;
4593 case Lisp_String: predicate = Qstringp; break;
4594 case Lisp_Symbol: predicate = Qsymbolp; break;
4595 default: emacs_abort ();
4596 }
4597
4598 wrong_type_argument (predicate, newval);
4599}
4600 4577
4601
4602/*********************************************************************** 4578/***********************************************************************
4603 Allocation with mmap 4579 Allocation with mmap
4604 ***********************************************************************/ 4580 ***********************************************************************/
@@ -5372,25 +5348,23 @@ init_buffer (void)
5372 free (pwd); 5348 free (pwd);
5373} 5349}
5374 5350
5375/* Similar to defvar_lisp but define a variable whose value is the Lisp 5351/* Similar to defvar_lisp but define a variable whose value is the
5376 Object stored in the current buffer. address is the address of the slot 5352 Lisp_Object stored in the current buffer. LNAME is the Lisp-level
5377 in the buffer that is current now. */ 5353 variable name. VNAME is the name of the buffer slot. PREDICATE
5378 5354 is nil for a general Lisp variable. If PREDICATE is non-nil, then
5379/* TYPE is nil for a general Lisp variable. 5355 only Lisp values that satisfies the PREDICATE are allowed (except
5380 An integer specifies a type; then only Lisp values 5356 that nil is allowed too). DOC is a dummy where you write the doc
5381 with that type code are allowed (except that nil is allowed too). 5357 string as a comment. */
5382 LNAME is the Lisp-level variable name. 5358
5383 VNAME is the name of the buffer slot. 5359#define DEFVAR_PER_BUFFER(lname, vname, predicate, doc) \
5384 DOC is a dummy where you write the doc string as a comment. */ 5360 do { \
5385#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ 5361 static struct Lisp_Buffer_Objfwd bo_fwd; \
5386 do { \ 5362 defvar_per_buffer (&bo_fwd, lname, vname, predicate); \
5387 static struct Lisp_Buffer_Objfwd bo_fwd; \
5388 defvar_per_buffer (&bo_fwd, lname, vname, type); \
5389 } while (0) 5363 } while (0)
5390 5364
5391static void 5365static void
5392defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, 5366defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
5393 Lisp_Object *address, Lisp_Object type) 5367 Lisp_Object *address, Lisp_Object predicate)
5394{ 5368{
5395 struct Lisp_Symbol *sym; 5369 struct Lisp_Symbol *sym;
5396 int offset; 5370 int offset;
@@ -5400,7 +5374,7 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring,
5400 5374
5401 bo_fwd->type = Lisp_Fwd_Buffer_Obj; 5375 bo_fwd->type = Lisp_Fwd_Buffer_Obj;
5402 bo_fwd->offset = offset; 5376 bo_fwd->offset = offset;
5403 bo_fwd->slottype = type; 5377 bo_fwd->predicate = predicate;
5404 sym->declared_special = 1; 5378 sym->declared_special = 1;
5405 sym->redirect = SYMBOL_FORWARDED; 5379 sym->redirect = SYMBOL_FORWARDED;
5406 { 5380 {
@@ -5663,7 +5637,7 @@ Decimal digits after the % specify field width to which to pad. */);
5663 doc: /* Value of `major-mode' for new buffers. */); 5637 doc: /* Value of `major-mode' for new buffers. */);
5664 5638
5665 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode), 5639 DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode),
5666 make_number (Lisp_Symbol), 5640 Qsymbolp,
5667 doc: /* Symbol for current buffer's major mode. 5641 doc: /* Symbol for current buffer's major mode.
5668The default value (normally `fundamental-mode') affects new buffers. 5642The default value (normally `fundamental-mode') affects new buffers.
5669A value of nil means to use the current buffer's major mode, provided 5643A value of nil means to use the current buffer's major mode, provided
@@ -5694,17 +5668,17 @@ Use the command `abbrev-mode' to change this variable. */);
5694 doc: /* Non-nil if searches and matches should ignore case. */); 5668 doc: /* Non-nil if searches and matches should ignore case. */);
5695 5669
5696 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column), 5670 DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
5697 make_number (Lisp_Int0), 5671 Qintegerp,
5698 doc: /* Column beyond which automatic line-wrapping should happen. 5672 doc: /* Column beyond which automatic line-wrapping should happen.
5699Interactively, you can set the buffer local value using \\[set-fill-column]. */); 5673Interactively, you can set the buffer local value using \\[set-fill-column]. */);
5700 5674
5701 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin), 5675 DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
5702 make_number (Lisp_Int0), 5676 Qintegerp,
5703 doc: /* Column for the default `indent-line-function' to indent to. 5677 doc: /* Column for the default `indent-line-function' to indent to.
5704Linefeed indents to this column in Fundamental mode. */); 5678Linefeed indents to this column in Fundamental mode. */);
5705 5679
5706 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width), 5680 DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
5707 make_number (Lisp_Int0), 5681 Qintegerp,
5708 doc: /* Distance between tab stops (for display of tab characters), in columns. 5682 doc: /* Distance between tab stops (for display of tab characters), in columns.
5709This should be an integer greater than zero. */); 5683This should be an integer greater than zero. */);
5710 5684
@@ -5789,7 +5763,7 @@ visual lines rather than logical lines. See the documentation of
5789`visual-line-mode'. */); 5763`visual-line-mode'. */);
5790 5764
5791 DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory), 5765 DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory),
5792 make_number (Lisp_String), 5766 Qstringp,
5793 doc: /* Name of default directory of current buffer. Should end with slash. 5767 doc: /* Name of default directory of current buffer. Should end with slash.
5794To interactively change the default directory, use command `cd'. */); 5768To interactively change the default directory, use command `cd'. */);
5795 5769
@@ -5802,18 +5776,18 @@ NOTE: This variable is not a hook;
5802its value may not be a list of functions. */); 5776its value may not be a list of functions. */);
5803 5777
5804 DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename), 5778 DEFVAR_PER_BUFFER ("buffer-file-name", &BVAR (current_buffer, filename),
5805 make_number (Lisp_String), 5779 Qstringp,
5806 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */); 5780 doc: /* Name of file visited in current buffer, or nil if not visiting a file. */);
5807 5781
5808 DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename), 5782 DEFVAR_PER_BUFFER ("buffer-file-truename", &BVAR (current_buffer, file_truename),
5809 make_number (Lisp_String), 5783 Qstringp,
5810 doc: /* Abbreviated truename of file visited in current buffer, or nil if none. 5784 doc: /* Abbreviated truename of file visited in current buffer, or nil if none.
5811The truename of a file is calculated by `file-truename' 5785The truename of a file is calculated by `file-truename'
5812and then abbreviated with `abbreviate-file-name'. */); 5786and then abbreviated with `abbreviate-file-name'. */);
5813 5787
5814 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name", 5788 DEFVAR_PER_BUFFER ("buffer-auto-save-file-name",
5815 &BVAR (current_buffer, auto_save_file_name), 5789 &BVAR (current_buffer, auto_save_file_name),
5816 make_number (Lisp_String), 5790 Qstringp,
5817 doc: /* Name of file for auto-saving current buffer. 5791 doc: /* Name of file for auto-saving current buffer.
5818If it is nil, that means don't auto-save this buffer. */); 5792If it is nil, that means don't auto-save this buffer. */);
5819 5793
@@ -5825,7 +5799,7 @@ If it is nil, that means don't auto-save this buffer. */);
5825Backing up is done before the first time the file is saved. */); 5799Backing up is done before the first time the file is saved. */);
5826 5800
5827 DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length), 5801 DEFVAR_PER_BUFFER ("buffer-saved-size", &BVAR (current_buffer, save_length),
5828 make_number (Lisp_Int0), 5802 Qintegerp,
5829 doc: /* Length of current buffer when last read in, saved or auto-saved. 5803 doc: /* Length of current buffer when last read in, saved or auto-saved.
58300 initially. 58040 initially.
5831-1 means auto-saving turned off until next real save. 5805-1 means auto-saving turned off until next real save.
@@ -5895,23 +5869,23 @@ In addition, a char-table has six extra slots to control the display of:
5895See also the functions `display-table-slot' and `set-display-table-slot'. */); 5869See also the functions `display-table-slot' and `set-display-table-slot'. */);
5896 5870
5897 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), 5871 DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols),
5898 Qnil, 5872 Qintegerp,
5899 doc: /* Width of left marginal area for display of a buffer. 5873 doc: /* Width of left marginal area for display of a buffer.
5900A value of nil means no marginal area. */); 5874A value of nil means no marginal area. */);
5901 5875
5902 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), 5876 DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols),
5903 Qnil, 5877 Qintegerp,
5904 doc: /* Width of right marginal area for display of a buffer. 5878 doc: /* Width of right marginal area for display of a buffer.
5905A value of nil means no marginal area. */); 5879A value of nil means no marginal area. */);
5906 5880
5907 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), 5881 DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width),
5908 Qnil, 5882 Qintegerp,
5909 doc: /* Width of this buffer's left fringe (in pixels). 5883 doc: /* Width of this buffer's left fringe (in pixels).
5910A value of 0 means no left fringe is shown in this buffer's window. 5884A value of 0 means no left fringe is shown in this buffer's window.
5911A value of nil means to use the left fringe width from the window's frame. */); 5885A value of nil means to use the left fringe width from the window's frame. */);
5912 5886
5913 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), 5887 DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width),
5914 Qnil, 5888 Qintegerp,
5915 doc: /* Width of this buffer's right fringe (in pixels). 5889 doc: /* Width of this buffer's right fringe (in pixels).
5916A value of 0 means no right fringe is shown in this buffer's window. 5890A value of 0 means no right fringe is shown in this buffer's window.
5917A value of nil means to use the right fringe width from the window's frame. */); 5891A value of nil means to use the right fringe width from the window's frame. */);
@@ -5922,7 +5896,7 @@ A value of nil means to use the right fringe width from the window's frame. */)
5922A value of nil means to display fringes between margins and buffer text. */); 5896A value of nil means to display fringes between margins and buffer text. */);
5923 5897
5924 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), 5898 DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width),
5925 Qnil, 5899 Qintegerp,
5926 doc: /* Width of this buffer's scroll bars in pixels. 5900 doc: /* Width of this buffer's scroll bars in pixels.
5927A value of nil means to use the scroll bar width from the window's frame. */); 5901A value of nil means to use the scroll bar width from the window's frame. */);
5928 5902
@@ -6002,7 +5976,7 @@ BITMAP is the corresponding fringe bitmap shown for the logical
6002cursor type. */); 5976cursor type. */);
6003 5977
6004 DEFVAR_PER_BUFFER ("scroll-up-aggressively", 5978 DEFVAR_PER_BUFFER ("scroll-up-aggressively",
6005 &BVAR (current_buffer, scroll_up_aggressively), Qnil, 5979 &BVAR (current_buffer, scroll_up_aggressively), Qfloatp,
6006 doc: /* How far to scroll windows upward. 5980 doc: /* How far to scroll windows upward.
6007If you move point off the bottom, the window scrolls automatically. 5981If you move point off the bottom, the window scrolls automatically.
6008This variable controls how far it scrolls. The value nil, the default, 5982This variable controls how far it scrolls. The value nil, the default,
@@ -6015,7 +5989,7 @@ window scrolls by a full window height. Meaningful values are
6015between 0.0 and 1.0, inclusive. */); 5989between 0.0 and 1.0, inclusive. */);
6016 5990
6017 DEFVAR_PER_BUFFER ("scroll-down-aggressively", 5991 DEFVAR_PER_BUFFER ("scroll-down-aggressively",
6018 &BVAR (current_buffer, scroll_down_aggressively), Qnil, 5992 &BVAR (current_buffer, scroll_down_aggressively), Qfloatp,
6019 doc: /* How far to scroll windows downward. 5993 doc: /* How far to scroll windows downward.
6020If you move point off the top, the window scrolls automatically. 5994If you move point off the top, the window scrolls automatically.
6021This variable controls how far it scrolls. The value nil, the default, 5995This variable controls how far it scrolls. The value nil, the default,
@@ -6169,7 +6143,7 @@ then characters with property value PROP are invisible,
6169and they have an ellipsis as well if ELLIPSIS is non-nil. */); 6143and they have an ellipsis as well if ELLIPSIS is non-nil. */);
6170 6144
6171 DEFVAR_PER_BUFFER ("buffer-display-count", 6145 DEFVAR_PER_BUFFER ("buffer-display-count",
6172 &BVAR (current_buffer, display_count), Qnil, 6146 &BVAR (current_buffer, display_count), Qintegerp,
6173 doc: /* A number incremented each time this buffer is displayed in a window. 6147 doc: /* A number incremented each time this buffer is displayed in a window.
6174The function `set-window-buffer' increments it. */); 6148The function `set-window-buffer' increments it. */);
6175 6149
@@ -6228,7 +6202,7 @@ cursor's appearance is instead controlled by the variable
6228`cursor-in-non-selected-windows'. */); 6202`cursor-in-non-selected-windows'. */);
6229 6203
6230 DEFVAR_PER_BUFFER ("line-spacing", 6204 DEFVAR_PER_BUFFER ("line-spacing",
6231 &BVAR (current_buffer, extra_line_spacing), Qnil, 6205 &BVAR (current_buffer, extra_line_spacing), Qnumberp,
6232 doc: /* Additional space to put between lines when displaying a buffer. 6206 doc: /* Additional space to put between lines when displaying a buffer.
6233The space is measured in pixels, and put below lines on graphic displays, 6207The space is measured in pixels, and put below lines on graphic displays,
6234see `display-graphic-p'. 6208see `display-graphic-p'.
diff --git a/src/buffer.h b/src/buffer.h
index 4bf2b4c2a0b..c0b0e227725 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -320,6 +320,16 @@ while (0)
320#define BUF_BYTES_MAX \ 320#define BUF_BYTES_MAX \
321 (ptrdiff_t) min (MOST_POSITIVE_FIXNUM - 1, min (SIZE_MAX, PTRDIFF_MAX)) 321 (ptrdiff_t) min (MOST_POSITIVE_FIXNUM - 1, min (SIZE_MAX, PTRDIFF_MAX))
322 322
323/* Maximum gap size after compact_buffer, in bytes. Also
324 used in make_gap_larger to get some extra reserved space. */
325
326#define GAP_BYTES_DFL 2000
327
328/* Minimum gap size after compact_buffer, in bytes. Also
329 used in make_gap_smaller to avoid too small gap size. */
330
331#define GAP_BYTES_MIN 20
332
323/* Return the address of byte position N in current buffer. */ 333/* Return the address of byte position N in current buffer. */
324 334
325#define BYTE_POS_ADDR(n) \ 335#define BYTE_POS_ADDR(n) \
@@ -1064,7 +1074,6 @@ extern void set_buffer_internal_1 (struct buffer *);
1064extern void set_buffer_temp (struct buffer *); 1074extern void set_buffer_temp (struct buffer *);
1065extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object); 1075extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object);
1066extern void record_buffer (Lisp_Object); 1076extern void record_buffer (Lisp_Object);
1067extern _Noreturn void buffer_slot_type_mismatch (Lisp_Object, int);
1068extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); 1077extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t);
1069extern void mmap_set_vars (bool); 1078extern void mmap_set_vars (bool);
1070 1079
diff --git a/src/coding.c b/src/coding.c
index 5285a906823..a9bf9032a69 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1049,14 +1049,7 @@ coding_alloc_by_making_gap (struct coding_system *coding,
1049 GPT -= gap_head_used, GPT_BYTE -= gap_head_used; 1049 GPT -= gap_head_used, GPT_BYTE -= gap_head_used;
1050 } 1050 }
1051 else 1051 else
1052 { 1052 make_gap_1 (XBUFFER (coding->dst_object), bytes);
1053 Lisp_Object this_buffer;
1054
1055 this_buffer = Fcurrent_buffer ();
1056 set_buffer_internal (XBUFFER (coding->dst_object));
1057 make_gap (bytes);
1058 set_buffer_internal (XBUFFER (this_buffer));
1059 }
1060} 1053}
1061 1054
1062 1055
diff --git a/src/data.c b/src/data.c
index e9f3a2cff3f..8a66cbe9197 100644
--- a/src/data.c
+++ b/src/data.c
@@ -951,13 +951,11 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
951 case Lisp_Fwd_Buffer_Obj: 951 case Lisp_Fwd_Buffer_Obj:
952 { 952 {
953 int offset = XBUFFER_OBJFWD (valcontents)->offset; 953 int offset = XBUFFER_OBJFWD (valcontents)->offset;
954 Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; 954 Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate;
955 955
956 if (!(NILP (type) || NILP (newval) 956 if (!NILP (predicate) && !NILP (newval)
957 || (XINT (type) == Lisp_Int0 957 && NILP (call1 (predicate, newval)))
958 ? INTEGERP (newval) 958 wrong_type_argument (predicate, newval);
959 : XTYPE (newval) == XINT (type))))
960 buffer_slot_type_mismatch (newval, XINT (type));
961 959
962 if (buf == NULL) 960 if (buf == NULL)
963 buf = current_buffer; 961 buf = current_buffer;
diff --git a/src/dired.c b/src/dired.c
index b4dc702112e..3dca9d24f67 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -78,7 +78,7 @@ directory_files_internal_w32_unwind (Lisp_Object arg)
78static Lisp_Object 78static Lisp_Object
79directory_files_internal_unwind (Lisp_Object dh) 79directory_files_internal_unwind (Lisp_Object dh)
80{ 80{
81 DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; 81 DIR *d = XSAVE_POINTER (dh, 0);
82 block_input (); 82 block_input ();
83 closedir (d); 83 closedir (d);
84 unblock_input (); 84 unblock_input ();
diff --git a/src/editfns.c b/src/editfns.c
index df0dad0669d..8910b66e4d3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -833,21 +833,17 @@ This function does not move point. */)
833Lisp_Object 833Lisp_Object
834save_excursion_save (void) 834save_excursion_save (void)
835{ 835{
836 Lisp_Object save, *data = xmalloc (word_size * 4); 836 return format_save_value
837 837 ("oooo",
838 data[0] = Fpoint_marker (); 838 Fpoint_marker (),
839 /* Do not copy the mark if it points to nowhere. */ 839 /* Do not copy the mark if it points to nowhere. */
840 data[1] = (XMARKER (BVAR (current_buffer, mark))->buffer 840 (XMARKER (BVAR (current_buffer, mark))->buffer
841 ? Fcopy_marker (BVAR (current_buffer, mark), Qnil) 841 ? Fcopy_marker (BVAR (current_buffer, mark), Qnil)
842 : Qnil); 842 : Qnil),
843 /* Selected window if current buffer is shown in it, nil otherwise. */ 843 /* Selected window if current buffer is shown in it, nil otherwise. */
844 data[2] = ((XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) 844 ((XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer)
845 ? selected_window : Qnil); 845 ? selected_window : Qnil),
846 data[3] = BVAR (current_buffer, mark_active); 846 BVAR (current_buffer, mark_active));
847
848 save = make_save_value (data, 4);
849 XSAVE_VALUE (save)->dogc = 1;
850 return save;
851} 847}
852 848
853/* Restore saved buffer before leaving `save-excursion' special form. */ 849/* Restore saved buffer before leaving `save-excursion' special form. */
@@ -855,10 +851,10 @@ save_excursion_save (void)
855Lisp_Object 851Lisp_Object
856save_excursion_restore (Lisp_Object info) 852save_excursion_restore (Lisp_Object info)
857{ 853{
858 Lisp_Object tem, tem1, omark, nmark, *data = XSAVE_VALUE (info)->pointer; 854 Lisp_Object tem, tem1, omark, nmark;
859 struct gcpro gcpro1, gcpro2, gcpro3; 855 struct gcpro gcpro1, gcpro2, gcpro3;
860 856
861 tem = Fmarker_buffer (data[0]); 857 tem = Fmarker_buffer (XSAVE_OBJECT (info, 0));
862 /* If we're unwinding to top level, saved buffer may be deleted. This 858 /* If we're unwinding to top level, saved buffer may be deleted. This
863 means that all of its markers are unchained and so tem is nil. */ 859 means that all of its markers are unchained and so tem is nil. */
864 if (NILP (tem)) 860 if (NILP (tem))
@@ -870,12 +866,12 @@ save_excursion_restore (Lisp_Object info)
870 Fset_buffer (tem); 866 Fset_buffer (tem);
871 867
872 /* Point marker. */ 868 /* Point marker. */
873 tem = data[0]; 869 tem = XSAVE_OBJECT (info, 0);
874 Fgoto_char (tem); 870 Fgoto_char (tem);
875 unchain_marker (XMARKER (tem)); 871 unchain_marker (XMARKER (tem));
876 872
877 /* Mark marker. */ 873 /* Mark marker. */
878 tem = data[1]; 874 tem = XSAVE_OBJECT (info, 1);
879 omark = Fmarker_position (BVAR (current_buffer, mark)); 875 omark = Fmarker_position (BVAR (current_buffer, mark));
880 if (NILP (tem)) 876 if (NILP (tem))
881 unchain_marker (XMARKER (BVAR (current_buffer, mark))); 877 unchain_marker (XMARKER (BVAR (current_buffer, mark)));
@@ -887,7 +883,7 @@ save_excursion_restore (Lisp_Object info)
887 } 883 }
888 884
889 /* Mark active. */ 885 /* Mark active. */
890 tem = data[3]; 886 tem = XSAVE_OBJECT (info, 3);
891 tem1 = BVAR (current_buffer, mark_active); 887 tem1 = BVAR (current_buffer, mark_active);
892 bset_mark_active (current_buffer, tem); 888 bset_mark_active (current_buffer, tem);
893 889
@@ -911,7 +907,7 @@ save_excursion_restore (Lisp_Object info)
911 /* If buffer was visible in a window, and a different window was 907 /* If buffer was visible in a window, and a different window was
912 selected, and the old selected window is still showing this 908 selected, and the old selected window is still showing this
913 buffer, restore point in that window. */ 909 buffer, restore point in that window. */
914 tem = data[2]; 910 tem = XSAVE_OBJECT (info, 2);
915 if (WINDOWP (tem) 911 if (WINDOWP (tem)
916 && !EQ (tem, selected_window) 912 && !EQ (tem, selected_window)
917 && (tem1 = XWINDOW (tem)->buffer, 913 && (tem1 = XWINDOW (tem)->buffer,
@@ -925,7 +921,7 @@ save_excursion_restore (Lisp_Object info)
925 921
926 out: 922 out:
927 923
928 free_save_value (info); 924 free_misc (info);
929 return Qnil; 925 return Qnil;
930} 926}
931 927
@@ -968,7 +964,7 @@ usage: (save-current-buffer &rest BODY) */)
968 return unbind_to (count, Fprogn (args)); 964 return unbind_to (count, Fprogn (args));
969} 965}
970 966
971DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0, 967DEFUN ("buffer-size", Fbuffer_size, Sbuffer_size, 0, 1, 0,
972 doc: /* Return the number of characters in the current buffer. 968 doc: /* Return the number of characters in the current buffer.
973If BUFFER, return the number of characters in that buffer instead. */) 969If BUFFER, return the number of characters in that buffer instead. */)
974 (Lisp_Object buffer) 970 (Lisp_Object buffer)
@@ -2188,6 +2184,7 @@ set_time_zone_rule (const char *tzstring)
2188 xputenv (set_time_zone_rule_tz[1]); 2184 xputenv (set_time_zone_rule_tz[1]);
2189 } 2185 }
2190 tzset (); 2186 tzset ();
2187 tzvalbuf_in_environ = 0;
2191#endif 2188#endif
2192 2189
2193 if (!tzstring) 2190 if (!tzstring)
@@ -4257,7 +4254,7 @@ usage: (format STRING &rest OBJECTS) */)
4257 memcpy (buf, initial_buffer, used); 4254 memcpy (buf, initial_buffer, used);
4258 } 4255 }
4259 else 4256 else
4260 XSAVE_VALUE (buf_save_value)->pointer = buf = xrealloc (buf, bufsize); 4257 XSAVE_POINTER (buf_save_value, 0) = buf = xrealloc (buf, bufsize);
4261 4258
4262 p = buf + used; 4259 p = buf + used;
4263 } 4260 }
@@ -4522,7 +4519,7 @@ Transposing beyond buffer boundaries is an error. */)
4522 (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers) 4519 (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers)
4523{ 4520{
4524 register ptrdiff_t start1, end1, start2, end2; 4521 register ptrdiff_t start1, end1, start2, end2;
4525 ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte; 4522 ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte, end2_byte;
4526 ptrdiff_t gap, len1, len_mid, len2; 4523 ptrdiff_t gap, len1, len_mid, len2;
4527 unsigned char *start1_addr, *start2_addr, *temp; 4524 unsigned char *start1_addr, *start2_addr, *temp;
4528 4525
@@ -4583,20 +4580,22 @@ Transposing beyond buffer boundaries is an error. */)
4583 the gap the minimum distance to get it out of the way, and then 4580 the gap the minimum distance to get it out of the way, and then
4584 deal with an unbroken array. */ 4581 deal with an unbroken array. */
4585 4582
4583 start1_byte = CHAR_TO_BYTE (start1);
4584 end2_byte = CHAR_TO_BYTE (end2);
4585
4586 /* Make sure the gap won't interfere, by moving it out of the text 4586 /* Make sure the gap won't interfere, by moving it out of the text
4587 we will operate on. */ 4587 we will operate on. */
4588 if (start1 < gap && gap < end2) 4588 if (start1 < gap && gap < end2)
4589 { 4589 {
4590 if (gap - start1 < end2 - gap) 4590 if (gap - start1 < end2 - gap)
4591 move_gap (start1); 4591 move_gap_both (start1, start1_byte);
4592 else 4592 else
4593 move_gap (end2); 4593 move_gap_both (end2, end2_byte);
4594 } 4594 }
4595 4595
4596 start1_byte = CHAR_TO_BYTE (start1);
4597 start2_byte = CHAR_TO_BYTE (start2); 4596 start2_byte = CHAR_TO_BYTE (start2);
4598 len1_byte = CHAR_TO_BYTE (end1) - start1_byte; 4597 len1_byte = CHAR_TO_BYTE (end1) - start1_byte;
4599 len2_byte = CHAR_TO_BYTE (end2) - start2_byte; 4598 len2_byte = end2_byte - start2_byte;
4600 4599
4601#ifdef BYTE_COMBINING_DEBUG 4600#ifdef BYTE_COMBINING_DEBUG
4602 if (end1 == start2) 4601 if (end1 == start2)
@@ -4883,12 +4882,10 @@ functions if all the text being accessed has this property. */);
4883 defsubr (&Sline_beginning_position); 4882 defsubr (&Sline_beginning_position);
4884 defsubr (&Sline_end_position); 4883 defsubr (&Sline_end_position);
4885 4884
4886/* defsubr (&Smark); */
4887/* defsubr (&Sset_mark); */
4888 defsubr (&Ssave_excursion); 4885 defsubr (&Ssave_excursion);
4889 defsubr (&Ssave_current_buffer); 4886 defsubr (&Ssave_current_buffer);
4890 4887
4891 defsubr (&Sbufsize); 4888 defsubr (&Sbuffer_size);
4892 defsubr (&Spoint_max); 4889 defsubr (&Spoint_max);
4893 defsubr (&Spoint_min); 4890 defsubr (&Spoint_min);
4894 defsubr (&Spoint_min_marker); 4891 defsubr (&Spoint_min_marker);
diff --git a/src/emacs.c b/src/emacs.c
index 57de81f05b0..1848c71a22f 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -340,25 +340,6 @@ terminate_due_to_signal (int sig, int backtrace_limit)
340 /* This shouldn't be executed, but it prevents a warning. */ 340 /* This shouldn't be executed, but it prevents a warning. */
341 exit (1); 341 exit (1);
342} 342}
343
344#ifdef SIGDANGER
345
346/* Handler for SIGDANGER. */
347static void
348handle_danger_signal (int sig)
349{
350 malloc_warning ("Operating system warns that virtual memory is running low.\n");
351
352 /* It might be unsafe to call do_auto_save now. */
353 force_auto_save_soon ();
354}
355
356static void
357deliver_danger_signal (int sig)
358{
359 deliver_process_signal (sig, handle_danger_signal);
360}
361#endif
362 343
363/* Code for dealing with Lisp access to the Unix command line. */ 344/* Code for dealing with Lisp access to the Unix command line. */
364 345
diff --git a/src/eval.c b/src/eval.c
index f88567f14cb..18031236c7d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1950,7 +1950,10 @@ eval_sub (Lisp_Object form)
1950 return form; 1950 return form;
1951 1951
1952 QUIT; 1952 QUIT;
1953
1954 GCPRO1 (form);
1953 maybe_gc (); 1955 maybe_gc ();
1956 UNGCPRO;
1954 1957
1955 if (++lisp_eval_depth > max_lisp_eval_depth) 1958 if (++lisp_eval_depth > max_lisp_eval_depth)
1956 { 1959 {
diff --git a/src/fileio.c b/src/fileio.c
index 5e9b36ee44a..87d945c1e5e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3408,30 +3408,22 @@ decide_coding_unwind (Lisp_Object unwind_data)
3408 return Qnil; 3408 return Qnil;
3409} 3409}
3410 3410
3411 3411/* Read from a non-regular file. STATE is a Lisp_Save_Value
3412/* Used to pass values from insert-file-contents to read_non_regular. */ 3412 object where slot 0 is the file descriptor, slot 1 specifies
3413 3413 an offset to put the read bytes, and slot 2 is the maximum
3414static int non_regular_fd; 3414 amount of bytes to read. Value is the number of bytes read. */
3415static ptrdiff_t non_regular_inserted;
3416static int non_regular_nbytes;
3417
3418
3419/* Read from a non-regular file.
3420 Read non_regular_nbytes bytes max from non_regular_fd.
3421 Non_regular_inserted specifies where to put the read bytes.
3422 Value is the number of bytes read. */
3423 3415
3424static Lisp_Object 3416static Lisp_Object
3425read_non_regular (Lisp_Object ignore) 3417read_non_regular (Lisp_Object state)
3426{ 3418{
3427 int nbytes; 3419 int nbytes;
3428 3420
3429 immediate_quit = 1; 3421 immediate_quit = 1;
3430 QUIT; 3422 QUIT;
3431 nbytes = emacs_read (non_regular_fd, 3423 nbytes = emacs_read (XSAVE_INTEGER (state, 0),
3432 ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE 3424 ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE
3433 + non_regular_inserted), 3425 + XSAVE_INTEGER (state, 1)),
3434 non_regular_nbytes); 3426 XSAVE_INTEGER (state, 2));
3435 immediate_quit = 0; 3427 immediate_quit = 0;
3436 return make_number (nbytes); 3428 return make_number (nbytes);
3437} 3429}
@@ -4238,7 +4230,7 @@ by calling `format-decode', which see. */)
4238 while (how_much < total) 4230 while (how_much < total)
4239 { 4231 {
4240 /* try is reserved in some compilers (Microsoft C) */ 4232 /* try is reserved in some compilers (Microsoft C) */
4241 int trytry = min (total - how_much, READ_BUF_SIZE); 4233 ptrdiff_t trytry = min (total - how_much, READ_BUF_SIZE);
4242 ptrdiff_t this; 4234 ptrdiff_t this;
4243 4235
4244 if (not_regular) 4236 if (not_regular)
@@ -4255,12 +4247,11 @@ by calling `format-decode', which see. */)
4255 /* Read from the file, capturing `quit'. When an 4247 /* Read from the file, capturing `quit'. When an
4256 error occurs, end the loop, and arrange for a quit 4248 error occurs, end the loop, and arrange for a quit
4257 to be signaled after decoding the text we read. */ 4249 to be signaled after decoding the text we read. */
4258 non_regular_fd = fd; 4250 nbytes = internal_condition_case_1
4259 non_regular_inserted = inserted; 4251 (read_non_regular,
4260 non_regular_nbytes = trytry; 4252 format_save_value ("iii", (ptrdiff_t) fd, inserted, trytry),
4261 nbytes = internal_condition_case_1 (read_non_regular, 4253 Qerror, read_non_regular_quit);
4262 Qnil, Qerror, 4254
4263 read_non_regular_quit);
4264 if (NILP (nbytes)) 4255 if (NILP (nbytes))
4265 { 4256 {
4266 read_quit = 1; 4257 read_quit = 1;
@@ -5507,7 +5498,7 @@ static Lisp_Object
5507do_auto_save_unwind (Lisp_Object arg) /* used as unwind-protect function */ 5498do_auto_save_unwind (Lisp_Object arg) /* used as unwind-protect function */
5508 5499
5509{ 5500{
5510 FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; 5501 FILE *stream = XSAVE_POINTER (arg, 0);
5511 auto_saving = 0; 5502 auto_saving = 0;
5512 if (stream != NULL) 5503 if (stream != NULL)
5513 { 5504 {
diff --git a/src/font.c b/src/font.c
index a3a41006f9b..89931f6ec76 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1857,7 +1857,7 @@ otf_open (Lisp_Object file)
1857 OTF *otf; 1857 OTF *otf;
1858 1858
1859 if (! NILP (val)) 1859 if (! NILP (val))
1860 otf = XSAVE_VALUE (XCDR (val))->pointer; 1860 otf = XSAVE_POINTER (XCDR (val), 0);
1861 else 1861 else
1862 { 1862 {
1863 otf = STRINGP (file) ? OTF_open (SSDATA (file)) : NULL; 1863 otf = STRINGP (file) ? OTF_open (SSDATA (file)) : NULL;
diff --git a/src/ftfont.c b/src/ftfont.c
index 1ada95d377c..5bf91832c7c 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -393,16 +393,14 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
393 cache_data = xmalloc (sizeof *cache_data); 393 cache_data = xmalloc (sizeof *cache_data);
394 cache_data->ft_face = NULL; 394 cache_data->ft_face = NULL;
395 cache_data->fc_charset = NULL; 395 cache_data->fc_charset = NULL;
396 val = make_save_value (NULL, 0); 396 val = make_save_value (cache_data, 0);
397 XSAVE_VALUE (val)->integer = 0;
398 XSAVE_VALUE (val)->pointer = cache_data;
399 cache = Fcons (Qnil, val); 397 cache = Fcons (Qnil, val);
400 Fputhash (key, cache, ft_face_cache); 398 Fputhash (key, cache, ft_face_cache);
401 } 399 }
402 else 400 else
403 { 401 {
404 val = XCDR (cache); 402 val = XCDR (cache);
405 cache_data = XSAVE_VALUE (val)->pointer; 403 cache_data = XSAVE_POINTER (val, 0);
406 } 404 }
407 405
408 if (cache_for == FTFONT_CACHE_FOR_ENTITY) 406 if (cache_for == FTFONT_CACHE_FOR_ENTITY)
@@ -468,7 +466,7 @@ ftfont_get_fc_charset (Lisp_Object entity)
468 466
469 cache = ftfont_lookup_cache (entity, FTFONT_CACHE_FOR_CHARSET); 467 cache = ftfont_lookup_cache (entity, FTFONT_CACHE_FOR_CHARSET);
470 val = XCDR (cache); 468 val = XCDR (cache);
471 cache_data = XSAVE_VALUE (val)->pointer; 469 cache_data = XSAVE_POINTER (val, 0);
472 return cache_data->fc_charset; 470 return cache_data->fc_charset;
473} 471}
474 472
@@ -1200,9 +1198,9 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
1200 filename = XCAR (val); 1198 filename = XCAR (val);
1201 idx = XCDR (val); 1199 idx = XCDR (val);
1202 val = XCDR (cache); 1200 val = XCDR (cache);
1203 cache_data = XSAVE_VALUE (XCDR (cache))->pointer; 1201 cache_data = XSAVE_POINTER (XCDR (cache), 0);
1204 ft_face = cache_data->ft_face; 1202 ft_face = cache_data->ft_face;
1205 if (XSAVE_VALUE (val)->integer > 0) 1203 if (XSAVE_INTEGER (val, 1) > 0)
1206 { 1204 {
1207 /* FT_Face in this cache is already used by the different size. */ 1205 /* FT_Face in this cache is already used by the different size. */
1208 if (FT_New_Size (ft_face, &ft_size) != 0) 1206 if (FT_New_Size (ft_face, &ft_size) != 0)
@@ -1213,13 +1211,13 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
1213 return Qnil; 1211 return Qnil;
1214 } 1212 }
1215 } 1213 }
1216 XSAVE_VALUE (val)->integer++; 1214 XSAVE_INTEGER (val, 1)++;
1217 size = XINT (AREF (entity, FONT_SIZE_INDEX)); 1215 size = XINT (AREF (entity, FONT_SIZE_INDEX));
1218 if (size == 0) 1216 if (size == 0)
1219 size = pixel_size; 1217 size = pixel_size;
1220 if (FT_Set_Pixel_Sizes (ft_face, size, size) != 0) 1218 if (FT_Set_Pixel_Sizes (ft_face, size, size) != 0)
1221 { 1219 {
1222 if (XSAVE_VALUE (val)->integer == 0) 1220 if (XSAVE_INTEGER (val, 1) == 0)
1223 FT_Done_Face (ft_face); 1221 FT_Done_Face (ft_face);
1224 return Qnil; 1222 return Qnil;
1225 } 1223 }
@@ -1328,10 +1326,10 @@ ftfont_close (FRAME_PTR f, struct font *font)
1328 cache = ftfont_lookup_cache (val, FTFONT_CACHE_FOR_FACE); 1326 cache = ftfont_lookup_cache (val, FTFONT_CACHE_FOR_FACE);
1329 eassert (CONSP (cache)); 1327 eassert (CONSP (cache));
1330 val = XCDR (cache); 1328 val = XCDR (cache);
1331 (XSAVE_VALUE (val)->integer)--; 1329 XSAVE_INTEGER (val, 1)--;
1332 if (XSAVE_VALUE (val)->integer == 0) 1330 if (XSAVE_INTEGER (val, 1) == 0)
1333 { 1331 {
1334 struct ftfont_cache_data *cache_data = XSAVE_VALUE (val)->pointer; 1332 struct ftfont_cache_data *cache_data = XSAVE_POINTER (val, 0);
1335 1333
1336 FT_Done_Face (cache_data->ft_face); 1334 FT_Done_Face (cache_data->ft_face);
1337#ifdef HAVE_LIBOTF 1335#ifdef HAVE_LIBOTF
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 95ac04b8ff0..f045deacd33 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1650,8 +1650,7 @@ xg_dialog_response_cb (GtkDialog *w,
1650static Lisp_Object 1650static Lisp_Object
1651pop_down_dialog (Lisp_Object arg) 1651pop_down_dialog (Lisp_Object arg)
1652{ 1652{
1653 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 1653 struct xg_dialog_data *dd = XSAVE_POINTER (arg, 0);
1654 struct xg_dialog_data *dd = (struct xg_dialog_data *) p->pointer;
1655 1654
1656 block_input (); 1655 block_input ();
1657 if (dd->w) gtk_widget_destroy (dd->w); 1656 if (dd->w) gtk_widget_destroy (dd->w);
@@ -3795,13 +3794,17 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3795 3794
3796 adj = gtk_range_get_adjustment (GTK_RANGE (wscroll)); 3795 adj = gtk_range_get_adjustment (GTK_RANGE (wscroll));
3797 3796
3798 /* We do the same as for MOTIF in xterm.c, assume 30 chars per line 3797 if (scroll_bar_adjust_thumb_portion_p)
3799 rather than the real portion value. This makes the thumb less likely 3798 {
3800 to resize and that looks better. */ 3799 /* We do the same as for MOTIF in xterm.c, use 30 chars per
3801 portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; 3800 line rather than the real portion value. This makes the
3802 /* When the thumb is at the bottom, position == whole. 3801 thumb less likely to resize and that looks better. */
3803 So we need to increase `whole' to make space for the thumb. */ 3802 portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30;
3804 whole += portion; 3803
3804 /* When the thumb is at the bottom, position == whole.
3805 So we need to increase `whole' to make space for the thumb. */
3806 whole += portion;
3807 }
3805 3808
3806 if (whole <= 0) 3809 if (whole <= 0)
3807 top = 0, shown = 1; 3810 top = 0, shown = 1;
@@ -5041,7 +5044,9 @@ xg_initialize (void)
5041 "cancel", 0); 5044 "cancel", 0);
5042 update_theme_scrollbar_width (); 5045 update_theme_scrollbar_width ();
5043 5046
5047#ifdef HAVE_FREETYPE
5044 x_last_font_name = NULL; 5048 x_last_font_name = NULL;
5049#endif
5045} 5050}
5046 5051
5047#endif /* USE_GTK */ 5052#endif /* USE_GTK */
diff --git a/src/indent.c b/src/indent.c
index 4a30c00dd27..45b6afbd395 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1970,7 +1970,7 @@ whether or not it is currently displayed in some window. */)
1970 struct window *w; 1970 struct window *w;
1971 Lisp_Object old_buffer; 1971 Lisp_Object old_buffer;
1972 EMACS_INT old_charpos IF_LINT (= 0), old_bytepos IF_LINT (= 0); 1972 EMACS_INT old_charpos IF_LINT (= 0), old_bytepos IF_LINT (= 0);
1973 struct gcpro gcpro1, gcpro2, gcpro3; 1973 struct gcpro gcpro1;
1974 Lisp_Object lcols = Qnil; 1974 Lisp_Object lcols = Qnil;
1975 double cols IF_LINT (= 0); 1975 double cols IF_LINT (= 0);
1976 void *itdata = NULL; 1976 void *itdata = NULL;
@@ -1987,7 +1987,7 @@ whether or not it is currently displayed in some window. */)
1987 w = decode_live_window (window); 1987 w = decode_live_window (window);
1988 1988
1989 old_buffer = Qnil; 1989 old_buffer = Qnil;
1990 GCPRO3 (old_buffer, old_charpos, old_bytepos); 1990 GCPRO1 (old_buffer);
1991 if (XBUFFER (w->buffer) != current_buffer) 1991 if (XBUFFER (w->buffer) != current_buffer)
1992 { 1992 {
1993 /* Set the window's buffer temporarily to the current buffer. */ 1993 /* Set the window's buffer temporarily to the current buffer. */
diff --git a/src/insdel.c b/src/insdel.c
index 52a017a62a2..303247816ca 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -84,21 +84,14 @@ check_markers (void)
84 84
85#endif /* MARKER_DEBUG */ 85#endif /* MARKER_DEBUG */
86 86
87/* Move gap to position CHARPOS.
88 Note that this can quit! */
89
90void
91move_gap (ptrdiff_t charpos)
92{
93 move_gap_both (charpos, CHAR_TO_BYTE (charpos));
94}
95
96/* Move gap to byte position BYTEPOS, which is also char position CHARPOS. 87/* Move gap to byte position BYTEPOS, which is also char position CHARPOS.
97 Note that this can quit! */ 88 Note that this can quit! */
98 89
99void 90void
100move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos) 91move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos)
101{ 92{
93 eassert (charpos == BYTE_TO_CHAR (bytepos)
94 && bytepos == CHAR_TO_BYTE (charpos));
102 if (bytepos < GPT_BYTE) 95 if (bytepos < GPT_BYTE)
103 gap_left (charpos, bytepos, 0); 96 gap_left (charpos, bytepos, 0);
104 else if (bytepos > GPT_BYTE) 97 else if (bytepos > GPT_BYTE)
@@ -388,14 +381,13 @@ make_gap_larger (ptrdiff_t nbytes_added)
388 ptrdiff_t real_gap_loc_byte; 381 ptrdiff_t real_gap_loc_byte;
389 ptrdiff_t old_gap_size; 382 ptrdiff_t old_gap_size;
390 ptrdiff_t current_size = Z_BYTE - BEG_BYTE + GAP_SIZE; 383 ptrdiff_t current_size = Z_BYTE - BEG_BYTE + GAP_SIZE;
391 enum { enough_for_a_while = 2000 };
392 384
393 if (BUF_BYTES_MAX - current_size < nbytes_added) 385 if (BUF_BYTES_MAX - current_size < nbytes_added)
394 buffer_overflow (); 386 buffer_overflow ();
395 387
396 /* If we have to get more space, get enough to last a while; 388 /* If we have to get more space, get enough to last a while;
397 but do not exceed the maximum buffer size. */ 389 but do not exceed the maximum buffer size. */
398 nbytes_added = min (nbytes_added + enough_for_a_while, 390 nbytes_added = min (nbytes_added + GAP_BYTES_DFL,
399 BUF_BYTES_MAX - current_size); 391 BUF_BYTES_MAX - current_size);
400 392
401 enlarge_buffer_text (current_buffer, nbytes_added); 393 enlarge_buffer_text (current_buffer, nbytes_added);
@@ -413,8 +405,7 @@ make_gap_larger (ptrdiff_t nbytes_added)
413 GPT_BYTE = Z_BYTE + GAP_SIZE; 405 GPT_BYTE = Z_BYTE + GAP_SIZE;
414 GAP_SIZE = nbytes_added; 406 GAP_SIZE = nbytes_added;
415 407
416 /* Move the new gap down to be consecutive with the end of the old one. 408 /* Move the new gap down to be consecutive with the end of the old one. */
417 This adjusts the markers properly too. */
418 gap_left (real_gap_loc + old_gap_size, real_gap_loc_byte + old_gap_size, 1); 409 gap_left (real_gap_loc + old_gap_size, real_gap_loc_byte + old_gap_size, 1);
419 410
420 /* Now combine the two into one large gap. */ 411 /* Now combine the two into one large gap. */
@@ -443,9 +434,9 @@ make_gap_smaller (ptrdiff_t nbytes_removed)
443 ptrdiff_t real_beg_unchanged; 434 ptrdiff_t real_beg_unchanged;
444 ptrdiff_t new_gap_size; 435 ptrdiff_t new_gap_size;
445 436
446 /* Make sure the gap is at least 20 bytes. */ 437 /* Make sure the gap is at least GAP_BYTES_MIN bytes. */
447 if (GAP_SIZE - nbytes_removed < 20) 438 if (GAP_SIZE - nbytes_removed < GAP_BYTES_MIN)
448 nbytes_removed = GAP_SIZE - 20; 439 nbytes_removed = GAP_SIZE - GAP_BYTES_MIN;
449 440
450 /* Prevent quitting in move_gap. */ 441 /* Prevent quitting in move_gap. */
451 tem = Vinhibit_quit; 442 tem = Vinhibit_quit;
@@ -468,8 +459,7 @@ make_gap_smaller (ptrdiff_t nbytes_removed)
468 Z_BYTE += new_gap_size; 459 Z_BYTE += new_gap_size;
469 GAP_SIZE = nbytes_removed; 460 GAP_SIZE = nbytes_removed;
470 461
471 /* Move the unwanted pretend gap to the end of the buffer. This 462 /* Move the unwanted pretend gap to the end of the buffer. */
472 adjusts the markers properly too. */
473 gap_right (Z, Z_BYTE); 463 gap_right (Z, Z_BYTE);
474 464
475 enlarge_buffer_text (current_buffer, -nbytes_removed); 465 enlarge_buffer_text (current_buffer, -nbytes_removed);
@@ -500,7 +490,20 @@ make_gap (ptrdiff_t nbytes_added)
500 make_gap_smaller (-nbytes_added); 490 make_gap_smaller (-nbytes_added);
501#endif 491#endif
502} 492}
503 493
494/* Add NBYTES to B's gap. It's enough to temporarily
495 fake current_buffer and avoid real switch to B. */
496
497void
498make_gap_1 (struct buffer *b, ptrdiff_t nbytes)
499{
500 struct buffer *oldb = current_buffer;
501
502 current_buffer = b;
503 make_gap (nbytes);
504 current_buffer = oldb;
505}
506
504/* Copy NBYTES bytes of text from FROM_ADDR to TO_ADDR. 507/* Copy NBYTES bytes of text from FROM_ADDR to TO_ADDR.
505 FROM_MULTIBYTE says whether the incoming text is multibyte. 508 FROM_MULTIBYTE says whether the incoming text is multibyte.
506 TO_MULTIBYTE says whether to store the text as multibyte. 509 TO_MULTIBYTE says whether to store the text as multibyte.
@@ -2081,7 +2084,7 @@ Fcombine_after_change_execute_1 (Lisp_Object val)
2081 2084
2082DEFUN ("combine-after-change-execute", Fcombine_after_change_execute, 2085DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
2083 Scombine_after_change_execute, 0, 0, 0, 2086 Scombine_after_change_execute, 0, 0, 0,
2084 doc: /* This function is for use internally in `combine-after-change-calls'. */) 2087 doc: /* This function is for use internally in the function `combine-after-change-calls'. */)
2085 (void) 2088 (void)
2086{ 2089{
2087 ptrdiff_t count = SPECPDL_INDEX (); 2090 ptrdiff_t count = SPECPDL_INDEX ();
@@ -2173,7 +2176,7 @@ syms_of_insdel (void)
2173 combine_after_change_buffer = Qnil; 2176 combine_after_change_buffer = Qnil;
2174 2177
2175 DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls, 2178 DEFVAR_LISP ("combine-after-change-calls", Vcombine_after_change_calls,
2176 doc: /* Used internally by the `combine-after-change-calls' macro. */); 2179 doc: /* Used internally by the function `combine-after-change-calls' macro. */);
2177 Vcombine_after_change_calls = Qnil; 2180 Vcombine_after_change_calls = Qnil;
2178 2181
2179 DEFVAR_BOOL ("inhibit-modification-hooks", inhibit_modification_hooks, 2182 DEFVAR_BOOL ("inhibit-modification-hooks", inhibit_modification_hooks,
diff --git a/src/keyboard.c b/src/keyboard.c
index 8edd705135f..7594a4f72fc 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -497,97 +497,103 @@ kset_system_key_syms (struct kboard *kb, Lisp_Object val)
497} 497}
498 498
499 499
500/* Add C to the echo string, if echoing is going on. 500/* Add C to the echo string, without echoing it immediately. C can be
501 C can be a character, which is printed prettily ("M-C-x" and all that 501 a character, which is pretty-printed, or a symbol, whose name is
502 jazz), or a symbol, whose name is printed. */ 502 printed. */
503 503
504static void 504static void
505echo_char (Lisp_Object c) 505echo_add_key (Lisp_Object c)
506{ 506{
507 if (current_kboard->immediate_echo) 507 int size = KEY_DESCRIPTION_SIZE + 100;
508 { 508 char *buffer = alloca (size);
509 int size = KEY_DESCRIPTION_SIZE + 100; 509 char *ptr = buffer;
510 char *buffer = alloca (size); 510 Lisp_Object echo_string;
511 char *ptr = buffer;
512 Lisp_Object echo_string;
513 511
514 echo_string = KVAR (current_kboard, echo_string); 512 echo_string = KVAR (current_kboard, echo_string);
515 513
516 /* If someone has passed us a composite event, use its head symbol. */ 514 /* If someone has passed us a composite event, use its head symbol. */
517 c = EVENT_HEAD (c); 515 c = EVENT_HEAD (c);
518 516
519 if (INTEGERP (c)) 517 if (INTEGERP (c))
518 ptr = push_key_description (XINT (c), ptr);
519 else if (SYMBOLP (c))
520 {
521 Lisp_Object name = SYMBOL_NAME (c);
522 int nbytes = SBYTES (name);
523
524 if (size - (ptr - buffer) < nbytes)
520 { 525 {
521 ptr = push_key_description (XINT (c), ptr); 526 int offset = ptr - buffer;
527 size = max (2 * size, size + nbytes);
528 buffer = alloca (size);
529 ptr = buffer + offset;
522 } 530 }
523 else if (SYMBOLP (c))
524 {
525 Lisp_Object name = SYMBOL_NAME (c);
526 int nbytes = SBYTES (name);
527 531
528 if (size - (ptr - buffer) < nbytes) 532 ptr += copy_text (SDATA (name), (unsigned char *) ptr, nbytes,
529 { 533 STRING_MULTIBYTE (name), 1);
530 int offset = ptr - buffer; 534 }
531 size = max (2 * size, size + nbytes);
532 buffer = alloca (size);
533 ptr = buffer + offset;
534 }
535 535
536 ptr += copy_text (SDATA (name), (unsigned char *) ptr, nbytes, 536 if ((NILP (echo_string) || SCHARS (echo_string) == 0)
537 STRING_MULTIBYTE (name), 1); 537 && help_char_p (c))
538 } 538 {
539 const char *text = " (Type ? for further options)";
540 int len = strlen (text);
539 541
540 if ((NILP (echo_string) || SCHARS (echo_string) == 0) 542 if (size - (ptr - buffer) < len)
541 && help_char_p (c))
542 { 543 {
543 const char *text = " (Type ? for further options)"; 544 int offset = ptr - buffer;
544 int len = strlen (text); 545 size += len;
545 546 buffer = alloca (size);
546 if (size - (ptr - buffer) < len) 547 ptr = buffer + offset;
547 {
548 int offset = ptr - buffer;
549 size += len;
550 buffer = alloca (size);
551 ptr = buffer + offset;
552 }
553
554 memcpy (ptr, text, len);
555 ptr += len;
556 } 548 }
557 549
558 /* Replace a dash from echo_dash with a space, otherwise 550 memcpy (ptr, text, len);
559 add a space at the end as a separator between keys. */ 551 ptr += len;
560 if (STRINGP (echo_string) 552 }
561 && SCHARS (echo_string) > 1)
562 {
563 Lisp_Object last_char, prev_char, idx;
564 553
565 idx = make_number (SCHARS (echo_string) - 2); 554 /* Replace a dash from echo_dash with a space, otherwise add a space
566 prev_char = Faref (echo_string, idx); 555 at the end as a separator between keys. */
556 if (STRINGP (echo_string) && SCHARS (echo_string) > 1)
557 {
558 Lisp_Object last_char, prev_char, idx;
567 559
568 idx = make_number (SCHARS (echo_string) - 1); 560 idx = make_number (SCHARS (echo_string) - 2);
569 last_char = Faref (echo_string, idx); 561 prev_char = Faref (echo_string, idx);
570 562
571 /* We test PREV_CHAR to make sure this isn't the echoing 563 idx = make_number (SCHARS (echo_string) - 1);
572 of a minus-sign. */ 564 last_char = Faref (echo_string, idx);
573 if (XINT (last_char) == '-' && XINT (prev_char) != ' ') 565
574 Faset (echo_string, idx, make_number (' ')); 566 /* We test PREV_CHAR to make sure this isn't the echoing of a
575 else 567 minus-sign. */
576 echo_string = concat2 (echo_string, build_string (" ")); 568 if (XINT (last_char) == '-' && XINT (prev_char) != ' ')
577 } 569 Faset (echo_string, idx, make_number (' '));
578 else if (STRINGP (echo_string)) 570 else
579 echo_string = concat2 (echo_string, build_string (" ")); 571 echo_string = concat2 (echo_string, build_string (" "));
572 }
573 else if (STRINGP (echo_string) && SCHARS (echo_string) > 0)
574 echo_string = concat2 (echo_string, build_string (" "));
580 575
581 kset_echo_string 576 kset_echo_string
582 (current_kboard, 577 (current_kboard,
583 concat2 (echo_string, make_string (buffer, ptr - buffer))); 578 concat2 (echo_string, make_string (buffer, ptr - buffer)));
579}
580
581/* Add C to the echo string, if echoing is going on. C can be a
582 character or a symbol. */
584 583
584static void
585echo_char (Lisp_Object c)
586{
587 if (current_kboard->immediate_echo)
588 {
589 echo_add_key (c);
585 echo_now (); 590 echo_now ();
586 } 591 }
587} 592}
588 593
589/* Temporarily add a dash to the end of the echo string if it's not 594/* Temporarily add a dash to the end of the echo string if it's not
590 empty, so that it serves as a mini-prompt for the very next character. */ 595 empty, so that it serves as a mini-prompt for the very next
596 character. */
591 597
592static void 598static void
593echo_dash (void) 599echo_dash (void)
@@ -9218,8 +9224,12 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9218 key = keybuf[t]; 9224 key = keybuf[t];
9219 add_command_key (key); 9225 add_command_key (key);
9220 if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 9226 if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
9221 && NILP (Fzerop (Vecho_keystrokes))) 9227 && NILP (Fzerop (Vecho_keystrokes))
9222 echo_char (key); 9228 && current_kboard->immediate_echo)
9229 {
9230 echo_add_key (key);
9231 echo_dash ();
9232 }
9223 } 9233 }
9224 9234
9225 /* If not, we should actually read a character. */ 9235 /* If not, we should actually read a character. */
@@ -10160,7 +10170,7 @@ DEFUN ("command-execute", Fcommand_execute, Scommand_execute, 1, 4, 0,
10160 doc: /* Execute CMD as an editor command. 10170 doc: /* Execute CMD as an editor command.
10161CMD must be a symbol that satisfies the `commandp' predicate. 10171CMD must be a symbol that satisfies the `commandp' predicate.
10162Optional second arg RECORD-FLAG non-nil 10172Optional second arg RECORD-FLAG non-nil
10163means unconditionally put this command in `command-history'. 10173means unconditionally put this command in the variable `command-history'.
10164Otherwise, that is done only if an arg is read using the minibuffer. 10174Otherwise, that is done only if an arg is read using the minibuffer.
10165The argument KEYS specifies the value to use instead of (this-command-keys) 10175The argument KEYS specifies the value to use instead of (this-command-keys)
10166when reading the arguments; if it is nil, (this-command-keys) is used. 10176when reading the arguments; if it is nil, (this-command-keys) is used.
@@ -12045,8 +12055,8 @@ This takes effect only when Transient Mark mode is enabled. */);
12045 Vsaved_region_selection, 12055 Vsaved_region_selection,
12046 doc: /* Contents of active region prior to buffer modification. 12056 doc: /* Contents of active region prior to buffer modification.
12047If `select-active-regions' is non-nil, Emacs sets this to the 12057If `select-active-regions' is non-nil, Emacs sets this to the
12048text in the region before modifying the buffer. The next 12058text in the region before modifying the buffer. The next call to
12049`deactivate-mark' call uses this to set the window selection. */); 12059the function `deactivate-mark' uses this to set the window selection. */);
12050 Vsaved_region_selection = Qnil; 12060 Vsaved_region_selection = Qnil;
12051 12061
12052 DEFVAR_LISP ("selection-inhibit-update-commands", 12062 DEFVAR_LISP ("selection-inhibit-update-commands",
diff --git a/src/keymap.c b/src/keymap.c
index d1ddd55a358..a9266120e86 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -565,15 +565,13 @@ map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val)
565{ 565{
566 if (!NILP (val)) 566 if (!NILP (val))
567 { 567 {
568 map_keymap_function_t fun 568 map_keymap_function_t fun = XSAVE_POINTER (args, 0);
569 = (map_keymap_function_t) XSAVE_VALUE (XCAR (args))->pointer;
570 args = XCDR (args);
571 /* If the key is a range, make a copy since map_char_table modifies 569 /* If the key is a range, make a copy since map_char_table modifies
572 it in place. */ 570 it in place. */
573 if (CONSP (key)) 571 if (CONSP (key))
574 key = Fcons (XCAR (key), XCDR (key)); 572 key = Fcons (XCAR (key), XCDR (key));
575 map_keymap_item (fun, XCDR (args), key, val, 573 map_keymap_item (fun, XSAVE_OBJECT (args, 2), key,
576 XSAVE_VALUE (XCAR (args))->pointer); 574 val, XSAVE_POINTER (args, 1));
577 } 575 }
578} 576}
579 577
@@ -611,12 +609,8 @@ map_keymap_internal (Lisp_Object map,
611 } 609 }
612 } 610 }
613 else if (CHAR_TABLE_P (binding)) 611 else if (CHAR_TABLE_P (binding))
614 { 612 map_char_table (map_keymap_char_table_item, Qnil, binding,
615 map_char_table (map_keymap_char_table_item, Qnil, binding, 613 format_save_value ("ppo", fun, data, args));
616 Fcons (make_save_value ((void *) fun, 0),
617 Fcons (make_save_value (data, 0),
618 args)));
619 }
620 } 614 }
621 UNGCPRO; 615 UNGCPRO;
622 return tail; 616 return tail;
diff --git a/src/lisp.h b/src/lisp.h
index e96c9664743..9cebdef2b20 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1389,20 +1389,60 @@ struct Lisp_Overlay
1389 Lisp_Object plist; 1389 Lisp_Object plist;
1390 }; 1390 };
1391 1391
1392/* Hold a C pointer for later use. 1392/* Types of data which may be saved in a Lisp_Save_Value. */
1393 This type of object is used in the arg to record_unwind_protect. */ 1393
1394enum
1395 {
1396 SAVE_UNUSED,
1397 SAVE_INTEGER,
1398 SAVE_POINTER,
1399 SAVE_OBJECT
1400 };
1401
1402/* Special object used to hold a different values for later use. */
1403
1394struct Lisp_Save_Value 1404struct Lisp_Save_Value
1395 { 1405 {
1396 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */ 1406 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */
1397 unsigned gcmarkbit : 1; 1407 unsigned gcmarkbit : 1;
1398 int spacer : 14; 1408 int spacer : 6;
1399 /* If DOGC is set, POINTER is the address of a memory 1409 /* If `area' is nonzero, `data[0].pointer' is the address of a memory area
1400 area containing INTEGER potential Lisp_Objects. */ 1410 containing `data[1].integer' potential Lisp_Objects. The rest of `data'
1401 unsigned int dogc : 1; 1411 fields are unused. */
1402 void *pointer; 1412 unsigned area : 1;
1403 ptrdiff_t integer; 1413 /* If `area' is zero, `data[N]' may hold different objects which type is
1414 encoded in `typeN' fields as described by the anonymous enum above.
1415 E.g. if `type0' is SAVE_INTEGER, `data[0].integer' is in use. */
1416 unsigned type0 : 2;
1417 unsigned type1 : 2;
1418 unsigned type2 : 2;
1419 unsigned type3 : 2;
1420 union {
1421 void *pointer;
1422 ptrdiff_t integer;
1423 Lisp_Object object;
1424 } data[4];
1404 }; 1425 };
1405 1426
1427/* Macro to set and extract Nth saved pointer. Type
1428 checking is ugly because it's used as an lvalue. */
1429
1430#define XSAVE_POINTER(obj, n) \
1431 XSAVE_VALUE (obj)->data[(eassert (XSAVE_VALUE (obj)->type \
1432 ## n == SAVE_POINTER), n)].pointer
1433
1434/* Likewise for the saved integer. */
1435
1436#define XSAVE_INTEGER(obj, n) \
1437 XSAVE_VALUE (obj)->data[(eassert (XSAVE_VALUE (obj)->type \
1438 ## n == SAVE_INTEGER), n)].integer
1439
1440/* Macro to extract Nth saved object. This is never used as
1441 an lvalue, so we can do more convenient type checking. */
1442
1443#define XSAVE_OBJECT(obj, n) \
1444 (eassert (XSAVE_VALUE (obj)->type ## n == SAVE_OBJECT), \
1445 XSAVE_VALUE (obj)->data[n].object)
1406 1446
1407/* A miscellaneous object, when it's on the free list. */ 1447/* A miscellaneous object, when it's on the free list. */
1408struct Lisp_Free 1448struct Lisp_Free
@@ -1461,7 +1501,8 @@ struct Lisp_Buffer_Objfwd
1461 { 1501 {
1462 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Buffer_Obj */ 1502 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Buffer_Obj */
1463 int offset; 1503 int offset;
1464 Lisp_Object slottype; /* Qnil, Lisp_Int, Lisp_Symbol, or Lisp_String. */ 1504 /* One of Qnil, Qintegerp, Qsymbolp, Qstringp, Qfloatp or Qnumberp. */
1505 Lisp_Object predicate;
1465 }; 1506 };
1466 1507
1467/* struct Lisp_Buffer_Local_Value is used in a symbol value cell when 1508/* struct Lisp_Buffer_Local_Value is used in a symbol value cell when
@@ -2231,8 +2272,12 @@ struct gcpro
2231 2 Mark the stack, and check that everything GCPRO'd is 2272 2 Mark the stack, and check that everything GCPRO'd is
2232 marked. 2273 marked.
2233 3 Mark using GCPRO's, mark stack last, and count how many 2274 3 Mark using GCPRO's, mark stack last, and count how many
2234 dead objects are kept alive. */ 2275 dead objects are kept alive.
2235 2276
2277 Formerly, method 0 was used. Currently, method 1 is used unless
2278 otherwise specified by hand when building, e.g.,
2279 "make CPPFLAGS='-DGC_MARK_STACK=GC_USE_GCPROS_AS_BEFORE'".
2280 Methods 2 and 3 are present mainly to debug the transition from 0 to 1. */
2236 2281
2237#define GC_USE_GCPROS_AS_BEFORE 0 2282#define GC_USE_GCPROS_AS_BEFORE 0
2238#define GC_MAKE_GCPROS_NOOPS 1 2283#define GC_MAKE_GCPROS_NOOPS 1
@@ -2788,10 +2833,10 @@ extern void syms_of_image (void);
2788 2833
2789/* Defined in insdel.c. */ 2834/* Defined in insdel.c. */
2790extern Lisp_Object Qinhibit_modification_hooks; 2835extern Lisp_Object Qinhibit_modification_hooks;
2791extern void move_gap (ptrdiff_t);
2792extern void move_gap_both (ptrdiff_t, ptrdiff_t); 2836extern void move_gap_both (ptrdiff_t, ptrdiff_t);
2793extern _Noreturn void buffer_overflow (void); 2837extern _Noreturn void buffer_overflow (void);
2794extern void make_gap (ptrdiff_t); 2838extern void make_gap (ptrdiff_t);
2839extern void make_gap_1 (struct buffer *, ptrdiff_t);
2795extern ptrdiff_t copy_text (const unsigned char *, unsigned char *, 2840extern ptrdiff_t copy_text (const unsigned char *, unsigned char *,
2796 ptrdiff_t, bool, bool); 2841 ptrdiff_t, bool, bool);
2797extern int count_combining_before (const unsigned char *, 2842extern int count_combining_before (const unsigned char *,
@@ -2902,6 +2947,7 @@ extern void memory_warnings (void *, void (*warnfun) (const char *));
2902 2947
2903/* Defined in alloc.c. */ 2948/* Defined in alloc.c. */
2904extern void check_pure_size (void); 2949extern void check_pure_size (void);
2950extern void free_misc (Lisp_Object);
2905extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT); 2951extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT);
2906extern void malloc_warning (const char *); 2952extern void malloc_warning (const char *);
2907extern _Noreturn void memory_full (size_t); 2953extern _Noreturn void memory_full (size_t);
@@ -2989,8 +3035,8 @@ extern bool abort_on_gc;
2989extern Lisp_Object make_float (double); 3035extern Lisp_Object make_float (double);
2990extern void display_malloc_warning (void); 3036extern void display_malloc_warning (void);
2991extern ptrdiff_t inhibit_garbage_collection (void); 3037extern ptrdiff_t inhibit_garbage_collection (void);
3038extern Lisp_Object format_save_value (const char *, ...);
2992extern Lisp_Object make_save_value (void *, ptrdiff_t); 3039extern Lisp_Object make_save_value (void *, ptrdiff_t);
2993extern void free_save_value (Lisp_Object);
2994extern Lisp_Object build_overlay (Lisp_Object, Lisp_Object, Lisp_Object); 3040extern Lisp_Object build_overlay (Lisp_Object, Lisp_Object, Lisp_Object);
2995extern void free_marker (Lisp_Object); 3041extern void free_marker (Lisp_Object);
2996extern void free_cons (struct Lisp_Cons *); 3042extern void free_cons (struct Lisp_Cons *);
@@ -3479,6 +3525,8 @@ extern void init_sigio (int);
3479extern void sys_subshell (void); 3525extern void sys_subshell (void);
3480extern void sys_suspend (void); 3526extern void sys_suspend (void);
3481extern void discard_tty_input (void); 3527extern void discard_tty_input (void);
3528extern void block_tty_out_signal (void);
3529extern void unblock_tty_out_signal (void);
3482extern void init_sys_modes (struct tty_display_info *); 3530extern void init_sys_modes (struct tty_display_info *);
3483extern void reset_sys_modes (struct tty_display_info *); 3531extern void reset_sys_modes (struct tty_display_info *);
3484extern void init_all_sys_modes (void); 3532extern void init_all_sys_modes (void);
@@ -3707,7 +3755,7 @@ extern void *record_xmalloc (size_t);
3707 Lisp_Object arg_; \ 3755 Lisp_Object arg_; \
3708 buf = xmalloc ((nelt) * word_size); \ 3756 buf = xmalloc ((nelt) * word_size); \
3709 arg_ = make_save_value (buf, nelt); \ 3757 arg_ = make_save_value (buf, nelt); \
3710 XSAVE_VALUE (arg_)->dogc = 1; \ 3758 XSAVE_VALUE (arg_)->area = 1; \
3711 sa_must_free = 1; \ 3759 sa_must_free = 1; \
3712 record_unwind_protect (safe_alloca_unwind, arg_); \ 3760 record_unwind_protect (safe_alloca_unwind, arg_); \
3713 } \ 3761 } \
diff --git a/src/lread.c b/src/lread.c
index 2b96dc16359..a01cf099b49 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1357,7 +1357,7 @@ Return t if the file exists and loads successfully. */)
1357static Lisp_Object 1357static Lisp_Object
1358load_unwind (Lisp_Object arg) /* Used as unwind-protect function in load. */ 1358load_unwind (Lisp_Object arg) /* Used as unwind-protect function in load. */
1359{ 1359{
1360 FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; 1360 FILE *stream = XSAVE_POINTER (arg, 0);
1361 if (stream != NULL) 1361 if (stream != NULL)
1362 { 1362 {
1363 block_input (); 1363 block_input ();
diff --git a/src/nsfns.m b/src/nsfns.m
index 1750eb62cdf..fac61d2ab53 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1503,12 +1503,12 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1503 [panel setDelegate: fileDelegate]; 1503 [panel setDelegate: fileDelegate];
1504 1504
1505 panelOK = 0; 1505 panelOK = 0;
1506 if (! NILP (dir_only_p)) 1506 if (! NILP (dir_only_p))
1507 { 1507 {
1508 [panel setCanChooseDirectories: YES]; 1508 [panel setCanChooseDirectories: YES];
1509 [panel setCanChooseFiles: NO]; 1509 [panel setCanChooseFiles: NO];
1510 } 1510 }
1511 1511
1512 block_input (); 1512 block_input ();
1513#if defined (NS_IMPL_COCOA) && \ 1513#if defined (NS_IMPL_COCOA) && \
1514 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 1514 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
@@ -1519,7 +1519,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */)
1519 [panel setNameFieldStringValue: [initS lastPathComponent]]; 1519 [panel setNameFieldStringValue: [initS lastPathComponent]];
1520 else 1520 else
1521 [panel setNameFieldStringValue: @""]; 1521 [panel setNameFieldStringValue: @""];
1522 1522
1523 ret = [panel runModal]; 1523 ret = [panel runModal];
1524#else 1524#else
1525 if (NILP (mustmatch) && NILP (dir_only_p)) 1525 if (NILP (mustmatch) && NILP (dir_only_p))
@@ -2147,7 +2147,7 @@ In case the execution fails, an error is signaled. */)
2147 [NSApp postEvent: nxev atStart: NO]; 2147 [NSApp postEvent: nxev atStart: NO];
2148 2148
2149 // If there are other events, the event loop may exit. Keep running 2149 // If there are other events, the event loop may exit. Keep running
2150 // until the script has been handeled. */ 2150 // until the script has been handled. */
2151 while (! NILP (as_script)) 2151 while (! NILP (as_script))
2152 [NSApp run]; 2152 [NSApp run];
2153 2153
diff --git a/src/nsfont.m b/src/nsfont.m
index c0bea2e225c..5039f0c9013 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -44,6 +44,7 @@ Author: Adrian Robert (arobert@cogsci.ucsd.edu)
44#endif 44#endif
45 45
46#define NSFONT_TRACE 0 46#define NSFONT_TRACE 0
47#define LCD_SMOOTHING_MARGIN 2
47 48
48extern Lisp_Object Qns; 49extern Lisp_Object Qns;
49extern Lisp_Object Qnormal, Qbold, Qitalic; 50extern Lisp_Object Qnormal, Qbold, Qitalic;
@@ -546,6 +547,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
546 NSSet *cFamilies; 547 NSSet *cFamilies;
547 BOOL foundItal = NO; 548 BOOL foundItal = NO;
548 549
550 block_input ();
549 if (NSFONT_TRACE) 551 if (NSFONT_TRACE)
550 { 552 {
551 fprintf (stderr, "nsfont: %s for fontspec:\n ", 553 fprintf (stderr, "nsfont: %s for fontspec:\n ",
@@ -560,10 +562,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
560 if (isMatch) 562 if (isMatch)
561 [fkeys removeObject: NSFontFamilyAttribute]; 563 [fkeys removeObject: NSFontFamilyAttribute];
562 564
563 if ([fkeys count] > 0) 565 matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
564 matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
565 else
566 matchingDescs = [NSMutableArray array];
567 566
568 if (NSFONT_TRACE) 567 if (NSFONT_TRACE)
569 NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc, 568 NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc,
@@ -598,6 +597,8 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
598 [s1 release]; 597 [s1 release];
599 } 598 }
600 599
600 unblock_input ();
601
601 /* Return something if was a match and nothing found. */ 602 /* Return something if was a match and nothing found. */
602 if (isMatch) 603 if (isMatch)
603 return ns_fallback_entity (); 604 return ns_fallback_entity ();
@@ -701,10 +702,12 @@ static Lisp_Object
701nsfont_list_family (Lisp_Object frame) 702nsfont_list_family (Lisp_Object frame)
702{ 703{
703 Lisp_Object list = Qnil; 704 Lisp_Object list = Qnil;
704 NSEnumerator *families = 705 NSEnumerator *families;
705 [[[NSFontManager sharedFontManager] availableFontFamilies]
706 objectEnumerator];
707 NSString *family; 706 NSString *family;
707
708 block_input ();
709 families = [[[NSFontManager sharedFontManager] availableFontFamilies]
710 objectEnumerator];
708 while ((family = [families nextObject])) 711 while ((family = [families nextObject]))
709 list = Fcons (intern ([family UTF8String]), list); 712 list = Fcons (intern ([family UTF8String]), list);
710 /* FIXME: escape the name? */ 713 /* FIXME: escape the name? */
@@ -713,6 +716,7 @@ nsfont_list_family (Lisp_Object frame)
713 fprintf (stderr, "nsfont: list families returning %"pI"d entries\n", 716 fprintf (stderr, "nsfont: list families returning %"pI"d entries\n",
714 XINT (Flength (list))); 717 XINT (Flength (list)));
715 718
719 unblock_input ();
716 return list; 720 return list;
717} 721}
718 722
@@ -735,6 +739,8 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
735 Lisp_Object font_object; 739 Lisp_Object font_object;
736 int fixLeopardBug; 740 int fixLeopardBug;
737 741
742 block_input ();
743
738 if (NSFONT_TRACE) 744 if (NSFONT_TRACE)
739 { 745 {
740 fprintf (stderr, "nsfont: open size %d of fontentity:\n ", pixel_size); 746 fprintf (stderr, "nsfont: open size %d of fontentity:\n ", pixel_size);
@@ -794,13 +800,14 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
794 font_info = (struct nsfont_info *) XFONT_OBJECT (font_object); 800 font_info = (struct nsfont_info *) XFONT_OBJECT (font_object);
795 font = (struct font *) font_info; 801 font = (struct font *) font_info;
796 if (!font) 802 if (!font)
797 return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */ 803 {
804 unblock_input ();
805 return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */
806 }
798 807
799 font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); 808 font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs);
800 font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics); 809 font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics);
801 810
802 block_input ();
803
804 /* for metrics */ 811 /* for metrics */
805#ifdef NS_IMPL_COCOA 812#ifdef NS_IMPL_COCOA
806 sfont = [nsfont screenFontWithRenderingMode: 813 sfont = [nsfont screenFontWithRenderingMode:
@@ -1051,6 +1058,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1051 char isComposite = s->first_glyph->type == COMPOSITE_GLYPH; 1058 char isComposite = s->first_glyph->type == COMPOSITE_GLYPH;
1052 int end = isComposite ? s->cmp_to : s->nchars; 1059 int end = isComposite ? s->cmp_to : s->nchars;
1053 1060
1061 block_input ();
1054 /* Select face based on input flags */ 1062 /* Select face based on input flags */
1055 switch (ns_tmp_flags) 1063 switch (ns_tmp_flags)
1056 { 1064 {
@@ -1240,7 +1248,6 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1240 else 1248 else
1241 CGContextSetShouldAntialias (gcontext, 1); 1249 CGContextSetShouldAntialias (gcontext, 1);
1242 1250
1243 CGContextSetShouldSmoothFonts (gcontext, NO);
1244 CGContextSetTextMatrix (gcontext, fliptf); 1251 CGContextSetTextMatrix (gcontext, fliptf);
1245 1252
1246 if (bgCol != nil) 1253 if (bgCol != nil)
@@ -1273,6 +1280,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1273 /* Draw underline, overline, strike-through. */ 1280 /* Draw underline, overline, strike-through. */
1274 ns_draw_text_decoration (s, face, col, r.size.width, r.origin.x); 1281 ns_draw_text_decoration (s, face, col, r.size.width, r.origin.x);
1275 1282
1283 unblock_input ();
1276 return to-from; 1284 return to-from;
1277} 1285}
1278 1286
@@ -1406,11 +1414,12 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
1406 1414
1407 lb = r.origin.x; 1415 lb = r.origin.x;
1408 rb = r.size.width - w; 1416 rb = r.size.width - w;
1417 // Add to bearing for LCD smoothing. We don't know if it is there.
1409 if (lb < 0) 1418 if (lb < 0)
1410 metrics->lbearing = round (lb); 1419 metrics->lbearing = round (lb - LCD_SMOOTHING_MARGIN);
1411 if (font_info->ital) 1420 if (font_info->ital)
1412 rb += 0.22 * font_info->height; 1421 rb += 0.22 * font_info->height;
1413 metrics->rbearing = lrint (w + rb); 1422 metrics->rbearing = lrint (w + rb + LCD_SMOOTHING_MARGIN);
1414 1423
1415 metrics->descent = r.origin.y < 0 ? -r.origin.y : 0; 1424 metrics->descent = r.origin.y < 0 ? -r.origin.y : 0;
1416 /*lrint (hshrink * [sfont ascender] + expand * hd/2); */ 1425 /*lrint (hshrink * [sfont ascender] + expand * hd/2); */
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 39797d414f0..b0369e76a27 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1347,8 +1347,7 @@ struct Popdown_data
1347static Lisp_Object 1347static Lisp_Object
1348pop_down_menu (Lisp_Object arg) 1348pop_down_menu (Lisp_Object arg)
1349{ 1349{
1350 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 1350 struct Popdown_data *unwind_data = XSAVE_POINTER (arg, 0);
1351 struct Popdown_data *unwind_data = (struct Popdown_data *) p->pointer;
1352 1351
1353 block_input (); 1352 block_input ();
1354 if (popup_activated_flag) 1353 if (popup_activated_flag)
diff --git a/src/nsterm.h b/src/nsterm.h
index e58b8493c94..0cf4aa60d08 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -675,9 +675,9 @@ struct x_output
675#define FRAME_FONT(f) ((f)->output_data.ns->font) 675#define FRAME_FONT(f) ((f)->output_data.ns->font)
676 676
677#ifdef __OBJC__ 677#ifdef __OBJC__
678#define XNS_SCROLL_BAR(vec) ((id) XSAVE_VALUE (vec)->pointer) 678#define XNS_SCROLL_BAR(vec) ((id) XSAVE_POINTER (vec, 0))
679#else 679#else
680#define XNS_SCROLL_BAR(vec) XSAVE_VALUE (vec)->pointer 680#define XNS_SCROLL_BAR(vec) XSAVE_POINTER (vec, 0)
681#endif 681#endif
682 682
683/* Compute pixel size for vertical scroll bars */ 683/* Compute pixel size for vertical scroll bars */
diff --git a/src/nsterm.m b/src/nsterm.m
index 0fd062b7f17..48efac3f70b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4981,6 +4981,7 @@ not_in_argv (NSString *arg)
4981 4981
4982 emacs_event->code = code; 4982 emacs_event->code = code;
4983 EV_TRAILER (theEvent); 4983 EV_TRAILER (theEvent);
4984 processingCompose = NO;
4984 return; 4985 return;
4985 } 4986 }
4986 } 4987 }
@@ -5171,6 +5172,7 @@ not_in_argv (NSString *arg)
5171 if (NS_KEYLOG) 5172 if (NS_KEYLOG)
5172 NSLog (@"doCommandBySelector: %@", NSStringFromSelector (aSelector)); 5173 NSLog (@"doCommandBySelector: %@", NSStringFromSelector (aSelector));
5173 5174
5175 processingCompose = NO;
5174 if (aSelector == @selector (deleteBackward:)) 5176 if (aSelector == @selector (deleteBackward:))
5175 { 5177 {
5176 /* happens when user backspaces over an ongoing composition: 5178 /* happens when user backspaces over an ongoing composition:
diff --git a/src/print.c b/src/print.c
index 2ffe7def396..62009e17686 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2063,8 +2063,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2063 PRINTCHAR ('>'); 2063 PRINTCHAR ('>');
2064 break; 2064 break;
2065 2065
2066 /* Remaining cases shouldn't happen in normal usage, but let's print 2066 /* Remaining cases shouldn't happen in normal usage, but let's
2067 them anyway for the benefit of the debugger. */ 2067 print them anyway for the benefit of the debugger. */
2068
2068 case Lisp_Misc_Free: 2069 case Lisp_Misc_Free:
2069 strout ("#<misc free cell>", -1, -1, printcharfun); 2070 strout ("#<misc free cell>", -1, -1, printcharfun);
2070 break; 2071 break;
@@ -2075,20 +2076,28 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2075 struct Lisp_Save_Value *v = XSAVE_VALUE (obj); 2076 struct Lisp_Save_Value *v = XSAVE_VALUE (obj);
2076 2077
2077 strout ("#<save-value ", -1, -1, printcharfun); 2078 strout ("#<save-value ", -1, -1, printcharfun);
2078 if (v->dogc) 2079
2080 if (v->area)
2079 { 2081 {
2080 int lim = min (v->integer, 8); 2082 ptrdiff_t amount = v->data[1].integer;
2081 2083
2082 /* Try to print up to 8 objects we have saved. Although 2084#if GC_MARK_STACK
2083 valid_lisp_object_p is slow, this shouldn't be a real 2085
2084 bottleneck because such a saved values are quite rare. */ 2086 /* If GC_MARK_STACK, valid_lisp_object_p is quite reliable,
2087 and so we try to print up to 8 objects we have saved.
2088 Although valid_lisp_object_p is slow, this shouldn't be
2089 a real bottleneck because we do not use this code under
2090 normal circumstances. */
2085 2091
2086 i = sprintf (buf, "with %"pD"d objects", v->integer); 2092 int limit = min (amount, 8);
2093 Lisp_Object *area = v->data[0].pointer;
2094
2095 i = sprintf (buf, "with %"pD"d objects", amount);
2087 strout (buf, i, i, printcharfun); 2096 strout (buf, i, i, printcharfun);
2088 2097
2089 for (i = 0; i < lim; i++) 2098 for (i = 0; i < limit; i++)
2090 { 2099 {
2091 Lisp_Object maybe = ((Lisp_Object *) v->pointer)[i]; 2100 Lisp_Object maybe = area[i];
2092 2101
2093 if (valid_lisp_object_p (maybe) > 0) 2102 if (valid_lisp_object_p (maybe) > 0)
2094 { 2103 {
@@ -2098,13 +2107,49 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2098 else 2107 else
2099 strout (" <invalid>", -1, -1, printcharfun); 2108 strout (" <invalid>", -1, -1, printcharfun);
2100 } 2109 }
2101 if (i == lim && i < v->integer) 2110 if (i == limit && i < amount)
2102 strout (" ...", 4, 4, printcharfun); 2111 strout (" ...", 4, 4, printcharfun);
2112
2113#else /* not GC_MARK_STACK */
2114
2115 /* If !GC_MARK_STACK, we have no reliable way to find
2116 whether Lisp_Object pointers points to an initialized
2117 objects, and so we do not ever trying to print them. */
2118
2119 i = sprintf (buf, "with %"pD"d objects", amount);
2120 strout (buf, i, i, printcharfun);
2121
2122#endif /* GC_MARK_STACK */
2103 } 2123 }
2104 else 2124 else
2105 { 2125 {
2106 i = sprintf (buf, "ptr=%p int=%"pD"d", v->pointer, v->integer); 2126 /* Print each `data[N]' slot according to its type. */
2107 strout (buf, i, i, printcharfun); 2127
2128#define PRINTX(index) \
2129 do { \
2130 i = 0; \
2131 if (v->type ## index == SAVE_UNUSED) \
2132 i = sprintf (buf, "<unused>"); \
2133 else if (v->type ## index == SAVE_INTEGER) \
2134 i = sprintf (buf, "<integer %"pD"d>", v->data[index].integer); \
2135 else if (v->type ## index == SAVE_POINTER) \
2136 i = sprintf (buf, "<pointer %p>", v->data[index].pointer); \
2137 else /* SAVE_OBJECT */ \
2138 print_object (v->data[index].object, printcharfun, escapeflag); \
2139 if (i) \
2140 strout (buf, i, i, printcharfun); \
2141 } while (0)
2142
2143 PRINTX (0);
2144 PRINTCHAR (' ');
2145 PRINTX (1);
2146 PRINTCHAR (' ');
2147 PRINTX (2);
2148 PRINTCHAR (' ');
2149 PRINTX (3);
2150
2151#undef PRINTX
2152
2108 } 2153 }
2109 PRINTCHAR ('>'); 2154 PRINTCHAR ('>');
2110 } 2155 }
diff --git a/src/sysdep.c b/src/sysdep.c
index 049eb85afe5..0e9a6826005 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -714,6 +714,27 @@ init_foreground_group (void)
714 inherited_pgroup = getpid () == pgrp ? 0 : pgrp; 714 inherited_pgroup = getpid () == pgrp ? 0 : pgrp;
715} 715}
716 716
717/* Block and unblock SIGTTOU. */
718
719void
720block_tty_out_signal (void)
721{
722#ifdef SIGTTOU
723 sigset_t blocked;
724 sigemptyset (&blocked);
725 sigaddset (&blocked, SIGTTOU);
726 pthread_sigmask (SIG_BLOCK, &blocked, 0);
727#endif
728}
729
730void
731unblock_tty_out_signal (void)
732{
733#ifdef SIGTTOU
734 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
735#endif
736}
737
717/* Safely set a controlling terminal FD's process group to PGID. 738/* Safely set a controlling terminal FD's process group to PGID.
718 If we are not in the foreground already, POSIX requires tcsetpgrp 739 If we are not in the foreground already, POSIX requires tcsetpgrp
719 to deliver a SIGTTOU signal, which would stop us. This is an 740 to deliver a SIGTTOU signal, which would stop us. This is an
@@ -725,11 +746,10 @@ static void
725tcsetpgrp_without_stopping (int fd, pid_t pgid) 746tcsetpgrp_without_stopping (int fd, pid_t pgid)
726{ 747{
727#ifdef SIGTTOU 748#ifdef SIGTTOU
728 signal_handler_t handler;
729 block_input (); 749 block_input ();
730 handler = signal (SIGTTOU, SIG_IGN); 750 block_tty_out_signal ();
731 tcsetpgrp (fd, pgid); 751 tcsetpgrp (fd, pgid);
732 signal (SIGTTOU, handler); 752 unblock_tty_out_signal ();
733 unblock_input (); 753 unblock_input ();
734#endif 754#endif
735} 755}
@@ -1658,6 +1678,25 @@ deliver_arith_signal (int sig)
1658 deliver_thread_signal (sig, handle_arith_signal); 1678 deliver_thread_signal (sig, handle_arith_signal);
1659} 1679}
1660 1680
1681#ifdef SIGDANGER
1682
1683/* Handler for SIGDANGER. */
1684static void
1685handle_danger_signal (int sig)
1686{
1687 malloc_warning ("Operating system warns that virtual memory is running low.\n");
1688
1689 /* It might be unsafe to call do_auto_save now. */
1690 force_auto_save_soon ();
1691}
1692
1693static void
1694deliver_danger_signal (int sig)
1695{
1696 deliver_process_signal (sig, handle_danger_signal);
1697}
1698#endif
1699
1661/* Treat SIG as a terminating signal, unless it is already ignored and 1700/* Treat SIG as a terminating signal, unless it is already ignored and
1662 we are in --batch mode. Among other things, this makes nohup work. */ 1701 we are in --batch mode. Among other things, this makes nohup work. */
1663static void 1702static void
diff --git a/src/term.c b/src/term.c
index d76562bb4db..f66a0bddc33 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2423,7 +2423,7 @@ frame's terminal). */)
2423 if (fd == -1) 2423 if (fd == -1)
2424 error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno)); 2424 error ("Can not reopen tty device %s: %s", t->display_info.tty->name, strerror (errno));
2425 2425
2426 if (strcmp (t->display_info.tty->name, DEV_TTY)) 2426 if (!O_IGNORE_CTTY && strcmp (t->display_info.tty->name, DEV_TTY) != 0)
2427 dissociate_if_controlling_tty (fd); 2427 dissociate_if_controlling_tty (fd);
2428 2428
2429 t->display_info.tty->output = fdopen (fd, "w+"); 2429 t->display_info.tty->output = fdopen (fd, "w+");
@@ -2903,13 +2903,23 @@ set_tty_hooks (struct terminal *terminal)
2903 terminal->delete_terminal_hook = &delete_tty; 2903 terminal->delete_terminal_hook = &delete_tty;
2904} 2904}
2905 2905
2906/* Drop the controlling terminal if fd is the same device. */ 2906/* If FD is the controlling terminal, drop it. */
2907static void 2907static void
2908dissociate_if_controlling_tty (int fd) 2908dissociate_if_controlling_tty (int fd)
2909{ 2909{
2910 pid_t pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */ 2910 /* If tcgetpgrp succeeds, fd is the controlling terminal,
2911 if (0 <= pgid) 2911 so dissociate it by invoking setsid. */
2912 setsid (); 2912 if (0 <= tcgetpgrp (fd) && setsid () < 0)
2913 {
2914#ifdef TIOCNOTTY
2915 /* setsid failed, presumably because Emacs is already a process
2916 group leader. Fall back on the obsolescent way to dissociate
2917 a controlling tty. */
2918 block_tty_out_signal ();
2919 ioctl (fd, TIOCNOTTY, 0);
2920 unblock_tty_out_signal ();
2921#endif
2922 }
2913} 2923}
2914 2924
2915/* Create a termcap display on the tty device with the given name and 2925/* Create a termcap display on the tty device with the given name and
@@ -3030,14 +3040,9 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3030 3040
3031 /* On some systems, tgetent tries to access the controlling 3041 /* On some systems, tgetent tries to access the controlling
3032 terminal. */ 3042 terminal. */
3033 { 3043 block_tty_out_signal ();
3034 sigset_t blocked; 3044 status = tgetent (tty->termcap_term_buffer, terminal_type);
3035 sigemptyset (&blocked); 3045 unblock_tty_out_signal ();
3036 sigaddset (&blocked, SIGTTOU);
3037 pthread_sigmask (SIG_BLOCK, &blocked, 0);
3038 status = tgetent (tty->termcap_term_buffer, terminal_type);
3039 pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
3040 }
3041 3046
3042 if (status < 0) 3047 if (status < 0)
3043 { 3048 {
diff --git a/src/undo.c b/src/undo.c
index 2626fd4ccfe..63edc8e9b8d 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -452,217 +452,6 @@ user_error (const char *msg)
452} 452}
453 453
454 454
455DEFUN ("primitive-undo", Fprimitive_undo, Sprimitive_undo, 2, 2, 0,
456 doc: /* Undo N records from the front of the list LIST.
457Return what remains of the list. */)
458 (Lisp_Object n, Lisp_Object list)
459{
460 struct gcpro gcpro1, gcpro2;
461 Lisp_Object next;
462 ptrdiff_t count = SPECPDL_INDEX ();
463 register EMACS_INT arg;
464 Lisp_Object oldlist;
465 int did_apply = 0;
466
467#if 0 /* This is a good feature, but would make undo-start
468 unable to do what is expected. */
469 Lisp_Object tem;
470
471 /* If the head of the list is a boundary, it is the boundary
472 preceding this command. Get rid of it and don't count it. */
473 tem = Fcar (list);
474 if (NILP (tem))
475 list = Fcdr (list);
476#endif
477
478 CHECK_NUMBER (n);
479 arg = XINT (n);
480 next = Qnil;
481 GCPRO2 (next, list);
482 /* I don't think we need to gcpro oldlist, as we use it only
483 to check for EQ. ++kfs */
484
485 /* In a writable buffer, enable undoing read-only text that is so
486 because of text properties. */
487 if (NILP (BVAR (current_buffer, read_only)))
488 specbind (Qinhibit_read_only, Qt);
489
490 /* Don't let `intangible' properties interfere with undo. */
491 specbind (Qinhibit_point_motion_hooks, Qt);
492
493 oldlist = BVAR (current_buffer, undo_list);
494
495 while (arg > 0)
496 {
497 while (CONSP (list))
498 {
499 next = XCAR (list);
500 list = XCDR (list);
501 /* Exit inner loop at undo boundary. */
502 if (NILP (next))
503 break;
504 /* Handle an integer by setting point to that value. */
505 if (INTEGERP (next))
506 SET_PT (clip_to_bounds (BEGV, XINT (next), ZV));
507 else if (CONSP (next))
508 {
509 Lisp_Object car, cdr;
510
511 car = XCAR (next);
512 cdr = XCDR (next);
513 if (EQ (car, Qt))
514 {
515 /* Element (t . TIME) records previous modtime.
516 Preserve any flag of NONEXISTENT_MODTIME_NSECS or
517 UNKNOWN_MODTIME_NSECS. */
518 struct buffer *base_buffer = current_buffer;
519 EMACS_TIME mod_time;
520
521 if (CONSP (cdr)
522 && CONSP (XCDR (cdr))
523 && CONSP (XCDR (XCDR (cdr)))
524 && CONSP (XCDR (XCDR (XCDR (cdr))))
525 && INTEGERP (XCAR (XCDR (XCDR (XCDR (cdr)))))
526 && XINT (XCAR (XCDR (XCDR (XCDR (cdr))))) < 0)
527 mod_time =
528 (make_emacs_time
529 (0, XINT (XCAR (XCDR (XCDR (XCDR (cdr))))) / 1000));
530 else
531 mod_time = lisp_time_argument (cdr);
532
533 if (current_buffer->base_buffer)
534 base_buffer = current_buffer->base_buffer;
535
536 /* If this records an obsolete save
537 (not matching the actual disk file)
538 then don't mark unmodified. */
539 if (EMACS_TIME_NE (mod_time, base_buffer->modtime))
540 continue;
541#ifdef CLASH_DETECTION
542 Funlock_buffer ();
543#endif /* CLASH_DETECTION */
544 Fset_buffer_modified_p (Qnil);
545 }
546 else if (EQ (car, Qnil))
547 {
548 /* Element (nil PROP VAL BEG . END) is property change. */
549 Lisp_Object beg, end, prop, val;
550
551 prop = Fcar (cdr);
552 cdr = Fcdr (cdr);
553 val = Fcar (cdr);
554 cdr = Fcdr (cdr);
555 beg = Fcar (cdr);
556 end = Fcdr (cdr);
557
558 if (XINT (beg) < BEGV || XINT (end) > ZV)
559 user_error ("Changes to be undone are outside visible portion of buffer");
560 Fput_text_property (beg, end, prop, val, Qnil);
561 }
562 else if (INTEGERP (car) && INTEGERP (cdr))
563 {
564 /* Element (BEG . END) means range was inserted. */
565
566 if (XINT (car) < BEGV
567 || XINT (cdr) > ZV)
568 user_error ("Changes to be undone are outside visible portion of buffer");
569 /* Set point first thing, so that undoing this undo
570 does not send point back to where it is now. */
571 Fgoto_char (car);
572 Fdelete_region (car, cdr);
573 }
574 else if (EQ (car, Qapply))
575 {
576 /* Element (apply FUN . ARGS) means call FUN to undo. */
577 struct buffer *save_buffer = current_buffer;
578
579 car = Fcar (cdr);
580 cdr = Fcdr (cdr);
581 if (INTEGERP (car))
582 {
583 /* Long format: (apply DELTA START END FUN . ARGS). */
584 Lisp_Object delta = car;
585 Lisp_Object start = Fcar (cdr);
586 Lisp_Object end = Fcar (Fcdr (cdr));
587 Lisp_Object start_mark = Fcopy_marker (start, Qnil);
588 Lisp_Object end_mark = Fcopy_marker (end, Qt);
589
590 cdr = Fcdr (Fcdr (cdr));
591 apply1 (Fcar (cdr), Fcdr (cdr));
592
593 /* Check that the function did what the entry said it
594 would do. */
595 if (!EQ (start, Fmarker_position (start_mark))
596 || (XINT (delta) + XINT (end)
597 != marker_position (end_mark)))
598 error ("Changes to be undone by function different than announced");
599 Fset_marker (start_mark, Qnil, Qnil);
600 Fset_marker (end_mark, Qnil, Qnil);
601 }
602 else
603 apply1 (car, cdr);
604
605 if (save_buffer != current_buffer)
606 error ("Undo function switched buffer");
607 did_apply = 1;
608 }
609 else if (STRINGP (car) && INTEGERP (cdr))
610 {
611 /* Element (STRING . POS) means STRING was deleted. */
612 Lisp_Object membuf;
613 EMACS_INT pos = XINT (cdr);
614
615 membuf = car;
616 if (pos < 0)
617 {
618 if (-pos < BEGV || -pos > ZV)
619 user_error ("Changes to be undone are outside visible portion of buffer");
620 SET_PT (-pos);
621 Finsert (1, &membuf);
622 }
623 else
624 {
625 if (pos < BEGV || pos > ZV)
626 user_error ("Changes to be undone are outside visible portion of buffer");
627 SET_PT (pos);
628
629 /* Now that we record marker adjustments
630 (caused by deletion) for undo,
631 we should always insert after markers,
632 so that undoing the marker adjustments
633 put the markers back in the right place. */
634 Finsert (1, &membuf);
635 SET_PT (pos);
636 }
637 }
638 else if (MARKERP (car) && INTEGERP (cdr))
639 {
640 /* (MARKER . INTEGER) means a marker MARKER
641 was adjusted by INTEGER. */
642 if (XMARKER (car)->buffer)
643 Fset_marker (car,
644 make_number (marker_position (car) - XINT (cdr)),
645 Fmarker_buffer (car));
646 }
647 }
648 }
649 arg--;
650 }
651
652
653 /* Make sure an apply entry produces at least one undo entry,
654 so the test in `undo' for continuing an undo series
655 will work right. */
656 if (did_apply
657 && EQ (oldlist, BVAR (current_buffer, undo_list)))
658 bset_undo_list
659 (current_buffer,
660 Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list)));
661
662 UNGCPRO;
663 return unbind_to (count, list);
664}
665
666void 455void
667syms_of_undo (void) 456syms_of_undo (void)
668{ 457{
@@ -675,7 +464,6 @@ syms_of_undo (void)
675 last_undo_buffer = NULL; 464 last_undo_buffer = NULL;
676 last_boundary_buffer = NULL; 465 last_boundary_buffer = NULL;
677 466
678 defsubr (&Sprimitive_undo);
679 defsubr (&Sundo_boundary); 467 defsubr (&Sundo_boundary);
680 468
681 DEFVAR_INT ("undo-limit", undo_limit, 469 DEFVAR_INT ("undo-limit", undo_limit,
diff --git a/src/w32.c b/src/w32.c
index 55581a17de5..812003e96c0 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3648,7 +3648,6 @@ static int
3648get_name_and_id (PSECURITY_DESCRIPTOR psd, unsigned *id, char *nm, int what) 3648get_name_and_id (PSECURITY_DESCRIPTOR psd, unsigned *id, char *nm, int what)
3649{ 3649{
3650 PSID sid = NULL; 3650 PSID sid = NULL;
3651 char machine[MAX_COMPUTERNAME_LENGTH+1];
3652 BOOL dflt; 3651 BOOL dflt;
3653 SID_NAME_USE ignore; 3652 SID_NAME_USE ignore;
3654 char name[UNLEN+1]; 3653 char name[UNLEN+1];
@@ -4800,7 +4799,6 @@ acl_set_file (const char *fname, acl_type_t type, acl_t acl)
4800{ 4799{
4801 TOKEN_PRIVILEGES old1, old2; 4800 TOKEN_PRIVILEGES old1, old2;
4802 DWORD err; 4801 DWORD err;
4803 BOOL res;
4804 int st = 0, retval = -1; 4802 int st = 0, retval = -1;
4805 SECURITY_INFORMATION flags = 0; 4803 SECURITY_INFORMATION flags = 0;
4806 PSID psid; 4804 PSID psid;
diff --git a/src/w32term.c b/src/w32term.c
index 36ae4d7797f..16c7bd415a5 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -5652,7 +5652,7 @@ x_check_fullscreen (struct frame *f)
5652static void 5652static void
5653w32fullscreen_hook (FRAME_PTR f) 5653w32fullscreen_hook (FRAME_PTR f)
5654{ 5654{
5655 static int normal_width, normal_height, normal_top, normal_left; 5655 static int normal_width, normal_height;
5656 5656
5657 if (f->async_visible) 5657 if (f->async_visible)
5658 { 5658 {
diff --git a/src/window.c b/src/window.c
index 71d8eb7f778..32a6759f9f4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1436,7 +1436,7 @@ window were selected.
1436 1436
1437Note that, when WINDOW is selected, the value returned is the same as 1437Note that, when WINDOW is selected, the value returned is the same as
1438that returned by `point' for WINDOW's buffer. It would be more strictly 1438that returned by `point' for WINDOW's buffer. It would be more strictly
1439correct to return the `top-level' value of `point', outside of any 1439correct to return the top-level value of `point', outside of any
1440`save-excursion' forms. But that is hard to define. */) 1440`save-excursion' forms. But that is hard to define. */)
1441 (Lisp_Object window) 1441 (Lisp_Object window)
1442{ 1442{
@@ -6793,7 +6793,8 @@ same combination.
6793 6793
6794Other values are reserved for future use. 6794Other values are reserved for future use.
6795 6795
6796This variable takes no effect if `window-combination-limit' is non-nil. */); 6796This variable takes no effect if the variable `window-combination-limit' is
6797non-nil. */);
6797 Vwindow_combination_resize = Qnil; 6798 Vwindow_combination_resize = Qnil;
6798 6799
6799 DEFVAR_LISP ("window-combination-limit", Vwindow_combination_limit, 6800 DEFVAR_LISP ("window-combination-limit", Vwindow_combination_limit,
diff --git a/src/xfaces.c b/src/xfaces.c
index ed2895c014c..43535b9ea0c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -4877,6 +4877,8 @@ tty_supports_face_attributes_p (struct frame *f,
4877 { 4877 {
4878 if (STRINGP (val)) 4878 if (STRINGP (val))
4879 return 0; /* ttys can't use colored underlines */ 4879 return 0; /* ttys can't use colored underlines */
4880 else if (EQ (CAR_SAFE (val), QCstyle) && EQ (CAR_SAFE (CDR_SAFE (val)), Qwave))
4881 return 0; /* ttys can't use wave underlines */
4880 else if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_INDEX])) 4882 else if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_INDEX]))
4881 return 0; /* same as default */ 4883 return 0; /* same as default */
4882 else 4884 else
diff --git a/src/xfns.c b/src/xfns.c
index 315d5093716..65148d1c9e1 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5292,8 +5292,7 @@ file_dialog_unmap_cb (Widget widget, XtPointer client_data, XtPointer call_data)
5292static Lisp_Object 5292static Lisp_Object
5293clean_up_file_dialog (Lisp_Object arg) 5293clean_up_file_dialog (Lisp_Object arg)
5294{ 5294{
5295 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 5295 Widget dialog = XSAVE_POINTER (arg, 0);
5296 Widget dialog = (Widget) p->pointer;
5297 5296
5298 /* Clean up. */ 5297 /* Clean up. */
5299 block_input (); 5298 block_input ();
diff --git a/src/xmenu.c b/src/xmenu.c
index 3d76070c336..7f6914d26ac 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1411,11 +1411,9 @@ popup_selection_callback (GtkWidget *widget, gpointer client_data)
1411static Lisp_Object 1411static Lisp_Object
1412pop_down_menu (Lisp_Object arg) 1412pop_down_menu (Lisp_Object arg)
1413{ 1413{
1414 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
1415
1416 popup_activated_flag = 0; 1414 popup_activated_flag = 0;
1417 block_input (); 1415 block_input ();
1418 gtk_widget_destroy (GTK_WIDGET (p->pointer)); 1416 gtk_widget_destroy (GTK_WIDGET (XSAVE_POINTER (arg, 0)));
1419 unblock_input (); 1417 unblock_input ();
1420 return Qnil; 1418 return Qnil;
1421} 1419}
@@ -1612,11 +1610,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1612static Lisp_Object 1610static Lisp_Object
1613cleanup_widget_value_tree (Lisp_Object arg) 1611cleanup_widget_value_tree (Lisp_Object arg)
1614{ 1612{
1615 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 1613 free_menubar_widget_value_tree (XSAVE_POINTER (arg, 0));
1616 widget_value *wv = p->pointer;
1617
1618 free_menubar_widget_value_tree (wv);
1619
1620 return Qnil; 1614 return Qnil;
1621} 1615}
1622 1616
@@ -2242,11 +2236,8 @@ menu_help_callback (char const *help_string, int pane, int item)
2242static Lisp_Object 2236static Lisp_Object
2243pop_down_menu (Lisp_Object arg) 2237pop_down_menu (Lisp_Object arg)
2244{ 2238{
2245 struct Lisp_Save_Value *p1 = XSAVE_VALUE (Fcar (arg)); 2239 FRAME_PTR f = XSAVE_POINTER (arg, 0);
2246 struct Lisp_Save_Value *p2 = XSAVE_VALUE (Fcdr (arg)); 2240 XMenu *menu = XSAVE_POINTER (arg, 1);
2247
2248 FRAME_PTR f = p1->pointer;
2249 XMenu *menu = p2->pointer;
2250 2241
2251 block_input (); 2242 block_input ();
2252#ifndef MSDOS 2243#ifndef MSDOS
@@ -2488,8 +2479,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
2488#endif 2479#endif
2489 2480
2490 record_unwind_protect (pop_down_menu, 2481 record_unwind_protect (pop_down_menu,
2491 Fcons (make_save_value (f, 0), 2482 format_save_value ("pp", f, menu));
2492 make_save_value (menu, 0)));
2493 2483
2494 /* Help display under X won't work because XMenuActivate contains 2484 /* Help display under X won't work because XMenuActivate contains
2495 a loop that doesn't give Emacs a chance to process it. */ 2485 a loop that doesn't give Emacs a chance to process it. */
diff --git a/src/xml.c b/src/xml.c
index 5939c58a564..5a52b0c2a1e 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -180,8 +180,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
180 xmlDoc *doc; 180 xmlDoc *doc;
181 Lisp_Object result = Qnil; 181 Lisp_Object result = Qnil;
182 const char *burl = ""; 182 const char *burl = "";
183 ptrdiff_t bytes; 183 ptrdiff_t istart, iend, istart_byte, iend_byte;
184 ptrdiff_t istart, iend;
185 184
186 fn_xmlCheckVersion (LIBXML_VERSION); 185 fn_xmlCheckVersion (LIBXML_VERSION);
187 186
@@ -189,9 +188,11 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
189 188
190 istart = XINT (start); 189 istart = XINT (start);
191 iend = XINT (end); 190 iend = XINT (end);
191 istart_byte = CHAR_TO_BYTE (istart);
192 iend_byte = CHAR_TO_BYTE (iend);
192 193
193 if (istart < GPT && GPT < iend) 194 if (istart < GPT && GPT < iend)
194 move_gap (iend); 195 move_gap_both (iend, iend_byte);
195 196
196 if (! NILP (base_url)) 197 if (! NILP (base_url))
197 { 198 {
@@ -199,17 +200,15 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
199 burl = SSDATA (base_url); 200 burl = SSDATA (base_url);
200 } 201 }
201 202
202 bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart);
203
204 if (htmlp) 203 if (htmlp)
205 doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), 204 doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
206 bytes, burl, "utf-8", 205 iend_byte - istart_byte, burl, "utf-8",
207 HTML_PARSE_RECOVER|HTML_PARSE_NONET| 206 HTML_PARSE_RECOVER|HTML_PARSE_NONET|
208 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR| 207 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
209 HTML_PARSE_NOBLANKS); 208 HTML_PARSE_NOBLANKS);
210 else 209 else
211 doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), 210 doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte),
212 bytes, burl, "utf-8", 211 iend_byte - istart_byte, burl, "utf-8",
213 XML_PARSE_NONET|XML_PARSE_NOWARNING| 212 XML_PARSE_NONET|XML_PARSE_NOWARNING|
214 XML_PARSE_NOBLANKS |XML_PARSE_NOERROR); 213 XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
215 214
diff --git a/src/xselect.c b/src/xselect.c
index f43efab827b..b7cdf70ff77 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1120,7 +1120,7 @@ unexpect_property_change (struct prop_location *location)
1120static Lisp_Object 1120static Lisp_Object
1121wait_for_property_change_unwind (Lisp_Object loc) 1121wait_for_property_change_unwind (Lisp_Object loc)
1122{ 1122{
1123 struct prop_location *location = XSAVE_VALUE (loc)->pointer; 1123 struct prop_location *location = XSAVE_POINTER (loc, 0);
1124 1124
1125 unexpect_property_change (location); 1125 unexpect_property_change (location);
1126 if (location == property_change_reply_object) 1126 if (location == property_change_reply_object)
diff --git a/src/xterm.c b/src/xterm.c
index f63f10566f6..26d40859ed3 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4802,21 +4802,24 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
4802 4802
4803#ifdef USE_MOTIF 4803#ifdef USE_MOTIF
4804 4804
4805 /* We use an estimate of 30 chars per line rather than the real 4805 if (scroll_bar_adjust_thumb_portion_p)
4806 `portion' value. This has the disadvantage that the thumb size 4806 {
4807 is not very representative, but it makes our life a lot easier. 4807 /* We use an estimate of 30 chars per line rather than the real
4808 Otherwise, we have to constantly adjust the thumb size, which 4808 `portion' value. This has the disadvantage that the thumb size
4809 we can't always do quickly enough: while dragging, the size of 4809 is not very representative, but it makes our life a lot easier.
4810 the thumb might prevent the user from dragging the thumb all the 4810 Otherwise, we have to constantly adjust the thumb size, which
4811 way to the end. but Motif and some versions of Xaw3d don't allow 4811 we can't always do quickly enough: while dragging, the size of
4812 updating the thumb size while dragging. Also, even if we can update 4812 the thumb might prevent the user from dragging the thumb all the
4813 its size, the update will often happen too late. 4813 way to the end. but Motif and some versions of Xaw3d don't allow
4814 If you don't believe it, check out revision 1.650 of xterm.c to see 4814 updating the thumb size while dragging. Also, even if we can update
4815 what hoops we were going through and the still poor behavior we got. */ 4815 its size, the update will often happen too late.
4816 portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; 4816 If you don't believe it, check out revision 1.650 of xterm.c to see
4817 /* When the thumb is at the bottom, position == whole. 4817 what hoops we were going through and the still poor behavior we got. */
4818 So we need to increase `whole' to make space for the thumb. */ 4818 portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30;
4819 whole += portion; 4819 /* When the thumb is at the bottom, position == whole.
4820 So we need to increase `whole' to make space for the thumb. */
4821 whole += portion;
4822 }
4820 4823
4821 if (whole <= 0) 4824 if (whole <= 0)
4822 top = 0, shown = 1; 4825 top = 0, shown = 1;
@@ -10784,6 +10787,16 @@ With MS Windows or Nextstep, the value is t. */);
10784 Vx_toolkit_scroll_bars = Qnil; 10787 Vx_toolkit_scroll_bars = Qnil;
10785#endif 10788#endif
10786 10789
10790 DEFVAR_BOOL ("scroll-bar-adjust-thumb-portion",
10791 scroll_bar_adjust_thumb_portion_p,
10792 doc: /* Adjust thumb for overscrolling for Gtk+ and MOTIF.
10793Non-nil means adjust the thumb in the scroll bar so it can be dragged downwards
10794even if the end of the buffer is shown (i.e. overscrolling).
10795Set to nil if you want the thumb to be at the bottom when the end of the buffer
10796is shown. Also, the thumb fills the whole scroll bar when the entire buffer
10797is visible. In this case you can not overscroll. */);
10798 scroll_bar_adjust_thumb_portion_p = 1;
10799
10787 staticpro (&last_mouse_motion_frame); 10800 staticpro (&last_mouse_motion_frame);
10788 last_mouse_motion_frame = Qnil; 10801 last_mouse_motion_frame = Qnil;
10789 10802
diff --git a/test/ChangeLog b/test/ChangeLog
index 43c783857f3..7857000ba2f 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,24 @@
12013-01-15 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * automated/advice-tests.el: Split up. Add advice-test-preactivate.
4
52013-01-14 Glenn Morris <rgm@gnu.org>
6
7 * automated/compile-tests.el (compile-tests--test-regexps-data):
8 Fix interpretation of gnu line.col1-col2 format. (Bug#13335)
9
102013-01-10 Wolfgang Jenkner <wjenkner@inode.at>
11
12 * automated/man-tests.el: New file.
13
142013-01-09 Aaron S. Hawley <aaron.s.hawley@gmail.com>
15
16 * automated/undo-tests.el (undo-test0): Adjust error to code change.
17
182013-01-08 Aaron S. Hawley <aaron.s.hawley@gmail.com>
19
20 * automated/undo-tests.el: New file.
21
12012-12-27 Dmitry Gutov <dgutov@yandex.ru> 222012-12-27 Dmitry Gutov <dgutov@yandex.ru>
2 23
3 * automated/ruby-mode-tests.el 24 * automated/ruby-mode-tests.el
diff --git a/test/automated/advice-tests.el b/test/automated/advice-tests.el
index bc9135c92d0..8beaea64cd9 100644
--- a/test/automated/advice-tests.el
+++ b/test/automated/advice-tests.el
@@ -21,93 +21,112 @@
21 21
22;;; Code: 22;;; Code:
23 23
24(ert-deftest advice-tests () 24(ert-deftest advice-tests-nadvice ()
25 "Test nadvice code."
26 (defun sm-test1 (x) (+ x 4))
27 (should (equal (sm-test1 6) 10))
28 (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 5)))
29 (should (equal (sm-test1 6) 50))
30 (defun sm-test1 (x) (+ x 14))
31 (should (equal (sm-test1 6) 100))
32 (should (equal (null (get 'sm-test1 'defalias-fset-function)) nil))
33 (advice-remove 'sm-test1 (lambda (f y) (* (funcall f y) 5)))
34 (should (equal (sm-test1 6) 20))
35 (should (equal (get 'sm-test1 'defalias-fset-function) nil))
36
37 (advice-add 'sm-test3 :around
38 (lambda (f &rest args) `(toto ,(apply f args)))
39 '((name . wrap-with-toto)))
40 (defmacro sm-test3 (x) `(call-test3 ,x))
41 (should (equal (macroexpand '(sm-test3 56)) '(toto (call-test3 56)))))
42
43(ert-deftest advice-tests-advice ()
25 "Test advice code." 44 "Test advice code."
26 (with-temp-buffer 45 (defun sm-test2 (x) (+ x 4))
27 (defun sm-test1 (x) (+ x 4)) 46 (should (equal (sm-test2 6) 10))
28 (should (equal (sm-test1 6) 10)) 47 (defadvice sm-test2 (around sm-test activate)
29 (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 5))) 48 ad-do-it (setq ad-return-value (* ad-return-value 5)))
30 (should (equal (sm-test1 6) 50)) 49 (should (equal (sm-test2 6) 50))
31 (defun sm-test1 (x) (+ x 14)) 50 (ad-deactivate 'sm-test2)
32 (should (equal (sm-test1 6) 100)) 51 (should (equal (sm-test2 6) 10))
33 (should (equal (null (get 'sm-test1 'defalias-fset-function)) nil)) 52 (ad-activate 'sm-test2)
34 (advice-remove 'sm-test1 (lambda (f y) (* (funcall f y) 5))) 53 (should (equal (sm-test2 6) 50))
35 (should (equal (sm-test1 6) 20)) 54 (defun sm-test2 (x) (+ x 14))
36 (should (equal (null (get 'sm-test1 'defalias-fset-function)) t)) 55 (should (equal (sm-test2 6) 100))
37 56 (should (equal (null (get 'sm-test2 'defalias-fset-function)) nil))
38 (defun sm-test2 (x) (+ x 4)) 57 (ad-remove-advice 'sm-test2 'around 'sm-test)
39 (should (equal (sm-test2 6) 10)) 58 (should (equal (sm-test2 6) 100))
40 (defadvice sm-test2 (around sm-test activate) 59 (ad-activate 'sm-test2)
41 ad-do-it (setq ad-return-value (* ad-return-value 5))) 60 (should (equal (sm-test2 6) 20))
42 (should (equal (sm-test2 6) 50)) 61 (should (equal (null (get 'sm-test2 'defalias-fset-function)) t))
43 (ad-deactivate 'sm-test2) 62
44 (should (equal (sm-test2 6) 10)) 63 (defadvice sm-test4 (around wrap-with-toto activate)
45 (ad-activate 'sm-test2) 64 ad-do-it (setq ad-return-value `(toto ,ad-return-value)))
46 (should (equal (sm-test2 6) 50)) 65 (defmacro sm-test4 (x) `(call-test4 ,x))
47 (defun sm-test2 (x) (+ x 14)) 66 (should (equal (macroexpand '(sm-test4 56)) '(toto (call-test4 56))))
48 (should (equal (sm-test2 6) 100)) 67 (defmacro sm-test4 (x) `(call-testq ,x))
49 (should (equal (null (get 'sm-test2 'defalias-fset-function)) nil)) 68 (should (equal (macroexpand '(sm-test4 56)) '(toto (call-testq 56))))
50 (ad-remove-advice 'sm-test2 'around 'sm-test) 69
51 (should (equal (sm-test2 6) 100)) 70 ;; This used to signal an error (bug#12858).
52 (ad-activate 'sm-test2) 71 (autoload 'sm-test6 "foo")
53 (should (equal (sm-test2 6) 20)) 72 (defadvice sm-test6 (around test activate)
54 (should (equal (null (get 'sm-test2 'defalias-fset-function)) t)) 73 ad-do-it))
55 74
56 (advice-add 'sm-test3 :around 75(ert-deftest advice-tests-combination ()
57 (lambda (f &rest args) `(toto ,(apply f args))) 76 "Combining old style and new style advices."
58 '((name . wrap-with-toto))) 77 (defun sm-test5 (x) (+ x 4))
59 (defmacro sm-test3 (x) `(call-test3 ,x)) 78 (should (equal (sm-test5 6) 10))
60 (should (equal (macroexpand '(sm-test3 56)) '(toto (call-test3 56)))) 79 (advice-add 'sm-test5 :around (lambda (f y) (* (funcall f y) 5)))
61 80 (should (equal (sm-test5 6) 50))
62 (defadvice sm-test4 (around wrap-with-toto activate) 81 (defadvice sm-test5 (around test activate)
63 ad-do-it (setq ad-return-value `(toto ,ad-return-value))) 82 ad-do-it (setq ad-return-value (+ ad-return-value 0.1)))
64 (defmacro sm-test4 (x) `(call-test4 ,x)) 83 (should (equal (sm-test5 5) 45.1))
65 (should (equal (macroexpand '(sm-test4 56)) '(toto (call-test4 56)))) 84 (ad-deactivate 'sm-test5)
66 (defmacro sm-test4 (x) `(call-testq ,x)) 85 (should (equal (sm-test5 6) 50))
67 (should (equal (macroexpand '(sm-test4 56)) '(toto (call-testq 56)))) 86 (ad-activate 'sm-test5)
68 87 (should (equal (sm-test5 6) 50.1))
69 ;; Combining old style and new style advices. 88 (defun sm-test5 (x) (+ x 14))
70 (defun sm-test5 (x) (+ x 4)) 89 (should (equal (sm-test5 6) 100.1))
71 (should (equal (sm-test5 6) 10)) 90 (advice-remove 'sm-test5 (lambda (f y) (* (funcall f y) 5)))
72 (advice-add 'sm-test5 :around (lambda (f y) (* (funcall f y) 5))) 91 (should (equal (sm-test5 6) 20.1)))
73 (should (equal (sm-test5 6) 50)) 92
74 (defadvice sm-test5 (around test activate) 93(ert-deftest advice-test-called-interactively-p ()
75 ad-do-it (setq ad-return-value (+ ad-return-value 0.1))) 94 "Check interaction between advice and called-interactively-p."
76 (should (equal (sm-test5 5) 45.1)) 95 (defun sm-test7 (&optional x) (interactive) (+ (or x 7) 4))
77 (ad-deactivate 'sm-test5) 96 (advice-add 'sm-test7 :around
78 (should (equal (sm-test5 6) 50)) 97 (lambda (f &rest args)
79 (ad-activate 'sm-test5) 98 (list (cons 1 (called-interactively-p)) (apply f args))))
80 (should (equal (sm-test5 6) 50.1)) 99 (should (equal (sm-test7) '((1 . nil) 11)))
81 (defun sm-test5 (x) (+ x 14)) 100 (should (equal (call-interactively 'sm-test7) '((1 . t) 11)))
82 (should (equal (sm-test5 6) 100.1)) 101 (let ((smi 7))
83 (advice-remove 'sm-test5 (lambda (f y) (* (funcall f y) 5))) 102 (advice-add 'sm-test7 :before
84 (should (equal (sm-test5 6) 20.1)) 103 (lambda (&rest args)
85 104 (setq smi (called-interactively-p))))
86 ;; This used to signal an error (bug#12858). 105 (should (equal (list (sm-test7) smi)
87 (autoload 'sm-test6 "foo") 106 '(((1 . nil) 11) nil)))
88 (defadvice sm-test6 (around test activate) 107 (should (equal (list (call-interactively 'sm-test7) smi)
89 ad-do-it) 108 '(((1 . t) 11) t))))
90 109 (advice-add 'sm-test7 :around
91 ;; Check interaction between advice and called-interactively-p. 110 (lambda (f &rest args)
92 (defun sm-test7 (&optional x) (interactive) (+ (or x 7) 4)) 111 (cons (cons 2 (called-interactively-p)) (apply f args))))
93 (advice-add 'sm-test7 :around 112 (should (equal (call-interactively 'sm-test7) '((2 . t) (1 . t) 11))))
94 (lambda (f &rest args) 113
95 (list (cons 1 (called-interactively-p)) (apply f args)))) 114(ert-deftest advice-test-interactive ()
96 (should (equal (sm-test7) '((1 . nil) 11))) 115 "Check handling of interactive spec."
97 (should (equal (call-interactively 'sm-test7) '((1 . t) 11))) 116 (defun sm-test8 (a) (interactive "p") a)
98 (let ((smi 7)) 117 (defadvice sm-test8 (before adv1 activate) nil)
99 (advice-add 'sm-test7 :before 118 (defadvice sm-test8 (before adv2 activate) (interactive "P") nil)
100 (lambda (&rest args) 119 (should (equal (interactive-form 'sm-test8) '(interactive "P"))))
101 (setq smi (called-interactively-p)))) 120
102 (should (equal (list (sm-test7) smi) 121(ert-deftest advice-test-preactivate ()
103 '(((1 . nil) 11) nil))) 122 (should (equal (null (get 'sm-test9 'defalias-fset-function)) t))
104 (should (equal (list (call-interactively 'sm-test7) smi) 123 (defun sm-test9 (a) (interactive "p") a)
105 '(((1 . t) 11) t)))) 124 (should (equal (null (get 'sm-test9 'defalias-fset-function)) t))
106 (advice-add 'sm-test7 :around 125 (defadvice sm-test9 (before adv1 pre act protect compile) nil)
107 (lambda (f &rest args) 126 (should (equal (null (get 'sm-test9 'defalias-fset-function)) nil))
108 (cons (cons 2 (called-interactively-p)) (apply f args)))) 127 (defadvice sm-test9 (before adv2 pre act protect compile)
109 (should (equal (call-interactively 'sm-test7) '((2 . t) (1 . t) 11))) 128 (interactive "P") nil)
110 )) 129 (should (equal (interactive-form 'sm-test9) '(interactive "P"))))
111 130
112;; Local Variables: 131;; Local Variables:
113;; no-byte-compile: t 132;; no-byte-compile: t
diff --git a/test/automated/compile-tests.el b/test/automated/compile-tests.el
index f976efe72de..682867d1178 100644
--- a/test/automated/compile-tests.el
+++ b/test/automated/compile-tests.el
@@ -176,8 +176,10 @@
176 ("foo.c:8.23: note: message" 1 23 8 "foo.c") 176 ("foo.c:8.23: note: message" 1 23 8 "foo.c")
177 ("foo.c:8.23: info: message" 1 23 8 "foo.c") 177 ("foo.c:8.23: info: message" 1 23 8 "foo.c")
178 ("foo.c:8:23:information: message" 1 23 8 "foo.c") 178 ("foo.c:8:23:information: message" 1 23 8 "foo.c")
179 ("foo.c:8.23-45: Informational: message" 1 (23 . nil) (8 . 45) "foo.c") 179 ("foo.c:8.23-45: Informational: message" 1 (23 . 46) (8 . nil) "foo.c")
180 ("foo.c:8-23: message" 1 nil (8 . 23) "foo.c") 180 ("foo.c:8-23: message" 1 nil (8 . 23) "foo.c")
181 ;; The next one is not in the GNU standards AFAICS.
182 ;; Here we seem to interpret it as LINE1-LINE2.COL2.
181 ("foo.c:8-45.3: message" 1 (nil . 4) (8 . 45) "foo.c") 183 ("foo.c:8-45.3: message" 1 (nil . 4) (8 . 45) "foo.c")
182 ("foo.c:8.23-9.1: message" 1 (23 . 2) (8 . 9) "foo.c") 184 ("foo.c:8.23-9.1: message" 1 (23 . 2) (8 . 9) "foo.c")
183 ("jade:dbcommon.dsl:133:17:E: missing argument for function call" 185 ("jade:dbcommon.dsl:133:17:E: missing argument for function call"
diff --git a/test/automated/man-tests.el b/test/automated/man-tests.el
new file mode 100644
index 00000000000..8a2ec953002
--- /dev/null
+++ b/test/automated/man-tests.el
@@ -0,0 +1,118 @@
1;;; man-tests.el --- Test suite for man.
2
3;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5;; Author: Wolfgang Jenkner <wjenkner@inode.at>
6;; Keywords: help, internal, unix
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Code:
24
25(require 'ert)
26(require 'man)
27
28(defconst man-tests-parse-man-k-tests
29 '(;; GNU/Linux: man-db-2.6.1
30 ("\
31sin (3) - sine function
32sinf (3) - sine function
33sinl (3) - sine function"
34 . (#("sin(3)" 0 6 (help-echo "sine function")) #("sinf(3)" 0 7 (help-echo "sine function")) #("sinl(3)" 0 7 (help-echo "sine function"))))
35 ;; GNU/Linux: man-1.6g
36 ("\
37sin (3) - sine function
38sinf [sin] (3) - sine function
39sinl [sin] (3) - sine function"
40 . (#("sin(3)" 0 6 (help-echo "sine function")) #("sinf(3)" 0 7 (help-echo "sine function")) #("sinl(3)" 0 7 (help-echo "sine function"))))
41 ;; FreeBSD 9
42 ("\
43sin(3), sinf(3), sinl(3) - sine functions"
44 . (#("sin(3)" 0 6 (help-echo "sine functions")) #("sinf(3)" 0 7 (help-echo "sine functions")) #("sinl(3)" 0 7 (help-echo "sine functions"))))
45 ;; SunOS, Solaris
46 ;; http://docs.oracle.com/cd/E19455-01/805-6331/usradm-7/index.html
47 ;; SunOS 4
48 ("\
49tset, reset (1) - establish or restore terminal characteristics"
50 . (#("tset(1)" 0 7 (help-echo "establish or restore terminal characteristics")) #("reset(1)" 0 8 (help-echo "establish or restore terminal characteristics"))))
51 ;; SunOS 5.7, Solaris
52 ("\
53reset tset (1b) - establish or restore terminal characteristics
54tset tset (1b) - establish or restore terminal characteristics"
55 . (#("reset(1b)" 0 8 (help-echo "establish or restore terminal characteristics")) #("tset(1b)" 0 7 (help-echo "establish or restore terminal characteristics"))))
56 ;; Minix 3
57 ;; http://www.minix3.org/manpages/html5/whatis.html
58 ("\
59cawf, nroff (1) - C version of the nroff-like, Amazingly Workable (text) Formatter
60whatis (5) - database of online manual pages"
61 . (#("cawf(1)" 0 7 (help-echo "C version of the nroff-like, Amazingly Workable (text) Formatter")) #("nroff(1)" 0 8 (help-echo "C version of the nroff-like, Amazingly Workable (text) Formatter")) #("whatis(5)" 0 9 (help-echo "database of online manual pages"))))
62 ;; HP-UX
63 ;; http://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/man.1.html
64 ;; Assuming that the line break in the zgrep description was
65 ;; introduced by the man page formatting.
66 ("\
67grep, egrep, fgrep (1) - search a file for a pattern
68zgrep(1) - search possibly compressed files for a regular expression"
69 . (#("grep(1)" 0 7 (help-echo "search a file for a pattern")) #("egrep(1)" 0 8 (help-echo "search a file for a pattern")) #("fgrep(1)" 0 8 (help-echo "search a file for a pattern")) #("zgrep(1)" 0 8 (help-echo "search possibly compressed files for a regular expression"))))
70 ;; AIX
71 ;; http://pic.dhe.ibm.com/infocenter/aix/v7r1/topic/com.ibm.aix.cmds/doc/aixcmds6/whatis.htm
72 ("\
73ls(1) -Displays the contents of a directory."
74 . (#("ls(1)" 0 5 (help-echo "Displays the contents of a directory."))))
75 ;; https://www.ibm.com/developerworks/mydeveloperworks/blogs/cgaix/entry/catman_0703_102_usr_lbin_mkwhatis_the_error_number_is_1?lang=en
76 ("\
77loopmount(1) - Associate an image file to a loopback device."
78 . (#("loopmount(1)" 0 12 (help-echo "Associate an image file to a loopback device."))))
79 )
80 "List of tests for `Man-parse-man-k'.
81Each element is a cons cell whose car is a string containing
82man -k output. That should result in the table which is stored
83in the cdr of the element.")
84
85(defun man-tests-name-equal-p (name description string)
86 (and (equal name string)
87 (not (next-single-property-change 0 'help-echo string))
88 (equal (get-text-property 0 'help-echo string) description)))
89
90(defun man-tests-parse-man-k-test-case (test)
91 (let ((temp-buffer (get-buffer-create " *test-man*"))
92 (man-k-output (car test)))
93 (unwind-protect
94 (save-window-excursion
95 (with-current-buffer temp-buffer
96 (erase-buffer)
97 (insert man-k-output)
98 (let ((result (Man-parse-man-k))
99 (checklist (cdr test)))
100 (while (and checklist result
101 (man-tests-name-equal-p
102 (car checklist)
103 (get-text-property 0 'help-echo
104 (car checklist))
105 (pop result)))
106 (pop checklist))
107 (and (null checklist) (null result)))))
108 (and (buffer-name temp-buffer)
109 (kill-buffer temp-buffer)))))
110
111(ert-deftest man-tests ()
112 "Test man."
113 (dolist (test man-tests-parse-man-k-tests)
114 (should (man-tests-parse-man-k-test-case test))))
115
116(provide 'man-tests)
117
118;;; man-tests.el ends here
diff --git a/test/automated/undo-tests.el b/test/automated/undo-tests.el
new file mode 100644
index 00000000000..3037db03602
--- /dev/null
+++ b/test/automated/undo-tests.el
@@ -0,0 +1,231 @@
1;;; undo-tests.el --- Tests of primitive-undo
2
3;; Copyright (C) 2012 Aaron S. Hawley
4
5;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com>
6
7;; This program is free software: you can redistribute it and/or
8;; modify it under the terms of the GNU General Public License as
9;; published by the Free Software Foundation, either version 3 of the
10;; License, or (at your option) any later version.
11;;
12;; This program is distributed in the hope that it will be useful, but
13;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15;; General Public License for more details.
16;;
17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see `http://www.gnu.org/licenses/'.
19
20;;; Commentary:
21
22;; Profiling when the code was translate from C to Lisp on 2012-12-24.
23
24;;; C
25
26;; (elp-instrument-function 'primitive-undo)
27;; (load-file "undo-test.elc")
28;; (benchmark 100 '(let ((undo-test5-error nil)) (undo-test-all)))
29;; Elapsed time: 305.218000s (104.841000s in 14804 GCs)
30;; M-x elp-results
31;; Function Name Call Count Elapsed Time Average Time
32;; primitive-undo 2600 3.4889999999 0.0013419230
33
34;;; Lisp
35
36;; (load-file "primundo.elc")
37;; (elp-instrument-function 'primitive-undo)
38;; (benchmark 100 '(undo-test-all))
39;; Elapsed time: 295.974000s (104.582000s in 14704 GCs)
40;; M-x elp-results
41;; Function Name Call Count Elapsed Time Average Time
42;; primitive-undo 2700 3.6869999999 0.0013655555
43
44;;; Code:
45
46(require 'ert)
47
48(ert-deftest undo-test0 ()
49 "Test basics of \\[undo]."
50 (with-temp-buffer
51 (buffer-enable-undo)
52 (condition-case err
53 (undo)
54 (error
55 (unless (string= "No further undo information"
56 (cadr err))
57 (error err))))
58 (undo-boundary)
59 (insert "This")
60 (undo-boundary)
61 (erase-buffer)
62 (undo-boundary)
63 (insert "That")
64 (undo-boundary)
65 (forward-word -1)
66 (undo-boundary)
67 (insert "With ")
68 (undo-boundary)
69 (forward-word -1)
70 (undo-boundary)
71 (kill-word 1)
72 (undo-boundary)
73 (put-text-property (point-min) (point-max) 'face 'bold)
74 (undo-boundary)
75 (remove-text-properties (point-min) (point-max) '(face default))
76 (undo-boundary)
77 (set-buffer-multibyte (not enable-multibyte-characters))
78 (undo-boundary)
79 (undo)
80 (should
81 (equal (should-error (undo-more nil))
82 '(wrong-type-argument number-or-marker-p nil)))
83 (undo-more 7)
84 (should (string-equal "" (buffer-string)))))
85
86(ert-deftest undo-test1 ()
87 "Test undo of \\[undo] command (redo)."
88 (with-temp-buffer
89 (buffer-enable-undo)
90 (undo-boundary)
91 (insert "This")
92 (undo-boundary)
93 (erase-buffer)
94 (undo-boundary)
95 (insert "That")
96 (undo-boundary)
97 (forward-word -1)
98 (undo-boundary)
99 (insert "With ")
100 (undo-boundary)
101 (forward-word -1)
102 (undo-boundary)
103 (kill-word 1)
104 (undo-boundary)
105 (facemenu-add-face 'bold (point-min) (point-max))
106 (undo-boundary)
107 (set-buffer-multibyte (not enable-multibyte-characters))
108 (undo-boundary)
109 (should
110 (string-equal (buffer-string)
111 (progn
112 (undo)
113 (undo-more 4)
114 (undo)
115 ;(undo-more -4)
116 (buffer-string))))))
117
118(ert-deftest undo-test2 ()
119 "Test basic redoing with \\[undo] command."
120 (with-temp-buffer
121 (buffer-enable-undo)
122 (undo-boundary)
123 (insert "One")
124 (undo-boundary)
125 (insert " Zero")
126 (undo-boundary)
127 (push-mark)
128 (delete-region (save-excursion
129 (forward-word -1)
130 (point)) (point))
131 (undo-boundary)
132 (beginning-of-line)
133 (insert "Zero")
134 (undo-boundary)
135 (undo)
136 (should
137 (string-equal (buffer-string)
138 (progn
139 (undo-more 2)
140 (undo)
141 (buffer-string))))))
142
143(ert-deftest undo-test3 ()
144 "Test modtime with \\[undo] command."
145 (let ((tmpfile (make-temp-file "undo-test3")))
146 (with-temp-file tmpfile
147 (let ((buffer-file-name tmpfile))
148 (buffer-enable-undo)
149 (set (make-local-variable 'make-backup-files) nil)
150 (undo-boundary)
151 (insert ?\s)
152 (undo-boundary)
153 (basic-save-buffer)
154 (insert ?\t)
155 (undo)
156 (should
157 (string-equal (buffer-string)
158 (progn
159 (undo)
160 (buffer-string)))))
161 (delete-file tmpfile))))
162
163(ert-deftest undo-test4 ()
164 "Test \\[undo] of \\[flush-lines]."
165 (with-temp-buffer
166 (buffer-enable-undo)
167 (dotimes (i 1048576)
168 (if (zerop (% i 2))
169 (insert "Evenses")
170 (insert "Oddses")))
171 (undo-boundary)
172 (should
173 ;; Avoid string-equal because ERT will save the `buffer-string'
174 ;; to the explanation. Using `not' will record nil or non-nil.
175 (not
176 (null
177 (string-equal (buffer-string)
178 (progn
179 (flush-lines "oddses" (point-min) (point-max))
180 (undo-boundary)
181 (undo)
182 (undo)
183 (buffer-string))))))))
184
185(ert-deftest undo-test5 ()
186 "Test basic redoing with \\[undo] command."
187 (with-temp-buffer
188 (buffer-enable-undo)
189 (undo-boundary)
190 (insert "AYE")
191 (undo-boundary)
192 (insert " BEE")
193 (undo-boundary)
194 (setq buffer-undo-list (cons '(0.0 bogus) buffer-undo-list))
195 (push-mark)
196 (delete-region (save-excursion
197 (forward-word -1)
198 (point)) (point))
199 (undo-boundary)
200 (beginning-of-line)
201 (insert "CEE")
202 (undo-boundary)
203 (undo)
204 (setq buffer-undo-list (cons "bogus" buffer-undo-list))
205 (should
206 (string-equal
207 (buffer-string)
208 (progn
209 (if (and (boundp 'undo-test5-error) (not undo-test5-error))
210 (progn
211 (should (null (undo-more 2)))
212 (should (undo)))
213 ;; Errors are generated by new Lisp version of
214 ;; `primitive-undo' not by built-in C version.
215 (should
216 (equal (should-error (undo-more 2))
217 '(error "Unrecognized entry in undo list (0.0 bogus)")))
218 (should
219 (equal (should-error (undo))
220 '(error "Unrecognized entry in undo list \"bogus\""))))
221 (buffer-string))))))
222
223(defun undo-test-all (&optional interactive)
224 "Run all tests for \\[undo]."
225 (interactive "p")
226 (if interactive
227 (ert-run-tests-interactively "^undo-")
228 (ert-run-tests-batch "^undo-")))
229
230(provide 'undo-tests)
231;;; undo-tests.el ends here