diff options
| author | Michael R. Mauger | 2017-04-02 18:10:57 -0400 |
|---|---|---|
| committer | Michael R. Mauger | 2017-04-02 18:10:57 -0400 |
| commit | 77083e2d34ba5559ae2899d3b03cf08c2e6c5ad4 (patch) | |
| tree | 27da92c2a61d664b700860c2d527a4d36000ca37 | |
| parent | c5a31f8292c94d19b80a3dbe0b3026693cc1090e (diff) | |
| parent | 8e394a7f35c2ba9297d222faa2689e177f268924 (diff) | |
| download | emacs-77083e2d34ba5559ae2899d3b03cf08c2e6c5ad4.tar.gz emacs-77083e2d34ba5559ae2899d3b03cf08c2e6c5ad4.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
99 files changed, 2369 insertions, 1485 deletions
diff --git a/.gitignore b/.gitignore index ce1866d616b..aa9e1ff709e 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -141,7 +141,6 @@ src/*.map | |||
| 141 | 141 | ||
| 142 | # Tests. | 142 | # Tests. |
| 143 | test/indent/*.new | 143 | test/indent/*.new |
| 144 | test/make-test-deps.mk | ||
| 145 | test/manual/biditest.txt | 144 | test/manual/biditest.txt |
| 146 | test/manual/etags/srclist | 145 | test/manual/etags/srclist |
| 147 | test/manual/etags/regexfile | 146 | test/manual/etags/regexfile |
diff --git a/ChangeLog.3 b/ChangeLog.3 index 1c2f5b1d2fa..f187c2852f7 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 | |||
| @@ -1015,7 +1015,7 @@ | |||
| 1015 | Upcase Path and ComSpec in process-environment | 1015 | Upcase Path and ComSpec in process-environment |
| 1016 | 1016 | ||
| 1017 | Since 2016-07-18 "Keep w32 environment settings internal only", the | 1017 | Since 2016-07-18 "Keep w32 environment settings internal only", the |
| 1018 | upcasing of environment variables "Path" and "ComSpec" occured after | 1018 | upcasing of environment variables "Path" and "ComSpec" occurred after |
| 1019 | initializing process-environment. This meant that Lisp code trying to | 1019 | initializing process-environment. This meant that Lisp code trying to |
| 1020 | override "PATH" environment had no effect (Bug #24956). | 1020 | override "PATH" environment had no effect (Bug #24956). |
| 1021 | 1021 | ||
diff --git a/Makefile.in b/Makefile.in index cf8ff84212f..06909c34445 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -821,9 +821,7 @@ mostlyclean_dirs = src oldXMenu lwlib lib lib-src nt doc/emacs doc/misc \ | |||
| 821 | $(foreach dir,$(mostlyclean_dirs),$(eval $(call submake_template,$(dir),mostlyclean))) | 821 | $(foreach dir,$(mostlyclean_dirs),$(eval $(call submake_template,$(dir),mostlyclean))) |
| 822 | 822 | ||
| 823 | mostlyclean: $(mostlyclean_dirs:=_mostlyclean) | 823 | mostlyclean: $(mostlyclean_dirs:=_mostlyclean) |
| 824 | for dir in test/automated; do \ | 824 | [ ! -d test ] || $(MAKE) -C test $@ |
| 825 | [ ! -d $$dir ] || $(MAKE) -C $$dir mostlyclean; \ | ||
| 826 | done | ||
| 827 | 825 | ||
| 828 | ### 'clean' | 826 | ### 'clean' |
| 829 | ### Delete all files from the current directory that are normally | 827 | ### Delete all files from the current directory that are normally |
| @@ -838,9 +836,8 @@ clean_dirs = $(mostlyclean_dirs) nextstep | |||
| 838 | $(foreach dir,$(clean_dirs),$(eval $(call submake_template,$(dir),clean))) | 836 | $(foreach dir,$(clean_dirs),$(eval $(call submake_template,$(dir),clean))) |
| 839 | 837 | ||
| 840 | clean: $(clean_dirs:=_clean) | 838 | clean: $(clean_dirs:=_clean) |
| 841 | for dir in test/automated admin/charsets; do \ | 839 | $(MAKE) -C admin/charsets $@ |
| 842 | [ ! -d $$dir ] || $(MAKE) -C $$dir clean; \ | 840 | [ ! -d test ] || $(MAKE) -C test $@ |
| 843 | done | ||
| 844 | -rm -f *.tmp etc/*.tmp* | 841 | -rm -f *.tmp etc/*.tmp* |
| 845 | -rm -rf info-dir.* | 842 | -rm -rf info-dir.* |
| 846 | 843 | ||
| @@ -864,12 +861,13 @@ distclean_dirs = $(clean_dirs) leim lisp | |||
| 864 | 861 | ||
| 865 | $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),distclean))) | 862 | $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),distclean))) |
| 866 | 863 | ||
| 867 | maybeclean_dirs = test/automated admin/grammars admin/unidata admin/charsets | 864 | maybeclean_dirs = test admin/grammars admin/unidata admin/charsets |
| 868 | 865 | ||
| 869 | distclean: $(distclean_dirs:=_distclean) | 866 | distclean: $(distclean_dirs:=_distclean) |
| 870 | for dir in ${maybeclean_dirs}; do \ | 867 | for dir in $(filter-out test,$(maybeclean_dirs)); do \ |
| 871 | [ ! -d $$dir ] || $(MAKE) -C $$dir distclean; \ | 868 | $(MAKE) -C $$dir $@ || exit; \ |
| 872 | done | 869 | done |
| 870 | [ ! -d test ] || $(MAKE) -C test $@ | ||
| 873 | ${top_distclean} | 871 | ${top_distclean} |
| 874 | 872 | ||
| 875 | ### 'bootstrap-clean' | 873 | ### 'bootstrap-clean' |
| @@ -878,9 +876,10 @@ distclean: $(distclean_dirs:=_distclean) | |||
| 878 | $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),bootstrap-clean))) | 876 | $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),bootstrap-clean))) |
| 879 | 877 | ||
| 880 | bootstrap-clean: $(distclean_dirs:=_bootstrap-clean) | 878 | bootstrap-clean: $(distclean_dirs:=_bootstrap-clean) |
| 881 | for dir in ${maybeclean_dirs}; do \ | 879 | for dir in $(filter-out test,$(maybeclean_dirs)); do \ |
| 882 | [ ! -d $$dir ] || $(MAKE) -C $$dir bootstrap-clean; \ | 880 | $(MAKE) -C $$dir $@ || exit; \ |
| 883 | done | 881 | done |
| 882 | [ ! -d test ] || $(MAKE) -C test $@ | ||
| 884 | [ ! -f config.log ] || mv -f config.log config.log~ | 883 | [ ! -f config.log ] || mv -f config.log config.log~ |
| 885 | rm -rf ${srcdir}/info | 884 | rm -rf ${srcdir}/info |
| 886 | rm -f ${srcdir}/etc/refcards/emacsver.tex | 885 | rm -f ${srcdir}/etc/refcards/emacsver.tex |
| @@ -906,9 +905,10 @@ maintainer_clean_dirs = src leim lisp | |||
| 906 | $(foreach dir,$(maintainer_clean_dirs),$(eval $(call submake_template,$(dir),maintainer-clean))) | 905 | $(foreach dir,$(maintainer_clean_dirs),$(eval $(call submake_template,$(dir),maintainer-clean))) |
| 907 | 906 | ||
| 908 | maintainer-clean: bootstrap-clean $(maintainer_clean_dirs:=_maintainer-clean) | 907 | maintainer-clean: bootstrap-clean $(maintainer_clean_dirs:=_maintainer-clean) |
| 909 | for dir in ${maybeclean_dirs}; do \ | 908 | for dir in $(filter-out test,$(maybeclean_dirs)); do \ |
| 910 | [ ! -d $$dir ] || $(MAKE) -C $$dir maintainer-clean; \ | 909 | $(MAKE) -C $$dir $@ || exit; \ |
| 911 | done | 910 | done |
| 911 | [ ! -d test ] || $(MAKE) -C test $@ | ||
| 912 | ${top_maintainer_clean} | 912 | ${top_maintainer_clean} |
| 913 | 913 | ||
| 914 | ### This doesn't actually appear in the coding standards, but Karl | 914 | ### This doesn't actually appear in the coding standards, but Karl |
diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS index 5aff8242887..c13cb552a78 100644 --- a/admin/MAINTAINERS +++ b/admin/MAINTAINERS | |||
| @@ -82,11 +82,11 @@ Simen Heggestøyl | |||
| 82 | 82 | ||
| 83 | Nicolas Petton | 83 | Nicolas Petton |
| 84 | lisp/emacs-lisp/map.el | 84 | lisp/emacs-lisp/map.el |
| 85 | test/automated/map-tests.el | 85 | test/lisp/emac-lisp/map-tests.el |
| 86 | lisp/emacs-lisp/seq.el | 86 | lisp/emacs-lisp/seq.el |
| 87 | test/automated/seq-tests.el | 87 | test/lisp/emac-lisp/seq-tests.el |
| 88 | lisp/emacs-lisp/thunk.el | 88 | lisp/emacs-lisp/thunk.el |
| 89 | test/automated/thunk-tests.el | 89 | test/lisp/emac-lisp/thunk-tests.el |
| 90 | 90 | ||
| 91 | The GNU AUCTeX maintainers (auctex-devel@gnu.org) | 91 | The GNU AUCTeX maintainers (auctex-devel@gnu.org) |
| 92 | RefTeX | 92 | RefTeX |
| @@ -104,7 +104,7 @@ The GNU AUCTeX maintainers (auctex-devel@gnu.org) | |||
| 104 | 104 | ||
| 105 | Dmitry Gutov | 105 | Dmitry Gutov |
| 106 | lisp/progmodes/ruby-mode.el | 106 | lisp/progmodes/ruby-mode.el |
| 107 | test/automated/ruby-mode-tests.el | 107 | test/lisp/progmodes/ruby-mode-tests.el |
| 108 | test/indent/ruby.rb | 108 | test/indent/ruby.rb |
| 109 | lisp/progmodes/xref.el | 109 | lisp/progmodes/xref.el |
| 110 | lisp/progmodes/project.el | 110 | lisp/progmodes/project.el |
| @@ -119,11 +119,11 @@ Ulf Jasper | |||
| 119 | lisp/net/newst-ticker.el | 119 | lisp/net/newst-ticker.el |
| 120 | lisp/net/newst-treeview.el | 120 | lisp/net/newst-treeview.el |
| 121 | lisp/net/newsticker.el | 121 | lisp/net/newsticker.el |
| 122 | test/automated/newsticker-tests.el | 122 | test/lisp/net/newsticker-tests.el |
| 123 | 123 | ||
| 124 | Icalendar | 124 | Icalendar |
| 125 | lisp/calendar/icalendar.el | 125 | lisp/calendar/icalendar.el |
| 126 | test/automated/icalendar-tests.el | 126 | test/lisp/calendar/icalendar-tests.el |
| 127 | 127 | ||
| 128 | ============================================================================== | 128 | ============================================================================== |
| 129 | 2. Areas that someone is willing to maintain, although he would not | 129 | 2. Areas that someone is willing to maintain, although he would not |
diff --git a/admin/gitmerge.el b/admin/gitmerge.el index c3981dd4b06..a0efce5ea69 100644 --- a/admin/gitmerge.el +++ b/admin/gitmerge.el | |||
| @@ -50,7 +50,7 @@ | |||
| 50 | (defvar gitmerge-skip-regexp | 50 | (defvar gitmerge-skip-regexp |
| 51 | ;; We used to include "sync" in there, but in my experience it only | 51 | ;; We used to include "sync" in there, but in my experience it only |
| 52 | ;; caused false positives. --Stef | 52 | ;; caused false positives. --Stef |
| 53 | "back[- ]?port\\|cherry picked from commit\\|\\(do not\\|no need to\\) merge\\|\ | 53 | "back[- ]?port\\|cherry picked from commit\\|\\(do\\( no\\|n['’]\\)t\\|no need to\\) merge\\|\ |
| 54 | re-?generate\\|bump version\\|from trunk\\|Auto-commit" | 54 | re-?generate\\|bump version\\|from trunk\\|Auto-commit" |
| 55 | "Regexp matching logs of revisions that might be skipped. | 55 | "Regexp matching logs of revisions that might be skipped. |
| 56 | `gitmerge-missing' will ask you if it should skip any matches.") | 56 | `gitmerge-missing' will ask you if it should skip any matches.") |
diff --git a/build-aux/config.sub b/build-aux/config.sub index 87abeab6cdf..7203bf1e64b 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | # Configuration validation subroutine script. | 2 | # Configuration validation subroutine script. |
| 3 | # Copyright 1992-2017 Free Software Foundation, Inc. | 3 | # Copyright 1992-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | timestamp='2017-02-07' | 5 | timestamp='2017-03-21' |
| 6 | 6 | ||
| 7 | # This file is free software; you can redistribute it and/or modify it | 7 | # This file is free software; you can redistribute it and/or modify it |
| 8 | # under the terms of the GNU General Public License as published by | 8 | # under the terms of the GNU General Public License as published by |
| @@ -315,6 +315,7 @@ case $basic_machine in | |||
| 315 | | ubicom32 \ | 315 | | ubicom32 \ |
| 316 | | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | 316 | | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ |
| 317 | | visium \ | 317 | | visium \ |
| 318 | | wasm32 \ | ||
| 318 | | we32k \ | 319 | | we32k \ |
| 319 | | x86 | xc16x | xstormy16 | xtensa \ | 320 | | x86 | xc16x | xstormy16 | xtensa \ |
| 320 | | z8k | z80) | 321 | | z8k | z80) |
| @@ -446,6 +447,7 @@ case $basic_machine in | |||
| 446 | | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | 447 | | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ |
| 447 | | vax-* \ | 448 | | vax-* \ |
| 448 | | visium-* \ | 449 | | visium-* \ |
| 450 | | wasm32-* \ | ||
| 449 | | we32k-* \ | 451 | | we32k-* \ |
| 450 | | x86-* | x86_64-* | xc16x-* | xps100-* \ | 452 | | x86-* | x86_64-* | xc16x-* | xps100-* \ |
| 451 | | xstormy16-* | xtensa*-* \ | 453 | | xstormy16-* | xtensa*-* \ |
| @@ -1246,6 +1248,9 @@ case $basic_machine in | |||
| 1246 | basic_machine=a29k-wrs | 1248 | basic_machine=a29k-wrs |
| 1247 | os=-vxworks | 1249 | os=-vxworks |
| 1248 | ;; | 1250 | ;; |
| 1251 | wasm32) | ||
| 1252 | basic_machine=wasm32-unknown | ||
| 1253 | ;; | ||
| 1249 | w65*) | 1254 | w65*) |
| 1250 | basic_machine=w65-wdc | 1255 | basic_machine=w65-wdc |
| 1251 | os=-none | 1256 | os=-none |
diff --git a/configure.ac b/configure.ac index b922dc473d6..bd8f7650cc4 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -234,14 +234,16 @@ AC_DEFUN([OPTION_DEFAULT_ON], [dnl | |||
| 234 | # connections. Encrypted connections should be the default. | 234 | # connections. Encrypted connections should be the default. |
| 235 | 235 | ||
| 236 | OPTION_DEFAULT_OFF([mailutils], | 236 | OPTION_DEFAULT_OFF([mailutils], |
| 237 | [rely on GNU Mailutils being installed; this makes the options | 237 | [rely on GNU Mailutils, so that the --without-pop through --with-mailhost |
| 238 | --without-pop through --with-mailhost irrelevant]) | 238 | options are irrelevant]) |
| 239 | if test "$with_mailutils" = no; then | 239 | if test "$with_mailutils" = no; then |
| 240 | with_mailutils= | 240 | with_mailutils= |
| 241 | fi | 241 | fi |
| 242 | AC_SUBST([with_mailutils]) | 242 | AC_SUBST([with_mailutils]) |
| 243 | 243 | ||
| 244 | OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail]) | 244 | OPTION_DEFAULT_ON([pop], |
| 245 | [don't support POP mail retrieval with movemail (--without-pop or | ||
| 246 | --with-mailutils is recommended, as movemail POP is insecure)]) | ||
| 245 | if test "$with_pop" = yes; then | 247 | if test "$with_pop" = yes; then |
| 246 | AC_DEFINE(MAIL_USE_POP) | 248 | AC_DEFINE(MAIL_USE_POP) |
| 247 | fi | 249 | fi |
| @@ -1176,6 +1178,16 @@ AC_PATH_PROG(GZIP_PROG, gzip) | |||
| 1176 | test $with_compress_install != yes && test -n "$GZIP_PROG" && \ | 1178 | test $with_compress_install != yes && test -n "$GZIP_PROG" && \ |
| 1177 | GZIP_PROG=" # $GZIP_PROG # (disabled by configure --without-compress-install)" | 1179 | GZIP_PROG=" # $GZIP_PROG # (disabled by configure --without-compress-install)" |
| 1178 | 1180 | ||
| 1181 | AC_CACHE_CHECK([for 'find' args to delete a file], | ||
| 1182 | [emacs_cv_find_delete], | ||
| 1183 | [if touch conftest.tmp && find conftest.tmp -delete 2>/dev/null && | ||
| 1184 | test ! -f conftest.tmp | ||
| 1185 | then emacs_cv_find_delete="-delete" | ||
| 1186 | else emacs_cv_find_delete="-exec rm -f {} ';'" | ||
| 1187 | fi]) | ||
| 1188 | FIND_DELETE=$emacs_cv_find_delete | ||
| 1189 | AC_SUBST([FIND_DELETE]) | ||
| 1190 | |||
| 1179 | PAXCTL_dumped= | 1191 | PAXCTL_dumped= |
| 1180 | PAXCTL_notdumped= | 1192 | PAXCTL_notdumped= |
| 1181 | if test $opsys = gnu-linux; then | 1193 | if test $opsys = gnu-linux; then |
| @@ -1730,6 +1742,7 @@ dnl AC_C_BIGENDIAN is done by gnulib. | |||
| 1730 | dnl check for Make feature | 1742 | dnl check for Make feature |
| 1731 | 1743 | ||
| 1732 | AUTO_DEPEND=no | 1744 | AUTO_DEPEND=no |
| 1745 | AUTODEPEND_PARENTS='lib src' | ||
| 1733 | dnl check if we have GCC and autodepend is on. | 1746 | dnl check if we have GCC and autodepend is on. |
| 1734 | if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then | 1747 | if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then |
| 1735 | AC_MSG_CHECKING([whether gcc understands -MMD -MF]) | 1748 | AC_MSG_CHECKING([whether gcc understands -MMD -MF]) |
| @@ -5013,8 +5026,10 @@ if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; then | |||
| 5013 | LIBXMENU= | 5026 | LIBXMENU= |
| 5014 | elif test "$USE_X_TOOLKIT" = none; then | 5027 | elif test "$USE_X_TOOLKIT" = none; then |
| 5015 | LIBXMENU='$(oldXMenudir)/libXMenu11.a' | 5028 | LIBXMENU='$(oldXMenudir)/libXMenu11.a' |
| 5029 | AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS oldXMenu" | ||
| 5016 | else | 5030 | else |
| 5017 | LIBXMENU='$(lwlibdir)/liblw.a' | 5031 | LIBXMENU='$(lwlibdir)/liblw.a' |
| 5032 | AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS lwlib" | ||
| 5018 | fi | 5033 | fi |
| 5019 | AC_SUBST(LIBXMENU) | 5034 | AC_SUBST(LIBXMENU) |
| 5020 | 5035 | ||
| @@ -5470,34 +5485,34 @@ ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile etc-emacsver || \ | |||
| 5470 | AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.]) | 5485 | AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.]) |
| 5471 | ]) | 5486 | ]) |
| 5472 | 5487 | ||
| 5488 | if test $AUTO_DEPEND = yes; then | ||
| 5489 | for dir in $AUTODEPEND_PARENTS; do | ||
| 5490 | AS_MKDIR_P([$dir/deps]) | ||
| 5491 | done | ||
| 5492 | fi | ||
| 5493 | |||
| 5473 | AC_OUTPUT | 5494 | AC_OUTPUT |
| 5474 | 5495 | ||
| 5475 | if test ! "$with_mailutils"; then | 5496 | if test ! "$with_mailutils"; then |
| 5497 | if test "$with_pop" = yes; then | ||
| 5498 | AC_MSG_WARN([This configuration installs a 'movemail' program | ||
| 5499 | that retrieves POP3 email via only insecure channels. | ||
| 5500 | To omit insecure POP3, you can use '$0 --without-pop'.]) | ||
| 5501 | fi | ||
| 5502 | |||
| 5476 | case $opsys in | 5503 | case $opsys in |
| 5477 | cygwin | mingw32) | 5504 | cygwin | mingw32) |
| 5478 | # Don't suggest GNU Mailutils, as it hasn't been ported. | 5505 | # Don't suggest GNU Mailutils, as it hasn't been ported. |
| 5479 | if test "$with_pop" = yes; then | 5506 | ;; |
| 5480 | emacs_fix_movemail="use '$0 --without-pop'" | ||
| 5481 | else | ||
| 5482 | emacs_fix_movemail= | ||
| 5483 | fi;; | ||
| 5484 | *) | 5507 | *) |
| 5485 | emacs_fix_movemail="use '$0 --with-mailutils'" | 5508 | emacs_fix_movemail="use '$0 --with-mailutils'" |
| 5486 | case `(movemail --version) 2>/dev/null` in | 5509 | case `(movemail --version) 2>/dev/null` in |
| 5487 | *Mailutils*) ;; | 5510 | *Mailutils*) ;; |
| 5488 | *) emacs_fix_movemail="install GNU Mailutils | 5511 | *) emacs_fix_movemail="install GNU Mailutils |
| 5489 | <http://mailutils.org> and $emacs_fix_movemail";; | 5512 | <http://mailutils.org> and $emacs_fix_movemail";; |
| 5490 | esac;; | 5513 | esac |
| 5514 | AC_MSG_NOTICE([You might want to $emacs_fix_movemail.]);; | ||
| 5491 | esac | 5515 | esac |
| 5492 | |||
| 5493 | if test "$with_pop" = yes; then | ||
| 5494 | AC_MSG_WARN([This configuration installs a 'movemail' program | ||
| 5495 | that retrieves POP3 email via only insecure channels. | ||
| 5496 | To fix this you can $emacs_fix_movemail.]) | ||
| 5497 | elif test "$emacs_fix_movemail"; then | ||
| 5498 | AC_MSG_NOTICE([This configuration installs a 'movemail' program that cannot | ||
| 5499 | retrieve POP3 email. You might want to $emacs_fix_movemail.]) | ||
| 5500 | fi | ||
| 5501 | fi | 5516 | fi |
| 5502 | 5517 | ||
| 5503 | test "$MAKE" = make || AC_MSG_NOTICE([Now you can run '$MAKE'.]) | 5518 | test "$MAKE" = make || AC_MSG_NOTICE([Now you can run '$MAKE'.]) |
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 9b6752c5e1a..438f48c3471 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -2707,7 +2707,10 @@ This does not depend on one of the libraries linked to Emacs. | |||
| 2707 | 2707 | ||
| 2708 | Since all these libraries emit different events on notified file | 2708 | Since all these libraries emit different events on notified file |
| 2709 | changes, there is the Emacs library @code{filenotify} which provides a | 2709 | changes, there is the Emacs library @code{filenotify} which provides a |
| 2710 | unique interface. | 2710 | unified interface. Lisp programs that want to receive file |
| 2711 | notifications should always use this library in preference to the | ||
| 2712 | native ones. | ||
| 2713 | |||
| 2711 | 2714 | ||
| 2712 | @defun file-notify-add-watch file flags callback | 2715 | @defun file-notify-add-watch file flags callback |
| 2713 | Add a watch for filesystem events pertaining to @var{file}. This | 2716 | Add a watch for filesystem events pertaining to @var{file}. This |
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index a4f8400170e..6aa9591e09f 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -2803,12 +2803,13 @@ put it in the selected window. | |||
| 2803 | @section Window History | 2803 | @section Window History |
| 2804 | @cindex window history | 2804 | @cindex window history |
| 2805 | 2805 | ||
| 2806 | Each window remembers in a list the buffers it has previously displayed, | 2806 | Each window remembers in a list the buffers it has previously |
| 2807 | and the order in which these buffers were removed from it. This history | 2807 | displayed, and the order in which these buffers were removed from it. |
| 2808 | is used, for example, by @code{replace-buffer-in-windows} | 2808 | This history is used, for example, by @code{replace-buffer-in-windows} |
| 2809 | (@pxref{Buffers and Windows}). The list is automatically maintained by | 2809 | (@pxref{Buffers and Windows}), and when quitting windows |
| 2810 | Emacs, but you can use the following functions to explicitly inspect or | 2810 | (@pxref{Quitting Windows}). The list is automatically maintained by |
| 2811 | alter it: | 2811 | Emacs, but you can use the following functions to explicitly inspect |
| 2812 | or alter it: | ||
| 2812 | 2813 | ||
| 2813 | @defun window-prev-buffers &optional window | 2814 | @defun window-prev-buffers &optional window |
| 2814 | This function returns a list specifying the previous contents of | 2815 | This function returns a list specifying the previous contents of |
| @@ -2994,33 +2995,35 @@ described next to deal with the window and its buffer. | |||
| 2994 | @end deffn | 2995 | @end deffn |
| 2995 | 2996 | ||
| 2996 | @defun quit-restore-window &optional window bury-or-kill | 2997 | @defun quit-restore-window &optional window bury-or-kill |
| 2997 | This function tries to restore the state of @var{window} that existed | 2998 | This function handles @var{window} and its buffer after quitting. The |
| 2998 | before its buffer was displayed in it. The optional argument | 2999 | optional argument @var{window} must be a live window and defaults to |
| 2999 | @var{window} must be a live window and defaults to the selected one. | 3000 | the selected one. The function's behavior is determined by the four |
| 3001 | elements of the @code{quit-restore} window parameter (@pxref{Window | ||
| 3002 | Parameters}), which is set to nil afterwards. | ||
| 3003 | |||
| 3004 | The window is deleted entirely if: 1) the first element of the | ||
| 3005 | @code{quit-restore} parameter is one of 'window or 'frame, 2) the | ||
| 3006 | window has no history of previously-displayed buffers, and 3) the | ||
| 3007 | displayed buffer matches the one in the fourth element of the | ||
| 3008 | @code{quit-restore} parameter. If @var{window} is the | ||
| 3009 | only window on its frame and there are other frames on the frame's | ||
| 3010 | terminal, the value of the optional argument @var{bury-or-kill} | ||
| 3011 | determines how to proceed with the window. If @var{bury-or-kill} | ||
| 3012 | equals @code{kill}, the frame is deleted unconditionally. Otherwise, | ||
| 3013 | the fate of the frame is determined by calling | ||
| 3014 | @code{frame-auto-hide-function} (see below) with that frame as sole | ||
| 3015 | argument. | ||
| 3000 | 3016 | ||
| 3001 | If @var{window} was created specially for displaying its buffer, this | 3017 | If the third element of the @code{quit-restore} parameter is a list of |
| 3002 | function deletes @var{window} provided its frame contains at least one | 3018 | buffer, window start (@pxref{Window Start and End}), and point |
| 3003 | other live window. If @var{window} is the only window on its frame and | 3019 | (@pxref{Window Point}), and that buffer is still live, the buffer will |
| 3004 | there are other frames on the frame's terminal, the value of the | 3020 | be displayed, and start and point set accordingly. If, in addition, |
| 3005 | optional argument @var{bury-or-kill} determines how to proceed with the | ||
| 3006 | window. If @var{bury-or-kill} equals @code{kill}, the frame is deleted | ||
| 3007 | unconditionally. Otherwise, the fate of the frame is determined by | ||
| 3008 | calling @code{frame-auto-hide-function} (see below) with that frame as | ||
| 3009 | sole argument. | ||
| 3010 | |||
| 3011 | Otherwise, this function tries to redisplay the buffer previously shown | ||
| 3012 | in @var{window}. It also tries to restore the window start | ||
| 3013 | (@pxref{Window Start and End}) and point (@pxref{Window Point}) | ||
| 3014 | positions of the previously shown buffer. If, in addition, | ||
| 3015 | @var{window}'s buffer was temporarily resized, this function will also | 3021 | @var{window}'s buffer was temporarily resized, this function will also |
| 3016 | try to restore the original height of @var{window}. | 3022 | try to restore the original height of @var{window}. |
| 3017 | 3023 | ||
| 3018 | The cases described so far require that the buffer shown in @var{window} | 3024 | Otherwise, if @var{window} was previously used for displaying other |
| 3019 | is still the buffer displayed by the last buffer display function for | 3025 | buffers (@pxref{Window History}), the most recent buffer in that |
| 3020 | this window. If another buffer has been shown in the meantime, or the | 3026 | history will be displayed. |
| 3021 | buffer previously shown no longer exists, this function calls | ||
| 3022 | @code{switch-to-prev-buffer} (@pxref{Window History}) to show some other | ||
| 3023 | buffer instead. | ||
| 3024 | 3027 | ||
| 3025 | The optional argument @var{bury-or-kill} specifies how to deal with | 3028 | The optional argument @var{bury-or-kill} specifies how to deal with |
| 3026 | @var{window}'s buffer. The following values are handled: | 3029 | @var{window}'s buffer. The following values are handled: |
| @@ -3048,9 +3051,24 @@ buffer again without killing the buffer. | |||
| 3048 | This means to kill @var{window}'s buffer. | 3051 | This means to kill @var{window}'s buffer. |
| 3049 | @end table | 3052 | @end table |
| 3050 | 3053 | ||
| 3051 | @code{quit-restore-window} bases its decisions on information stored in | 3054 | Typically, the display routines run by @code{display-buffer} will set |
| 3052 | @var{window}'s @code{quit-restore} window parameter (@pxref{Window | 3055 | the @code{quit-restore} window parameter correctly. It's also |
| 3053 | Parameters}), and resets that parameter to @code{nil} after it's done. | 3056 | possible to set it manually, using the following code for displaying |
| 3057 | @var{buffer} in @var{window}: | ||
| 3058 | |||
| 3059 | @example | ||
| 3060 | @group | ||
| 3061 | (display-buffer-record-window type window buffer) | ||
| 3062 | |||
| 3063 | (set-window-buffer window buffer) | ||
| 3064 | |||
| 3065 | (set-window-prev-buffers window nil) | ||
| 3066 | @end group | ||
| 3067 | @end example | ||
| 3068 | |||
| 3069 | Setting the window history to nil ensures that a future call to | ||
| 3070 | @code{quit-window} can delete the window altogether. | ||
| 3071 | |||
| 3054 | @end defun | 3072 | @end defun |
| 3055 | 3073 | ||
| 3056 | The following option specifies how to deal with a frame containing just | 3074 | The following option specifies how to deal with a frame containing just |
| @@ -4845,25 +4863,32 @@ This parameter is installed by the buffer display functions | |||
| 4845 | (@pxref{Choosing Window}) and consulted by @code{quit-restore-window} | 4863 | (@pxref{Choosing Window}) and consulted by @code{quit-restore-window} |
| 4846 | (@pxref{Quitting Windows}). It contains four elements: | 4864 | (@pxref{Quitting Windows}). It contains four elements: |
| 4847 | 4865 | ||
| 4848 | The first element is one of the symbols @code{window}, meaning that the | 4866 | The first element is one of the symbols @code{window}, meaning that |
| 4849 | window has been specially created by @code{display-buffer}; @code{frame}, | 4867 | the window has been specially created by @code{display-buffer}; |
| 4850 | a separate frame has been created; @code{same}, the window has | 4868 | @code{frame}, a separate frame has been created; @code{same}, the |
| 4851 | displayed the same buffer before; or @code{other}, the window showed | 4869 | window has only ever displayed this buffer; or @code{other}, the |
| 4852 | another buffer before. | 4870 | window showed another buffer before. @code{frame} and @code{window} |
| 4871 | affect how the window is quit, while @code{same} and @code{other} | ||
| 4872 | affect the redisplay of buffers previously shown in this window. | ||
| 4853 | 4873 | ||
| 4854 | The second element is either one of the symbols @code{window} or | 4874 | The second element is either one of the symbols @code{window} or |
| 4855 | @code{frame}, or a list whose elements are the buffer shown in the | 4875 | @code{frame}, or a list whose elements are the buffer shown in the |
| 4856 | window before, that buffer's window start and window point positions, | 4876 | window before, that buffer's window start and window point positions, |
| 4857 | and the window's height at that time. | 4877 | and the window's height at that time. If that buffer is still live |
| 4878 | when the window is quit, then the function @code{quit-restore-window} | ||
| 4879 | reuses the window to display the buffer. | ||
| 4858 | 4880 | ||
| 4859 | The third element is the window selected at the time the parameter was | 4881 | The third element is the window selected at the time the parameter was |
| 4860 | created. The function @code{quit-restore-window} tries to reselect that | 4882 | created. If @code{quit-restore-window} deletes the window passed to |
| 4861 | window when it deletes the window passed to it as argument. | 4883 | it as argument, it then tries to reselect this window. |
| 4862 | 4884 | ||
| 4863 | The fourth element is the buffer whose display caused the creation of | 4885 | The fourth element is the buffer whose display caused the creation of |
| 4864 | this parameter. @code{quit-restore-window} deletes the specified window | 4886 | this parameter. @code{quit-restore-window} deletes the specified window |
| 4865 | only if it still shows that buffer. | 4887 | only if it still shows that buffer. |
| 4866 | 4888 | ||
| 4889 | See the description of @code{quit-restore-window} in @ref{Quitting | ||
| 4890 | Windows} for details. | ||
| 4891 | |||
| 4867 | @item @code{window-side} @code{window-slot} | 4892 | @item @code{window-side} @code{window-slot} |
| 4868 | These parameters are used for implementing side windows (@pxref{Side | 4893 | These parameters are used for implementing side windows (@pxref{Side |
| 4869 | Windows}). | 4894 | Windows}). |
| @@ -4894,9 +4919,6 @@ applications. It might be replaced by an improved solution in future | |||
| 4894 | versions of Emacs. | 4919 | versions of Emacs. |
| 4895 | @end table | 4920 | @end table |
| 4896 | 4921 | ||
| 4897 | The @code{window-atom} parameter is used for implementing atomic windows. | ||
| 4898 | |||
| 4899 | |||
| 4900 | @node Window Hooks | 4922 | @node Window Hooks |
| 4901 | @section Hooks for Window Scrolling and Changes | 4923 | @section Hooks for Window Scrolling and Changes |
| 4902 | @cindex hooks for window operations | 4924 | @cindex hooks for window operations |
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index a29873b03b3..91e20fa7247 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi | |||
| @@ -274,6 +274,7 @@ Font Locking | |||
| 274 | * Font Locking Preliminaries:: | 274 | * Font Locking Preliminaries:: |
| 275 | * Faces:: | 275 | * Faces:: |
| 276 | * Doc Comments:: | 276 | * Doc Comments:: |
| 277 | * Misc Font Locking:: | ||
| 277 | * AWK Mode Font Locking:: | 278 | * AWK Mode Font Locking:: |
| 278 | 279 | ||
| 279 | Configuration Basics | 280 | Configuration Basics |
| @@ -1821,6 +1822,7 @@ sections apply to the other languages. | |||
| 1821 | * Font Locking Preliminaries:: | 1822 | * Font Locking Preliminaries:: |
| 1822 | * Faces:: | 1823 | * Faces:: |
| 1823 | * Doc Comments:: | 1824 | * Doc Comments:: |
| 1825 | * Misc Font Locking:: | ||
| 1824 | * AWK Mode Font Locking:: | 1826 | * AWK Mode Font Locking:: |
| 1825 | @end menu | 1827 | @end menu |
| 1826 | 1828 | ||
| @@ -2023,7 +2025,7 @@ since those aren't syntactic errors in themselves. | |||
| 2023 | 2025 | ||
| 2024 | 2026 | ||
| 2025 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 2027 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 2026 | @node Doc Comments, AWK Mode Font Locking, Faces, Font Locking | 2028 | @node Doc Comments, Misc Font Locking, Faces, Font Locking |
| 2027 | @comment node-name, next, previous, up | 2029 | @comment node-name, next, previous, up |
| 2028 | @section Documentation Comments | 2030 | @section Documentation Comments |
| 2029 | @cindex documentation comments | 2031 | @cindex documentation comments |
| @@ -2099,9 +2101,63 @@ initialization and the result is prepended. For an example, see | |||
| 2099 | If you add support for another doc comment style, please consider | 2101 | If you add support for another doc comment style, please consider |
| 2100 | contributing it: send a note to @email{bug-cc-mode@@gnu.org}. | 2102 | contributing it: send a note to @email{bug-cc-mode@@gnu.org}. |
| 2101 | 2103 | ||
| 2104 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| 2105 | @node Misc Font Locking, AWK Mode Font Locking, Doc Comments, Font Locking | ||
| 2106 | @comment node-name, next, previous, up | ||
| 2107 | @section Miscellaneous Font Locking | ||
| 2108 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| 2109 | |||
| 2110 | In some languages, particularly in C++, there are constructs which are | ||
| 2111 | syntactically ambiguous---they could be either declarations or | ||
| 2112 | expressions, and @ccmode{} cannot tell for sure which. Often such a | ||
| 2113 | construct is one of the operators @samp{*} or @samp{&} surrounded by | ||
| 2114 | two identifiers. | ||
| 2115 | |||
| 2116 | Experience shows that very often when such a construct is a | ||
| 2117 | declaration it will be written with the operator touching exactly one | ||
| 2118 | of the identifiers, like: | ||
| 2119 | |||
| 2120 | @example | ||
| 2121 | foo *bar | ||
| 2122 | @end example | ||
| 2123 | or | ||
| 2124 | @example | ||
| 2125 | foo& bar | ||
| 2126 | @end example | ||
| 2127 | |||
| 2128 | . Whether such code is fontified depends on the setting of | ||
| 2129 | @code{c-asymmetry-fontification-flag}. | ||
| 2130 | |||
| 2131 | @defvar c-asymmetry-fontification-flag | ||
| 2132 | @vindex asymmetry-fontification-flag (c-) | ||
| 2133 | When @code{c-asymmetry-fontification-flag} is non-nil (which it is by | ||
| 2134 | default), code like the above, with white space either before or after | ||
| 2135 | the operator, but not both, is fontified as a declaration. When the | ||
| 2136 | variable is nil, such a construct gets the default face. | ||
| 2137 | @end defvar | ||
| 2138 | |||
| 2139 | When the construct is an expression there will often be white space | ||
| 2140 | both before and after the operator or there will be no white space | ||
| 2141 | around it at all, like: | ||
| 2142 | |||
| 2143 | @example | ||
| 2144 | foo * bar | ||
| 2145 | @end example | ||
| 2146 | or | ||
| 2147 | @example | ||
| 2148 | foo&bar | ||
| 2149 | @end example | ||
| 2150 | . | ||
| 2151 | |||
| 2152 | Such code is not fontified as a declaration. (Typically, the | ||
| 2153 | identifiers don't get a non-default face.) | ||
| 2154 | |||
| 2155 | For clarity's sake, we emphasize that the ``asymmetry'' rule in this | ||
| 2156 | section only applies when CC Mode cannot disambiguate a construct in | ||
| 2157 | any other way. | ||
| 2102 | 2158 | ||
| 2103 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 2159 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 2104 | @node AWK Mode Font Locking, , Doc Comments, Font Locking | 2160 | @node AWK Mode Font Locking, , Misc Font Locking, Font Locking |
| 2105 | @comment node-name, next, previous, up | 2161 | @comment node-name, next, previous, up |
| 2106 | @section AWK Mode Font Locking | 2162 | @section AWK Mode Font Locking |
| 2107 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 2163 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi index 1e6f4b03bb0..bf103256f29 100644 --- a/doc/misc/dired-x.texi +++ b/doc/misc/dired-x.texi | |||
| @@ -721,15 +721,27 @@ variable @code{window-min-height}. | |||
| 721 | @item dired-mark-extension | 721 | @item dired-mark-extension |
| 722 | @findex dired-mark-extension | 722 | @findex dired-mark-extension |
| 723 | Mark all files with a certain extension for use in later commands. A @samp{.} | 723 | Mark all files with a certain extension for use in later commands. A @samp{.} |
| 724 | is not automatically prepended to the string entered, you must type it | 724 | is automatically prepended to the string entered when not present. |
| 725 | explicitly. | 725 | If invoked with prefix argument @kbd{C-u}, this command unmarks files instead. |
| 726 | If invoked with prefix argument @kbd{C-u}, this command unmark files instead. | ||
| 727 | If called with the @kbd{C-u C-u} prefix, asks for a character to use | 726 | If called with the @kbd{C-u C-u} prefix, asks for a character to use |
| 728 | as the marker, and marks files with it. | 727 | as the marker, and marks files with it. |
| 729 | 728 | ||
| 730 | When called from Lisp, @var{extension} may also be a list of extensions | 729 | When called from Lisp, @var{extension} may also be a list of extensions |
| 731 | and an optional argument @var{marker-char} specifies the marker used. | 730 | and an optional argument @var{marker-char} specifies the marker used. |
| 732 | 731 | ||
| 732 | @item dired-mark-suffix | ||
| 733 | @findex dired-mark-suffix | ||
| 734 | Mark all files with a certain suffix for use in later commands. A @samp{.} | ||
| 735 | is not automatically prepended to the string entered, you must type it | ||
| 736 | explicitly. This is different from @var{dired-mark-extension} which prepends | ||
| 737 | a @samp{.} if not present. | ||
| 738 | If invoked with prefix argument @kbd{C-u}, this command unmarks files instead. | ||
| 739 | If called with the @kbd{C-u C-u} prefix, asks for a character to use | ||
| 740 | as the marker, and marks files with it. | ||
| 741 | |||
| 742 | When called from Lisp, @var{suffix} may also be a list of suffixes | ||
| 743 | and an optional argument @var{marker-char} specifies the marker used. | ||
| 744 | |||
| 733 | @item dired-flag-extension | 745 | @item dired-flag-extension |
| 734 | @findex dired-flag-extension | 746 | @findex dired-flag-extension |
| 735 | Flag all files with a certain extension for deletion. A @samp{.} is | 747 | Flag all files with a certain extension for deletion. A @samp{.} is |
diff --git a/doc/misc/org.texi b/doc/misc/org.texi index 21c8758b802..fca5185337e 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi | |||
| @@ -15327,14 +15327,9 @@ inheritance}).}. | |||
| 15327 | |sed '1d' \ | 15327 | |sed '1d' \ |
| 15328 | #+END_SRC | 15328 | #+END_SRC |
| 15329 | 15329 | ||
| 15330 | ** sort by the percent full | 15330 | ** output mount point of fullest disk |
| 15331 | #+BEGIN_SRC sh | 15331 | #+BEGIN_SRC sh |
| 15332 | |awk '@{print $5 " " $6@}'|sort -n |tail -1 \ | 15332 | |awk '@{if (u < +$5) @{u = +$5; m = $6@}@} END @{print m@}' |
| 15333 | #+END_SRC | ||
| 15334 | |||
| 15335 | ** extract the mount point | ||
| 15336 | #+BEGIN_SRC sh | ||
| 15337 | |awk '@{print $2@}' | ||
| 15338 | #+END_SRC | 15333 | #+END_SRC |
| 15339 | @end example | 15334 | @end example |
| 15340 | 15335 | ||
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index e1d84457ff9..8e04d69c199 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -2499,6 +2499,42 @@ Starting with Emacs 24, when @option{explicit-shell-file-name} is | |||
| 2499 | equal to @code{nil}, calling @code{shell} interactively will prompt | 2499 | equal to @code{nil}, calling @code{shell} interactively will prompt |
| 2500 | for a shell name. | 2500 | for a shell name. |
| 2501 | 2501 | ||
| 2502 | Starting with Emacs 26, you could use connection-local variables for | ||
| 2503 | setting different values of @option{explicit-shell-file-name} for | ||
| 2504 | different remote hosts. | ||
| 2505 | @ifinfo | ||
| 2506 | @pxref{Connection Local Variables, , , elisp} | ||
| 2507 | @end ifinfo | ||
| 2508 | |||
| 2509 | @lisp | ||
| 2510 | @group | ||
| 2511 | (connection-local-set-profile-variables | ||
| 2512 | 'remote-bash | ||
| 2513 | '((explicit-shell-file-name . "/bin/bash") | ||
| 2514 | (explicit-bash-args . ("-i")))) | ||
| 2515 | @end group | ||
| 2516 | |||
| 2517 | @group | ||
| 2518 | (connection-local-set-profile-variables | ||
| 2519 | 'remote-ksh | ||
| 2520 | '((explicit-shell-file-name . "/bin/ksh") | ||
| 2521 | (explicit-ksh-args . ("-i")))) | ||
| 2522 | @end group | ||
| 2523 | |||
| 2524 | @group | ||
| 2525 | (connection-local-set-profiles | ||
| 2526 | '(:application 'tramp :protocol "ssh" :machine "localhost") | ||
| 2527 | 'remote-bash) | ||
| 2528 | @end group | ||
| 2529 | |||
| 2530 | @group | ||
| 2531 | (connection-local-set-profiles | ||
| 2532 | `(:application 'tramp :protocol "sudo" | ||
| 2533 | :user "root" :machine ,(system-name)) | ||
| 2534 | 'remote-ksh) | ||
| 2535 | @end group | ||
| 2536 | @end lisp | ||
| 2537 | |||
| 2502 | 2538 | ||
| 2503 | @subsection Running @code{shell-command} on a remote host | 2539 | @subsection Running @code{shell-command} on a remote host |
| 2504 | @cindex shell-command | 2540 | @cindex shell-command |
| @@ -2542,11 +2578,10 @@ uid=0(root) gid=0(root) groups=0(root) | |||
| 2542 | @end group | 2578 | @end group |
| 2543 | @end example | 2579 | @end example |
| 2544 | 2580 | ||
| 2545 | @code{eshell} in Emacs 23.2 added custom @code{su} and @code{sudo} | 2581 | @code{eshell} added custom @code{su} and @code{sudo} commands that set |
| 2546 | commands that set the default directory correctly for the | 2582 | the default directory correctly for the @file{*eshell*} buffer. |
| 2547 | @file{*eshell*} buffer. @value{tramp} silently updates | 2583 | @value{tramp} silently updates @option{tramp-default-proxies-alist} |
| 2548 | @option{tramp-default-proxies-alist} with an entry for this directory | 2584 | with an entry for this directory (@pxref{Multi-hops}): |
| 2549 | (@pxref{Multi-hops}): | ||
| 2550 | 2585 | ||
| 2551 | @example | 2586 | @example |
| 2552 | @group | 2587 | @group |
| @@ -2763,11 +2798,12 @@ Where is the latest @value{tramp}? | |||
| 2763 | @item | 2798 | @item |
| 2764 | Which systems does it work on? | 2799 | Which systems does it work on? |
| 2765 | 2800 | ||
| 2766 | The package works successfully on Emacs 23, Emacs 24, and Emacs 25. | 2801 | The package works successfully on Emacs 23, Emacs 24, Emacs 25, and |
| 2802 | Emacs 26. | ||
| 2767 | 2803 | ||
| 2768 | While Unix and Unix-like systems are the primary remote targets, | 2804 | While Unix and Unix-like systems are the primary remote targets, |
| 2769 | @value{tramp} has equal success connecting to other platforms, such as | 2805 | @value{tramp} has equal success connecting to other platforms, such as |
| 2770 | MS Windows XP/Vista/7. | 2806 | MS Windows 7/8/10. |
| 2771 | 2807 | ||
| 2772 | 2808 | ||
| 2773 | @item | 2809 | @item |
| @@ -471,8 +471,6 @@ where to place point after C-c M-r and C-c M-s. | |||
| 471 | --- | 471 | --- |
| 472 | *** Messages from CMake are now recognized. | 472 | *** Messages from CMake are now recognized. |
| 473 | 473 | ||
| 474 | ** Dired | ||
| 475 | |||
| 476 | +++ | 474 | +++ |
| 477 | *** A new option 'dired-always-read-filesystem' default to nil. | 475 | *** A new option 'dired-always-read-filesystem' default to nil. |
| 478 | If non-nil, buffers visiting files are reverted before search them; | 476 | If non-nil, buffers visiting files are reverted before search them; |
| @@ -759,6 +757,11 @@ processes on exit. | |||
| 759 | * Incompatible Lisp Changes in Emacs 26.1 | 757 | * Incompatible Lisp Changes in Emacs 26.1 |
| 760 | 758 | ||
| 761 | +++ | 759 | +++ |
| 760 | *** Command 'dired-mark-extension' now automatically prepends a '.' to the | ||
| 761 | extension when not present. The new command 'dired-mark-suffix' behaves | ||
| 762 | similarly but it doesn't prepend a '.'. | ||
| 763 | |||
| 764 | +++ | ||
| 762 | ** Certain cond/pcase/cl-case forms are now compiled using a faster jump | 765 | ** Certain cond/pcase/cl-case forms are now compiled using a faster jump |
| 763 | table implementation. This uses a new bytecode op `switch', which isn't | 766 | table implementation. This uses a new bytecode op `switch', which isn't |
| 764 | compatible with previous Emacs versions. This functionality can be disabled | 767 | compatible with previous Emacs versions. This functionality can be disabled |
| @@ -139,7 +139,7 @@ things in their .emacs. | |||
| 139 | case to make sure it stays fixed. Or pick your favorite programming | 139 | case to make sure it stays fixed. Or pick your favorite programming |
| 140 | major-mode, and write a test for its indentation. Or a version | 140 | major-mode, and write a test for its indentation. Or a version |
| 141 | control backend, and write a test for its status parser. Etc. | 141 | control backend, and write a test for its status parser. Etc. |
| 142 | See test/automated for examples. | 142 | See the 'test' directory for examples. |
| 143 | 143 | ||
| 144 | * Small but important fixes needed in existing features: | 144 | * Small but important fixes needed in existing features: |
| 145 | 145 | ||
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index b2cd66c0498..fa8de0bcc94 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in | |||
| @@ -266,7 +266,9 @@ need-blessmail: blessmail | |||
| 266 | maybe-blessmail: $(BLESSMAIL_TARGET) | 266 | maybe-blessmail: $(BLESSMAIL_TARGET) |
| 267 | 267 | ||
| 268 | ## Install the internal utilities. Until they are installed, we can | 268 | ## Install the internal utilities. Until they are installed, we can |
| 269 | ## just run them directly from lib-src. | 269 | ## just run them directly from lib-src. When installing, do not give |
| 270 | ## up if chown or chgrp fails, as the package responsible for | ||
| 271 | ## installing Emacs can fix this problem later. | ||
| 270 | $(DESTDIR)${archlibdir}: all | 272 | $(DESTDIR)${archlibdir}: all |
| 271 | @echo | 273 | @echo |
| 272 | @echo "Installing utilities run internally by Emacs." | 274 | @echo "Installing utilities run internally by Emacs." |
| @@ -283,15 +285,19 @@ $(DESTDIR)${archlibdir}: all | |||
| 283 | touch "$(DESTDIR)${gamedir}/snake-scores" \ | 285 | touch "$(DESTDIR)${gamedir}/snake-scores" \ |
| 284 | "$(DESTDIR)${gamedir}/tetris-scores" | 286 | "$(DESTDIR)${gamedir}/tetris-scores" |
| 285 | ifneq (,$(gameuser)) | 287 | ifneq (,$(gameuser)) |
| 286 | chown ${gameuser} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" | 288 | -chown ${gameuser} \ |
| 287 | chmod u+s,go-r "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" | 289 | "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \ |
| 288 | chown ${gameuser} "$(DESTDIR)${gamedir}" | 290 | "$(DESTDIR)${gamedir}" && \ |
| 289 | chmod u=rwx,g=rx,o=rx "$(DESTDIR)${gamedir}" | 291 | chmod u+s,go-r \ |
| 292 | "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \ | ||
| 293 | chmod u=rwx,g=rx,o=rx "$(DESTDIR)${gamedir}" | ||
| 290 | else | 294 | else |
| 291 | chgrp ${gamegroup} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" | 295 | -chgrp ${gamegroup} \ |
| 292 | chmod g+s,o-r "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" | 296 | "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \ |
| 293 | chgrp ${gamegroup} "$(DESTDIR)${gamedir}" | 297 | "$(DESTDIR)${gamedir}" && \ |
| 294 | chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}" | 298 | chmod g+s,o-r \ |
| 299 | "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \ | ||
| 300 | chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}" | ||
| 295 | endif | 301 | endif |
| 296 | endif | 302 | endif |
| 297 | exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \ | 303 | exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \ |
diff --git a/lib/Makefile.in b/lib/Makefile.in index 4e51ac6b029..832704f3a8d 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in | |||
| @@ -65,16 +65,12 @@ ifneq ($(SYSTEM_TYPE),windows-nt) | |||
| 65 | libgnu_a_SOURCES += openat-die.c save-cwd.c | 65 | libgnu_a_SOURCES += openat-die.c save-cwd.c |
| 66 | endif | 66 | endif |
| 67 | 67 | ||
| 68 | # Dependencies. When !AUTO_DEPEND, don't bother with a dependencies file, | ||
| 69 | # as the default dependencies are often adequate. | ||
| 70 | DEPDIR = deps | 68 | DEPDIR = deps |
| 71 | ifeq ($(AUTO_DEPEND),yes) | 69 | ifeq ($(AUTO_DEPEND),yes) |
| 72 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP | 70 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP |
| 73 | MKDEPDIR = $(MKDIR_P) $(DEPDIR) | ||
| 74 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) | 71 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) |
| 75 | else | 72 | else |
| 76 | DEPFLAGS = | 73 | DEPFLAGS = |
| 77 | MKDEPDIR = : | ||
| 78 | endif | 74 | endif |
| 79 | 75 | ||
| 80 | .PRECIOUS: ../config.status Makefile | 76 | .PRECIOUS: ../config.status Makefile |
| @@ -90,10 +86,8 @@ libegnu_a_OBJECTS = $(patsubst %.o,e-%.o,$(libgnu_a_OBJECTS)) | |||
| 90 | $(libegnu_a_OBJECTS) $(libgnu_a_OBJECTS): $(BUILT_SOURCES) | 86 | $(libegnu_a_OBJECTS) $(libgnu_a_OBJECTS): $(BUILT_SOURCES) |
| 91 | 87 | ||
| 92 | .c.o: | 88 | .c.o: |
| 93 | @$(MKDEPDIR) | ||
| 94 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< | 89 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< |
| 95 | e-%.o: %.c | 90 | e-%.o: %.c |
| 96 | @$(MKDEPDIR) | ||
| 97 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -Demacs -o $@ $< | 91 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -Demacs -o $@ $< |
| 98 | 92 | ||
| 99 | all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a) | 93 | all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a) |
| @@ -118,10 +112,10 @@ TAGS: $(ETAGS) $(tagsfiles) | |||
| 118 | .PHONY: $(ETAGS) tags | 112 | .PHONY: $(ETAGS) tags |
| 119 | 113 | ||
| 120 | clean mostlyclean: | 114 | clean mostlyclean: |
| 121 | rm -f *.[ao] \#* | 115 | rm -f *.[ao] \#* $(DEPDIR)/* |
| 122 | -rm -rf $(DEPDIR) | ||
| 123 | distclean: clean | 116 | distclean: clean |
| 124 | rm -f Makefile $(BUILT_SOURCES) | 117 | rm -f Makefile $(BUILT_SOURCES) |
| 118 | rm -fr $(DEPDIR) | ||
| 125 | bootstrap-clean: distclean | 119 | bootstrap-clean: distclean |
| 126 | rm -f TAGS | 120 | rm -f TAGS |
| 127 | maintainer-clean: bootstrap-clean | 121 | maintainer-clean: bootstrap-clean |
diff --git a/lib/getopt.c b/lib/getopt.c index e40ea8d5eaa..7afd0dcabe8 100644 --- a/lib/getopt.c +++ b/lib/getopt.c | |||
| @@ -2,22 +2,22 @@ | |||
| 2 | NOTE: getopt is part of the C library, so if you don't know what | 2 | NOTE: getopt is part of the C library, so if you don't know what |
| 3 | "Keep this file name-space clean" means, talk to drepper@gnu.org | 3 | "Keep this file name-space clean" means, talk to drepper@gnu.org |
| 4 | before changing it! | 4 | before changing it! |
| 5 | Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2017 Free Software | 5 | Copyright (C) 1987-2017 Free Software Foundation, Inc. |
| 6 | Foundation, Inc. | ||
| 7 | This file is part of the GNU C Library. | 6 | This file is part of the GNU C Library. |
| 8 | 7 | ||
| 9 | This program is free software: you can redistribute it and/or modify | 8 | The GNU C Library is free software; you can redistribute it and/or |
| 10 | it under the terms of the GNU General Public License as published by | 9 | modify it under the terms of the GNU General Public |
| 11 | the Free Software Foundation; either version 3 of the License, or | 10 | License as published by the Free Software Foundation; either |
| 12 | (at your option) any later version. | 11 | version 3 of the License, or (at your option) any later version. |
| 13 | 12 | ||
| 14 | This program is distributed in the hope that it will be useful, | 13 | The GNU C Library is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | GNU General Public License for more details. | 16 | General Public License for more details. |
| 18 | 17 | ||
| 19 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public |
| 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 19 | License along with the GNU C Library; if not, see |
| 20 | <http://www.gnu.org/licenses/>. */ | ||
| 21 | 21 | ||
| 22 | #ifndef _LIBC | 22 | #ifndef _LIBC |
| 23 | # include <config.h> | 23 | # include <config.h> |
| @@ -27,8 +27,8 @@ | |||
| 27 | 27 | ||
| 28 | #include <stdio.h> | 28 | #include <stdio.h> |
| 29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
| 30 | #include <string.h> | ||
| 31 | #include <unistd.h> | 30 | #include <unistd.h> |
| 31 | #include <string.h> | ||
| 32 | 32 | ||
| 33 | #ifdef _LIBC | 33 | #ifdef _LIBC |
| 34 | # include <libintl.h> | 34 | # include <libintl.h> |
| @@ -37,7 +37,7 @@ | |||
| 37 | # define _(msgid) gettext (msgid) | 37 | # define _(msgid) gettext (msgid) |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #if defined _LIBC && defined USE_IN_LIBIO | 40 | #if defined _LIBC |
| 41 | # include <wchar.h> | 41 | # include <wchar.h> |
| 42 | #endif | 42 | #endif |
| 43 | 43 | ||
| @@ -181,7 +181,7 @@ exchange (char **argv, struct _getopt_data *d) | |||
| 181 | { | 181 | { |
| 182 | /* Bottom segment is the short one. */ | 182 | /* Bottom segment is the short one. */ |
| 183 | int len = middle - bottom; | 183 | int len = middle - bottom; |
| 184 | register int i; | 184 | int i; |
| 185 | 185 | ||
| 186 | /* Swap it with the top part of the top segment. */ | 186 | /* Swap it with the top part of the top segment. */ |
| 187 | for (i = 0; i < len; i++) | 187 | for (i = 0; i < len; i++) |
| @@ -198,7 +198,7 @@ exchange (char **argv, struct _getopt_data *d) | |||
| 198 | { | 198 | { |
| 199 | /* Top segment is the short one. */ | 199 | /* Top segment is the short one. */ |
| 200 | int len = top - middle; | 200 | int len = top - middle; |
| 201 | register int i; | 201 | int i; |
| 202 | 202 | ||
| 203 | /* Swap it with the bottom part of the bottom segment. */ | 203 | /* Swap it with the bottom part of the bottom segment. */ |
| 204 | for (i = 0; i < len; i++) | 204 | for (i = 0; i < len; i++) |
| @@ -564,11 +564,11 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 564 | first.next = ambig_list; | 564 | first.next = ambig_list; |
| 565 | ambig_list = &first; | 565 | ambig_list = &first; |
| 566 | 566 | ||
| 567 | #if defined _LIBC && defined USE_IN_LIBIO | 567 | #if defined _LIBC |
| 568 | char *buf = NULL; | 568 | char *buf = NULL; |
| 569 | size_t buflen = 0; | 569 | size_t buflen = 0; |
| 570 | 570 | ||
| 571 | FILE *fp = open_memstream (&buf, &buflen); | 571 | FILE *fp = __open_memstream (&buf, &buflen); |
| 572 | if (fp != NULL) | 572 | if (fp != NULL) |
| 573 | { | 573 | { |
| 574 | fprintf (fp, | 574 | fprintf (fp, |
| @@ -584,7 +584,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 584 | 584 | ||
| 585 | fputc_unlocked ('\n', fp); | 585 | fputc_unlocked ('\n', fp); |
| 586 | 586 | ||
| 587 | if (__builtin_expect (fclose (fp) != EOF, 1)) | 587 | if (__glibc_likely (fclose (fp) != EOF)) |
| 588 | { | 588 | { |
| 589 | _IO_flockfile (stderr); | 589 | _IO_flockfile (stderr); |
| 590 | 590 | ||
| @@ -642,7 +642,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 642 | { | 642 | { |
| 643 | if (print_errors) | 643 | if (print_errors) |
| 644 | { | 644 | { |
| 645 | #if defined _LIBC && defined USE_IN_LIBIO | 645 | #if defined _LIBC |
| 646 | char *buf; | 646 | char *buf; |
| 647 | int n; | 647 | int n; |
| 648 | #endif | 648 | #endif |
| @@ -650,7 +650,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 650 | if (argv[d->optind - 1][1] == '-') | 650 | if (argv[d->optind - 1][1] == '-') |
| 651 | { | 651 | { |
| 652 | /* --option */ | 652 | /* --option */ |
| 653 | #if defined _LIBC && defined USE_IN_LIBIO | 653 | #if defined _LIBC |
| 654 | n = __asprintf (&buf, _("\ | 654 | n = __asprintf (&buf, _("\ |
| 655 | %s: option '--%s' doesn't allow an argument\n"), | 655 | %s: option '--%s' doesn't allow an argument\n"), |
| 656 | argv[0], pfound->name); | 656 | argv[0], pfound->name); |
| @@ -663,7 +663,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 663 | else | 663 | else |
| 664 | { | 664 | { |
| 665 | /* +option or -option */ | 665 | /* +option or -option */ |
| 666 | #if defined _LIBC && defined USE_IN_LIBIO | 666 | #if defined _LIBC |
| 667 | n = __asprintf (&buf, _("\ | 667 | n = __asprintf (&buf, _("\ |
| 668 | %s: option '%c%s' doesn't allow an argument\n"), | 668 | %s: option '%c%s' doesn't allow an argument\n"), |
| 669 | argv[0], argv[d->optind - 1][0], | 669 | argv[0], argv[d->optind - 1][0], |
| @@ -676,7 +676,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 676 | #endif | 676 | #endif |
| 677 | } | 677 | } |
| 678 | 678 | ||
| 679 | #if defined _LIBC && defined USE_IN_LIBIO | 679 | #if defined _LIBC |
| 680 | if (n >= 0) | 680 | if (n >= 0) |
| 681 | { | 681 | { |
| 682 | _IO_flockfile (stderr); | 682 | _IO_flockfile (stderr); |
| @@ -709,7 +709,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 709 | { | 709 | { |
| 710 | if (print_errors) | 710 | if (print_errors) |
| 711 | { | 711 | { |
| 712 | #if defined _LIBC && defined USE_IN_LIBIO | 712 | #if defined _LIBC |
| 713 | char *buf; | 713 | char *buf; |
| 714 | 714 | ||
| 715 | if (__asprintf (&buf, _("\ | 715 | if (__asprintf (&buf, _("\ |
| @@ -760,7 +760,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 760 | { | 760 | { |
| 761 | if (print_errors) | 761 | if (print_errors) |
| 762 | { | 762 | { |
| 763 | #if defined _LIBC && defined USE_IN_LIBIO | 763 | #if defined _LIBC |
| 764 | char *buf; | 764 | char *buf; |
| 765 | int n; | 765 | int n; |
| 766 | #endif | 766 | #endif |
| @@ -768,7 +768,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 768 | if (argv[d->optind][1] == '-') | 768 | if (argv[d->optind][1] == '-') |
| 769 | { | 769 | { |
| 770 | /* --option */ | 770 | /* --option */ |
| 771 | #if defined _LIBC && defined USE_IN_LIBIO | 771 | #if defined _LIBC |
| 772 | n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"), | 772 | n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"), |
| 773 | argv[0], d->__nextchar); | 773 | argv[0], d->__nextchar); |
| 774 | #else | 774 | #else |
| @@ -779,7 +779,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 779 | else | 779 | else |
| 780 | { | 780 | { |
| 781 | /* +option or -option */ | 781 | /* +option or -option */ |
| 782 | #if defined _LIBC && defined USE_IN_LIBIO | 782 | #if defined _LIBC |
| 783 | n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"), | 783 | n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"), |
| 784 | argv[0], argv[d->optind][0], d->__nextchar); | 784 | argv[0], argv[d->optind][0], d->__nextchar); |
| 785 | #else | 785 | #else |
| @@ -788,7 +788,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 788 | #endif | 788 | #endif |
| 789 | } | 789 | } |
| 790 | 790 | ||
| 791 | #if defined _LIBC && defined USE_IN_LIBIO | 791 | #if defined _LIBC |
| 792 | if (n >= 0) | 792 | if (n >= 0) |
| 793 | { | 793 | { |
| 794 | _IO_flockfile (stderr); | 794 | _IO_flockfile (stderr); |
| @@ -826,19 +826,19 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 826 | { | 826 | { |
| 827 | if (print_errors) | 827 | if (print_errors) |
| 828 | { | 828 | { |
| 829 | #if defined _LIBC && defined USE_IN_LIBIO | 829 | #if defined _LIBC |
| 830 | char *buf; | 830 | char *buf; |
| 831 | int n; | 831 | int n; |
| 832 | #endif | 832 | #endif |
| 833 | 833 | ||
| 834 | #if defined _LIBC && defined USE_IN_LIBIO | 834 | #if defined _LIBC |
| 835 | n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"), | 835 | n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"), |
| 836 | argv[0], c); | 836 | argv[0], c); |
| 837 | #else | 837 | #else |
| 838 | fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c); | 838 | fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c); |
| 839 | #endif | 839 | #endif |
| 840 | 840 | ||
| 841 | #if defined _LIBC && defined USE_IN_LIBIO | 841 | #if defined _LIBC |
| 842 | if (n >= 0) | 842 | if (n >= 0) |
| 843 | { | 843 | { |
| 844 | _IO_flockfile (stderr); | 844 | _IO_flockfile (stderr); |
| @@ -884,7 +884,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 884 | { | 884 | { |
| 885 | if (print_errors) | 885 | if (print_errors) |
| 886 | { | 886 | { |
| 887 | #if defined _LIBC && defined USE_IN_LIBIO | 887 | #if defined _LIBC |
| 888 | char *buf; | 888 | char *buf; |
| 889 | 889 | ||
| 890 | if (__asprintf (&buf, | 890 | if (__asprintf (&buf, |
| @@ -958,7 +958,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 958 | { | 958 | { |
| 959 | if (print_errors) | 959 | if (print_errors) |
| 960 | { | 960 | { |
| 961 | #if defined _LIBC && defined USE_IN_LIBIO | 961 | #if defined _LIBC |
| 962 | char *buf; | 962 | char *buf; |
| 963 | 963 | ||
| 964 | if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"), | 964 | if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"), |
| @@ -998,7 +998,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 998 | { | 998 | { |
| 999 | if (print_errors) | 999 | if (print_errors) |
| 1000 | { | 1000 | { |
| 1001 | #if defined _LIBC && defined USE_IN_LIBIO | 1001 | #if defined _LIBC |
| 1002 | char *buf; | 1002 | char *buf; |
| 1003 | 1003 | ||
| 1004 | if (__asprintf (&buf, _("\ | 1004 | if (__asprintf (&buf, _("\ |
| @@ -1037,7 +1037,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 1037 | { | 1037 | { |
| 1038 | if (print_errors) | 1038 | if (print_errors) |
| 1039 | { | 1039 | { |
| 1040 | #if defined _LIBC && defined USE_IN_LIBIO | 1040 | #if defined _LIBC |
| 1041 | char *buf; | 1041 | char *buf; |
| 1042 | 1042 | ||
| 1043 | if (__asprintf (&buf, _("\ | 1043 | if (__asprintf (&buf, _("\ |
| @@ -1112,7 +1112,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | |||
| 1112 | { | 1112 | { |
| 1113 | if (print_errors) | 1113 | if (print_errors) |
| 1114 | { | 1114 | { |
| 1115 | #if defined _LIBC && defined USE_IN_LIBIO | 1115 | #if defined _LIBC |
| 1116 | char *buf; | 1116 | char *buf; |
| 1117 | 1117 | ||
| 1118 | if (__asprintf (&buf, _("\ | 1118 | if (__asprintf (&buf, _("\ |
diff --git a/lib/getopt.in.h b/lib/getopt.in.h index 6cbad8e0339..3f57c68a25e 100644 --- a/lib/getopt.in.h +++ b/lib/getopt.in.h | |||
| @@ -1,20 +1,20 @@ | |||
| 1 | /* Declarations for getopt. | 1 | /* Declarations for getopt. |
| 2 | Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2017 Free Software | 2 | Copyright (C) 1989-2017 Free Software Foundation, Inc. |
| 3 | Foundation, Inc. | ||
| 4 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
| 5 | 4 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 5 | The GNU C Library is free software; you can redistribute it and/or |
| 7 | it under the terms of the GNU General Public License as published by | 6 | modify it under the terms of the GNU General Public |
| 8 | the Free Software Foundation; either version 3 of the License, or | 7 | License as published by the Free Software Foundation; either |
| 9 | (at your option) any later version. | 8 | version 3 of the License, or (at your option) any later version. |
| 10 | 9 | ||
| 11 | This program is distributed in the hope that it will be useful, | 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | GNU General Public License for more details. | 13 | General Public License for more details. |
| 15 | 14 | ||
| 16 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public |
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 16 | License along with the GNU C Library; if not, see |
| 17 | <http://www.gnu.org/licenses/>. */ | ||
| 18 | 18 | ||
| 19 | #ifndef _@GUARD_PREFIX@_GETOPT_H | 19 | #ifndef _@GUARD_PREFIX@_GETOPT_H |
| 20 | 20 | ||
| @@ -238,6 +238,25 @@ struct option | |||
| 238 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) | 238 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) |
| 239 | __THROW _GL_ARG_NONNULL ((2, 3)); | 239 | __THROW _GL_ARG_NONNULL ((2, 3)); |
| 240 | 240 | ||
| 241 | #ifndef __GETOPT_PREFIX | ||
| 242 | # if defined __need_getopt && defined __USE_POSIX2 \ | ||
| 243 | && !defined __USE_POSIX_IMPLICITLY && !defined __USE_GNU | ||
| 244 | /* The GNU getopt has more functionality than the standard version. The | ||
| 245 | additional functionality can be disable at runtime. This redirection | ||
| 246 | helps to also do this at runtime. */ | ||
| 247 | # ifdef __REDIRECT | ||
| 248 | extern int __REDIRECT_NTH (getopt, (int ___argc, char *const *___argv, | ||
| 249 | const char *__shortopts), | ||
| 250 | __posix_getopt); | ||
| 251 | # else | ||
| 252 | extern int __posix_getopt (int ___argc, char *const *___argv, | ||
| 253 | const char *__shortopts) | ||
| 254 | __THROW _GL_ARG_NONNULL ((2, 3)); | ||
| 255 | # define getopt __posix_getopt | ||
| 256 | # endif | ||
| 257 | # endif | ||
| 258 | #endif | ||
| 259 | |||
| 241 | #ifndef __need_getopt | 260 | #ifndef __need_getopt |
| 242 | extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, | 261 | extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, |
| 243 | const char *__shortopts, | 262 | const char *__shortopts, |
diff --git a/lib/getopt1.c b/lib/getopt1.c index 4d2e8cbac33..166b1295333 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c | |||
| @@ -1,20 +1,20 @@ | |||
| 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. | 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. |
| 2 | Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2017 Free Software | 2 | Copyright (C) 1987-2017 Free Software Foundation, Inc. |
| 3 | Foundation, Inc. | ||
| 4 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
| 5 | 4 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 5 | The GNU C Library is free software; you can redistribute it and/or |
| 7 | it under the terms of the GNU General Public License as published by | 6 | modify it under the terms of the GNU General Public |
| 8 | the Free Software Foundation; either version 3 of the License, or | 7 | License as published by the Free Software Foundation; either |
| 9 | (at your option) any later version. | 8 | version 3 of the License, or (at your option) any later version. |
| 10 | 9 | ||
| 11 | This program is distributed in the hope that it will be useful, | 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | GNU General Public License for more details. | 13 | General Public License for more details. |
| 15 | 14 | ||
| 16 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public |
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 16 | License along with the GNU C Library; if not, see |
| 17 | <http://www.gnu.org/licenses/>. */ | ||
| 18 | 18 | ||
| 19 | #ifdef _LIBC | 19 | #ifdef _LIBC |
| 20 | # include <getopt.h> | 20 | # include <getopt.h> |
diff --git a/lib/getopt_int.h b/lib/getopt_int.h index a7ce0e9cc14..c614fcb65be 100644 --- a/lib/getopt_int.h +++ b/lib/getopt_int.h | |||
| @@ -1,20 +1,20 @@ | |||
| 1 | /* Internal declarations for getopt. | 1 | /* Internal declarations for getopt. |
| 2 | Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2017 Free Software | 2 | Copyright (C) 1989-2017 Free Software Foundation, Inc. |
| 3 | Foundation, Inc. | ||
| 4 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
| 5 | 4 | ||
| 6 | This program is free software: you can redistribute it and/or modify | 5 | The GNU C Library is free software; you can redistribute it and/or |
| 7 | it under the terms of the GNU General Public License as published by | 6 | modify it under the terms of the GNU General Public |
| 8 | the Free Software Foundation; either version 3 of the License, or | 7 | License as published by the Free Software Foundation; either |
| 9 | (at your option) any later version. | 8 | version 3 of the License, or (at your option) any later version. |
| 10 | 9 | ||
| 11 | This program is distributed in the hope that it will be useful, | 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | GNU General Public License for more details. | 13 | General Public License for more details. |
| 15 | 14 | ||
| 16 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public |
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 16 | License along with the GNU C Library; if not, see |
| 17 | <http://www.gnu.org/licenses/>. */ | ||
| 18 | 18 | ||
| 19 | #ifndef _GETOPT_INT_H | 19 | #ifndef _GETOPT_INT_H |
| 20 | #define _GETOPT_INT_H 1 | 20 | #define _GETOPT_INT_H 1 |
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 2c0b689e710..ca95ed7e825 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in | |||
| @@ -558,7 +558,6 @@ LIBS_GNUSTEP = @LIBS_GNUSTEP@ | |||
| 558 | LIBS_MAIL = @LIBS_MAIL@ | 558 | LIBS_MAIL = @LIBS_MAIL@ |
| 559 | LIBS_SYSTEM = @LIBS_SYSTEM@ | 559 | LIBS_SYSTEM = @LIBS_SYSTEM@ |
| 560 | LIBS_TERMCAP = @LIBS_TERMCAP@ | 560 | LIBS_TERMCAP = @LIBS_TERMCAP@ |
| 561 | LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@ | ||
| 562 | LIBTIFF = @LIBTIFF@ | 561 | LIBTIFF = @LIBTIFF@ |
| 563 | LIBXMENU = @LIBXMENU@ | 562 | LIBXMENU = @LIBXMENU@ |
| 564 | LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ | 563 | LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ |
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index cbe7718981e..185554ca63a 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -47,6 +47,9 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) | |||
| 47 | am__v_at_0 = @ | 47 | am__v_at_0 = @ |
| 48 | am__v_at_1 = | 48 | am__v_at_1 = |
| 49 | 49 | ||
| 50 | |||
| 51 | FIND_DELETE = @FIND_DELETE@ | ||
| 52 | |||
| 50 | # You can specify a different executable on the make command line, | 53 | # You can specify a different executable on the make command line, |
| 51 | # e.g. "make EMACS=../src/emacs ...". | 54 | # e.g. "make EMACS=../src/emacs ...". |
| 52 | 55 | ||
| @@ -343,7 +346,7 @@ compile: $(LOADDEFS) autoloads compile-first | |||
| 343 | # unconditionally. Some files don't actually get compiled because they | 346 | # unconditionally. Some files don't actually get compiled because they |
| 344 | # set the local variable no-byte-compile. | 347 | # set the local variable no-byte-compile. |
| 345 | compile-always: | 348 | compile-always: |
| 346 | cd $(lisp) && rm -f *.elc */*.elc */*/*.elc */*/*/*.elc | 349 | find $(lisp) -name '*.elc' $(FIND_DELETE) |
| 347 | $(MAKE) compile | 350 | $(MAKE) compile |
| 348 | 351 | ||
| 349 | .PHONY: backup-compiled-files compile-after-backup | 352 | .PHONY: backup-compiled-files compile-after-backup |
| @@ -433,7 +436,8 @@ $(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC) $(CAL_DIR)/diary-loaddefs.el | |||
| 433 | .PHONY: bootstrap-clean distclean maintainer-clean | 436 | .PHONY: bootstrap-clean distclean maintainer-clean |
| 434 | 437 | ||
| 435 | bootstrap-clean: | 438 | bootstrap-clean: |
| 436 | -cd $(lisp) && rm -f *.elc */*.elc */*/*.elc */*/*/*.elc $(AUTOGENEL) | 439 | find $(lisp) -name '*.elc' $(FIND_DELETE) |
| 440 | -cd $(lisp) && rm -f $(AUTOGENEL) | ||
| 437 | 441 | ||
| 438 | distclean: | 442 | distclean: |
| 439 | -rm -f ./Makefile $(lisp)/loaddefs.el~ | 443 | -rm -f ./Makefile $(lisp)/loaddefs.el~ |
diff --git a/lisp/cedet/semantic/wisent/wisent.el b/lisp/cedet/semantic/wisent/wisent.el index 36dff019792..08cad524aed 100644 --- a/lisp/cedet/semantic/wisent/wisent.el +++ b/lisp/cedet/semantic/wisent/wisent.el | |||
| @@ -114,7 +114,7 @@ If OBJ is a symbol check its value." | |||
| 114 | (and (vectorp obj) (= 4 (length obj)) | 114 | (and (vectorp obj) (= 4 (length obj)) |
| 115 | (vectorp (aref obj 0)) (vectorp (aref obj 1)) | 115 | (vectorp (aref obj 0)) (vectorp (aref obj 1)) |
| 116 | (= (length (aref obj 0)) (length (aref obj 1))) | 116 | (= (length (aref obj 0)) (length (aref obj 1))) |
| 117 | (listp (aref obj 2)) (vectorp (aref obj 3)))) | 117 | (listp (aref obj 2)) (obarrayp (aref obj 3)))) |
| 118 | 118 | ||
| 119 | (defsubst wisent-region (&rest positions) | 119 | (defsubst wisent-region (&rest positions) |
| 120 | "Return the start/end positions of the region including POSITIONS. | 120 | "Return the start/end positions of the region including POSITIONS. |
diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 6c8fb0e7dae..527685acf37 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el | |||
| @@ -332,46 +332,73 @@ See also the functions: | |||
| 332 | 332 | ||
| 333 | ;;; EXTENSION MARKING FUNCTIONS. | 333 | ;;; EXTENSION MARKING FUNCTIONS. |
| 334 | 334 | ||
| 335 | (defun dired--mark-suffix-interactive-spec () | ||
| 336 | (let* ((default | ||
| 337 | (let ((file (dired-get-filename nil t))) | ||
| 338 | (when file | ||
| 339 | (file-name-extension file)))) | ||
| 340 | (suffix | ||
| 341 | (read-string (format "%s extension%s: " | ||
| 342 | (if (equal current-prefix-arg '(4)) | ||
| 343 | "UNmarking" | ||
| 344 | "Marking") | ||
| 345 | (if default | ||
| 346 | (format " (default %s)" default) | ||
| 347 | "")) nil nil default)) | ||
| 348 | (marker | ||
| 349 | (pcase current-prefix-arg | ||
| 350 | ('(4) ?\s) | ||
| 351 | ('(16) | ||
| 352 | (let* ((dflt (char-to-string dired-marker-char)) | ||
| 353 | (input (read-string | ||
| 354 | (format | ||
| 355 | "Marker character to use (default %s): " dflt) | ||
| 356 | nil nil dflt))) | ||
| 357 | (aref input 0))) | ||
| 358 | (_ dired-marker-char)))) | ||
| 359 | (list suffix marker))) | ||
| 360 | |||
| 335 | ;; Mark files with some extension. | 361 | ;; Mark files with some extension. |
| 336 | (defun dired-mark-extension (extension &optional marker-char) | 362 | (defun dired-mark-extension (extension &optional marker-char) |
| 337 | "Mark all files with a certain EXTENSION for use in later commands. | 363 | "Mark all files with a certain EXTENSION for use in later commands. |
| 338 | A `.' is *not* automatically prepended to the string entered. | 364 | A `.' is automatically prepended to EXTENSION when not present. |
| 339 | EXTENSION may also be a list of extensions instead of a single one. | 365 | EXTENSION may also be a list of extensions instead of a single one. |
| 340 | Optional MARKER-CHAR is marker to use. | 366 | Optional MARKER-CHAR is marker to use. |
| 341 | Interactively, ask for EXTENSION. | 367 | Interactively, ask for EXTENSION. |
| 342 | Prefixed with one C-u, unmark files instead. | 368 | Prefixed with one C-u, unmark files instead. |
| 343 | Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it." | 369 | Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it." |
| 344 | (interactive | 370 | (interactive (dired--mark-suffix-interactive-spec)) |
| 345 | (let* ((default | 371 | (unless (listp extension) |
| 346 | (let ((file (dired-get-filename nil t))) | 372 | (setq extension (list extension))) |
| 347 | (when file | 373 | (dired-mark-files-regexp |
| 348 | (file-name-extension file)))) | 374 | (concat ".";; don't match names with nothing but an extension |
| 349 | (suffix | 375 | "\\(" |
| 350 | (read-string (format "%s extension%s: " | 376 | (mapconcat |
| 351 | (if (equal current-prefix-arg '(4)) | 377 | (lambda (x) |
| 352 | "UNmarking" | 378 | (regexp-quote |
| 353 | "Marking") | 379 | (if (string-prefix-p "." x) x (concat "." x)))) |
| 354 | (if default | 380 | extension "\\|") |
| 355 | (format " (default %s)" default) | 381 | "\\)$") |
| 356 | "")) nil nil default)) | 382 | marker-char)) |
| 357 | (marker | 383 | |
| 358 | (pcase current-prefix-arg | 384 | ;; Mark files ending with some suffix. |
| 359 | ('(4) ?\s) | 385 | (defun dired-mark-suffix (suffix &optional marker-char) |
| 360 | ('(16) | 386 | "Mark all files with a certain SUFFIX for use in later commands. |
| 361 | (let* ((dflt (char-to-string dired-marker-char)) | 387 | A `.' is *not* automatically prepended to the string entered; see |
| 362 | (input (read-string | 388 | also `dired-mark-extension', which is similar but automatically |
| 363 | (format | 389 | prepends `.' when not present. |
| 364 | "Marker character to use (default %s): " dflt) | 390 | SUFFIX may also be a list of suffixes instead of a single one. |
| 365 | nil nil dflt))) | 391 | Optional MARKER-CHAR is marker to use. |
| 366 | (aref input 0))) | 392 | Interactively, ask for SUFFIX. |
| 367 | (_ dired-marker-char)))) | 393 | Prefixed with one C-u, unmark files instead. |
| 368 | (list suffix marker))) | 394 | Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it." |
| 369 | (or (listp extension) | 395 | (interactive (dired--mark-suffix-interactive-spec)) |
| 370 | (setq extension (list extension))) | 396 | (unless (listp suffix) |
| 397 | (setq suffix (list suffix))) | ||
| 371 | (dired-mark-files-regexp | 398 | (dired-mark-files-regexp |
| 372 | (concat ".";; don't match names with nothing but an extension | 399 | (concat ".";; don't match names with nothing but an extension |
| 373 | "\\(" | 400 | "\\(" |
| 374 | (mapconcat 'regexp-quote extension "\\|") | 401 | (mapconcat 'regexp-quote suffix "\\|") |
| 375 | "\\)$") | 402 | "\\)$") |
| 376 | marker-char)) | 403 | marker-char)) |
| 377 | 404 | ||
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index f45ae359f6c..2c2996ebab4 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -443,7 +443,7 @@ Return the compile-time value of FORM." | |||
| 443 | ;; Macroexpand (not macroexpand-all!) form at toplevel in case it | 443 | ;; Macroexpand (not macroexpand-all!) form at toplevel in case it |
| 444 | ;; expands into a toplevel-equivalent `progn'. See CLHS section | 444 | ;; expands into a toplevel-equivalent `progn'. See CLHS section |
| 445 | ;; 3.2.3.1, "Processing of Top Level Forms". The semantics are very | 445 | ;; 3.2.3.1, "Processing of Top Level Forms". The semantics are very |
| 446 | ;; subtle: see test/automated/bytecomp-tests.el for interesting | 446 | ;; subtle: see test/lisp/emacs-lisp/bytecomp-tests.el for interesting |
| 447 | ;; cases. | 447 | ;; cases. |
| 448 | (setf form (macroexp-macroexpand form byte-compile-macro-environment)) | 448 | (setf form (macroexp-macroexpand form byte-compile-macro-environment)) |
| 449 | (if (eq (car-safe form) 'progn) | 449 | (if (eq (car-safe form) 'progn) |
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 60133055623..4116e31d0a9 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el | |||
| @@ -733,9 +733,9 @@ Maybe clear the markers and delete the symbol's edebug property?" | |||
| 733 | ((eq class 'string) (read (current-buffer))) | 733 | ((eq class 'string) (read (current-buffer))) |
| 734 | ((eq class 'quote) (forward-char 1) | 734 | ((eq class 'quote) (forward-char 1) |
| 735 | (list 'quote (edebug-read-sexp))) | 735 | (list 'quote (edebug-read-sexp))) |
| 736 | ((eq class 'backquote) | 736 | ((eq class 'backquote) (forward-char 1) |
| 737 | (list '\` (edebug-read-sexp))) | 737 | (list '\` (edebug-read-sexp))) |
| 738 | ((eq class 'comma) | 738 | ((eq class 'comma) (forward-char 1) |
| 739 | (list '\, (edebug-read-sexp))) | 739 | (list '\, (edebug-read-sexp))) |
| 740 | (t ; anything else, just read it. | 740 | (t ; anything else, just read it. |
| 741 | (read (current-buffer)))))) | 741 | (read (current-buffer)))))) |
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index cadd66ca6ed..e7387e463cb 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el | |||
| @@ -1236,7 +1236,7 @@ SELECTOR is the selector that was used to select TESTS." | |||
| 1236 | (funcall listener 'test-ended stats test result)) | 1236 | (funcall listener 'test-ended stats test result)) |
| 1237 | (setf (ert--stats-current-test stats) nil)))) | 1237 | (setf (ert--stats-current-test stats) nil)))) |
| 1238 | 1238 | ||
| 1239 | (defun ert-run-tests (selector listener) | 1239 | (defun ert-run-tests (selector listener &optional interactively) |
| 1240 | "Run the tests specified by SELECTOR, sending progress updates to LISTENER." | 1240 | "Run the tests specified by SELECTOR, sending progress updates to LISTENER." |
| 1241 | (let* ((tests (ert-select-tests selector t)) | 1241 | (let* ((tests (ert-select-tests selector t)) |
| 1242 | (stats (ert--make-stats tests selector))) | 1242 | (stats (ert--make-stats tests selector))) |
| @@ -1247,10 +1247,14 @@ SELECTOR is the selector that was used to select TESTS." | |||
| 1247 | (let ((ert--current-run-stats stats)) | 1247 | (let ((ert--current-run-stats stats)) |
| 1248 | (force-mode-line-update) | 1248 | (force-mode-line-update) |
| 1249 | (unwind-protect | 1249 | (unwind-protect |
| 1250 | (progn | 1250 | (cl-loop for test in tests do |
| 1251 | (cl-loop for test in tests do | 1251 | (ert-run-or-rerun-test stats test listener) |
| 1252 | (ert-run-or-rerun-test stats test listener)) | 1252 | (when (and interactively |
| 1253 | (setq abortedp nil)) | 1253 | (ert-test-quit-p |
| 1254 | (ert-test-most-recent-result test)) | ||
| 1255 | (y-or-n-p "Abort testing? ")) | ||
| 1256 | (cl-return)) | ||
| 1257 | finally (setq abortedp nil)) | ||
| 1254 | (setf (ert--stats-aborted-p stats) abortedp) | 1258 | (setf (ert--stats-aborted-p stats) abortedp) |
| 1255 | (setf (ert--stats-end-time stats) (current-time)) | 1259 | (setf (ert--stats-end-time stats) (current-time)) |
| 1256 | (funcall listener 'run-ended stats abortedp))) | 1260 | (funcall listener 'run-ended stats abortedp))) |
| @@ -1442,7 +1446,8 @@ Returns the stats object." | |||
| 1442 | (ert-test-result-expected-p | 1446 | (ert-test-result-expected-p |
| 1443 | test result)) | 1447 | test result)) |
| 1444 | (1+ (ert--stats-test-pos stats test)) | 1448 | (1+ (ert--stats-test-pos stats test)) |
| 1445 | (ert-test-name test))))))))) | 1449 | (ert-test-name test))))))) |
| 1450 | nil)) | ||
| 1446 | 1451 | ||
| 1447 | ;;;###autoload | 1452 | ;;;###autoload |
| 1448 | (defun ert-run-tests-batch-and-exit (&optional selector) | 1453 | (defun ert-run-tests-batch-and-exit (&optional selector) |
| @@ -2033,9 +2038,8 @@ and how to display message." | |||
| 2033 | test result))) | 2038 | test result))) |
| 2034 | (ert--results-update-stats-display-maybe ewoc stats) | 2039 | (ert--results-update-stats-display-maybe ewoc stats) |
| 2035 | (ewoc-invalidate ewoc node)))))))) | 2040 | (ewoc-invalidate ewoc node)))))))) |
| 2036 | (ert-run-tests | 2041 | (ert-run-tests selector listener t))) |
| 2037 | selector | 2042 | |
| 2038 | listener))) | ||
| 2039 | ;;;###autoload | 2043 | ;;;###autoload |
| 2040 | (defalias 'ert 'ert-run-tests-interactively) | 2044 | (defalias 'ert 'ert-run-tests-interactively) |
| 2041 | 2045 | ||
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index eb07c18b03d..b7a5eb774da 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -259,6 +259,24 @@ This will generate compile-time constants from BINDINGS." | |||
| 259 | (funcall loop bindings))))))) | 259 | (funcall loop bindings))))))) |
| 260 | (funcall loop bindings))) | 260 | (funcall loop bindings))) |
| 261 | 261 | ||
| 262 | (defun elisp--font-lock-backslash () | ||
| 263 | (let* ((beg0 (match-beginning 0)) | ||
| 264 | (end0 (match-end 0)) | ||
| 265 | (ppss (save-excursion (syntax-ppss beg0)))) | ||
| 266 | (and (nth 3 ppss) ;Inside a string. | ||
| 267 | (not (nth 5 ppss)) ;The \ is not itself \-escaped. | ||
| 268 | ;; Don't highlight the \( introduced because of | ||
| 269 | ;; `open-paren-in-column-0-is-defun-start'. | ||
| 270 | (not (eq ?\n (char-before beg0))) | ||
| 271 | (equal (ignore-errors | ||
| 272 | (car (read-from-string | ||
| 273 | (format "\"%s\"" | ||
| 274 | (buffer-substring-no-properties | ||
| 275 | beg0 end0))))) | ||
| 276 | (buffer-substring-no-properties (1+ beg0) end0)) | ||
| 277 | `(face ,font-lock-warning-face | ||
| 278 | help-echo "This \\ has no effect")))) | ||
| 279 | |||
| 262 | (let-when-compile | 280 | (let-when-compile |
| 263 | ((lisp-fdefs '("defmacro" "defun")) | 281 | ((lisp-fdefs '("defmacro" "defun")) |
| 264 | (lisp-vdefs '("defvar")) | 282 | (lisp-vdefs '("defvar")) |
| @@ -413,17 +431,7 @@ This will generate compile-time constants from BINDINGS." | |||
| 413 | (1 font-lock-constant-face prepend)) | 431 | (1 font-lock-constant-face prepend)) |
| 414 | ;; Ineffective backslashes (typically in need of doubling). | 432 | ;; Ineffective backslashes (typically in need of doubling). |
| 415 | ("\\(\\\\\\)\\([^\"\\]\\)" | 433 | ("\\(\\\\\\)\\([^\"\\]\\)" |
| 416 | (1 (let ((ppss (save-excursion (syntax-ppss (match-beginning 0))))) | 434 | (1 (elisp--font-lock-backslash) prepend)) |
| 417 | (and (nth 3 ppss) ;Inside a string. | ||
| 418 | (not (nth 5 ppss)) ;The \ is not itself \-escaped. | ||
| 419 | (equal (ignore-errors | ||
| 420 | (car (read-from-string | ||
| 421 | (format "\"%s\"" | ||
| 422 | (match-string-no-properties 0))))) | ||
| 423 | (match-string-no-properties 2)) | ||
| 424 | `(face ,font-lock-warning-face | ||
| 425 | help-echo "This \\ has no effect"))) | ||
| 426 | prepend)) | ||
| 427 | ;; Words inside ‘’ and `' tend to be symbol names. | 435 | ;; Words inside ‘’ and `' tend to be symbol names. |
| 428 | (,(concat "[`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)" | 436 | (,(concat "[`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)" |
| 429 | lisp-mode-symbol-regexp "\\)['’]") | 437 | lisp-mode-symbol-regexp "\\)['’]") |
| @@ -1083,7 +1091,8 @@ ENDPOS is encountered." | |||
| 1083 | (init-depth (car state)) | 1091 | (init-depth (car state)) |
| 1084 | (next-depth init-depth) | 1092 | (next-depth init-depth) |
| 1085 | (last-depth init-depth) | 1093 | (last-depth init-depth) |
| 1086 | (last-syntax-point (point))) | 1094 | (last-syntax-point (point)) |
| 1095 | (real-endpos endpos)) | ||
| 1087 | (unless endpos | 1096 | (unless endpos |
| 1088 | ;; Get error now if we don't have a complete sexp after point. | 1097 | ;; Get error now if we don't have a complete sexp after point. |
| 1089 | (save-excursion (forward-sexp 1) | 1098 | (save-excursion (forward-sexp 1) |
| @@ -1116,6 +1125,8 @@ ENDPOS is encountered." | |||
| 1116 | last-depth (- last-depth next-depth) | 1125 | last-depth (- last-depth next-depth) |
| 1117 | next-depth init-depth)) | 1126 | next-depth init-depth)) |
| 1118 | (forward-line 1) | 1127 | (forward-line 1) |
| 1128 | (when (and (not real-endpos) (<= next-depth init-depth)) | ||
| 1129 | (goto-char endpos)) | ||
| 1119 | (when (< (point) endpos) | 1130 | (when (< (point) endpos) |
| 1120 | (let ((depth-delta (- next-depth last-depth))) | 1131 | (let ((depth-delta (- next-depth last-depth))) |
| 1121 | (cond ((< depth-delta 0) | 1132 | (cond ((< depth-delta 0) |
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 289265abf27..fc5474ecc43 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el | |||
| @@ -175,8 +175,8 @@ Emacs Lisp manual for more information and examples." | |||
| 175 | ;; (when (gethash (car cases) pcase--memoize-2) | 175 | ;; (when (gethash (car cases) pcase--memoize-2) |
| 176 | ;; (message "pcase-memoize failed because of eq test on %S" | 176 | ;; (message "pcase-memoize failed because of eq test on %S" |
| 177 | ;; (car cases))) | 177 | ;; (car cases))) |
| 178 | (when data | 178 | ;; (when data |
| 179 | (message "pcase-memoize: equal first branch, yet different")) | 179 | ;; (message "pcase-memoize: equal first branch, yet different")) |
| 180 | (let ((expansion (pcase--expand exp cases))) | 180 | (let ((expansion (pcase--expand exp cases))) |
| 181 | (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize) | 181 | (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize) |
| 182 | ;; (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize-1) | 182 | ;; (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize-1) |
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 41187646624..10de2484798 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el | |||
| @@ -52,7 +52,7 @@ | |||
| 52 | ;; - `seq-copy' | 52 | ;; - `seq-copy' |
| 53 | ;; - `seq-into' | 53 | ;; - `seq-into' |
| 54 | ;; | 54 | ;; |
| 55 | ;; All functions are tested in test/automated/seq-tests.el | 55 | ;; All functions are tested in test/lisp/emacs-lisp/seq-tests.el |
| 56 | 56 | ||
| 57 | ;;; Code: | 57 | ;;; Code: |
| 58 | 58 | ||
diff --git a/lisp/emacs-lisp/thunk.el b/lisp/emacs-lisp/thunk.el index be0a90fefde..f4c075d22ce 100644 --- a/lisp/emacs-lisp/thunk.el +++ b/lisp/emacs-lisp/thunk.el | |||
| @@ -42,8 +42,6 @@ | |||
| 42 | ;; | 42 | ;; |
| 43 | ;; (thunk-force delayed) | 43 | ;; (thunk-force delayed) |
| 44 | 44 | ||
| 45 | ;; Tests are located at test/automated/thunk-tests.el | ||
| 46 | |||
| 47 | ;;; Code: | 45 | ;;; Code: |
| 48 | 46 | ||
| 49 | (defmacro thunk-delay (&rest body) | 47 | (defmacro thunk-delay (&rest body) |
diff --git a/lisp/ffap.el b/lisp/ffap.el index d7222bfb681..1ea32b75f12 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el | |||
| @@ -1110,32 +1110,67 @@ The arguments CHARS, BEG and END are handled as described in | |||
| 1110 | 1110 | ||
| 1111 | (defun ffap-string-at-point (&optional mode) | 1111 | (defun ffap-string-at-point (&optional mode) |
| 1112 | "Return a string of characters from around point. | 1112 | "Return a string of characters from around point. |
| 1113 | |||
| 1113 | MODE (defaults to value of `major-mode') is a symbol used to look up | 1114 | MODE (defaults to value of `major-mode') is a symbol used to look up |
| 1114 | string syntax parameters in `ffap-string-at-point-mode-alist'. | 1115 | string syntax parameters in `ffap-string-at-point-mode-alist'. |
| 1116 | |||
| 1115 | If MODE is not found, we use `file' instead of MODE. | 1117 | If MODE is not found, we use `file' instead of MODE. |
| 1118 | |||
| 1116 | If the region is active, return a string from the region. | 1119 | If the region is active, return a string from the region. |
| 1117 | Set the variable `ffap-string-at-point' and the variable | 1120 | |
| 1121 | If the point is in a comment, ensure that the returned string does not | ||
| 1122 | contain the comment start characters (especially for major modes that | ||
| 1123 | have '//' as comment start characters). | ||
| 1124 | |||
| 1125 | Set the variables `ffap-string-at-point' and | ||
| 1118 | `ffap-string-at-point-region'. | 1126 | `ffap-string-at-point-region'. |
| 1127 | |||
| 1119 | When the region is active and larger than `ffap-max-region-length', | 1128 | When the region is active and larger than `ffap-max-region-length', |
| 1120 | return an empty string, and set `ffap-string-at-point-region' to '(1 1)." | 1129 | return an empty string, and set `ffap-string-at-point-region' to '(1 1)." |
| 1121 | (let* ((args | 1130 | (let* ((args |
| 1122 | (cdr | 1131 | (cdr |
| 1123 | (or (assq (or mode major-mode) ffap-string-at-point-mode-alist) | 1132 | (or (assq (or mode major-mode) ffap-string-at-point-mode-alist) |
| 1124 | (assq 'file ffap-string-at-point-mode-alist)))) | 1133 | (assq 'file ffap-string-at-point-mode-alist)))) |
| 1134 | (region-selected (use-region-p)) | ||
| 1125 | (pt (point)) | 1135 | (pt (point)) |
| 1126 | (beg (if (use-region-p) | 1136 | (beg (if region-selected |
| 1127 | (region-beginning) | 1137 | (region-beginning) |
| 1128 | (save-excursion | 1138 | (save-excursion |
| 1129 | (skip-chars-backward (car args)) | 1139 | (skip-chars-backward (car args)) |
| 1130 | (skip-chars-forward (nth 1 args) pt) | 1140 | (skip-chars-forward (nth 1 args) pt) |
| 1131 | (point)))) | 1141 | (point)))) |
| 1132 | (end (if (use-region-p) | 1142 | (end (if region-selected |
| 1133 | (region-end) | 1143 | (region-end) |
| 1134 | (save-excursion | 1144 | (save-excursion |
| 1135 | (skip-chars-forward (car args)) | 1145 | (skip-chars-forward (car args)) |
| 1136 | (skip-chars-backward (nth 2 args) pt) | 1146 | (skip-chars-backward (nth 2 args) pt) |
| 1137 | (point)))) | 1147 | (point)))) |
| 1138 | (region-len (- (max beg end) (min beg end)))) | 1148 | (region-len (- (max beg end) (min beg end)))) |
| 1149 | |||
| 1150 | ;; If the initial characters of the to-be-returned string are the | ||
| 1151 | ;; current major mode's comment starter characters, *and* are | ||
| 1152 | ;; not part of a comment, remove those from the returned string | ||
| 1153 | ;; (Bug#24057). | ||
| 1154 | ;; Example comments in `c-mode' (which considers lines beginning | ||
| 1155 | ;; with "//" as comments): | ||
| 1156 | ;; //tmp - This is a comment. It does not contain any path reference. | ||
| 1157 | ;; ///tmp - This is a comment. The "/tmp" portion in that is a path. | ||
| 1158 | ;; ////tmp - This is a comment. The "//tmp" portion in that is a path. | ||
| 1159 | (when (and | ||
| 1160 | ;; Proceed if no region is selected by the user. | ||
| 1161 | (null region-selected) | ||
| 1162 | ;; Check if END character is part of a comment. | ||
| 1163 | (save-excursion | ||
| 1164 | (nth 4 (syntax-ppss end)))) | ||
| 1165 | ;; Move BEG to beginning of comment (after the comment start | ||
| 1166 | ;; characters), or END, whichever comes first. | ||
| 1167 | (save-excursion | ||
| 1168 | (let ((state (syntax-ppss beg))) | ||
| 1169 | ;; (nth 4 (syntax-ppss)) will be nil for comment start chars. | ||
| 1170 | (unless (nth 4 state) | ||
| 1171 | (parse-partial-sexp beg end nil nil state :commentstop) | ||
| 1172 | (setq beg (point)))))) | ||
| 1173 | |||
| 1139 | (if (and (natnump ffap-max-region-length) | 1174 | (if (and (natnump ffap-max-region-length) |
| 1140 | (< region-len ffap-max-region-length)) ; Bug#25243. | 1175 | (< region-len ffap-max-region-length)) ; Bug#25243. |
| 1141 | (setf ffap-string-at-point-region (list beg end) | 1176 | (setf ffap-string-at-point-region (list beg end) |
diff --git a/lisp/filenotify.el b/lisp/filenotify.el index 7eb6229976a..8bbe348f332 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | (require 'cl-lib) | 30 | (require 'cl-lib) |
| 31 | (require 'subr-x) | ||
| 31 | 32 | ||
| 32 | (defconst file-notify--library | 33 | (defconst file-notify--library |
| 33 | (cond | 34 | (cond |
| @@ -40,41 +41,43 @@ The value is the name of the low-level file notification package | |||
| 40 | to be used for local file systems. Remote file notifications | 41 | to be used for local file systems. Remote file notifications |
| 41 | could use another implementation.") | 42 | could use another implementation.") |
| 42 | 43 | ||
| 44 | (cl-defstruct (file-notify--watch | ||
| 45 | (:constructor nil) | ||
| 46 | (:constructor | ||
| 47 | file-notify--watch-make (directory filename callback))) | ||
| 48 | ;; Watched directory | ||
| 49 | directory | ||
| 50 | ;; Watched relative filename, nil if watching the directory. | ||
| 51 | filename | ||
| 52 | ;; Function to propagate events to | ||
| 53 | callback) | ||
| 54 | |||
| 55 | (defun file-notify--watch-absolute-filename (watch) | ||
| 56 | "Return the absolute filename observed by WATCH." | ||
| 57 | (if (file-notify--watch-filename watch) | ||
| 58 | (expand-file-name | ||
| 59 | (file-notify--watch-filename watch) | ||
| 60 | (file-notify--watch-directory watch)) | ||
| 61 | (file-notify--watch-directory watch))) | ||
| 62 | |||
| 43 | (defvar file-notify-descriptors (make-hash-table :test 'equal) | 63 | (defvar file-notify-descriptors (make-hash-table :test 'equal) |
| 44 | "Hash table for registered file notification descriptors. | 64 | "Hash table for registered file notification descriptors. |
| 45 | A key in this hash table is the descriptor as returned from | 65 | A key in this hash table is the descriptor as returned from |
| 46 | `inotify', `kqueue', `gfilenotify', `w32notify' or a file name | 66 | `inotify', `kqueue', `gfilenotify', `w32notify' or a file name |
| 47 | handler. The value in the hash table is a list | 67 | handler. The value in the hash table is `file-notify--watch' |
| 48 | 68 | struct.") | |
| 49 | (DIR (FILE . CALLBACK) (FILE . CALLBACK) ...) | ||
| 50 | |||
| 51 | Several values for a given DIR happen only for `inotify', when | ||
| 52 | different files from the same directory are watched.") | ||
| 53 | 69 | ||
| 54 | (defun file-notify--rm-descriptor (descriptor) | 70 | (defun file-notify--rm-descriptor (descriptor) |
| 55 | "Remove DESCRIPTOR from `file-notify-descriptors'. | 71 | "Remove DESCRIPTOR from `file-notify-descriptors'. |
| 56 | DESCRIPTOR should be an object returned by `file-notify-add-watch'. | 72 | DESCRIPTOR should be an object returned by `file-notify-add-watch'. |
| 57 | If it is registered in `file-notify-descriptors', a stopped event is sent." | 73 | If it is registered in `file-notify-descriptors', a stopped event is sent." |
| 58 | (let* ((desc (if (consp descriptor) (car descriptor) descriptor)) | 74 | (when-let (watch (gethash descriptor file-notify-descriptors)) |
| 59 | (registered (gethash desc file-notify-descriptors)) | 75 | ;; Send `stopped' event. |
| 60 | (file (if (consp descriptor) (cdr descriptor) (cl-caadr registered))) | 76 | (unwind-protect |
| 61 | (dir (car registered))) | ||
| 62 | |||
| 63 | (when (consp registered) | ||
| 64 | ;; Send `stopped' event. | ||
| 65 | (when (consp (assoc file (cdr registered))) | ||
| 66 | (funcall | 77 | (funcall |
| 67 | (cdr (assoc file (cdr registered))) | 78 | (file-notify--watch-callback watch) |
| 68 | `(,descriptor stopped ,(if file (expand-file-name file dir) dir)))) | 79 | `(,descriptor stopped ,(file-notify--watch-absolute-filename watch))) |
| 69 | 80 | (remhash descriptor file-notify-descriptors)))) | |
| 70 | ;; Modify `file-notify-descriptors'. | ||
| 71 | (if (not file) | ||
| 72 | (remhash desc file-notify-descriptors) | ||
| 73 | (setcdr registered | ||
| 74 | (delete (assoc file (cdr registered)) (cdr registered))) | ||
| 75 | (if (null (cdr registered)) | ||
| 76 | (remhash desc file-notify-descriptors) | ||
| 77 | (puthash desc registered file-notify-descriptors)))))) | ||
| 78 | 81 | ||
| 79 | ;; This function is used by `inotify', `kqueue', `gfilenotify' and | 82 | ;; This function is used by `inotify', `kqueue', `gfilenotify' and |
| 80 | ;; `w32notify' events. | 83 | ;; `w32notify' events. |
| @@ -88,7 +91,8 @@ If EVENT is a filewatch event, call its callback. It has the format | |||
| 88 | Otherwise, signal a `file-notify-error'." | 91 | Otherwise, signal a `file-notify-error'." |
| 89 | (interactive "e") | 92 | (interactive "e") |
| 90 | ;;(message "file-notify-handle-event %S" event) | 93 | ;;(message "file-notify-handle-event %S" event) |
| 91 | (if (and (eq (car event) 'file-notify) | 94 | (if (and (consp event) |
| 95 | (eq (car event) 'file-notify) | ||
| 92 | (>= (length event) 3)) | 96 | (>= (length event) 3)) |
| 93 | (funcall (nth 2 event) (nth 1 event)) | 97 | (funcall (nth 2 event) (nth 1 event)) |
| 94 | (signal 'file-notify-error | 98 | (signal 'file-notify-error |
| @@ -96,33 +100,32 @@ Otherwise, signal a `file-notify-error'." | |||
| 96 | 100 | ||
| 97 | ;; Needed for `inotify' and `w32notify'. In the latter case, COOKIE is nil. | 101 | ;; Needed for `inotify' and `w32notify'. In the latter case, COOKIE is nil. |
| 98 | (defvar file-notify--pending-event nil | 102 | (defvar file-notify--pending-event nil |
| 99 | "A pending file notification events for a future `renamed' action. | 103 | "A pending file notification event for a future `renamed' action. |
| 100 | It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).") | 104 | It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).") |
| 101 | 105 | ||
| 102 | (defun file-notify--event-watched-file (event) | 106 | (defun file-notify--event-watched-file (event) |
| 103 | "Return file or directory being watched. | 107 | "Return file or directory being watched. |
| 104 | Could be different from the directory watched by the backend library." | 108 | Could be different from the directory watched by the backend library." |
| 105 | (let* ((desc (if (consp (car event)) (caar event) (car event))) | 109 | (when-let (watch (gethash (car event) file-notify-descriptors)) |
| 106 | (registered (gethash desc file-notify-descriptors)) | 110 | (file-notify--watch-absolute-filename watch))) |
| 107 | (file (if (consp (car event)) (cdar event) (cl-caadr registered))) | ||
| 108 | (dir (car registered))) | ||
| 109 | (if file (expand-file-name file dir) dir))) | ||
| 110 | 111 | ||
| 111 | (defun file-notify--event-file-name (event) | 112 | (defun file-notify--event-file-name (event) |
| 112 | "Return file name of file notification event, or nil." | 113 | "Return file name of file notification event, or nil." |
| 113 | (directory-file-name | 114 | (when-let (watch (gethash (car event) file-notify-descriptors)) |
| 114 | (expand-file-name | 115 | (directory-file-name |
| 115 | (or (and (stringp (nth 2 event)) (nth 2 event)) "") | 116 | (expand-file-name |
| 116 | (car (gethash (car event) file-notify-descriptors))))) | 117 | (or (and (stringp (nth 2 event)) (nth 2 event)) "") |
| 118 | (file-notify--watch-directory watch))))) | ||
| 117 | 119 | ||
| 118 | ;; Only `gfilenotify' could return two file names. | 120 | ;; Only `gfilenotify' could return two file names. |
| 119 | (defun file-notify--event-file1-name (event) | 121 | (defun file-notify--event-file1-name (event) |
| 120 | "Return second file name of file notification event, or nil. | 122 | "Return second file name of file notification event, or nil. |
| 121 | This is available in case a file has been moved." | 123 | This is available in case a file has been moved." |
| 122 | (and (stringp (nth 3 event)) | 124 | (when-let (watch (gethash (car event) file-notify-descriptors)) |
| 123 | (directory-file-name | 125 | (and (stringp (nth 3 event)) |
| 124 | (expand-file-name | 126 | (directory-file-name |
| 125 | (nth 3 event) (car (gethash (car event) file-notify-descriptors)))))) | 127 | (expand-file-name |
| 128 | (nth 3 event) (file-notify--watch-directory watch)))))) | ||
| 126 | 129 | ||
| 127 | ;; Cookies are offered by `inotify' only. | 130 | ;; Cookies are offered by `inotify' only. |
| 128 | (defun file-notify--event-cookie (event) | 131 | (defun file-notify--event-cookie (event) |
| @@ -130,21 +133,6 @@ This is available in case a file has been moved." | |||
| 130 | This is available in case a file has been moved." | 133 | This is available in case a file has been moved." |
| 131 | (nth 3 event)) | 134 | (nth 3 event)) |
| 132 | 135 | ||
| 133 | ;; `inotify' returns the same descriptor when the file (directory) | ||
| 134 | ;; uses the same inode. We want to distinguish, and apply a virtual | ||
| 135 | ;; descriptor which make the difference. | ||
| 136 | (defun file-notify--descriptor (desc file) | ||
| 137 | "Return the descriptor to be used in `file-notify-*-watch'. | ||
| 138 | For `gfilenotify' and `w32notify' it is the same descriptor as | ||
| 139 | used in the low-level file notification package." | ||
| 140 | (if (and (natnump desc) (eq file-notify--library 'inotify)) | ||
| 141 | (cons desc | ||
| 142 | (and (stringp file) | ||
| 143 | (car (assoc | ||
| 144 | (file-name-nondirectory file) | ||
| 145 | (gethash desc file-notify-descriptors))))) | ||
| 146 | desc)) | ||
| 147 | |||
| 148 | ;; The callback function used to map between specific flags of the | 136 | ;; The callback function used to map between specific flags of the |
| 149 | ;; respective file notifications, and the ones we return. | 137 | ;; respective file notifications, and the ones we return. |
| 150 | (defun file-notify-callback (event) | 138 | (defun file-notify-callback (event) |
| @@ -152,138 +140,123 @@ used in the low-level file notification package." | |||
| 152 | EVENT is the cadr of the event in `file-notify-handle-event' | 140 | EVENT is the cadr of the event in `file-notify-handle-event' |
| 153 | \(DESCRIPTOR ACTIONS FILE [FILE1-OR-COOKIE])." | 141 | \(DESCRIPTOR ACTIONS FILE [FILE1-OR-COOKIE])." |
| 154 | (let* ((desc (car event)) | 142 | (let* ((desc (car event)) |
| 155 | (registered (gethash desc file-notify-descriptors)) | 143 | (watch (gethash desc file-notify-descriptors)) |
| 156 | (actions (nth 1 event)) | 144 | (actions (nth 1 event)) |
| 157 | (file (file-notify--event-file-name event)) | 145 | (file (file-notify--event-file-name event)) |
| 158 | file1 callback pending-event stopped) | 146 | file1 pending-event stopped) |
| 159 | 147 | ||
| 160 | ;; Make actions a list. | 148 | ;; Make actions a list. |
| 161 | (unless (consp actions) (setq actions (cons actions nil))) | 149 | (unless (consp actions) (setq actions (cons actions nil))) |
| 162 | 150 | ||
| 163 | ;; Loop over registered entries. In fact, more than one entry | 151 | (when watch |
| 164 | ;; happens only for `inotify'. | ||
| 165 | (dolist (entry (cdr registered)) | ||
| 166 | |||
| 167 | ;; Check, that event is meant for us. | ||
| 168 | (unless (setq callback (cdr entry)) | ||
| 169 | (setq actions nil)) | ||
| 170 | |||
| 171 | ;; Loop over actions. In fact, more than one action happens only | 152 | ;; Loop over actions. In fact, more than one action happens only |
| 172 | ;; for `inotify' and `kqueue'. | 153 | ;; for `inotify' and `kqueue'. |
| 173 | (dolist (action actions) | 154 | (while actions |
| 174 | 155 | (let ((action (pop actions))) | |
| 175 | ;; Send pending event, if it doesn't match. | 156 | ;; Send pending event, if it doesn't match. |
| 176 | (when (and file-notify--pending-event | 157 | (when (and file-notify--pending-event |
| 177 | ;; The cookie doesn't match. | 158 | ;; The cookie doesn't match. |
| 178 | (not (eq (file-notify--event-cookie | 159 | (not (equal (file-notify--event-cookie |
| 179 | (car file-notify--pending-event)) | 160 | (car file-notify--pending-event)) |
| 180 | (file-notify--event-cookie event))) | 161 | (file-notify--event-cookie event))) |
| 181 | (or | 162 | (or |
| 182 | ;; inotify. | 163 | ;; inotify. |
| 183 | (and (eq (nth 1 (car file-notify--pending-event)) | 164 | (and (eq (nth 1 (car file-notify--pending-event)) |
| 184 | 'moved-from) | 165 | 'moved-from) |
| 185 | (not (eq action 'moved-to))) | 166 | (not (eq action 'moved-to))) |
| 186 | ;; w32notify. | 167 | ;; w32notify. |
| 187 | (and (eq (nth 1 (car file-notify--pending-event)) | 168 | (and (eq (nth 1 (car file-notify--pending-event)) |
| 188 | 'renamed-from) | 169 | 'renamed-from) |
| 189 | (not (eq action 'renamed-to))))) | 170 | (not (eq action 'renamed-to))))) |
| 190 | (setq pending-event file-notify--pending-event | 171 | (setq pending-event file-notify--pending-event |
| 191 | file-notify--pending-event nil) | 172 | file-notify--pending-event nil) |
| 192 | (setcar (cdar pending-event) 'deleted)) | 173 | (setcar (cdar pending-event) 'deleted)) |
| 193 | 174 | ||
| 194 | ;; Map action. We ignore all events which cannot be mapped. | 175 | ;; Map action. We ignore all events which cannot be mapped. |
| 195 | (setq action | 176 | (setq action |
| 196 | (cond | 177 | (cond |
| 197 | ((memq action | 178 | ((memq action |
| 198 | '(attribute-changed changed created deleted renamed)) | 179 | '(attribute-changed changed created deleted renamed)) |
| 199 | action) | 180 | action) |
| 200 | ((memq action '(moved rename)) | 181 | ((memq action '(moved rename)) |
| 201 | ;; The kqueue rename event does not return file1 in | 182 | ;; The kqueue rename event does not return file1 in |
| 202 | ;; case a file monitor is established. | 183 | ;; case a file monitor is established. |
| 203 | (if (setq file1 (file-notify--event-file1-name event)) | 184 | (if (setq file1 (file-notify--event-file1-name event)) |
| 204 | 'renamed 'deleted)) | 185 | 'renamed 'deleted)) |
| 205 | ((eq action 'ignored) | 186 | ((eq action 'ignored) |
| 206 | (setq stopped t actions nil)) | 187 | (setq stopped t actions nil)) |
| 207 | ((memq action '(attrib link)) 'attribute-changed) | 188 | ((memq action '(attrib link)) 'attribute-changed) |
| 208 | ((memq action '(create added)) 'created) | 189 | ((memq action '(create added)) 'created) |
| 209 | ((memq action '(modify modified write)) 'changed) | 190 | ((memq action '(modify modified write)) 'changed) |
| 210 | ((memq action '(delete delete-self move-self removed)) 'deleted) | 191 | ((memq action |
| 211 | ;; Make the event pending. | 192 | '(delete delete-self move-self removed)) 'deleted) |
| 212 | ((memq action '(moved-from renamed-from)) | 193 | ;; Make the event pending. |
| 213 | (setq file-notify--pending-event | 194 | ((memq action '(moved-from renamed-from)) |
| 214 | `((,desc ,action ,file ,(file-notify--event-cookie event)) | 195 | (setq file-notify--pending-event |
| 215 | ,callback)) | 196 | `((,desc ,action ,file |
| 216 | nil) | 197 | ,(file-notify--event-cookie event)) |
| 217 | ;; Look for pending event. | 198 | ,(file-notify--watch-callback watch))) |
| 218 | ((memq action '(moved-to renamed-to)) | 199 | nil) |
| 219 | (if (null file-notify--pending-event) | 200 | ;; Look for pending event. |
| 220 | 'created | 201 | ((memq action '(moved-to renamed-to)) |
| 221 | (setq file1 file | 202 | (if (null file-notify--pending-event) |
| 222 | file (file-notify--event-file-name | 203 | 'created |
| 223 | (car file-notify--pending-event))) | 204 | (setq file1 file |
| 224 | ;; If the source is handled by another watch, we | 205 | file (file-notify--event-file-name |
| 225 | ;; must fire the rename event there as well. | 206 | (car file-notify--pending-event))) |
| 226 | (when (not (equal (file-notify--descriptor desc file1) | 207 | ;; If the source is handled by another watch, we |
| 227 | (file-notify--descriptor | 208 | ;; must fire the rename event there as well. |
| 228 | (caar file-notify--pending-event) | 209 | (unless (equal desc (caar file-notify--pending-event)) |
| 229 | (file-notify--event-file-name | 210 | (setq pending-event |
| 230 | file-notify--pending-event)))) | 211 | `((,(caar file-notify--pending-event) |
| 231 | (setq pending-event | 212 | renamed ,file ,file1) |
| 232 | `((,(caar file-notify--pending-event) | 213 | ,(cadr file-notify--pending-event)))) |
| 233 | renamed ,file ,file1) | 214 | (setq file-notify--pending-event nil) |
| 234 | ,(cadr file-notify--pending-event)))) | 215 | 'renamed)))) |
| 235 | (setq file-notify--pending-event nil) | 216 | |
| 236 | 'renamed)))) | 217 | ;; Apply pending callback. |
| 237 | 218 | (when pending-event | |
| 238 | ;; Apply pending callback. | 219 | (funcall (cadr pending-event) (car pending-event)) |
| 239 | (when pending-event | 220 | (setq pending-event nil)) |
| 240 | (setcar | 221 | |
| 241 | (car pending-event) | 222 | ;; Apply callback. |
| 242 | (file-notify--descriptor | 223 | (when (and action |
| 243 | (caar pending-event) | 224 | (or |
| 244 | (file-notify--event-file-name file-notify--pending-event))) | 225 | ;; If there is no relative file name for that |
| 245 | (funcall (cadr pending-event) (car pending-event)) | 226 | ;; watch, we watch the whole directory. |
| 246 | (setq pending-event nil)) | 227 | (null (file-notify--watch-filename watch)) |
| 247 | 228 | ;; File matches. | |
| 248 | ;; Apply callback. | 229 | (string-equal |
| 249 | (when (and action | 230 | (file-notify--watch-filename watch) |
| 250 | (or | 231 | (file-name-nondirectory file)) |
| 251 | ;; If there is no relative file name for that watch, | 232 | ;; Directory matches. |
| 252 | ;; we watch the whole directory. | 233 | (string-equal |
| 253 | (null (nth 0 entry)) | 234 | (file-name-nondirectory file) |
| 254 | ;; File matches. | 235 | (file-name-nondirectory |
| 255 | (string-equal | 236 | (file-notify--watch-directory watch))) |
| 256 | (nth 0 entry) (file-name-nondirectory file)) | 237 | ;; File1 matches. |
| 257 | ;; Directory matches. | 238 | (and (stringp file1) |
| 258 | (string-equal | 239 | (string-equal |
| 259 | (file-name-nondirectory file) | 240 | (file-notify--watch-filename watch) |
| 260 | (file-name-nondirectory (car registered))) | 241 | (file-name-nondirectory file1))))) |
| 261 | ;; File1 matches. | 242 | ;;(message |
| 262 | (and (stringp file1) | 243 | ;;"file-notify-callback %S %S %S %S %S" |
| 263 | (string-equal | 244 | ;;desc action file file1 watch) |
| 264 | (nth 0 entry) (file-name-nondirectory file1))))) | 245 | (if file1 |
| 265 | ;;(message | 246 | (funcall (file-notify--watch-callback watch) |
| 266 | ;;"file-notify-callback %S %S %S %S %S" | 247 | `(,desc ,action ,file ,file1)) |
| 267 | ;;(file-notify--descriptor desc (car entry)) | 248 | (funcall (file-notify--watch-callback watch) |
| 268 | ;;action file file1 registered) | 249 | `(,desc ,action ,file)))) |
| 269 | (if file1 | 250 | |
| 270 | (funcall | 251 | ;; Send `stopped' event. |
| 271 | callback | 252 | (when (or stopped |
| 272 | `(,(file-notify--descriptor desc (car entry)) | 253 | (and (memq action '(deleted renamed)) |
| 273 | ,action ,file ,file1)) | 254 | ;; Not, when a file is backed up. |
| 274 | (funcall | 255 | (not (and (stringp file1) (backup-file-name-p file1))) |
| 275 | callback | 256 | ;; Watched file or directory is concerned. |
| 276 | `(,(file-notify--descriptor desc (car entry)) ,action ,file)))) | 257 | (string-equal |
| 277 | 258 | file (file-notify--event-watched-file event)))) | |
| 278 | ;; Send `stopped' event. | 259 | (file-notify-rm-watch desc))))))) |
| 279 | (when (or stopped | ||
| 280 | (and (memq action '(deleted renamed)) | ||
| 281 | ;; Not, when a file is backed up. | ||
| 282 | (not (and (stringp file1) (backup-file-name-p file1))) | ||
| 283 | ;; Watched file or directory is concerned. | ||
| 284 | (string-equal | ||
| 285 | file (file-notify--event-watched-file event)))) | ||
| 286 | (file-notify-rm-watch (file-notify--descriptor desc (car entry)))))))) | ||
| 287 | 260 | ||
| 288 | ;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor | 261 | ;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor |
| 289 | ;; for every `file-notify-add-watch', while `inotify' returns a unique | 262 | ;; for every `file-notify-add-watch', while `inotify' returns a unique |
| @@ -339,7 +312,7 @@ FILE is the name of the file whose event is being reported." | |||
| 339 | (if (file-directory-p file) | 312 | (if (file-directory-p file) |
| 340 | file | 313 | file |
| 341 | (file-name-directory file)))) | 314 | (file-name-directory file)))) |
| 342 | desc func l-flags registered entry) | 315 | desc func l-flags) |
| 343 | 316 | ||
| 344 | (unless (file-directory-p dir) | 317 | (unless (file-directory-p dir) |
| 345 | (signal 'file-notify-error `("Directory does not exist" ,dir))) | 318 | (signal 'file-notify-error `("Directory does not exist" ,dir))) |
| @@ -347,13 +320,7 @@ FILE is the name of the file whose event is being reported." | |||
| 347 | (if handler | 320 | (if handler |
| 348 | ;; A file name handler could exist even if there is no local | 321 | ;; A file name handler could exist even if there is no local |
| 349 | ;; file notification support. | 322 | ;; file notification support. |
| 350 | (setq desc (funcall | 323 | (setq desc (funcall handler 'file-notify-add-watch dir flags callback)) |
| 351 | handler 'file-notify-add-watch | ||
| 352 | ;; kqueue does not report file changes in | ||
| 353 | ;; directory monitor. So we must watch the file | ||
| 354 | ;; itself. | ||
| 355 | (if (eq file-notify--library 'kqueue) file dir) | ||
| 356 | flags callback)) | ||
| 357 | 324 | ||
| 358 | ;; Check, whether Emacs has been compiled with file notification | 325 | ;; Check, whether Emacs has been compiled with file notification |
| 359 | ;; support. | 326 | ;; support. |
| @@ -391,70 +358,52 @@ FILE is the name of the file whose event is being reported." | |||
| 391 | 358 | ||
| 392 | ;; Call low-level function. | 359 | ;; Call low-level function. |
| 393 | (setq desc (funcall | 360 | (setq desc (funcall |
| 361 | ;; kqueue does not report file changes in directory | ||
| 362 | ;; monitor. So we must watch the file itself. | ||
| 394 | func (if (eq file-notify--library 'kqueue) file dir) | 363 | func (if (eq file-notify--library 'kqueue) file dir) |
| 395 | l-flags 'file-notify-callback))) | 364 | l-flags 'file-notify-callback))) |
| 396 | 365 | ||
| 397 | ;; Modify `file-notify-descriptors'. | 366 | ;; Modify `file-notify-descriptors'. |
| 398 | (setq file (unless (file-directory-p file) (file-name-nondirectory file)) | 367 | (let ((watch (file-notify--watch-make |
| 399 | desc (if (consp desc) (car desc) desc) | 368 | dir |
| 400 | registered (gethash desc file-notify-descriptors) | 369 | (unless (file-directory-p file) (file-name-nondirectory file)) |
| 401 | entry `(,file . ,callback)) | 370 | callback))) |
| 402 | (unless (member entry (cdr registered)) | 371 | (puthash desc watch file-notify-descriptors)) |
| 403 | (puthash desc `(,dir ,entry . ,(cdr registered)) file-notify-descriptors)) | ||
| 404 | |||
| 405 | ;; Return descriptor. | 372 | ;; Return descriptor. |
| 406 | (file-notify--descriptor desc file))) | 373 | desc)) |
| 407 | 374 | ||
| 408 | (defun file-notify-rm-watch (descriptor) | 375 | (defun file-notify-rm-watch (descriptor) |
| 409 | "Remove an existing watch specified by its DESCRIPTOR. | 376 | "Remove an existing watch specified by its DESCRIPTOR. |
| 410 | DESCRIPTOR should be an object returned by `file-notify-add-watch'." | 377 | DESCRIPTOR should be an object returned by `file-notify-add-watch'." |
| 411 | (let* ((desc (if (consp descriptor) (car descriptor) descriptor)) | 378 | (when-let (watch (gethash descriptor file-notify-descriptors)) |
| 412 | (file (if (consp descriptor) (cdr descriptor))) | 379 | (let ((handler (find-file-name-handler |
| 413 | (registered (gethash desc file-notify-descriptors)) | 380 | (file-notify--watch-directory watch) |
| 414 | (dir (car registered)) | 381 | 'file-notify-rm-watch))) |
| 415 | (handler (and (stringp dir) | 382 | (condition-case nil |
| 416 | (find-file-name-handler dir 'file-notify-rm-watch)))) | 383 | (if handler |
| 417 | 384 | ;; A file name handler could exist even if there is no | |
| 418 | (when (stringp dir) | 385 | ;; local file notification support. |
| 419 | ;; Call low-level function. | 386 | (funcall handler 'file-notify-rm-watch descriptor) |
| 420 | (when (or (not file) | 387 | |
| 421 | (and (= (length (cdr registered)) 1) | 388 | (funcall |
| 422 | (assoc file (cdr registered)))) | 389 | (cond |
| 423 | (condition-case nil | 390 | ((eq file-notify--library 'inotify) 'inotify-rm-watch) |
| 424 | (if handler | 391 | ((eq file-notify--library 'kqueue) 'kqueue-rm-watch) |
| 425 | ;; A file name handler could exist even if there is no local | 392 | ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch) |
| 426 | ;; file notification support. | 393 | ((eq file-notify--library 'w32notify) 'w32notify-rm-watch)) |
| 427 | (funcall handler 'file-notify-rm-watch descriptor) | 394 | descriptor)) |
| 428 | 395 | (file-notify-error nil))) | |
| 429 | (funcall | 396 | ;; Modify `file-notify-descriptors'. |
| 430 | (cond | 397 | (file-notify--rm-descriptor descriptor))) |
| 431 | ((eq file-notify--library 'inotify) 'inotify-rm-watch) | ||
| 432 | ((eq file-notify--library 'kqueue) 'kqueue-rm-watch) | ||
| 433 | ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch) | ||
| 434 | ((eq file-notify--library 'w32notify) 'w32notify-rm-watch)) | ||
| 435 | desc)) | ||
| 436 | (file-notify-error nil))) | ||
| 437 | |||
| 438 | ;; Modify `file-notify-descriptors'. | ||
| 439 | (file-notify--rm-descriptor descriptor)))) | ||
| 440 | 398 | ||
| 441 | (defun file-notify-valid-p (descriptor) | 399 | (defun file-notify-valid-p (descriptor) |
| 442 | "Check a watch specified by its DESCRIPTOR. | 400 | "Check a watch specified by its DESCRIPTOR. |
| 443 | DESCRIPTOR should be an object returned by `file-notify-add-watch'." | 401 | DESCRIPTOR should be an object returned by `file-notify-add-watch'." |
| 444 | (let* ((desc (if (consp descriptor) (car descriptor) descriptor)) | 402 | (when-let (watch (gethash descriptor file-notify-descriptors)) |
| 445 | (file (if (consp descriptor) (cdr descriptor))) | 403 | (let ((handler (find-file-name-handler |
| 446 | (registered (gethash desc file-notify-descriptors)) | 404 | (file-notify--watch-directory watch) |
| 447 | (dir (car registered)) | 405 | 'file-notify-valid-p))) |
| 448 | handler) | 406 | (and (if handler |
| 449 | |||
| 450 | (when (stringp dir) | ||
| 451 | (setq handler (find-file-name-handler dir 'file-notify-valid-p)) | ||
| 452 | |||
| 453 | (and (or ;; It is a directory. | ||
| 454 | (not file) | ||
| 455 | ;; The file is registered. | ||
| 456 | (assoc file (cdr registered))) | ||
| 457 | (if handler | ||
| 458 | ;; A file name handler could exist even if there is no | 407 | ;; A file name handler could exist even if there is no |
| 459 | ;; local file notification support. | 408 | ;; local file notification support. |
| 460 | (funcall handler 'file-notify-valid-p descriptor) | 409 | (funcall handler 'file-notify-valid-p descriptor) |
| @@ -464,9 +413,19 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'." | |||
| 464 | ((eq file-notify--library 'kqueue) 'kqueue-valid-p) | 413 | ((eq file-notify--library 'kqueue) 'kqueue-valid-p) |
| 465 | ((eq file-notify--library 'gfilenotify) 'gfile-valid-p) | 414 | ((eq file-notify--library 'gfilenotify) 'gfile-valid-p) |
| 466 | ((eq file-notify--library 'w32notify) 'w32notify-valid-p)) | 415 | ((eq file-notify--library 'w32notify) 'w32notify-valid-p)) |
| 467 | desc)) | 416 | descriptor)) |
| 468 | t)))) | 417 | t)))) |
| 469 | 418 | ||
| 419 | |||
| 420 | ;; TODO: | ||
| 421 | ;; * Watching a /dir/file may receive events for dir. | ||
| 422 | ;; (This may be the desired behaviour.) | ||
| 423 | ;; * Watching a file in a already watched directory | ||
| 424 | ;; If the file is created and *then* a watch is added to that file, the | ||
| 425 | ;; watch might receive events which occurred prior to it being created, | ||
| 426 | ;; due to the way events are propagated during idle time. Note: This | ||
| 427 | ;; may be perfectly acceptable. | ||
| 428 | |||
| 470 | ;; The end: | 429 | ;; The end: |
| 471 | (provide 'filenotify) | 430 | (provide 'filenotify) |
| 472 | 431 | ||
diff --git a/lisp/files-x.el b/lisp/files-x.el index a0cad708425..b7c6f51e658 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el | |||
| @@ -585,7 +585,7 @@ Return a new ordered plist list containing only property names from PROPERTIES." | |||
| 585 | nil | 585 | nil |
| 586 | (mapcar | 586 | (mapcar |
| 587 | (lambda (property) | 587 | (lambda (property) |
| 588 | (when (plist-member criteria property) | 588 | (when (and (plist-member criteria property) (plist-get criteria property)) |
| 589 | (list property (plist-get criteria property)))) | 589 | (list property (plist-get criteria property)))) |
| 590 | properties))) | 590 | properties))) |
| 591 | 591 | ||
| @@ -606,12 +606,10 @@ using this connection, see `connection-local-criteria-alist'." | |||
| 606 | 606 | ||
| 607 | ;;;###autoload | 607 | ;;;###autoload |
| 608 | (defun connection-local-set-profiles (criteria &rest profiles) | 608 | (defun connection-local-set-profiles (criteria &rest profiles) |
| 609 | "Add PROFILES for remote servers. | 609 | "Add PROFILES for CRITERIA. |
| 610 | CRITERIA is either a regular expression identifying a remote | 610 | CRITERIA is a plist identifying a connection and the application |
| 611 | server, or a function with one argument IDENTIFICATION, which | 611 | using this connection, see `connection-local-criteria-alist'. |
| 612 | returns non-nil when a remote server shall apply PROFILE's | 612 | PROFILES are the names of connection profiles (a symbol). |
| 613 | variables. If CRITERIA is nil, it always applies. | ||
| 614 | PROFILES are the names of a connection profile (a symbol). | ||
| 615 | 613 | ||
| 616 | When a connection to a remote server is opened and CRITERIA | 614 | When a connection to a remote server is opened and CRITERIA |
| 617 | matches to that server, the connection-local variables from | 615 | matches to that server, the connection-local variables from |
| @@ -678,7 +676,7 @@ will not be changed." | |||
| 678 | ;;;###autoload | 676 | ;;;###autoload |
| 679 | (defmacro with-connection-local-profiles (profiles &rest body) | 677 | (defmacro with-connection-local-profiles (profiles &rest body) |
| 680 | "Apply connection-local variables according to PROFILES in current buffer. | 678 | "Apply connection-local variables according to PROFILES in current buffer. |
| 681 | Execute BODY, and unwind connection local variables." | 679 | Execute BODY, and unwind connection-local variables." |
| 682 | (declare (indent 1) (debug t)) | 680 | (declare (indent 1) (debug t)) |
| 683 | `(let ((enable-connection-local-variables t) | 681 | `(let ((enable-connection-local-variables t) |
| 684 | (old-buffer-local-variables (buffer-local-variables)) | 682 | (old-buffer-local-variables (buffer-local-variables)) |
diff --git a/lisp/files.el b/lisp/files.el index 0a023a88b10..b4872e46b01 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -279,8 +279,13 @@ The value `never' means do not make them." | |||
| 279 | (const :tag "If existing" nil) | 279 | (const :tag "If existing" nil) |
| 280 | (other :tag "Always" t)) | 280 | (other :tag "Always" t)) |
| 281 | :group 'backup) | 281 | :group 'backup) |
| 282 | |||
| 283 | (defun version-control-safe-local-p (x) | ||
| 284 | "Return whether X is safe as local value for `version-control'." | ||
| 285 | (or (booleanp x) (equal x 'never))) | ||
| 286 | |||
| 282 | (put 'version-control 'safe-local-variable | 287 | (put 'version-control 'safe-local-variable |
| 283 | (lambda (x) (or (booleanp x) (equal x 'never)))) | 288 | #'version-control-safe-local-p) |
| 284 | 289 | ||
| 285 | (defcustom dired-kept-versions 2 | 290 | (defcustom dired-kept-versions 2 |
| 286 | "When cleaning directory, number of versions to keep." | 291 | "When cleaning directory, number of versions to keep." |
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index be46339cd38..90f3cb48c27 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el | |||
| @@ -3196,7 +3196,7 @@ If this variable is nil, don't do anything." | |||
| 3196 | 3196 | ||
| 3197 | (defun gnus-display-time-event-handler () | 3197 | (defun gnus-display-time-event-handler () |
| 3198 | (if (and (fboundp 'display-time-event-handler) | 3198 | (if (and (fboundp 'display-time-event-handler) |
| 3199 | (gnus-boundp 'display-time-timer)) | 3199 | (bound-and-true-p display-time-timer)) |
| 3200 | (display-time-event-handler))) | 3200 | (display-time-event-handler))) |
| 3201 | 3201 | ||
| 3202 | (defun gnus-check-reasonable-setup () | 3202 | (defun gnus-check-reasonable-setup () |
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 20eceb58edd..b509d8ad448 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el | |||
| @@ -84,11 +84,6 @@ This is a compatibility function for different Emacsen." | |||
| 84 | (declare (obsolete replace-regexp-in-string "26.1")) | 84 | (declare (obsolete replace-regexp-in-string "26.1")) |
| 85 | (replace-regexp-in-string regexp newtext string nil literal)) | 85 | (replace-regexp-in-string regexp newtext string nil literal)) |
| 86 | 86 | ||
| 87 | (defun gnus-boundp (variable) | ||
| 88 | "Return non-nil if VARIABLE is bound and non-nil." | ||
| 89 | (and (boundp variable) | ||
| 90 | (symbol-value variable))) | ||
| 91 | |||
| 92 | (defmacro gnus-eval-in-buffer-window (buffer &rest forms) | 87 | (defmacro gnus-eval-in-buffer-window (buffer &rest forms) |
| 93 | "Pop to BUFFER, evaluate FORMS, and then return to the original window." | 88 | "Pop to BUFFER, evaluate FORMS, and then return to the original window." |
| 94 | (let ((tempvar (make-symbol "GnusStartBufferWindow")) | 89 | (let ((tempvar (make-symbol "GnusStartBufferWindow")) |
diff --git a/lisp/help.el b/lisp/help.el index d3aaa1e251d..26be3b0e07f 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -1419,7 +1419,7 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"." | |||
| 1419 | 1419 | ||
| 1420 | (defun help-function-arglist (def &optional preserve-names) | 1420 | (defun help-function-arglist (def &optional preserve-names) |
| 1421 | "Return a formal argument list for the function DEF. | 1421 | "Return a formal argument list for the function DEF. |
| 1422 | IF PRESERVE-NAMES is non-nil, return a formal arglist that uses | 1422 | If PRESERVE-NAMES is non-nil, return a formal arglist that uses |
| 1423 | the same names as used in the original source code, when possible." | 1423 | the same names as used in the original source code, when possible." |
| 1424 | ;; Handle symbols aliased to other symbols. | 1424 | ;; Handle symbols aliased to other symbols. |
| 1425 | (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def))) | 1425 | (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def))) |
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 66916b2bca1..c83c21315a1 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el | |||
| @@ -1689,7 +1689,7 @@ If point is on a group name, this function operates on that group." | |||
| 1689 | ;; generate a call to the column function. | 1689 | ;; generate a call to the column function. |
| 1690 | (ibuffer-aif (assq sym ibuffer-inline-columns) | 1690 | (ibuffer-aif (assq sym ibuffer-inline-columns) |
| 1691 | (nth 1 it) | 1691 | (nth 1 it) |
| 1692 | `(,sym buffer mark))) | 1692 | `(or (,sym buffer mark) ""))) |
| 1693 | ;; You're not expected to understand this. Hell, I | 1693 | ;; You're not expected to understand this. Hell, I |
| 1694 | ;; don't even understand it, and I wrote it five | 1694 | ;; don't even understand it, and I wrote it five |
| 1695 | ;; minutes ago. | 1695 | ;; minutes ago. |
diff --git a/lisp/info.el b/lisp/info.el index 8dc85f48a43..a6bab290a72 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -1998,19 +1998,20 @@ If DIRECTION is `backward', search in the reverse direction." | |||
| 1998 | Info-isearch-initial-node | 1998 | Info-isearch-initial-node |
| 1999 | bound | 1999 | bound |
| 2000 | (and found (> found opoint-min) (< found opoint-max))) | 2000 | (and found (> found opoint-min) (< found opoint-max))) |
| 2001 | (signal 'search-failed (list regexp "end of node"))) | 2001 | (user-error "Search failed: `%s' (end of node)" regexp)) |
| 2002 | 2002 | ||
| 2003 | ;; If no subfiles, give error now. | 2003 | ;; If no subfiles, give error now. |
| 2004 | (unless (or found Info-current-subfile) | 2004 | (unless (or found Info-current-subfile) |
| 2005 | (if isearch-mode | 2005 | (if isearch-mode |
| 2006 | (signal 'search-failed (list regexp "end of manual")) | 2006 | (user-error "Search failed: `%s' (end of manual)" regexp) |
| 2007 | (let ((search-spaces-regexp Info-search-whitespace-regexp)) | 2007 | (let ((search-spaces-regexp Info-search-whitespace-regexp)) |
| 2008 | (if backward | 2008 | (unless (if backward |
| 2009 | (re-search-backward regexp) | 2009 | (re-search-backward regexp nil t) |
| 2010 | (re-search-forward regexp))))) | 2010 | (re-search-forward regexp nil t)) |
| 2011 | (user-error "Search failed: `%s'" regexp))))) | ||
| 2011 | 2012 | ||
| 2012 | (if (and bound (not found)) | 2013 | (if (and bound (not found)) |
| 2013 | (signal 'search-failed (list regexp))) | 2014 | (user-error "Search failed: `%s'" regexp)) |
| 2014 | 2015 | ||
| 2015 | (unless (or found bound) | 2016 | (unless (or found bound) |
| 2016 | (unwind-protect | 2017 | (unwind-protect |
| @@ -2054,9 +2055,8 @@ If DIRECTION is `backward', search in the reverse direction." | |||
| 2054 | (setq list nil))) | 2055 | (setq list nil))) |
| 2055 | (if found | 2056 | (if found |
| 2056 | (message "") | 2057 | (message "") |
| 2057 | (signal 'search-failed (if isearch-mode | 2058 | (user-error "Search failed: `%s'%s" |
| 2058 | (list regexp "end of manual") | 2059 | regexp (if isearch-mode " (end of manual)" "")))) |
| 2059 | (list regexp))))) | ||
| 2060 | (if (not found) | 2060 | (if (not found) |
| 2061 | (progn (Info-read-subfile osubfile) | 2061 | (progn (Info-read-subfile osubfile) |
| 2062 | (goto-char opoint) | 2062 | (goto-char opoint) |
| @@ -2699,7 +2699,8 @@ Because of ambiguities, this should be concatenated with something like | |||
| 2699 | (orignode Info-current-node) | 2699 | (orignode Info-current-node) |
| 2700 | nextnode) | 2700 | nextnode) |
| 2701 | (goto-char (point-min)) | 2701 | (goto-char (point-min)) |
| 2702 | (search-forward "\n* Menu:") | 2702 | (unless (search-forward "\n* Menu:" nil t) |
| 2703 | (user-error "No menu in this node")) | ||
| 2703 | (cond | 2704 | (cond |
| 2704 | ((eq (car-safe action) 'boundaries) nil) | 2705 | ((eq (car-safe action) 'boundaries) nil) |
| 2705 | ((eq action 'lambda) | 2706 | ((eq action 'lambda) |
| @@ -5237,9 +5238,6 @@ BUFFER is the buffer speedbar is requesting buttons for." | |||
| 5237 | (erase-buffer)) | 5238 | (erase-buffer)) |
| 5238 | (Info-speedbar-hierarchy-buttons nil 0)) | 5239 | (Info-speedbar-hierarchy-buttons nil 0)) |
| 5239 | 5240 | ||
| 5240 | ;; FIXME: Really? Why here? | ||
| 5241 | (add-to-list 'debug-ignored-errors 'search-failed) | ||
| 5242 | |||
| 5243 | ;;;; Desktop support | 5241 | ;;;; Desktop support |
| 5244 | 5242 | ||
| 5245 | (defun Info-desktop-buffer-misc-data (_desktop-dirname) | 5243 | (defun Info-desktop-buffer-misc-data (_desktop-dirname) |
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 01a3e5d1506..411969a5420 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el | |||
| @@ -5224,7 +5224,9 @@ You might also use mode hooks to specify it in certain modes, like this: | |||
| 5224 | (concat \"make -k \" | 5224 | (concat \"make -k \" |
| 5225 | (if buffer-file-name | 5225 | (if buffer-file-name |
| 5226 | (shell-quote-argument | 5226 | (shell-quote-argument |
| 5227 | (file-name-sans-extension buffer-file-name))))))))") | 5227 | (file-name-sans-extension buffer-file-name)))))))) |
| 5228 | |||
| 5229 | It's often useful to leave a space at the end of the value.") | ||
| 5228 | 5230 | ||
| 5229 | (custom-autoload 'compile-command "compile" t) | 5231 | (custom-autoload 'compile-command "compile" t) |
| 5230 | (put 'compile-command 'safe-local-variable (lambda (a) (and (stringp a) (or (not (boundp 'compilation-read-command)) compilation-read-command)))) | 5232 | (put 'compile-command 'safe-local-variable (lambda (a) (and (stringp a) (or (not (boundp 'compilation-read-command)) compilation-read-command)))) |
| @@ -12465,12 +12467,10 @@ Copy directory-local variables to the -*- line. | |||
| 12465 | Non-nil means enable use of connection-local variables.") | 12467 | Non-nil means enable use of connection-local variables.") |
| 12466 | 12468 | ||
| 12467 | (autoload 'connection-local-set-profiles "files-x" "\ | 12469 | (autoload 'connection-local-set-profiles "files-x" "\ |
| 12468 | Add PROFILES for remote servers. | 12470 | Add PROFILES for CRITERIA. |
| 12469 | CRITERIA is either a regular expression identifying a remote | 12471 | CRITERIA is a plist identifying a connection and the application |
| 12470 | server, or a function with one argument IDENTIFICATION, which | 12472 | using this connection, see `connection-local-criteria-alist'. |
| 12471 | returns non-nil when a remote server shall apply PROFILE's | 12473 | PROFILES are the names of connection profiles (a symbol). |
| 12472 | variables. If CRITERIA is nil, it always applies. | ||
| 12473 | PROFILES are the names of a connection profile (a symbol). | ||
| 12474 | 12474 | ||
| 12475 | When a connection to a remote server is opened and CRITERIA | 12475 | When a connection to a remote server is opened and CRITERIA |
| 12476 | matches to that server, the connection-local variables from | 12476 | matches to that server, the connection-local variables from |
| @@ -12504,7 +12504,7 @@ will not be changed. | |||
| 12504 | 12504 | ||
| 12505 | (autoload 'with-connection-local-profiles "files-x" "\ | 12505 | (autoload 'with-connection-local-profiles "files-x" "\ |
| 12506 | Apply connection-local variables according to PROFILES in current buffer. | 12506 | Apply connection-local variables according to PROFILES in current buffer. |
| 12507 | Execute BODY, and unwind connection local variables. | 12507 | Execute BODY, and unwind connection-local variables. |
| 12508 | 12508 | ||
| 12509 | \(fn PROFILES &rest BODY)" nil t) | 12509 | \(fn PROFILES &rest BODY)" nil t) |
| 12510 | 12510 | ||
| @@ -15857,14 +15857,6 @@ This discards the buffer's undo information. | |||
| 15857 | 15857 | ||
| 15858 | ;;;*** | 15858 | ;;;*** |
| 15859 | 15859 | ||
| 15860 | ;;;### (autoloads "actual autoloads are elsewhere" "hfy-cmap" "hfy-cmap.el" | ||
| 15861 | ;;;;;; (0 0 0 0)) | ||
| 15862 | ;;; Generated autoloads from hfy-cmap.el | ||
| 15863 | |||
| 15864 | (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "hfy-cmap" '("hfy-" "htmlfontify-unload-rgb-file"))) | ||
| 15865 | |||
| 15866 | ;;;*** | ||
| 15867 | |||
| 15868 | ;;;### (autoloads nil "hi-lock" "hi-lock.el" (0 0 0 0)) | 15860 | ;;;### (autoloads nil "hi-lock" "hi-lock.el" (0 0 0 0)) |
| 15869 | ;;; Generated autoloads from hi-lock.el | 15861 | ;;; Generated autoloads from hi-lock.el |
| 15870 | 15862 | ||
| @@ -21868,7 +21860,7 @@ QUALITY can be: | |||
| 21868 | `approximate', in which case we may cut some corners to avoid | 21860 | `approximate', in which case we may cut some corners to avoid |
| 21869 | excessive work. | 21861 | excessive work. |
| 21870 | `exact', in which case we may end up re-(en/de)coding a large | 21862 | `exact', in which case we may end up re-(en/de)coding a large |
| 21871 | part of the file/buffer. | 21863 | part of the file/buffer, this can be expensive and slow. |
| 21872 | nil, in which case we may return nil rather than an approximation. | 21864 | nil, in which case we may return nil rather than an approximation. |
| 21873 | 21865 | ||
| 21874 | \(fn BYTE &optional QUALITY CODING-SYSTEM)" nil nil) | 21866 | \(fn BYTE &optional QUALITY CODING-SYSTEM)" nil nil) |
| @@ -21882,7 +21874,7 @@ QUALITY can be: | |||
| 21882 | `approximate', in which case we may cut some corners to avoid | 21874 | `approximate', in which case we may cut some corners to avoid |
| 21883 | excessive work. | 21875 | excessive work. |
| 21884 | `exact', in which case we may end up re-(en/de)coding a large | 21876 | `exact', in which case we may end up re-(en/de)coding a large |
| 21885 | part of the file/buffer. | 21877 | part of the file/buffer, this can be expensive and slow. |
| 21886 | nil, in which case we may return nil rather than an approximation. | 21878 | nil, in which case we may return nil rather than an approximation. |
| 21887 | 21879 | ||
| 21888 | \(fn POSITION &optional QUALITY CODING-SYSTEM)" nil nil) | 21880 | \(fn POSITION &optional QUALITY CODING-SYSTEM)" nil nil) |
| @@ -33879,7 +33871,7 @@ It can have the following values: | |||
| 33879 | 33871 | ||
| 33880 | (custom-autoload 'tramp-syntax "tramp" t) | 33872 | (custom-autoload 'tramp-syntax "tramp" t) |
| 33881 | 33873 | ||
| 33882 | (defconst tramp-file-name-regexp-unified (if (memq system-type '(cygwin windows-nt)) "\\`/\\(\\[.*\\]\\|[^/|:]\\{2,\\}[^/|]*\\):" "\\`/[^/|:][^/|]*:") "\ | 33874 | (defconst tramp-file-name-regexp-unified "\\`/.+:.*:" "\ |
| 33883 | Value for `tramp-file-name-regexp' for unified remoting. | 33875 | Value for `tramp-file-name-regexp' for unified remoting. |
| 33884 | See `tramp-file-name-structure' for more explanations. | 33876 | See `tramp-file-name-structure' for more explanations. |
| 33885 | 33877 | ||
| @@ -33889,23 +33881,23 @@ On W32 systems, the volume letter must be ignored.") | |||
| 33889 | Value for `tramp-file-name-regexp' for separate remoting. | 33881 | Value for `tramp-file-name-regexp' for separate remoting. |
| 33890 | See `tramp-file-name-structure' for more explanations.") | 33882 | See `tramp-file-name-structure' for more explanations.") |
| 33891 | 33883 | ||
| 33892 | (defvar tramp-file-name-regexp (cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified) ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate) (t (error "Wrong `tramp-syntax' defined"))) "\ | 33884 | (defvar tramp-file-name-regexp (cond ((eq tramp-syntax 'ftp) tramp-file-name-regexp-unified) ((eq tramp-syntax 'sep) tramp-file-name-regexp-separate) (t (error "Wrong `tramp-syntax' defined"))) "\ |
| 33893 | Regular expression matching file names handled by Tramp. | 33885 | Regular expression matching file names handled by Tramp. |
| 33894 | This regexp should match Tramp file names but no other file | 33886 | This regexp should match Tramp file names but no other file |
| 33895 | names. When calling `tramp-register-file-name-handlers', the | 33887 | names. When calling `tramp-register-file-name-handlers', the |
| 33896 | initial value is overwritten by the car of `tramp-file-name-structure'.") | 33888 | initial value is overwritten by the car of `tramp-file-name-structure'.") |
| 33897 | 33889 | ||
| 33898 | (defconst tramp-completion-file-name-regexp-unified (if (memq system-type '(cygwin windows-nt)) "\\`/[^/]\\{2,\\}\\'" "\\`/[^/]*\\'") "\ | 33890 | (defconst tramp-completion-file-name-regexp-unified (concat "\\`/\\(" "\\([^/|:]+:[^/|:]*|\\)*" (if (memq system-type '(cygwin windows-nt)) "\\(-\\|[^/|:]\\{2,\\}\\)" "[^/|:]+") "\\(:[^/|:]*\\)?" "\\)?\\'") "\ |
| 33899 | Value for `tramp-completion-file-name-regexp' for unified remoting. | 33891 | Value for `tramp-completion-file-name-regexp' for unified remoting. |
| 33900 | See `tramp-file-name-structure' for more explanations. | 33892 | See `tramp-file-name-structure' for more explanations. |
| 33901 | 33893 | ||
| 33902 | On W32 systems, the volume letter must be ignored.") | 33894 | On W32 systems, the volume letter must be ignored.") |
| 33903 | 33895 | ||
| 33904 | (defconst tramp-completion-file-name-regexp-separate "\\`/\\([[][^]]*\\)?\\'" "\ | 33896 | (defconst tramp-completion-file-name-regexp-separate "\\`/\\[\\([^]]*\\)?\\'" "\ |
| 33905 | Value for `tramp-completion-file-name-regexp' for separate remoting. | 33897 | Value for `tramp-completion-file-name-regexp' for separate remoting. |
| 33906 | See `tramp-file-name-structure' for more explanations.") | 33898 | See `tramp-file-name-structure' for more explanations.") |
| 33907 | 33899 | ||
| 33908 | (defconst tramp-completion-file-name-regexp (cond ((equal tramp-syntax 'ftp) tramp-completion-file-name-regexp-unified) ((equal tramp-syntax 'sep) tramp-completion-file-name-regexp-separate) (t (error "Wrong `tramp-syntax' defined"))) "\ | 33900 | (defconst tramp-completion-file-name-regexp (cond ((eq tramp-syntax 'ftp) tramp-completion-file-name-regexp-unified) ((eq tramp-syntax 'sep) tramp-completion-file-name-regexp-separate) (t (error "Wrong `tramp-syntax' defined"))) "\ |
| 33909 | Regular expression matching file names handled by Tramp completion. | 33901 | Regular expression matching file names handled by Tramp completion. |
| 33910 | This regexp should match partial Tramp file names only. | 33902 | This regexp should match partial Tramp file names only. |
| 33911 | 33903 | ||
| @@ -33916,20 +33908,31 @@ updated after changing this variable. | |||
| 33916 | 33908 | ||
| 33917 | Also see `tramp-file-name-structure'.") | 33909 | Also see `tramp-file-name-structure'.") |
| 33918 | 33910 | ||
| 33919 | (defun tramp-completion-run-real-handler (operation args) "\ | 33911 | (defconst tramp-completion-file-name-handler-alist '((file-name-all-completions . tramp-completion-handle-file-name-all-completions) (file-name-completion . tramp-completion-handle-file-name-completion)) "\ |
| 33920 | Invoke `tramp-file-name-handler' for OPERATION. | 33912 | Alist of completion handler functions. |
| 33913 | Used for file names matching `tramp-completion-file-name-regexp'. | ||
| 33914 | Operations not mentioned here will be handled by Tramp's file | ||
| 33915 | name handler functions, or the normal Emacs functions.") | ||
| 33916 | |||
| 33917 | (defun tramp-run-real-handler (operation args) "\ | ||
| 33918 | Invoke normal file name handler for OPERATION. | ||
| 33921 | First arg specifies the OPERATION, second arg is a list of arguments to | 33919 | First arg specifies the OPERATION, second arg is a list of arguments to |
| 33922 | pass to the OPERATION." (let* ((inhibit-file-name-handlers (\` (tramp-completion-file-name-handler cygwin-mount-name-hook-function cygwin-mount-map-drive-hook-function \, (and (eq inhibit-file-name-operation operation) inhibit-file-name-handlers)))) (inhibit-file-name-operation operation)) (apply operation args))) | 33920 | pass to the OPERATION." (let* ((inhibit-file-name-handlers (\` (tramp-file-name-handler tramp-vc-file-name-handler tramp-completion-file-name-handler cygwin-mount-name-hook-function cygwin-mount-map-drive-hook-function \, (and (eq inhibit-file-name-operation operation) inhibit-file-name-handlers)))) (inhibit-file-name-operation operation)) (apply operation args))) |
| 33923 | (defun tramp-completion-file-name-handler (operation &rest args) | ||
| 33924 | (if (tramp-completion-mode-p) | ||
| 33925 | (apply 'tramp-autoload-file-name-handler operation args) | ||
| 33926 | (tramp-completion-run-real-handler operation args))) | ||
| 33927 | 33921 | ||
| 33928 | (defun tramp-autoload-file-name-handler (operation &rest args) "\ | 33922 | (autoload 'tramp-file-name-handler "tramp" "\ |
| 33929 | Load Tramp file name handler, and perform OPERATION." (if (and (not (and (stringp (car args)) (string-equal (car args) "/"))) (let ((default-directory temporary-file-directory)) (and (null load-in-progress) (load "tramp" (quote noerror) (quote nomessage))))) (apply operation args) (tramp-completion-run-real-handler operation args))) | 33923 | Invoke Tramp file name handler. |
| 33924 | Falls back to normal file name handler if no Tramp file name handler exists. | ||
| 33925 | |||
| 33926 | \(fn OPERATION &rest ARGS)" nil nil) | ||
| 33927 | |||
| 33928 | (autoload 'tramp-completion-file-name-handler "tramp" "\ | ||
| 33929 | Invoke Tramp file name completion handler. | ||
| 33930 | Falls back to normal file name handler if no Tramp file name handler exists. | ||
| 33931 | |||
| 33932 | \(fn OPERATION &rest ARGS)" nil nil) | ||
| 33930 | 33933 | ||
| 33931 | (defun tramp-register-autoload-file-name-handlers nil "\ | 33934 | (defun tramp-register-autoload-file-name-handlers nil "\ |
| 33932 | Add Tramp file name handlers to `file-name-handler-alist' during autoload." (add-to-list (quote file-name-handler-alist) (cons tramp-file-name-regexp (quote tramp-autoload-file-name-handler))) (put (quote tramp-autoload-file-name-handler) (quote safe-magic) t) (add-to-list (quote file-name-handler-alist) (cons tramp-completion-file-name-regexp (quote tramp-completion-file-name-handler))) (put (quote tramp-completion-file-name-handler) (quote safe-magic) t)) | 33935 | Add Tramp file name handlers to `file-name-handler-alist' during autoload." (add-to-list (quote file-name-handler-alist) (cons tramp-file-name-regexp (quote tramp-file-name-handler))) (put (quote tramp-file-name-handler) (quote safe-magic) t) (put (quote tramp-file-name-handler) (quote operations) (quote (file-name-all-completions file-name-completion file-remote-p))) (add-to-list (quote file-name-handler-alist) (cons tramp-completion-file-name-regexp (quote tramp-completion-file-name-handler))) (put (quote tramp-completion-file-name-handler) (quote safe-magic) t) (put (quote tramp-completion-file-name-handler) (quote operations) (mapcar (quote car) tramp-completion-file-name-handler-alist))) |
| 33933 | 33936 | ||
| 33934 | (tramp-register-autoload-file-name-handlers) | 33937 | (tramp-register-autoload-file-name-handlers) |
| 33935 | 33938 | ||
| @@ -33939,15 +33942,7 @@ Unload Tramp file name handlers from `file-name-handler-alist'. | |||
| 33939 | \(fn)" nil nil) | 33942 | \(fn)" nil nil) |
| 33940 | 33943 | ||
| 33941 | (defvar tramp-completion-mode nil "\ | 33944 | (defvar tramp-completion-mode nil "\ |
| 33942 | If non-nil, external packages signal that they are in file name completion. | 33945 | If non-nil, external packages signal that they are in file name completion.") |
| 33943 | |||
| 33944 | This is necessary, because Tramp uses a heuristic depending on last | ||
| 33945 | input event. This fails when external packages use other characters | ||
| 33946 | but <TAB>, <SPACE> or ?\\? for file name completion. This variable | ||
| 33947 | should never be set globally, the intention is to let-bind it.") | ||
| 33948 | |||
| 33949 | (defun tramp-completion-mode-p nil "\ | ||
| 33950 | Check, whether method / user name / host name completion is active." (or (and (boundp (quote non-essential)) (symbol-value (quote non-essential))) tramp-completion-mode (equal last-input-event (quote tab)))) | ||
| 33951 | 33946 | ||
| 33952 | (autoload 'tramp-unload-tramp "tramp" "\ | 33947 | (autoload 'tramp-unload-tramp "tramp" "\ |
| 33953 | Discard Tramp from loading remote files. | 33948 | Discard Tramp from loading remote files. |
| @@ -37759,7 +37754,7 @@ The major browsing mode used is essentially the standard Man mode. | |||
| 37759 | Choose the filename for the man page using completion, based on the | 37754 | Choose the filename for the man page using completion, based on the |
| 37760 | topic selected from the directories specified in `woman-manpath' and | 37755 | topic selected from the directories specified in `woman-manpath' and |
| 37761 | `woman-path'. The directory expansions and topics are cached for | 37756 | `woman-path'. The directory expansions and topics are cached for |
| 37762 | speed, but a non-nil interactive argument forces the caches to be | 37757 | speed. With a prefix argument, force the caches to be |
| 37763 | updated (e.g. to re-interpret the current directory). | 37758 | updated (e.g. to re-interpret the current directory). |
| 37764 | 37759 | ||
| 37765 | Used non-interactively, arguments are optional: if given then TOPIC | 37760 | Used non-interactively, arguments are optional: if given then TOPIC |
| @@ -38050,17 +38045,16 @@ Zone out, completely. | |||
| 38050 | ;;;*** | 38045 | ;;;*** |
| 38051 | 38046 | ||
| 38052 | ;;;### (autoloads nil nil ("abbrev.el" "bindings.el" "buff-menu.el" | 38047 | ;;;### (autoloads nil nil ("abbrev.el" "bindings.el" "buff-menu.el" |
| 38053 | ;;;;;; "button.el" "calc/calc-aent.el" "calc/calc-embed.el" "calc/calc-loaddefs.el" | 38048 | ;;;;;; "button.el" "calc/calc-aent.el" "calc/calc-embed.el" "calc/calc-misc.el" |
| 38054 | ;;;;;; "calc/calc-misc.el" "calc/calc-yank.el" "calendar/cal-loaddefs.el" | 38049 | ;;;;;; "calc/calc-yank.el" "calendar/cal-loaddefs.el" "calendar/diary-loaddefs.el" |
| 38055 | ;;;;;; "calendar/diary-loaddefs.el" "calendar/hol-loaddefs.el" "case-table.el" | 38050 | ;;;;;; "calendar/hol-loaddefs.el" "case-table.el" "cedet/ede/base.el" |
| 38056 | ;;;;;; "cedet/ede/base.el" "cedet/ede/config.el" "cedet/ede/cpp-root.el" | 38051 | ;;;;;; "cedet/ede/config.el" "cedet/ede/cpp-root.el" "cedet/ede/custom.el" |
| 38057 | ;;;;;; "cedet/ede/custom.el" "cedet/ede/dired.el" "cedet/ede/emacs.el" | 38052 | ;;;;;; "cedet/ede/dired.el" "cedet/ede/emacs.el" "cedet/ede/files.el" |
| 38058 | ;;;;;; "cedet/ede/files.el" "cedet/ede/generic.el" "cedet/ede/linux.el" | 38053 | ;;;;;; "cedet/ede/generic.el" "cedet/ede/linux.el" "cedet/ede/locate.el" |
| 38059 | ;;;;;; "cedet/ede/loaddefs.el" "cedet/ede/locate.el" "cedet/ede/make.el" | 38054 | ;;;;;; "cedet/ede/make.el" "cedet/ede/shell.el" "cedet/ede/speedbar.el" |
| 38060 | ;;;;;; "cedet/ede/shell.el" "cedet/ede/speedbar.el" "cedet/ede/system.el" | 38055 | ;;;;;; "cedet/ede/system.el" "cedet/ede/util.el" "cedet/semantic/analyze.el" |
| 38061 | ;;;;;; "cedet/ede/util.el" "cedet/semantic/analyze.el" "cedet/semantic/analyze/complete.el" | 38056 | ;;;;;; "cedet/semantic/analyze/complete.el" "cedet/semantic/analyze/refs.el" |
| 38062 | ;;;;;; "cedet/semantic/analyze/refs.el" "cedet/semantic/bovine.el" | 38057 | ;;;;;; "cedet/semantic/bovine.el" "cedet/semantic/bovine/c.el" "cedet/semantic/bovine/el.el" |
| 38063 | ;;;;;; "cedet/semantic/bovine/c.el" "cedet/semantic/bovine/el.el" | ||
| 38064 | ;;;;;; "cedet/semantic/bovine/gcc.el" "cedet/semantic/bovine/make.el" | 38058 | ;;;;;; "cedet/semantic/bovine/gcc.el" "cedet/semantic/bovine/make.el" |
| 38065 | ;;;;;; "cedet/semantic/bovine/scm.el" "cedet/semantic/complete.el" | 38059 | ;;;;;; "cedet/semantic/bovine/scm.el" "cedet/semantic/complete.el" |
| 38066 | ;;;;;; "cedet/semantic/ctxt.el" "cedet/semantic/db-file.el" "cedet/semantic/db-find.el" | 38060 | ;;;;;; "cedet/semantic/ctxt.el" "cedet/semantic/db-file.el" "cedet/semantic/db-find.el" |
| @@ -38071,40 +38065,38 @@ Zone out, completely. | |||
| 38071 | ;;;;;; "cedet/semantic/find.el" "cedet/semantic/format.el" "cedet/semantic/html.el" | 38065 | ;;;;;; "cedet/semantic/find.el" "cedet/semantic/format.el" "cedet/semantic/html.el" |
| 38072 | ;;;;;; "cedet/semantic/ia-sb.el" "cedet/semantic/ia.el" "cedet/semantic/idle.el" | 38066 | ;;;;;; "cedet/semantic/ia-sb.el" "cedet/semantic/ia.el" "cedet/semantic/idle.el" |
| 38073 | ;;;;;; "cedet/semantic/imenu.el" "cedet/semantic/lex-spp.el" "cedet/semantic/lex.el" | 38067 | ;;;;;; "cedet/semantic/imenu.el" "cedet/semantic/lex-spp.el" "cedet/semantic/lex.el" |
| 38074 | ;;;;;; "cedet/semantic/loaddefs.el" "cedet/semantic/mru-bookmark.el" | 38068 | ;;;;;; "cedet/semantic/mru-bookmark.el" "cedet/semantic/scope.el" |
| 38075 | ;;;;;; "cedet/semantic/scope.el" "cedet/semantic/senator.el" "cedet/semantic/sort.el" | 38069 | ;;;;;; "cedet/semantic/senator.el" "cedet/semantic/sort.el" "cedet/semantic/symref.el" |
| 38076 | ;;;;;; "cedet/semantic/symref.el" "cedet/semantic/symref/cscope.el" | 38070 | ;;;;;; "cedet/semantic/symref/cscope.el" "cedet/semantic/symref/global.el" |
| 38077 | ;;;;;; "cedet/semantic/symref/global.el" "cedet/semantic/symref/grep.el" | 38071 | ;;;;;; "cedet/semantic/symref/grep.el" "cedet/semantic/symref/idutils.el" |
| 38078 | ;;;;;; "cedet/semantic/symref/idutils.el" "cedet/semantic/symref/list.el" | 38072 | ;;;;;; "cedet/semantic/symref/list.el" "cedet/semantic/tag-file.el" |
| 38079 | ;;;;;; "cedet/semantic/tag-file.el" "cedet/semantic/tag-ls.el" "cedet/semantic/tag-write.el" | 38073 | ;;;;;; "cedet/semantic/tag-ls.el" "cedet/semantic/tag-write.el" |
| 38080 | ;;;;;; "cedet/semantic/tag.el" "cedet/semantic/texi.el" "cedet/semantic/util-modes.el" | 38074 | ;;;;;; "cedet/semantic/tag.el" "cedet/semantic/texi.el" "cedet/semantic/util-modes.el" |
| 38081 | ;;;;;; "cedet/semantic/wisent/java-tags.el" "cedet/semantic/wisent/javascript.el" | 38075 | ;;;;;; "cedet/semantic/wisent/java-tags.el" "cedet/semantic/wisent/javascript.el" |
| 38082 | ;;;;;; "cedet/semantic/wisent/python.el" "cedet/srecode/compile.el" | 38076 | ;;;;;; "cedet/semantic/wisent/python.el" "cedet/srecode/compile.el" |
| 38083 | ;;;;;; "cedet/srecode/cpp.el" "cedet/srecode/document.el" "cedet/srecode/el.el" | 38077 | ;;;;;; "cedet/srecode/cpp.el" "cedet/srecode/document.el" "cedet/srecode/el.el" |
| 38084 | ;;;;;; "cedet/srecode/expandproto.el" "cedet/srecode/getset.el" | 38078 | ;;;;;; "cedet/srecode/expandproto.el" "cedet/srecode/getset.el" |
| 38085 | ;;;;;; "cedet/srecode/insert.el" "cedet/srecode/java.el" "cedet/srecode/loaddefs.el" | 38079 | ;;;;;; "cedet/srecode/insert.el" "cedet/srecode/java.el" "cedet/srecode/map.el" |
| 38086 | ;;;;;; "cedet/srecode/map.el" "cedet/srecode/mode.el" "cedet/srecode/srt.el" | 38080 | ;;;;;; "cedet/srecode/mode.el" "cedet/srecode/srt.el" "cedet/srecode/template.el" |
| 38087 | ;;;;;; "cedet/srecode/template.el" "cedet/srecode/texi.el" "composite.el" | 38081 | ;;;;;; "cedet/srecode/texi.el" "composite.el" "cus-face.el" "cus-start.el" |
| 38088 | ;;;;;; "cus-face.el" "cus-start.el" "custom.el" "dired-aux.el" "dired-loaddefs.el" | 38082 | ;;;;;; "custom.el" "dired-aux.el" "dired-x.el" "electric.el" "emacs-lisp/backquote.el" |
| 38089 | ;;;;;; "dired-x.el" "electric.el" "emacs-lisp/backquote.el" "emacs-lisp/byte-run.el" | 38083 | ;;;;;; "emacs-lisp/byte-run.el" "emacs-lisp/cl-extra.el" "emacs-lisp/cl-macs.el" |
| 38090 | ;;;;;; "emacs-lisp/cl-extra.el" "emacs-lisp/cl-loaddefs.el" "emacs-lisp/cl-macs.el" | ||
| 38091 | ;;;;;; "emacs-lisp/cl-preloaded.el" "emacs-lisp/cl-seq.el" "emacs-lisp/eieio-compat.el" | 38084 | ;;;;;; "emacs-lisp/cl-preloaded.el" "emacs-lisp/cl-seq.el" "emacs-lisp/eieio-compat.el" |
| 38092 | ;;;;;; "emacs-lisp/eieio-custom.el" "emacs-lisp/eieio-loaddefs.el" | 38085 | ;;;;;; "emacs-lisp/eieio-custom.el" "emacs-lisp/eieio-opt.el" "emacs-lisp/eldoc.el" |
| 38093 | ;;;;;; "emacs-lisp/eieio-opt.el" "emacs-lisp/eldoc.el" "emacs-lisp/float-sup.el" | 38086 | ;;;;;; "emacs-lisp/float-sup.el" "emacs-lisp/lisp-mode.el" "emacs-lisp/lisp.el" |
| 38094 | ;;;;;; "emacs-lisp/lisp-mode.el" "emacs-lisp/lisp.el" "emacs-lisp/macroexp.el" | 38087 | ;;;;;; "emacs-lisp/macroexp.el" "emacs-lisp/map-ynp.el" "emacs-lisp/nadvice.el" |
| 38095 | ;;;;;; "emacs-lisp/map-ynp.el" "emacs-lisp/nadvice.el" "emacs-lisp/syntax.el" | 38088 | ;;;;;; "emacs-lisp/syntax.el" "emacs-lisp/timer.el" "env.el" "epa-hook.el" |
| 38096 | ;;;;;; "emacs-lisp/timer.el" "env.el" "epa-hook.el" "eshell/em-alias.el" | 38089 | ;;;;;; "eshell/em-alias.el" "eshell/em-banner.el" "eshell/em-basic.el" |
| 38097 | ;;;;;; "eshell/em-banner.el" "eshell/em-basic.el" "eshell/em-cmpl.el" | 38090 | ;;;;;; "eshell/em-cmpl.el" "eshell/em-dirs.el" "eshell/em-glob.el" |
| 38098 | ;;;;;; "eshell/em-dirs.el" "eshell/em-glob.el" "eshell/em-hist.el" | 38091 | ;;;;;; "eshell/em-hist.el" "eshell/em-ls.el" "eshell/em-pred.el" |
| 38099 | ;;;;;; "eshell/em-ls.el" "eshell/em-pred.el" "eshell/em-prompt.el" | 38092 | ;;;;;; "eshell/em-prompt.el" "eshell/em-rebind.el" "eshell/em-script.el" |
| 38100 | ;;;;;; "eshell/em-rebind.el" "eshell/em-script.el" "eshell/em-smart.el" | 38093 | ;;;;;; "eshell/em-smart.el" "eshell/em-term.el" "eshell/em-tramp.el" |
| 38101 | ;;;;;; "eshell/em-term.el" "eshell/em-tramp.el" "eshell/em-unix.el" | 38094 | ;;;;;; "eshell/em-unix.el" "eshell/em-xtra.el" "facemenu.el" "faces.el" |
| 38102 | ;;;;;; "eshell/em-xtra.el" "eshell/esh-groups.el" "facemenu.el" | 38095 | ;;;;;; "files.el" "font-core.el" "font-lock.el" "format.el" "frame.el" |
| 38103 | ;;;;;; "faces.el" "files.el" "font-core.el" "font-lock.el" "format.el" | 38096 | ;;;;;; "help.el" "hfy-cmap.el" "htmlfontify-loaddefs.el" "ibuf-ext.el" |
| 38104 | ;;;;;; "frame.el" "help.el" "hfy-cmap.el" "htmlfontify-loaddefs.el" | 38097 | ;;;;;; "indent.el" "international/characters.el" "international/charprop.el" |
| 38105 | ;;;;;; "ibuf-ext.el" "ibuffer-loaddefs.el" "indent.el" "international/characters.el" | 38098 | ;;;;;; "international/charscript.el" "international/cp51932.el" |
| 38106 | ;;;;;; "international/charprop.el" "international/charscript.el" | 38099 | ;;;;;; "international/eucjp-ms.el" "international/mule-cmds.el" |
| 38107 | ;;;;;; "international/cp51932.el" "international/eucjp-ms.el" "international/mule-cmds.el" | ||
| 38108 | ;;;;;; "international/mule-conf.el" "international/mule.el" "international/uni-bidi.el" | 38100 | ;;;;;; "international/mule-conf.el" "international/mule.el" "international/uni-bidi.el" |
| 38109 | ;;;;;; "international/uni-brackets.el" "international/uni-category.el" | 38101 | ;;;;;; "international/uni-brackets.el" "international/uni-category.el" |
| 38110 | ;;;;;; "international/uni-combining.el" "international/uni-comment.el" | 38102 | ;;;;;; "international/uni-combining.el" "international/uni-comment.el" |
| @@ -38132,32 +38124,30 @@ Zone out, completely. | |||
| 38132 | ;;;;;; "leim/quail/pypunct-b5.el" "leim/quail/rfc1345.el" "leim/quail/sgml-input.el" | 38124 | ;;;;;; "leim/quail/pypunct-b5.el" "leim/quail/rfc1345.el" "leim/quail/sgml-input.el" |
| 38133 | ;;;;;; "leim/quail/slovak.el" "leim/quail/symbol-ksc.el" "leim/quail/tamil-dvorak.el" | 38125 | ;;;;;; "leim/quail/slovak.el" "leim/quail/symbol-ksc.el" "leim/quail/tamil-dvorak.el" |
| 38134 | ;;;;;; "leim/quail/vntelex.el" "leim/quail/vnvni.el" "leim/quail/welsh.el" | 38126 | ;;;;;; "leim/quail/vntelex.el" "leim/quail/vnvni.el" "leim/quail/welsh.el" |
| 38135 | ;;;;;; "loadup.el" "mail/blessmail.el" "mail/rmail-loaddefs.el" | 38127 | ;;;;;; "loadup.el" "mail/blessmail.el" "mail/rmailedit.el" "mail/rmailkwd.el" |
| 38136 | ;;;;;; "mail/rmailedit.el" "mail/rmailkwd.el" "mail/rmailmm.el" | 38128 | ;;;;;; "mail/rmailmm.el" "mail/rmailmsc.el" "mail/rmailsort.el" |
| 38137 | ;;;;;; "mail/rmailmsc.el" "mail/rmailsort.el" "mail/rmailsum.el" | 38129 | ;;;;;; "mail/rmailsum.el" "mail/undigest.el" "menu-bar.el" "mh-e/mh-gnus.el" |
| 38138 | ;;;;;; "mail/undigest.el" "menu-bar.el" "mh-e/mh-gnus.el" "mh-e/mh-loaddefs.el" | 38130 | ;;;;;; "mh-e/mh-loaddefs.el" "minibuffer.el" "mouse.el" "net/tramp-loaddefs.el" |
| 38139 | ;;;;;; "minibuffer.el" "mouse.el" "net/tramp-loaddefs.el" "newcomment.el" | 38131 | ;;;;;; "newcomment.el" "obarray.el" "org/ob-core.el" "org/ob-keys.el" |
| 38140 | ;;;;;; "obarray.el" "org/ob-core.el" "org/ob-keys.el" "org/ob-lob.el" | 38132 | ;;;;;; "org/ob-lob.el" "org/ob-matlab.el" "org/ob-tangle.el" "org/ob.el" |
| 38141 | ;;;;;; "org/ob-matlab.el" "org/ob-tangle.el" "org/ob.el" "org/org-archive.el" | 38133 | ;;;;;; "org/org-archive.el" "org/org-attach.el" "org/org-bbdb.el" |
| 38142 | ;;;;;; "org/org-attach.el" "org/org-bbdb.el" "org/org-clock.el" | 38134 | ;;;;;; "org/org-clock.el" "org/org-datetree.el" "org/org-element.el" |
| 38143 | ;;;;;; "org/org-datetree.el" "org/org-element.el" "org/org-feed.el" | 38135 | ;;;;;; "org/org-feed.el" "org/org-footnote.el" "org/org-id.el" "org/org-indent.el" |
| 38144 | ;;;;;; "org/org-footnote.el" "org/org-id.el" "org/org-indent.el" | 38136 | ;;;;;; "org/org-install.el" "org/org-irc.el" "org/org-mobile.el" |
| 38145 | ;;;;;; "org/org-install.el" "org/org-irc.el" "org/org-loaddefs.el" | 38137 | ;;;;;; "org/org-plot.el" "org/org-table.el" "org/org-timer.el" "org/ox-ascii.el" |
| 38146 | ;;;;;; "org/org-mobile.el" "org/org-plot.el" "org/org-table.el" | 38138 | ;;;;;; "org/ox-beamer.el" "org/ox-html.el" "org/ox-icalendar.el" |
| 38147 | ;;;;;; "org/org-timer.el" "org/ox-ascii.el" "org/ox-beamer.el" "org/ox-html.el" | 38139 | ;;;;;; "org/ox-latex.el" "org/ox-man.el" "org/ox-md.el" "org/ox-odt.el" |
| 38148 | ;;;;;; "org/ox-icalendar.el" "org/ox-latex.el" "org/ox-man.el" "org/ox-md.el" | 38140 | ;;;;;; "org/ox-org.el" "org/ox-publish.el" "org/ox-texinfo.el" "org/ox.el" |
| 38149 | ;;;;;; "org/ox-odt.el" "org/ox-org.el" "org/ox-publish.el" "org/ox-texinfo.el" | 38141 | ;;;;;; "progmodes/elisp-mode.el" "progmodes/prog-mode.el" "ps-def.el" |
| 38150 | ;;;;;; "org/ox.el" "progmodes/elisp-mode.el" "progmodes/prog-mode.el" | 38142 | ;;;;;; "ps-mule.el" "register.el" "replace.el" "rfn-eshadow.el" |
| 38151 | ;;;;;; "ps-def.el" "ps-mule.el" "ps-print-loaddefs.el" "register.el" | 38143 | ;;;;;; "select.el" "simple.el" "startup.el" "subdirs.el" "subr.el" |
| 38152 | ;;;;;; "replace.el" "rfn-eshadow.el" "select.el" "simple.el" "startup.el" | 38144 | ;;;;;; "textmodes/fill.el" "textmodes/page.el" "textmodes/paragraphs.el" |
| 38153 | ;;;;;; "subdirs.el" "subr.el" "textmodes/fill.el" "textmodes/page.el" | 38145 | ;;;;;; "textmodes/reftex-auc.el" "textmodes/reftex-cite.el" "textmodes/reftex-dcr.el" |
| 38154 | ;;;;;; "textmodes/paragraphs.el" "textmodes/reftex-auc.el" "textmodes/reftex-cite.el" | 38146 | ;;;;;; "textmodes/reftex-global.el" "textmodes/reftex-index.el" |
| 38155 | ;;;;;; "textmodes/reftex-dcr.el" "textmodes/reftex-global.el" "textmodes/reftex-index.el" | 38147 | ;;;;;; "textmodes/reftex-parse.el" "textmodes/reftex-ref.el" "textmodes/reftex-sel.el" |
| 38156 | ;;;;;; "textmodes/reftex-loaddefs.el" "textmodes/reftex-parse.el" | 38148 | ;;;;;; "textmodes/reftex-toc.el" "textmodes/text-mode.el" "uniquify.el" |
| 38157 | ;;;;;; "textmodes/reftex-ref.el" "textmodes/reftex-sel.el" "textmodes/reftex-toc.el" | 38149 | ;;;;;; "vc/ediff-hook.el" "vc/vc-hooks.el" "version.el" "widget.el" |
| 38158 | ;;;;;; "textmodes/text-mode.el" "uniquify.el" "vc/ediff-hook.el" | 38150 | ;;;;;; "window.el") (0 0 0 0)) |
| 38159 | ;;;;;; "vc/vc-hooks.el" "version.el" "widget.el" "window.el") (0 | ||
| 38160 | ;;;;;; 0 0 0)) | ||
| 38161 | 38151 | ||
| 38162 | ;;;*** | 38152 | ;;;*** |
| 38163 | 38153 | ||
diff --git a/lisp/man.el b/lisp/man.el index 4f6e1187e0d..0e1c92956b3 100644 --- a/lisp/man.el +++ b/lisp/man.el | |||
| @@ -832,10 +832,7 @@ indicating optional parts and whitespace being interpreted | |||
| 832 | somewhat loosely. | 832 | somewhat loosely. |
| 833 | 833 | ||
| 834 | foo[, bar [, ...]] [other stuff] (sec) - description | 834 | foo[, bar [, ...]] [other stuff] (sec) - description |
| 835 | foo(sec)[, bar(sec) [, ...]] [other stuff] - description | 835 | foo(sec)[, bar(sec) [, ...]] [other stuff] - description" |
| 836 | |||
| 837 | For more details and some regression tests, please see | ||
| 838 | test/automated/man-tests.el in the emacs repository." | ||
| 839 | (goto-char (point-min)) | 836 | (goto-char (point-min)) |
| 840 | ;; See man-tests for data about which systems use which format (hopefully we | 837 | ;; See man-tests for data about which systems use which format (hopefully we |
| 841 | ;; will be able to simplify the code if/when some of those formats aren't | 838 | ;; will be able to simplify the code if/when some of those formats aren't |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 6ec647e8028..7472c4133ad 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -933,17 +933,19 @@ If EXTERNAL, browse the URL using `shr-external-browser'." | |||
| 933 | (let ((data (shr-parse-image-data))) | 933 | (let ((data (shr-parse-image-data))) |
| 934 | (with-current-buffer buffer | 934 | (with-current-buffer buffer |
| 935 | (save-excursion | 935 | (save-excursion |
| 936 | (let ((alt (buffer-substring start end)) | 936 | (save-restriction |
| 937 | (properties (text-properties-at start)) | 937 | (widen) |
| 938 | (inhibit-read-only t)) | 938 | (let ((alt (buffer-substring start end)) |
| 939 | (delete-region start end) | 939 | (properties (text-properties-at start)) |
| 940 | (goto-char start) | 940 | (inhibit-read-only t)) |
| 941 | (funcall shr-put-image-function data alt flags) | 941 | (delete-region start end) |
| 942 | (while properties | 942 | (goto-char start) |
| 943 | (let ((type (pop properties)) | 943 | (funcall shr-put-image-function data alt flags) |
| 944 | (value (pop properties))) | 944 | (while properties |
| 945 | (unless (memq type '(display image-size)) | 945 | (let ((type (pop properties)) |
| 946 | (put-text-property start (point) type value)))))))))) | 946 | (value (pop properties))) |
| 947 | (unless (memq type '(display image-size)) | ||
| 948 | (put-text-property start (point) type value))))))))))) | ||
| 947 | (kill-buffer image-buffer))) | 949 | (kill-buffer image-buffer))) |
| 948 | 950 | ||
| 949 | (defun shr-image-from-data (data) | 951 | (defun shr-image-from-data (data) |
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index bf89ab37123..240e017279c 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-adb.el --- Functions for calling Android Debug Bridge from Tramp | 1 | ;;; tramp-adb.el --- Functions for calling Android Debug Bridge from Tramp -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2011-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2011-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -94,9 +94,6 @@ It is used for TCP/IP devices." | |||
| 94 | tramp-adb-method '((tramp-adb-parse-device-names "")))) | 94 | tramp-adb-method '((tramp-adb-parse-device-names "")))) |
| 95 | 95 | ||
| 96 | ;;;###tramp-autoload | 96 | ;;;###tramp-autoload |
| 97 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 98 | (cons 'tramp-adb-file-name-p 'tramp-adb-file-name-handler)) | ||
| 99 | |||
| 100 | (defconst tramp-adb-file-name-handler-alist | 97 | (defconst tramp-adb-file-name-handler-alist |
| 101 | '((access-file . ignore) | 98 | '((access-file . ignore) |
| 102 | (add-name-to-file . tramp-adb-handle-copy-file) | 99 | (add-name-to-file . tramp-adb-handle-copy-file) |
| @@ -190,6 +187,10 @@ pass to the OPERATION." | |||
| 190 | (tramp-run-real-handler operation args)))) | 187 | (tramp-run-real-handler operation args)))) |
| 191 | 188 | ||
| 192 | ;;;###tramp-autoload | 189 | ;;;###tramp-autoload |
| 190 | (tramp-register-foreign-file-name-handler | ||
| 191 | 'tramp-adb-file-name-p 'tramp-adb-file-name-handler) | ||
| 192 | |||
| 193 | ;;;###tramp-autoload | ||
| 193 | (defun tramp-adb-parse-device-names (_ignore) | 194 | (defun tramp-adb-parse-device-names (_ignore) |
| 194 | "Return a list of (nil host) tuples allowed to access." | 195 | "Return a list of (nil host) tuples allowed to access." |
| 195 | (with-timeout (10) | 196 | (with-timeout (10) |
| @@ -209,7 +210,7 @@ pass to the OPERATION." | |||
| 209 | (tramp-message v 6 "\n%s" (buffer-string)) | 210 | (tramp-message v 6 "\n%s" (buffer-string)) |
| 210 | (goto-char (point-min)) | 211 | (goto-char (point-min)) |
| 211 | (while (search-forward-regexp "^\\(\\S-+\\)[[:space:]]+device$" nil t) | 212 | (while (search-forward-regexp "^\\(\\S-+\\)[[:space:]]+device$" nil t) |
| 212 | (add-to-list 'result (list nil (match-string 1)))) | 213 | (push (list nil (match-string 1)) result)) |
| 213 | 214 | ||
| 214 | ;; Replace ":" by "#". | 215 | ;; Replace ":" by "#". |
| 215 | (mapc | 216 | (mapc |
| @@ -1060,8 +1061,7 @@ E.g. a host name \"192.168.1.1#5555\" returns \"192.168.1.1:5555\" | |||
| 1060 | ;; unwanted entries first. | 1061 | ;; unwanted entries first. |
| 1061 | (tramp-flush-connection-property nil) | 1062 | (tramp-flush-connection-property nil) |
| 1062 | (with-tramp-connection-property (tramp-get-connection-process vec) "device" | 1063 | (with-tramp-connection-property (tramp-get-connection-process vec) "device" |
| 1063 | (let* ((method (tramp-file-name-method vec)) | 1064 | (let* ((host (tramp-file-name-host vec)) |
| 1064 | (host (tramp-file-name-host vec)) | ||
| 1065 | (port (tramp-file-name-port vec)) | 1065 | (port (tramp-file-name-port vec)) |
| 1066 | (devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))) | 1066 | (devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))) |
| 1067 | (replace-regexp-in-string | 1067 | (replace-regexp-in-string |
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index ce7df02e094..64268cfc25a 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-cache.el --- file information caching for Tramp | 1 | ;;; tramp-cache.el --- file information caching for Tramp -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2000, 2005-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2000, 2005-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 576f9b1eadc..c41b5b5659e 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-cmds.el --- Interactive commands for Tramp | 1 | ;;; tramp-cmds.el --- Interactive commands for Tramp -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2007-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2007-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 8e5b3e45d13..8f346eb4409 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-compat.el --- Tramp compatibility functions | 1 | ;;; tramp-compat.el --- Tramp compatibility functions -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2007-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2007-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 85e4f2b0f0c..231383fde3d 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP | 1 | ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2002-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2002-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 7725d40f198..59d8771cf1d 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-gvfs.el --- Tramp access functions for GVFS daemon | 1 | ;;; tramp-gvfs.el --- Tramp access functions for GVFS daemon -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2009-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2009-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -452,6 +452,7 @@ Every entry is a list (NAME ADDRESS).") | |||
| 452 | 452 | ||
| 453 | 453 | ||
| 454 | ;; New handlers should be added here. | 454 | ;; New handlers should be added here. |
| 455 | ;;;###tramp-autoload | ||
| 455 | (defconst tramp-gvfs-file-name-handler-alist | 456 | (defconst tramp-gvfs-file-name-handler-alist |
| 456 | '((access-file . ignore) | 457 | '((access-file . ignore) |
| 457 | (add-name-to-file . tramp-gvfs-handle-copy-file) | 458 | (add-name-to-file . tramp-gvfs-handle-copy-file) |
| @@ -548,12 +549,10 @@ pass to the OPERATION." | |||
| 548 | (save-match-data (apply (cdr fn) args)) | 549 | (save-match-data (apply (cdr fn) args)) |
| 549 | (tramp-run-real-handler operation args)))) | 550 | (tramp-run-real-handler operation args)))) |
| 550 | 551 | ||
| 551 | ;; This might be moved to tramp.el. It shall be the first file name | ||
| 552 | ;; handler. | ||
| 553 | ;;;###tramp-autoload | 552 | ;;;###tramp-autoload |
| 554 | (when (featurep 'dbusbind) | 553 | (when (featurep 'dbusbind) |
| 555 | (add-to-list 'tramp-foreign-file-name-handler-alist | 554 | (tramp-register-foreign-file-name-handler |
| 556 | (cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler))) | 555 | 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler)) |
| 557 | 556 | ||
| 558 | 557 | ||
| 559 | ;; D-Bus helper function. | 558 | ;; D-Bus helper function. |
| @@ -1874,12 +1873,9 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi." | |||
| 1874 | (lambda (x) | 1873 | (lambda (x) |
| 1875 | (let* ((list (split-string x ";")) | 1874 | (let* ((list (split-string x ";")) |
| 1876 | (host (nth 6 list)) | 1875 | (host (nth 6 list)) |
| 1877 | (port (nth 8 list)) | ||
| 1878 | (text (tramp-compat-funcall | 1876 | (text (tramp-compat-funcall |
| 1879 | 'split-string (nth 9 list) "\" \"" 'omit "\"")) | 1877 | 'split-string (nth 9 list) "\" \"" 'omit "\"")) |
| 1880 | user) | 1878 | user) |
| 1881 | ; (when (and port (not (string-equal port "0"))) | ||
| 1882 | ; (setq host (format "%s%s%s" host tramp-prefix-port-regexp port))) | ||
| 1883 | ;; A user is marked in a TXT field like "u=guest". | 1879 | ;; A user is marked in a TXT field like "u=guest". |
| 1884 | (while text | 1880 | (while text |
| 1885 | (when (string-match "u=\\(.+\\)$" (car text)) | 1881 | (when (string-match "u=\\(.+\\)$" (car text)) |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index af27d3e28ec..e4a48b7f8e2 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections | 1 | ;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -33,6 +33,9 @@ | |||
| 33 | (eval-when-compile | 33 | (eval-when-compile |
| 34 | (require 'cl) | 34 | (require 'cl) |
| 35 | (require 'dired)) | 35 | (require 'dired)) |
| 36 | |||
| 37 | (declare-function dired-remove-file "dired-aux") | ||
| 38 | (defvar dired-compress-file-suffixes) | ||
| 36 | (defvar vc-handled-backends) | 39 | (defvar vc-handled-backends) |
| 37 | (defvar vc-bzr-program) | 40 | (defvar vc-bzr-program) |
| 38 | (defvar vc-git-program) | 41 | (defvar vc-git-program) |
| @@ -978,6 +981,7 @@ here-document, otherwise the command could exceed maximum length | |||
| 978 | of command line.") | 981 | of command line.") |
| 979 | 982 | ||
| 980 | ;; New handlers should be added here. | 983 | ;; New handlers should be added here. |
| 984 | ;;;###tramp-autoload | ||
| 981 | (defconst tramp-sh-file-name-handler-alist | 985 | (defconst tramp-sh-file-name-handler-alist |
| 982 | '(;; `access-file' performed by default handler. | 986 | '(;; `access-file' performed by default handler. |
| 983 | (add-name-to-file . tramp-sh-handle-add-name-to-file) | 987 | (add-name-to-file . tramp-sh-handle-add-name-to-file) |
| @@ -1051,11 +1055,6 @@ of command line.") | |||
| 1051 | "Alist of handler functions. | 1055 | "Alist of handler functions. |
| 1052 | Operations not mentioned here will be handled by the normal Emacs functions.") | 1056 | Operations not mentioned here will be handled by the normal Emacs functions.") |
| 1053 | 1057 | ||
| 1054 | ;; This must be the last entry, because `identity' always matches. | ||
| 1055 | ;;;###tramp-autoload | ||
| 1056 | (add-to-list 'tramp-foreign-file-name-handler-alist | ||
| 1057 | '(identity . tramp-sh-file-name-handler) 'append) | ||
| 1058 | |||
| 1059 | ;;; File Name Handler Functions: | 1058 | ;;; File Name Handler Functions: |
| 1060 | 1059 | ||
| 1061 | (defun tramp-sh-handle-make-symbolic-link | 1060 | (defun tramp-sh-handle-make-symbolic-link |
| @@ -2593,9 +2592,6 @@ The method used must be an out-of-band method." | |||
| 2593 | 2592 | ||
| 2594 | ;; Dired. | 2593 | ;; Dired. |
| 2595 | 2594 | ||
| 2596 | (defvar dired-compress-file-suffixes) | ||
| 2597 | (declare-function dired-remove-file "dired-aux") | ||
| 2598 | |||
| 2599 | (defun tramp-sh-handle-dired-compress-file (file) | 2595 | (defun tramp-sh-handle-dired-compress-file (file) |
| 2600 | "Like `dired-compress-file' for Tramp files." | 2596 | "Like `dired-compress-file' for Tramp files." |
| 2601 | ;; Code stolen mainly from dired-aux.el. | 2597 | ;; Code stolen mainly from dired-aux.el. |
| @@ -3536,6 +3532,11 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 3536 | (tramp-run-real-handler operation args))))) | 3532 | (tramp-run-real-handler operation args))))) |
| 3537 | (setq tramp-locked tl)))) | 3533 | (setq tramp-locked tl)))) |
| 3538 | 3534 | ||
| 3535 | ;; This must be the last entry, because `identity' always matches. | ||
| 3536 | ;;;###tramp-autoload | ||
| 3537 | (tramp-register-foreign-file-name-handler | ||
| 3538 | 'identity 'tramp-sh-file-name-handler 'append) | ||
| 3539 | |||
| 3539 | (defun tramp-vc-file-name-handler (operation &rest args) | 3540 | (defun tramp-vc-file-name-handler (operation &rest args) |
| 3540 | "Invoke special file name handler, which collects files to be handled." | 3541 | "Invoke special file name handler, which collects files to be handled." |
| 3541 | (save-match-data | 3542 | (save-match-data |
| @@ -5221,7 +5222,7 @@ Nonexistent directories are removed from spec." | |||
| 5221 | "Determine remote locale, supporting UTF8 if possible." | 5222 | "Determine remote locale, supporting UTF8 if possible." |
| 5222 | (with-tramp-connection-property vec "locale" | 5223 | (with-tramp-connection-property vec "locale" |
| 5223 | (tramp-send-command vec "locale -a") | 5224 | (tramp-send-command vec "locale -a") |
| 5224 | (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8")) | 5225 | (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8" "C.UTF-8")) |
| 5225 | locale) | 5226 | locale) |
| 5226 | (with-current-buffer (tramp-get-connection-buffer vec) | 5227 | (with-current-buffer (tramp-get-connection-buffer vec) |
| 5227 | (while candidates | 5228 | (while candidates |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 91f69567573..4205376d655 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-smb.el --- Tramp access functions for SMB servers | 1 | ;;; tramp-smb.el --- Tramp access functions for SMB servers -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2002-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2002-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -157,6 +157,7 @@ call, letting the SMB client use the default one." | |||
| 157 | "NT_STATUS_OBJECT_NAME_COLLISION" | 157 | "NT_STATUS_OBJECT_NAME_COLLISION" |
| 158 | "NT_STATUS_OBJECT_NAME_INVALID" | 158 | "NT_STATUS_OBJECT_NAME_INVALID" |
| 159 | "NT_STATUS_OBJECT_NAME_NOT_FOUND" | 159 | "NT_STATUS_OBJECT_NAME_NOT_FOUND" |
| 160 | "NT_STATUS_PASSWORD_MUST_CHANGE" | ||
| 160 | "NT_STATUS_SHARING_VIOLATION" | 161 | "NT_STATUS_SHARING_VIOLATION" |
| 161 | "NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE" | 162 | "NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE" |
| 162 | "NT_STATUS_UNSUCCESSFUL" | 163 | "NT_STATUS_UNSUCCESSFUL" |
| @@ -217,6 +218,7 @@ This list is used for smbcacls actions. | |||
| 217 | See `tramp-actions-before-shell' for more info.") | 218 | See `tramp-actions-before-shell' for more info.") |
| 218 | 219 | ||
| 219 | ;; New handlers should be added here. | 220 | ;; New handlers should be added here. |
| 221 | ;;;###tramp-autoload | ||
| 220 | (defconst tramp-smb-file-name-handler-alist | 222 | (defconst tramp-smb-file-name-handler-alist |
| 221 | '(;; `access-file' performed by default handler. | 223 | '(;; `access-file' performed by default handler. |
| 222 | (add-name-to-file . tramp-smb-handle-add-name-to-file) | 224 | (add-name-to-file . tramp-smb-handle-add-name-to-file) |
| @@ -340,9 +342,8 @@ pass to the OPERATION." | |||
| 340 | 342 | ||
| 341 | ;;;###tramp-autoload | 343 | ;;;###tramp-autoload |
| 342 | (unless (memq system-type '(cygwin windows-nt)) | 344 | (unless (memq system-type '(cygwin windows-nt)) |
| 343 | (add-to-list 'tramp-foreign-file-name-handler-alist | 345 | (tramp-register-foreign-file-name-handler |
| 344 | (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler))) | 346 | 'tramp-smb-file-name-p 'tramp-smb-file-name-handler)) |
| 345 | |||
| 346 | 347 | ||
| 347 | ;; File name primitives. | 348 | ;; File name primitives. |
| 348 | 349 | ||
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el index 0aa2cc09924..5e5f05da4a8 100644 --- a/lisp/net/tramp-uu.el +++ b/lisp/net/tramp-uu.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-uu.el --- uuencode in Lisp | 1 | ;;; tramp-uu.el --- uuencode in Lisp -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2002-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2002-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index fdd4661decb..0ca5a6d3acb 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp.el --- Transparent Remote Access, Multiple Protocol | 1 | ;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -60,7 +60,10 @@ | |||
| 60 | ;; Pacify byte-compiler. | 60 | ;; Pacify byte-compiler. |
| 61 | (eval-when-compile | 61 | (eval-when-compile |
| 62 | (require 'cl)) | 62 | (require 'cl)) |
| 63 | (defvar auto-save-file-name-transforms) | ||
| 63 | (defvar eshell-path-env) | 64 | (defvar eshell-path-env) |
| 65 | (defvar ls-lisp-use-insert-directory-program) | ||
| 66 | (defvar outline-regexp) | ||
| 64 | 67 | ||
| 65 | ;;; User Customizable Internal Variables: | 68 | ;;; User Customizable Internal Variables: |
| 66 | 69 | ||
| @@ -1052,8 +1055,7 @@ means to use always cached values for the directory contents." | |||
| 1052 | 1055 | ||
| 1053 | ;;;###autoload | 1056 | ;;;###autoload |
| 1054 | (defconst tramp-completion-file-name-handler-alist | 1057 | (defconst tramp-completion-file-name-handler-alist |
| 1055 | '(;(expand-file-name . tramp-completion-handle-expand-file-name) | 1058 | '((file-name-all-completions |
| 1056 | (file-name-all-completions | ||
| 1057 | . tramp-completion-handle-file-name-all-completions) | 1059 | . tramp-completion-handle-file-name-all-completions) |
| 1058 | (file-name-completion . tramp-completion-handle-file-name-completion)) | 1060 | (file-name-completion . tramp-completion-handle-file-name-completion)) |
| 1059 | "Alist of completion handler functions. | 1061 | "Alist of completion handler functions. |
| @@ -1374,8 +1376,6 @@ Point must be at the beginning of a header line. | |||
| 1374 | The outline level is equal to the verbosity of the Tramp message." | 1376 | The outline level is equal to the verbosity of the Tramp message." |
| 1375 | (1+ (string-to-number (match-string 1)))) | 1377 | (1+ (string-to-number (match-string 1)))) |
| 1376 | 1378 | ||
| 1377 | (defvar outline-regexp) | ||
| 1378 | |||
| 1379 | (defun tramp-get-debug-buffer (vec) | 1379 | (defun tramp-get-debug-buffer (vec) |
| 1380 | "Get the debug buffer for VEC." | 1380 | "Get the debug buffer for VEC." |
| 1381 | (with-current-buffer | 1381 | (with-current-buffer |
| @@ -1871,13 +1871,12 @@ temporary file names. If `file-coding-system-alist' contains an | |||
| 1871 | expression, which matches more than the file name suffix, the | 1871 | expression, which matches more than the file name suffix, the |
| 1872 | coding system might not be determined. This function repairs it." | 1872 | coding system might not be determined. This function repairs it." |
| 1873 | (let (result) | 1873 | (let (result) |
| 1874 | (dolist (elt file-coding-system-alist result) | 1874 | (dolist (elt file-coding-system-alist (nreverse result)) |
| 1875 | (when (and (consp elt) (string-match (car elt) filename)) | 1875 | (when (and (consp elt) (string-match (car elt) filename)) |
| 1876 | ;; We found a matching entry in `file-coding-system-alist'. | 1876 | ;; We found a matching entry in `file-coding-system-alist'. |
| 1877 | ;; So we add a similar entry, but with the temporary file name | 1877 | ;; So we add a similar entry, but with the temporary file name |
| 1878 | ;; as regexp. | 1878 | ;; as regexp. |
| 1879 | (add-to-list | 1879 | (push (cons (regexp-quote tmpname) (cdr elt)) result))))) |
| 1880 | 'result (cons (regexp-quote tmpname) (cdr elt)) 'append))))) | ||
| 1881 | 1880 | ||
| 1882 | ;;;###autoload | 1881 | ;;;###autoload |
| 1883 | (progn (defun tramp-run-real-handler (operation args) | 1882 | (progn (defun tramp-run-real-handler (operation args) |
| @@ -1995,6 +1994,7 @@ ARGS are the arguments OPERATION has been called with." | |||
| 1995 | (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers))) | 1994 | (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers))) |
| 1996 | 1995 | ||
| 1997 | ;; Main function. | 1996 | ;; Main function. |
| 1997 | ;;;###autoload | ||
| 1998 | (defun tramp-file-name-handler (operation &rest args) | 1998 | (defun tramp-file-name-handler (operation &rest args) |
| 1999 | "Invoke Tramp file name handler. | 1999 | "Invoke Tramp file name handler. |
| 2000 | Falls back to normal file name handler if no Tramp file name handler exists." | 2000 | Falls back to normal file name handler if no Tramp file name handler exists." |
| @@ -2113,20 +2113,7 @@ preventing reentrant calls of Tramp.") | |||
| 2113 | Together with `tramp-locked', this implements a locking mechanism | 2113 | Together with `tramp-locked', this implements a locking mechanism |
| 2114 | preventing reentrant calls of Tramp.") | 2114 | preventing reentrant calls of Tramp.") |
| 2115 | 2115 | ||
| 2116 | ;; Avoid recursive loading of tramp.el. | 2116 | ;;;###autoload |
| 2117 | ;; FIXME: This must go better. Checking for `operation' is wrong. | ||
| 2118 | ;;;###autoload(defun tramp-completion-file-name-handler (operation &rest args) | ||
| 2119 | ;;;###autoload (let ((fn | ||
| 2120 | ;;;###autoload (assoc | ||
| 2121 | ;;;###autoload operation tramp-completion-file-name-handler-alist))) | ||
| 2122 | ;;;###autoload (if (and | ||
| 2123 | ;;;###autoload tramp-mode fn (null load-in-progress) | ||
| 2124 | ;;;###autoload (member | ||
| 2125 | ;;;###autoload operation | ||
| 2126 | ;;;###autoload '(file-name-all-completions file-name-completion))) | ||
| 2127 | ;;;###autoload (apply 'tramp-autoload-file-name-handler operation args) | ||
| 2128 | ;;;###autoload (tramp-run-real-handler operation args)))) | ||
| 2129 | |||
| 2130 | (defun tramp-completion-file-name-handler (operation &rest args) | 2117 | (defun tramp-completion-file-name-handler (operation &rest args) |
| 2131 | "Invoke Tramp file name completion handler. | 2118 | "Invoke Tramp file name completion handler. |
| 2132 | Falls back to normal file name handler if no Tramp file name handler exists." | 2119 | Falls back to normal file name handler if no Tramp file name handler exists." |
| @@ -2135,36 +2122,26 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2135 | (save-match-data (apply (cdr fn) args)) | 2122 | (save-match-data (apply (cdr fn) args)) |
| 2136 | (tramp-run-real-handler operation args)))) | 2123 | (tramp-run-real-handler operation args)))) |
| 2137 | 2124 | ||
| 2138 | ;;;###autoload | 2125 | ;; `tramp-file-name-handler' must be registered before evaluation of |
| 2139 | (progn (defun tramp-autoload-file-name-handler (operation &rest args) | 2126 | ;; site-start and init files, because there might exist remote files |
| 2140 | "Load Tramp file name handler, and perform OPERATION." | 2127 | ;; already, f.e. files kept via recentf-mode. |
| 2141 | (if (and | ||
| 2142 | ;; Do not load tramp.el just for "/". | ||
| 2143 | (not (and (stringp (car args)) (string-equal (car args) "/"))) | ||
| 2144 | ;; Avoid recursive loading of tramp.el. | ||
| 2145 | (let ((default-directory temporary-file-directory)) | ||
| 2146 | (and (null load-in-progress) (load "tramp" 'noerror 'nomessage)))) | ||
| 2147 | (apply operation args) | ||
| 2148 | ;; tramp.el not needed or not available for loading, fall back. | ||
| 2149 | (tramp-run-real-handler operation args)))) | ||
| 2150 | |||
| 2151 | ;; `tramp-autoload-file-name-handler' must be registered before | ||
| 2152 | ;; evaluation of site-start and init files, because there might exist | ||
| 2153 | ;; remote files already, f.e. files kept via recentf-mode. We cannot | ||
| 2154 | ;; autoload `tramp-file-name-handler', because it would result in | ||
| 2155 | ;; recursive loading of tramp.el when `default-directory' is set to | ||
| 2156 | ;; remote. | ||
| 2157 | ;;;###autoload | 2128 | ;;;###autoload |
| 2158 | (progn (defun tramp-register-autoload-file-name-handlers () | 2129 | (progn (defun tramp-register-autoload-file-name-handlers () |
| 2159 | "Add Tramp file name handlers to `file-name-handler-alist' during autoload." | 2130 | "Add Tramp file name handlers to `file-name-handler-alist' during autoload." |
| 2160 | (add-to-list 'file-name-handler-alist | 2131 | (add-to-list 'file-name-handler-alist |
| 2161 | (cons tramp-file-name-regexp | 2132 | (cons tramp-file-name-regexp 'tramp-file-name-handler)) |
| 2162 | 'tramp-autoload-file-name-handler)) | 2133 | (put 'tramp-file-name-handler 'safe-magic t) |
| 2163 | (put 'tramp-autoload-file-name-handler 'safe-magic t) | 2134 | ;; Mark `operations' the handler is responsible for. It's a short list ... |
| 2135 | (put 'tramp-file-name-handler 'operations | ||
| 2136 | '(file-name-all-completions file-name-completion file-remote-p)) | ||
| 2137 | |||
| 2164 | (add-to-list 'file-name-handler-alist | 2138 | (add-to-list 'file-name-handler-alist |
| 2165 | (cons tramp-completion-file-name-regexp | 2139 | (cons tramp-completion-file-name-regexp |
| 2166 | 'tramp-completion-file-name-handler)) | 2140 | 'tramp-completion-file-name-handler)) |
| 2167 | (put 'tramp-completion-file-name-handler 'safe-magic t))) | 2141 | (put 'tramp-completion-file-name-handler 'safe-magic t) |
| 2142 | ;; Mark `operations' the handler is responsible for. | ||
| 2143 | (put 'tramp-completion-file-name-handler 'operations | ||
| 2144 | (mapcar 'car tramp-completion-file-name-handler-alist)))) | ||
| 2168 | 2145 | ||
| 2169 | ;;;###autoload | 2146 | ;;;###autoload |
| 2170 | (tramp-register-autoload-file-name-handlers) | 2147 | (tramp-register-autoload-file-name-handlers) |
| @@ -2174,22 +2151,29 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2174 | ;; Remove autoloaded handlers from file name handler alist. Useful, | 2151 | ;; Remove autoloaded handlers from file name handler alist. Useful, |
| 2175 | ;; if `tramp-syntax' has been changed. | 2152 | ;; if `tramp-syntax' has been changed. |
| 2176 | (dolist (fnh '(tramp-file-name-handler | 2153 | (dolist (fnh '(tramp-file-name-handler |
| 2177 | tramp-completion-file-name-handler | 2154 | tramp-completion-file-name-handler)) |
| 2178 | tramp-autoload-file-name-handler)) | ||
| 2179 | (let ((a1 (rassq fnh file-name-handler-alist))) | 2155 | (let ((a1 (rassq fnh file-name-handler-alist))) |
| 2180 | (setq file-name-handler-alist (delq a1 file-name-handler-alist)))) | 2156 | (setq file-name-handler-alist (delq a1 file-name-handler-alist)))) |
| 2157 | |||
| 2181 | ;; The initial value of `tramp-file-name-regexp' is too simple | 2158 | ;; The initial value of `tramp-file-name-regexp' is too simple |
| 2182 | ;; minded, but we cannot give it the real value in the autoload | 2159 | ;; minded, but we cannot give it the real value in the autoload |
| 2183 | ;; pattern. See Bug#24889. | 2160 | ;; pattern. See Bug#24889. |
| 2184 | (setq tramp-file-name-regexp (car tramp-file-name-structure)) | 2161 | (setq tramp-file-name-regexp (car tramp-file-name-structure)) |
| 2185 | ;; Add the handlers. | 2162 | ;; Add the handlers. We do not add anything to the `operations' |
| 2163 | ;; property of `tramp-file-name-handler', this shall be done by the | ||
| 2164 | ;; respective foreign handlers. | ||
| 2186 | (add-to-list 'file-name-handler-alist | 2165 | (add-to-list 'file-name-handler-alist |
| 2187 | (cons tramp-file-name-regexp 'tramp-file-name-handler)) | 2166 | (cons tramp-file-name-regexp 'tramp-file-name-handler)) |
| 2188 | (put 'tramp-file-name-handler 'safe-magic t) | 2167 | (put 'tramp-file-name-handler 'safe-magic t) |
| 2168 | |||
| 2189 | (add-to-list 'file-name-handler-alist | 2169 | (add-to-list 'file-name-handler-alist |
| 2190 | (cons tramp-completion-file-name-regexp | 2170 | (cons tramp-completion-file-name-regexp |
| 2191 | 'tramp-completion-file-name-handler)) | 2171 | 'tramp-completion-file-name-handler)) |
| 2192 | (put 'tramp-completion-file-name-handler 'safe-magic t) | 2172 | (put 'tramp-completion-file-name-handler 'safe-magic t) |
| 2173 | ;; Mark `operations' the handler is responsible for. | ||
| 2174 | (put 'tramp-completion-file-name-handler 'operations | ||
| 2175 | (mapcar 'car tramp-completion-file-name-handler-alist)) | ||
| 2176 | |||
| 2193 | ;; If jka-compr or epa-file are already loaded, move them to the | 2177 | ;; If jka-compr or epa-file are already loaded, move them to the |
| 2194 | ;; front of `file-name-handler-alist'. | 2178 | ;; front of `file-name-handler-alist'. |
| 2195 | (dolist (fnh '(epa-file-handler jka-compr-handler)) | 2179 | (dolist (fnh '(epa-file-handler jka-compr-handler)) |
| @@ -2200,6 +2184,24 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2200 | 2184 | ||
| 2201 | (eval-after-load 'tramp (tramp-register-file-name-handlers)) | 2185 | (eval-after-load 'tramp (tramp-register-file-name-handlers)) |
| 2202 | 2186 | ||
| 2187 | ;;;###tramp-autoload | ||
| 2188 | (progn (defun tramp-register-foreign-file-name-handler | ||
| 2189 | (func handler &optional append) | ||
| 2190 | "Register (FUNC . HANDLER) in `tramp-foreign-file-name-handler-alist'. | ||
| 2191 | FUNC is the function, which determines whether HANDLER is to be called. | ||
| 2192 | Add operations defined in `HANDLER-alist' to `tramp-file-name-handler'." | ||
| 2193 | (add-to-list | ||
| 2194 | 'tramp-foreign-file-name-handler-alist `(,func . ,handler) append) | ||
| 2195 | ;; Mark `operations' the handler is responsible for. | ||
| 2196 | (put 'tramp-file-name-handler | ||
| 2197 | 'operations | ||
| 2198 | (cl-delete-duplicates | ||
| 2199 | (append | ||
| 2200 | (get 'tramp-file-name-handler 'operations) | ||
| 2201 | (mapcar | ||
| 2202 | 'car | ||
| 2203 | (symbol-value (intern (concat (symbol-name handler) "-alist"))))))))) | ||
| 2204 | |||
| 2203 | (defun tramp-exists-file-name-handler (operation &rest args) | 2205 | (defun tramp-exists-file-name-handler (operation &rest args) |
| 2204 | "Check, whether OPERATION runs a file name handler." | 2206 | "Check, whether OPERATION runs a file name handler." |
| 2205 | ;; The file name handler is determined on base of either an | 2207 | ;; The file name handler is determined on base of either an |
| @@ -2258,15 +2260,6 @@ not in completion mode." | |||
| 2258 | (tramp-get-connection-process | 2260 | (tramp-get-connection-process |
| 2259 | (tramp-dissect-file-name filename))))))) | 2261 | (tramp-dissect-file-name filename))))))) |
| 2260 | 2262 | ||
| 2261 | (defun tramp-completion-handle-expand-file-name (name &optional dir) | ||
| 2262 | "Like `expand-file-name' for Tramp files." | ||
| 2263 | ;; If DIR is not given, use `default-directory' or "/". | ||
| 2264 | (setq dir (or dir default-directory "/")) | ||
| 2265 | (cond | ||
| 2266 | ((file-name-absolute-p name) name) | ||
| 2267 | ((zerop (length name)) dir) | ||
| 2268 | (t (concat (file-name-as-directory dir) name)))) | ||
| 2269 | |||
| 2270 | ;; Method, host name and user name completion. | 2263 | ;; Method, host name and user name completion. |
| 2271 | ;; `tramp-completion-dissect-file-name' returns a list of | 2264 | ;; `tramp-completion-dissect-file-name' returns a list of |
| 2272 | ;; tramp-file-name structures. For all of them we return possible completions. | 2265 | ;; tramp-file-name structures. For all of them we return possible completions. |
| @@ -2328,9 +2321,9 @@ not in completion mode." | |||
| 2328 | (when elt | 2321 | (when elt |
| 2329 | (string-match tramp-prefix-regexp elt) | 2322 | (string-match tramp-prefix-regexp elt) |
| 2330 | (setq elt (replace-match (concat tramp-prefix-format hop) nil nil elt)) | 2323 | (setq elt (replace-match (concat tramp-prefix-format hop) nil nil elt)) |
| 2331 | (add-to-list | 2324 | (push |
| 2332 | 'result1 | 2325 | (substring elt (length (tramp-drop-volume-letter directory))) |
| 2333 | (substring elt (length (tramp-drop-volume-letter directory)))))) | 2326 | result1))) |
| 2334 | 2327 | ||
| 2335 | ;; Complete local parts. | 2328 | ;; Complete local parts. |
| 2336 | (append | 2329 | (append |
| @@ -2955,8 +2948,6 @@ User is always nil." | |||
| 2955 | backup-directory-alist))) | 2948 | backup-directory-alist))) |
| 2956 | (tramp-run-real-handler 'find-backup-file-name (list filename))))) | 2949 | (tramp-run-real-handler 'find-backup-file-name (list filename))))) |
| 2957 | 2950 | ||
| 2958 | (defvar ls-lisp-use-insert-directory-program) | ||
| 2959 | |||
| 2960 | (defun tramp-handle-insert-directory | 2951 | (defun tramp-handle-insert-directory |
| 2961 | (filename switches &optional wildcard full-directory-p) | 2952 | (filename switches &optional wildcard full-directory-p) |
| 2962 | "Like `insert-directory' for Tramp files." | 2953 | "Like `insert-directory' for Tramp files." |
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index 35ad2f0acff..35b5eb6728a 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; trampver.el --- Transparent Remote Access, Multiple Protocol | 1 | ;;; trampver.el --- Transparent Remote Access, Multiple Protocol -*- lexical-binding:t -*- |
| 2 | ;;; lisp/trampver.el. Generated from trampver.el.in by configure. | 2 | ;;; lisp/trampver.el. Generated from trampver.el.in by configure. |
| 3 | 3 | ||
| 4 | ;; Copyright (C) 2003-2017 Free Software Foundation, Inc. | 4 | ;; Copyright (C) 2003-2017 Free Software Foundation, Inc. |
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 677946262c5..8f013bb09f2 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el | |||
| @@ -2106,28 +2106,23 @@ for a moment, then straighten yourself up.\n") | |||
| 2106 | (dun-mprincl "That answer is incorrect."))))) | 2106 | (dun-mprincl "That answer is incorrect."))))) |
| 2107 | 2107 | ||
| 2108 | (defun dun-endgame-question () | 2108 | (defun dun-endgame-question () |
| 2109 | (if (not dun-endgame-questions) | 2109 | (let ((questions dun-endgame-questions)) |
| 2110 | (progn | 2110 | (if (null questions) |
| 2111 | (dun-mprincl "Your question is:") | 2111 | (progn |
| 2112 | (dun-mprincl "No more questions, just do ‘answer foo’.") | 2112 | (dun-mprincl "Your question is:") |
| 2113 | (setq dun-correct-answer '("foo"))) | 2113 | (dun-mprincl "No more questions, just do ‘answer foo’.") |
| 2114 | (let (which i newques) | 2114 | (setq dun-correct-answer '("foo"))) |
| 2115 | (setq i 0) | 2115 | (let* ((which (random (length questions))) |
| 2116 | (setq newques nil) | 2116 | (question (nth which questions))) |
| 2117 | (setq which (random (length dun-endgame-questions))) | 2117 | (dun-mprincl "Your question is:") |
| 2118 | (dun-mprincl "Your question is:") | 2118 | (dun-mprincl (setq dun-endgame-question (car question))) |
| 2119 | (dun-mprincl (setq dun-endgame-question (car | 2119 | (setq dun-correct-answer (cdr question)) |
| 2120 | (nth which | 2120 | (let ((i 0) res) |
| 2121 | dun-endgame-questions)))) | 2121 | (dolist (q questions) |
| 2122 | (setq dun-correct-answer (cdr (nth which dun-endgame-questions))) | 2122 | (when (/= i which) |
| 2123 | (while (< i which) | 2123 | (push q res)) |
| 2124 | (setq newques (append newques (list (nth i dun-endgame-questions)))) | 2124 | (setq i (1+ i))) |
| 2125 | (setq i (1+ i))) | 2125 | (setq dun-endgame-questions (nreverse res))))))) |
| 2126 | (setq i (1+ which)) | ||
| 2127 | (while (< i (length dun-endgame-questions)) | ||
| 2128 | (setq newques (append newques (list (nth i dun-endgame-questions)))) | ||
| 2129 | (setq i (1+ i))) | ||
| 2130 | (setq dun-endgame-questions newques)))) | ||
| 2131 | 2126 | ||
| 2132 | (defun dun-power (_args) | 2127 | (defun dun-power (_args) |
| 2133 | (if (not (= dun-current-room pc-area)) | 2128 | (if (not (= dun-current-room pc-area)) |
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 3fdd56124c4..8dd56106af4 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -94,7 +94,7 @@ | |||
| 94 | 94 | ||
| 95 | ;;; Variables also used at compile time. | 95 | ;;; Variables also used at compile time. |
| 96 | 96 | ||
| 97 | (defconst c-version "5.32.99" | 97 | (defconst c-version "5.33" |
| 98 | "CC Mode version number.") | 98 | "CC Mode version number.") |
| 99 | 99 | ||
| 100 | (defconst c-version-sym (intern c-version)) | 100 | (defconst c-version-sym (intern c-version)) |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index bdc77dc5028..de15d1d82fc 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -6243,9 +6243,9 @@ comment at the start of cc-engine.el for more info." | |||
| 6243 | (eq (char-before) ?<)) | 6243 | (eq (char-before) ?<)) |
| 6244 | (c-backward-token-2) | 6244 | (c-backward-token-2) |
| 6245 | (when (eq (char-after) ?<) | 6245 | (when (eq (char-after) ?<) |
| 6246 | (c-clear-<-pair-props-if-match-after beg))) | 6246 | (c-clear-<-pair-props-if-match-after beg) |
| 6247 | (setq new-beg (point)))) | ||
| 6247 | (c-forward-syntactic-ws) | 6248 | (c-forward-syntactic-ws) |
| 6248 | (setq new-beg (point)) | ||
| 6249 | 6249 | ||
| 6250 | ;; ...Then the ones with < before end and > after end. | 6250 | ;; ...Then the ones with < before end and > after end. |
| 6251 | (goto-char (if end-lit-limits (cdr end-lit-limits) end)) | 6251 | (goto-char (if end-lit-limits (cdr end-lit-limits) end)) |
| @@ -6254,9 +6254,9 @@ comment at the start of cc-engine.el for more info." | |||
| 6254 | (eq (char-before) ?>)) | 6254 | (eq (char-before) ?>)) |
| 6255 | (c-end-of-current-token) | 6255 | (c-end-of-current-token) |
| 6256 | (when (eq (char-before) ?>) | 6256 | (when (eq (char-before) ?>) |
| 6257 | (c-clear->-pair-props-if-match-before end (1- (point))))) | 6257 | (c-clear->-pair-props-if-match-before end (1- (point))) |
| 6258 | (setq new-end (point)))) | ||
| 6258 | (c-backward-syntactic-ws) | 6259 | (c-backward-syntactic-ws) |
| 6259 | (setq new-end (point)) | ||
| 6260 | 6260 | ||
| 6261 | ;; Extend the fontification region, if needed. | 6261 | ;; Extend the fontification region, if needed. |
| 6262 | (and new-beg | 6262 | (and new-beg |
| @@ -8863,7 +8863,29 @@ comment at the start of cc-engine.el for more info." | |||
| 8863 | ;; it as a declaration if "a" has been used as a type | 8863 | ;; it as a declaration if "a" has been used as a type |
| 8864 | ;; somewhere else (if it's a known type we won't get here). | 8864 | ;; somewhere else (if it's a known type we won't get here). |
| 8865 | (setq maybe-expression t) | 8865 | (setq maybe-expression t) |
| 8866 | (throw 'at-decl-or-cast t))) | 8866 | (throw 'at-decl-or-cast t)) |
| 8867 | |||
| 8868 | ;; CASE 17.5 | ||
| 8869 | (when (and c-asymmetry-fontification-flag | ||
| 8870 | got-prefix-before-parens | ||
| 8871 | at-type | ||
| 8872 | (or (not got-suffix) | ||
| 8873 | at-decl-start)) | ||
| 8874 | (let ((space-before-id | ||
| 8875 | (save-excursion | ||
| 8876 | (goto-char name-start) | ||
| 8877 | (or (bolp) (memq (char-before) '(?\ ?\t))))) | ||
| 8878 | (space-after-type | ||
| 8879 | (save-excursion | ||
| 8880 | (goto-char type-start) | ||
| 8881 | (and (c-forward-type) | ||
| 8882 | (progn (c-backward-syntactic-ws) t) | ||
| 8883 | (or (eolp) | ||
| 8884 | (memq (char-after) '(?\ ?\t))))))) | ||
| 8885 | (when (not (eq (not space-before-id) | ||
| 8886 | (not space-after-type))) | ||
| 8887 | (setq maybe-expression t) | ||
| 8888 | (throw 'at-decl-or-cast t))))) | ||
| 8867 | 8889 | ||
| 8868 | ;; CASE 18 | 8890 | ;; CASE 18 |
| 8869 | (when (and (not (memq context '(nil top))) | 8891 | (when (and (not (memq context '(nil top))) |
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index f623b9f3332..923f077b411 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -1117,6 +1117,124 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1117 | (setq pos (point)))))) ; acts to make the `while' form continue. | 1117 | (setq pos (point)))))) ; acts to make the `while' form continue. |
| 1118 | nil) | 1118 | nil) |
| 1119 | 1119 | ||
| 1120 | (defun c-get-fontification-context (match-pos not-front-decl &optional toplev) | ||
| 1121 | ;; Return a cons (CONTEXT . RESTRICTED-<>-ARGLISTS) for MATCH-POS. | ||
| 1122 | ;; NOT-FRONT-DECL is non-nil when a declaration later in the buffer than | ||
| 1123 | ;; MATCH-POS has already been parsed. TOPLEV is non-nil when MATCH-POS is | ||
| 1124 | ;; known to be at "top level", i.e. outside any braces, or directly inside a | ||
| 1125 | ;; namespace, class, etc. | ||
| 1126 | ;; | ||
| 1127 | ;; CONTEXT is the fontification context of MATCH-POS, and is one of the | ||
| 1128 | ;; following: | ||
| 1129 | ;; 'decl In a comma-separated declaration context (typically | ||
| 1130 | ;; inside a function declaration arglist). | ||
| 1131 | ;; '<> In an angle bracket arglist. | ||
| 1132 | ;; 'arglist Some other type of arglist. | ||
| 1133 | ;; 'top Some other context and point is at the top-level (either | ||
| 1134 | ;; outside any braces or directly inside a class or namespace, | ||
| 1135 | ;; etc.) | ||
| 1136 | ;; nil Some other context or unknown context. Includes | ||
| 1137 | ;; within the parens of an if, for, ... construct. | ||
| 1138 | ;; 'not-decl Definitely not in a declaration. | ||
| 1139 | ;; | ||
| 1140 | ;; RESTRICTED-<>-ARGLISTS is non-nil when a scan of template/generic | ||
| 1141 | ;; arguments lists (i.e. lists enclosed by <...>) is more strict about what | ||
| 1142 | ;; characters it allows within the list. | ||
| 1143 | (let ((type (and (> match-pos (point-min)) | ||
| 1144 | (c-get-char-property (1- match-pos) 'c-type)))) | ||
| 1145 | (cond ((not (memq (char-before match-pos) '(?\( ?, ?\[ ?< ?{))) | ||
| 1146 | (cons (and toplev 'top) nil)) | ||
| 1147 | ;; A control flow expression or a decltype | ||
| 1148 | ((and (eq (char-before match-pos) ?\() | ||
| 1149 | (save-excursion | ||
| 1150 | (goto-char match-pos) | ||
| 1151 | (backward-char) | ||
| 1152 | (c-backward-token-2) | ||
| 1153 | (or (looking-at c-block-stmt-2-key) | ||
| 1154 | (looking-at c-block-stmt-1-2-key) | ||
| 1155 | (looking-at c-typeof-key)))) | ||
| 1156 | (cons nil t)) | ||
| 1157 | ;; Near BOB. | ||
| 1158 | ((<= match-pos (point-min)) | ||
| 1159 | (cons 'arglist t)) | ||
| 1160 | ;; Got a cached hit in a declaration arglist. | ||
| 1161 | ((eq type 'c-decl-arg-start) | ||
| 1162 | (cons 'decl nil)) | ||
| 1163 | ;; We're inside (probably) a brace list. | ||
| 1164 | ((eq type 'c-not-decl) | ||
| 1165 | (cons 'not-decl nil)) | ||
| 1166 | ;; Inside a C++11 lambda function arglist. | ||
| 1167 | ((and (c-major-mode-is 'c++-mode) | ||
| 1168 | (eq (char-before match-pos) ?\() | ||
| 1169 | (save-excursion | ||
| 1170 | (goto-char match-pos) | ||
| 1171 | (c-backward-token-2) | ||
| 1172 | (and | ||
| 1173 | (c-safe (goto-char (scan-sexps (point) -1))) | ||
| 1174 | (c-looking-at-c++-lambda-capture-list)))) | ||
| 1175 | (c-put-char-property (1- match-pos) 'c-type | ||
| 1176 | 'c-decl-arg-start) | ||
| 1177 | (cons 'decl nil)) | ||
| 1178 | ;; We're inside a brace list. | ||
| 1179 | ((and (eq (char-before match-pos) ?{) | ||
| 1180 | (save-excursion | ||
| 1181 | (goto-char (1- match-pos)) | ||
| 1182 | (consp | ||
| 1183 | (c-looking-at-or-maybe-in-bracelist)))) | ||
| 1184 | (c-put-char-property (1- match-pos) 'c-type | ||
| 1185 | 'c-not-decl) | ||
| 1186 | (cons 'not-decl nil)) | ||
| 1187 | ;; We're inside an "ordinary" open brace. | ||
| 1188 | ((eq (char-before match-pos) ?{) | ||
| 1189 | (cons (and toplev 'top) nil)) | ||
| 1190 | ;; Inside an angle bracket arglist. | ||
| 1191 | ((or (eq type 'c-<>-arg-sep) | ||
| 1192 | (eq (char-before match-pos) ?<)) | ||
| 1193 | (cons '<> nil)) | ||
| 1194 | ;; Got a cached hit in some other type of arglist. | ||
| 1195 | (type | ||
| 1196 | (cons 'arglist t)) | ||
| 1197 | (not-front-decl | ||
| 1198 | ;; The point is within the range of a previously | ||
| 1199 | ;; encountered type decl expression, so the arglist | ||
| 1200 | ;; is probably one that contains declarations. | ||
| 1201 | ;; However, if `c-recognize-paren-inits' is set it | ||
| 1202 | ;; might also be an initializer arglist. | ||
| 1203 | ;; | ||
| 1204 | ;; The result of this check is cached with a char | ||
| 1205 | ;; property on the match token, so that we can look | ||
| 1206 | ;; it up again when refontifying single lines in a | ||
| 1207 | ;; multiline declaration. | ||
| 1208 | (c-put-char-property (1- match-pos) | ||
| 1209 | 'c-type 'c-decl-arg-start) | ||
| 1210 | (cons 'decl nil)) | ||
| 1211 | ;; Got an open paren preceded by an arith operator. | ||
| 1212 | ((and (eq (char-before match-pos) ?\() | ||
| 1213 | (save-excursion | ||
| 1214 | (and (zerop (c-backward-token-2 2)) | ||
| 1215 | (looking-at c-arithmetic-op-regexp)))) | ||
| 1216 | (cons nil nil)) | ||
| 1217 | ;; At start of a declaration inside a declaration paren. | ||
| 1218 | ((save-excursion | ||
| 1219 | (and (memq (char-before match-pos) '(?\( ?\,)) | ||
| 1220 | (c-go-up-list-backward match-pos) | ||
| 1221 | (eq (char-after) ?\() | ||
| 1222 | (let ((type (c-get-char-property (point) 'c-type))) | ||
| 1223 | (or (memq type '(c-decl-arg-start c-decl-type-start)) | ||
| 1224 | (and | ||
| 1225 | (progn (c-backward-syntactic-ws) t) | ||
| 1226 | (c-back-over-compound-identifier) | ||
| 1227 | (progn | ||
| 1228 | (c-backward-syntactic-ws) | ||
| 1229 | (or (bobp) | ||
| 1230 | (progn | ||
| 1231 | (setq type (c-get-char-property (1- (point)) | ||
| 1232 | 'c-type)) | ||
| 1233 | (memq type '(c-decl-arg-start | ||
| 1234 | c-decl-type-start)))))))))) | ||
| 1235 | (cons 'decl nil)) | ||
| 1236 | (t (cons 'arglist t))))) | ||
| 1237 | |||
| 1120 | (defun c-font-lock-declarations (limit) | 1238 | (defun c-font-lock-declarations (limit) |
| 1121 | ;; Fontify all the declarations, casts and labels from the point to LIMIT. | 1239 | ;; Fontify all the declarations, casts and labels from the point to LIMIT. |
| 1122 | ;; Assumes that strings and comments have been fontified already. | 1240 | ;; Assumes that strings and comments have been fontified already. |
| @@ -1231,95 +1349,15 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1231 | ;; "<" for the sake of C++-style template arglists. | 1349 | ;; "<" for the sake of C++-style template arglists. |
| 1232 | ;; Ignore "(" when it's part of a control flow construct | 1350 | ;; Ignore "(" when it's part of a control flow construct |
| 1233 | ;; (e.g. "for ("). | 1351 | ;; (e.g. "for ("). |
| 1234 | (let ((type (and (> match-pos (point-min)) | 1352 | (let ((got-context |
| 1235 | (c-get-char-property (1- match-pos) 'c-type)))) | 1353 | (c-get-fontification-context |
| 1236 | (cond ((not (memq (char-before match-pos) '(?\( ?, ?\[ ?< ?{))) | 1354 | match-pos |
| 1237 | (setq context (and toplev 'top) | 1355 | (< match-pos (if inside-macro |
| 1238 | c-restricted-<>-arglists nil)) | 1356 | max-type-decl-end-before-token |
| 1239 | ;; A control flow expression or a decltype | 1357 | max-type-decl-end)) |
| 1240 | ((and (eq (char-before match-pos) ?\() | 1358 | toplev))) |
| 1241 | (save-excursion | 1359 | (setq context (car got-context) |
| 1242 | (goto-char match-pos) | 1360 | c-restricted-<>-arglists (cdr got-context))) |
| 1243 | (backward-char) | ||
| 1244 | (c-backward-token-2) | ||
| 1245 | (or (looking-at c-block-stmt-2-key) | ||
| 1246 | (looking-at c-block-stmt-1-2-key) | ||
| 1247 | (looking-at c-typeof-key)))) | ||
| 1248 | (setq context nil | ||
| 1249 | c-restricted-<>-arglists t)) | ||
| 1250 | ;; Near BOB. | ||
| 1251 | ((<= match-pos (point-min)) | ||
| 1252 | (setq context 'arglist | ||
| 1253 | c-restricted-<>-arglists t)) | ||
| 1254 | ;; Got a cached hit in a declaration arglist. | ||
| 1255 | ((eq type 'c-decl-arg-start) | ||
| 1256 | (setq context 'decl | ||
| 1257 | c-restricted-<>-arglists nil)) | ||
| 1258 | ;; We're inside (probably) a brace list. | ||
| 1259 | ((eq type 'c-not-decl) | ||
| 1260 | (setq context 'not-decl | ||
| 1261 | c-restricted-<>-arglists nil)) | ||
| 1262 | ;; Inside a C++11 lambda function arglist. | ||
| 1263 | ((and (c-major-mode-is 'c++-mode) | ||
| 1264 | (eq (char-before match-pos) ?\() | ||
| 1265 | (save-excursion | ||
| 1266 | (goto-char match-pos) | ||
| 1267 | (c-backward-token-2) | ||
| 1268 | (and | ||
| 1269 | (c-safe (goto-char (scan-sexps (point) -1))) | ||
| 1270 | (c-looking-at-c++-lambda-capture-list)))) | ||
| 1271 | (setq context 'decl | ||
| 1272 | c-restricted-<>-arglists nil) | ||
| 1273 | (c-put-char-property (1- match-pos) 'c-type | ||
| 1274 | 'c-decl-arg-start)) | ||
| 1275 | ;; We're inside a brace list. | ||
| 1276 | ((and (eq (char-before match-pos) ?{) | ||
| 1277 | (save-excursion | ||
| 1278 | (goto-char (1- match-pos)) | ||
| 1279 | (consp | ||
| 1280 | (c-looking-at-or-maybe-in-bracelist)))) | ||
| 1281 | (setq context 'not-decl | ||
| 1282 | c-restricted-<>-arglists nil) | ||
| 1283 | (c-put-char-property (1- match-pos) 'c-type | ||
| 1284 | 'c-not-decl)) | ||
| 1285 | ;; We're inside an "ordinary" open brace. | ||
| 1286 | ((eq (char-before match-pos) ?{) | ||
| 1287 | (setq context (and toplev 'top) | ||
| 1288 | c-restricted-<>-arglists nil)) | ||
| 1289 | ;; Inside an angle bracket arglist. | ||
| 1290 | ((or (eq type 'c-<>-arg-sep) | ||
| 1291 | (eq (char-before match-pos) ?<)) | ||
| 1292 | (setq context '<> | ||
| 1293 | c-restricted-<>-arglists nil)) | ||
| 1294 | ;; Got a cached hit in some other type of arglist. | ||
| 1295 | (type | ||
| 1296 | (setq context 'arglist | ||
| 1297 | c-restricted-<>-arglists t)) | ||
| 1298 | ((if inside-macro | ||
| 1299 | (< match-pos max-type-decl-end-before-token) | ||
| 1300 | (< match-pos max-type-decl-end)) | ||
| 1301 | ;; The point is within the range of a previously | ||
| 1302 | ;; encountered type decl expression, so the arglist | ||
| 1303 | ;; is probably one that contains declarations. | ||
| 1304 | ;; However, if `c-recognize-paren-inits' is set it | ||
| 1305 | ;; might also be an initializer arglist. | ||
| 1306 | (setq context 'decl | ||
| 1307 | c-restricted-<>-arglists nil) | ||
| 1308 | ;; The result of this check is cached with a char | ||
| 1309 | ;; property on the match token, so that we can look | ||
| 1310 | ;; it up again when refontifying single lines in a | ||
| 1311 | ;; multiline declaration. | ||
| 1312 | (c-put-char-property (1- match-pos) | ||
| 1313 | 'c-type 'c-decl-arg-start)) | ||
| 1314 | ;; Got an open paren preceded by an arith operator. | ||
| 1315 | ((and (eq (char-before match-pos) ?\() | ||
| 1316 | (save-excursion | ||
| 1317 | (and (zerop (c-backward-token-2 2)) | ||
| 1318 | (looking-at c-arithmetic-op-regexp)))) | ||
| 1319 | (setq context nil | ||
| 1320 | c-restricted-<>-arglists nil)) | ||
| 1321 | (t (setq context 'arglist | ||
| 1322 | c-restricted-<>-arglists t)))) | ||
| 1323 | 1361 | ||
| 1324 | ;; Check we haven't missed a preceding "typedef". | 1362 | ;; Check we haven't missed a preceding "typedef". |
| 1325 | (when (not (looking-at c-typedef-key)) | 1363 | (when (not (looking-at c-typedef-key)) |
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 8326e6a6f29..20c63d4dbe2 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -1363,6 +1363,7 @@ Note that the style variables are always made local to the buffer." | |||
| 1363 | ;; This function is called indirectly from font locking stuff - either from | 1363 | ;; This function is called indirectly from font locking stuff - either from |
| 1364 | ;; c-after-change (to prepare for after-change font-locking) or from font | 1364 | ;; c-after-change (to prepare for after-change font-locking) or from font |
| 1365 | ;; lock context (etc.) fontification. | 1365 | ;; lock context (etc.) fontification. |
| 1366 | (goto-char pos) | ||
| 1366 | (let ((lit-start (c-literal-start)) | 1367 | (let ((lit-start (c-literal-start)) |
| 1367 | (new-pos pos) | 1368 | (new-pos pos) |
| 1368 | capture-opener | 1369 | capture-opener |
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 1114b21381d..ccd4fd29940 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el | |||
| @@ -1634,6 +1634,18 @@ names).")) | |||
| 1634 | :type 'c-extra-types-widget | 1634 | :type 'c-extra-types-widget |
| 1635 | :group 'c) | 1635 | :group 'c) |
| 1636 | 1636 | ||
| 1637 | (defcustom c-asymmetry-fontification-flag t | ||
| 1638 | "Whether to fontify certain ambiguous constructs by white space asymmetry. | ||
| 1639 | |||
| 1640 | In the fontification engine, it is sometimes impossible to determine | ||
| 1641 | whether a construct is a declaration or an expression. This happens | ||
| 1642 | particularly in C++, due to ambiguities in the language. When such a | ||
| 1643 | construct is like \"foo * bar\" or \"foo &bar\", and this variable is non-nil | ||
| 1644 | (the default), the construct will be fontified as a declaration if there is | ||
| 1645 | white space either before or after the operator, but not both." | ||
| 1646 | :type 'boolean | ||
| 1647 | :group 'c) | ||
| 1648 | |||
| 1637 | (defvar c-noise-macro-with-parens-name-re "\\<\\>") | 1649 | (defvar c-noise-macro-with-parens-name-re "\\<\\>") |
| 1638 | (defvar c-noise-macro-name-re "\\<\\>") | 1650 | (defvar c-noise-macro-name-re "\\<\\>") |
| 1639 | 1651 | ||
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index aed42a85076..3c720c05610 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -1713,7 +1713,7 @@ This performs fontification according to `js--class-styles'." | |||
| 1713 | (not (any ?\] ?\\)) | 1713 | (not (any ?\] ?\\)) |
| 1714 | (and "\\" not-newline))) | 1714 | (and "\\" not-newline))) |
| 1715 | "]"))) | 1715 | "]"))) |
| 1716 | (group "/")) | 1716 | (group (zero-or-one "/"))) |
| 1717 | "Regular expression matching a JavaScript regexp literal.") | 1717 | "Regular expression matching a JavaScript regexp literal.") |
| 1718 | 1718 | ||
| 1719 | (defun js-syntax-propertize-regexp (end) | 1719 | (defun js-syntax-propertize-regexp (end) |
| @@ -1721,12 +1721,13 @@ This performs fontification according to `js--class-styles'." | |||
| 1721 | (when (eq (nth 3 ppss) ?/) | 1721 | (when (eq (nth 3 ppss) ?/) |
| 1722 | ;; A /.../ regexp. | 1722 | ;; A /.../ regexp. |
| 1723 | (goto-char (nth 8 ppss)) | 1723 | (goto-char (nth 8 ppss)) |
| 1724 | (when (and (looking-at js--syntax-propertize-regexp-regexp) | 1724 | (when (looking-at js--syntax-propertize-regexp-regexp) |
| 1725 | ;; Don't touch text after END. | 1725 | ;; Don't touch text after END. |
| 1726 | (<= (match-end 1) end)) | 1726 | (when (> end (match-end 1)) |
| 1727 | (put-text-property (match-beginning 1) (match-end 1) | 1727 | (setq end (match-end 1))) |
| 1728 | (put-text-property (match-beginning 1) end | ||
| 1728 | 'syntax-table (string-to-syntax "\"/")) | 1729 | 'syntax-table (string-to-syntax "\"/")) |
| 1729 | (goto-char (match-end 0)))))) | 1730 | (goto-char end))))) |
| 1730 | 1731 | ||
| 1731 | (defun js-syntax-propertize (start end) | 1732 | (defun js-syntax-propertize (start end) |
| 1732 | ;; JavaScript allows immediate regular expression objects, written /.../. | 1733 | ;; JavaScript allows immediate regular expression objects, written /.../. |
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index a516f07e72f..b75f32ee200 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el | |||
| @@ -255,9 +255,11 @@ | |||
| 255 | ;; format statements | 255 | ;; format statements |
| 256 | ("^[ \t]*format.*=[ \t]*\\(\n\\)" | 256 | ("^[ \t]*format.*=[ \t]*\\(\n\\)" |
| 257 | (1 (prog1 "\"" (perl-syntax-propertize-special-constructs end)))) | 257 | (1 (prog1 "\"" (perl-syntax-propertize-special-constructs end)))) |
| 258 | ;; Funny things in `sub' arg-specs like `sub myfun ($)' or `sub ($)'. | 258 | ;; Propertize perl prototype chars `$%&*;+@\[]' as punctuation |
| 259 | ;; Be careful not to match "sub { (...) ... }". | 259 | ;; in `sub' arg-specs like `sub myfun ($)' and `sub ($)'. But |
| 260 | ("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([^)]+\\))" | 260 | ;; don't match subroutine signatures like `sub add ($a, $b)', or |
| 261 | ;; anonymous subs like "sub { (...) ... }". | ||
| 262 | ("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([][$%&*;+@\\]+\\))" | ||
| 261 | (1 ".")) | 263 | (1 ".")) |
| 262 | ;; Turn __DATA__ trailer into a comment. | 264 | ;; Turn __DATA__ trailer into a comment. |
| 263 | ("^\\(_\\)_\\(?:DATA\\|END\\)__[ \t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)" | 265 | ("^\\(_\\)_\\(?:DATA\\|END\\)__[ \t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)" |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 228a4484616..2697f1a3107 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1491,10 +1491,18 @@ Optional argument NOEND is internal and makes the logic to not | |||
| 1491 | jump to the end of line when moving forward searching for the end | 1491 | jump to the end of line when moving forward searching for the end |
| 1492 | of the statement." | 1492 | of the statement." |
| 1493 | (interactive "^") | 1493 | (interactive "^") |
| 1494 | (let (string-start bs-pos) | 1494 | (let (string-start bs-pos (last-string-end 0)) |
| 1495 | (while (and (or noend (goto-char (line-end-position))) | 1495 | (while (and (or noend (goto-char (line-end-position))) |
| 1496 | (not (eobp)) | 1496 | (not (eobp)) |
| 1497 | (cond ((setq string-start (python-syntax-context 'string)) | 1497 | (cond ((setq string-start (python-syntax-context 'string)) |
| 1498 | ;; The assertion can only fail if syntax table | ||
| 1499 | ;; text properties and the `syntax-ppss' cache | ||
| 1500 | ;; are somehow out of whack. This has been | ||
| 1501 | ;; observed when using `syntax-ppss' during | ||
| 1502 | ;; narrowing. | ||
| 1503 | (cl-assert (> string-start last-string-end) | ||
| 1504 | :show-args | ||
| 1505 | "Overlapping strings detected") | ||
| 1498 | (goto-char string-start) | 1506 | (goto-char string-start) |
| 1499 | (if (python-syntax-context 'paren) | 1507 | (if (python-syntax-context 'paren) |
| 1500 | ;; Ended up inside a paren, roll again. | 1508 | ;; Ended up inside a paren, roll again. |
| @@ -1504,8 +1512,10 @@ of the statement." | |||
| 1504 | (goto-char (+ (point) | 1512 | (goto-char (+ (point) |
| 1505 | (python-syntax-count-quotes | 1513 | (python-syntax-count-quotes |
| 1506 | (char-after (point)) (point)))) | 1514 | (char-after (point)) (point)))) |
| 1507 | (or (re-search-forward (rx (syntax string-delimiter)) nil t) | 1515 | (setq last-string-end |
| 1508 | (goto-char (point-max))))) | 1516 | (or (re-search-forward |
| 1517 | (rx (syntax string-delimiter)) nil t) | ||
| 1518 | (goto-char (point-max)))))) | ||
| 1509 | ((python-syntax-context 'paren) | 1519 | ((python-syntax-context 'paren) |
| 1510 | ;; The statement won't end before we've escaped | 1520 | ;; The statement won't end before we've escaped |
| 1511 | ;; at least one level of parenthesis. | 1521 | ;; at least one level of parenthesis. |
diff --git a/lisp/replace.el b/lisp/replace.el index 0841ba11b8b..a7b8ae6a347 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -848,7 +848,6 @@ called interactively by passing a non-nil INTERACTIVE argument. | |||
| 848 | This function starts looking for the next match from the end of | 848 | This function starts looking for the next match from the end of |
| 849 | the previous match. Hence, it ignores matches that overlap | 849 | the previous match. Hence, it ignores matches that overlap |
| 850 | a previously found match." | 850 | a previously found match." |
| 851 | |||
| 852 | (interactive | 851 | (interactive |
| 853 | (progn | 852 | (progn |
| 854 | (barf-if-buffer-read-only) | 853 | (barf-if-buffer-read-only) |
| @@ -923,7 +922,6 @@ a non-nil INTERACTIVE argument. | |||
| 923 | If a match is split across lines, all the lines it lies in are deleted. | 922 | If a match is split across lines, all the lines it lies in are deleted. |
| 924 | They are deleted _before_ looking for the next match. Hence, a match | 923 | They are deleted _before_ looking for the next match. Hence, a match |
| 925 | starting on the same line at which another match ended is ignored." | 924 | starting on the same line at which another match ended is ignored." |
| 926 | |||
| 927 | (interactive | 925 | (interactive |
| 928 | (progn | 926 | (progn |
| 929 | (barf-if-buffer-read-only) | 927 | (barf-if-buffer-read-only) |
| @@ -971,7 +969,6 @@ end of (the accessible portion of) the buffer. | |||
| 971 | This function starts looking for the next match from the end of | 969 | This function starts looking for the next match from the end of |
| 972 | the previous match. Hence, it ignores matches that overlap | 970 | the previous match. Hence, it ignores matches that overlap |
| 973 | a previously found match." | 971 | a previously found match." |
| 974 | |||
| 975 | (interactive | 972 | (interactive |
| 976 | (keep-lines-read-args "How many matches for regexp")) | 973 | (keep-lines-read-args "How many matches for regexp")) |
| 977 | (save-excursion | 974 | (save-excursion |
diff --git a/lisp/ses.el b/lisp/ses.el index 76d4ca577d7..66fc0c5ebdf 100644 --- a/lisp/ses.el +++ b/lisp/ses.el | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | |||
| 2 | ;;; ses.el -- Simple Emacs Spreadsheet -*- lexical-binding:t -*- | 1 | ;;; ses.el -- Simple Emacs Spreadsheet -*- lexical-binding:t -*- |
| 3 | 2 | ||
| 4 | ;; Copyright (C) 2002-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2002-2017 Free Software Foundation, Inc. |
| @@ -2273,15 +2272,19 @@ print area if NONARROW is nil." | |||
| 2273 | ;; (defvar maxrow) | 2272 | ;; (defvar maxrow) |
| 2274 | ;; (defvar maxcol) | 2273 | ;; (defvar maxcol) |
| 2275 | 2274 | ||
| 2276 | (defun ses-recalculate-cell () | 2275 | (defun ses-recalculate-cell (&optional ses--curcell) |
| 2277 | "Recalculate and reprint the current cell or range. | 2276 | "Recalculate and reprint the current cell or range. |
| 2278 | 2277 | ||
| 2278 | If SES--CURCELL is non nil use it as current cell or range | ||
| 2279 | without any check, otherwise function (ses-check-curcell 'range) | ||
| 2280 | is called. | ||
| 2281 | |||
| 2279 | For an individual cell, shows the error if the formula or printer | 2282 | For an individual cell, shows the error if the formula or printer |
| 2280 | signals one, or otherwise shows the cell's complete value. For a range, the | 2283 | signals one, or otherwise shows the cell's complete value. For a range, the |
| 2281 | cells are recalculated in \"natural\" order, so cells that other cells refer | 2284 | cells are recalculated in \"natural\" order, so cells that other cells refer |
| 2282 | to are recalculated first." | 2285 | to are recalculated first." |
| 2283 | (interactive "*") | 2286 | (interactive "*") |
| 2284 | (ses-check-curcell 'range) | 2287 | (or ses--curcell (ses-check-curcell 'range)) |
| 2285 | (ses-begin-change) | 2288 | (ses-begin-change) |
| 2286 | (ses-initialize-Dijkstra-attempt) | 2289 | (ses-initialize-Dijkstra-attempt) |
| 2287 | (let (sig cur-rowcol) | 2290 | (let (sig cur-rowcol) |
| @@ -2334,7 +2337,7 @@ to are recalculated first." | |||
| 2334 | (let ((startcell (ses--cell-at-pos (point))) | 2337 | (let ((startcell (ses--cell-at-pos (point))) |
| 2335 | (ses--curcell (cons 'A1 (ses-cell-symbol (1- ses--numrows) | 2338 | (ses--curcell (cons 'A1 (ses-cell-symbol (1- ses--numrows) |
| 2336 | (1- ses--numcols))))) | 2339 | (1- ses--numcols))))) |
| 2337 | (ses-recalculate-cell) | 2340 | (ses-recalculate-cell ses--curcell) |
| 2338 | (ses-jump-safe startcell))) | 2341 | (ses-jump-safe startcell))) |
| 2339 | 2342 | ||
| 2340 | (defun ses-truncate-cell () | 2343 | (defun ses-truncate-cell () |
diff --git a/lisp/shell.el b/lisp/shell.el index c8a8555d632..55a053295fa 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -711,36 +711,43 @@ Otherwise, one argument `-i' is passed to the shell. | |||
| 711 | ;; If the current buffer is a dead shell buffer, use it. | 711 | ;; If the current buffer is a dead shell buffer, use it. |
| 712 | (current-buffer))) | 712 | (current-buffer))) |
| 713 | 713 | ||
| 714 | ;; On remote hosts, the local `shell-file-name' might be useless. | 714 | (with-current-buffer buffer |
| 715 | (if (and (called-interactively-p 'any) | 715 | (when (file-remote-p default-directory) |
| 716 | (file-remote-p default-directory) | 716 | ;; Apply connection-local variables. |
| 717 | (null explicit-shell-file-name) | 717 | (hack-connection-local-variables-apply |
| 718 | (null (getenv "ESHELL"))) | 718 | `(:application 'tramp |
| 719 | (with-current-buffer buffer | 719 | :protocol ,(file-remote-p default-directory 'method) |
| 720 | (set (make-local-variable 'explicit-shell-file-name) | 720 | :user ,(file-remote-p default-directory 'user) |
| 721 | (expand-file-name | 721 | :machine ,(file-remote-p default-directory 'host))) |
| 722 | (file-local-name | 722 | |
| 723 | (read-file-name | 723 | ;; On remote hosts, the local `shell-file-name' might be useless. |
| 724 | "Remote shell path: " default-directory shell-file-name | 724 | (if (and (called-interactively-p 'any) |
| 725 | t shell-file-name)))))) | 725 | (null explicit-shell-file-name) |
| 726 | 726 | (null (getenv "ESHELL"))) | |
| 727 | ;; The buffer's window must be correctly set when we call comint (so | 727 | (set (make-local-variable 'explicit-shell-file-name) |
| 728 | ;; that comint sets the COLUMNS env var properly). | 728 | (expand-file-name |
| 729 | (pop-to-buffer buffer) | 729 | (file-local-name |
| 730 | (unless (comint-check-proc buffer) | 730 | (read-file-name |
| 731 | (let* ((prog (or explicit-shell-file-name | 731 | "Remote shell path: " default-directory shell-file-name |
| 732 | (getenv "ESHELL") shell-file-name)) | 732 | t shell-file-name)))))) |
| 733 | (name (file-name-nondirectory prog)) | 733 | |
| 734 | (startfile (concat "~/.emacs_" name)) | 734 | ;; The buffer's window must be correctly set when we call comint |
| 735 | (xargs-name (intern-soft (concat "explicit-" name "-args")))) | 735 | ;; (so that comint sets the COLUMNS env var properly). |
| 736 | (unless (file-exists-p startfile) | 736 | (pop-to-buffer buffer) |
| 737 | (setq startfile (concat user-emacs-directory "init_" name ".sh"))) | 737 | (unless (comint-check-proc buffer) |
| 738 | (apply 'make-comint-in-buffer "shell" buffer prog | 738 | (let* ((prog (or explicit-shell-file-name |
| 739 | (if (file-exists-p startfile) startfile) | 739 | (getenv "ESHELL") shell-file-name)) |
| 740 | (if (and xargs-name (boundp xargs-name)) | 740 | (name (file-name-nondirectory prog)) |
| 741 | (symbol-value xargs-name) | 741 | (startfile (concat "~/.emacs_" name)) |
| 742 | '("-i"))) | 742 | (xargs-name (intern-soft (concat "explicit-" name "-args")))) |
| 743 | (shell-mode))) | 743 | (unless (file-exists-p startfile) |
| 744 | (setq startfile (concat user-emacs-directory "init_" name ".sh"))) | ||
| 745 | (apply 'make-comint-in-buffer "shell" buffer prog | ||
| 746 | (if (file-exists-p startfile) startfile) | ||
| 747 | (if (and xargs-name (boundp xargs-name)) | ||
| 748 | (symbol-value xargs-name) | ||
| 749 | '("-i"))) | ||
| 750 | (shell-mode)))) | ||
| 744 | buffer) | 751 | buffer) |
| 745 | 752 | ||
| 746 | ;;; Directory tracking | 753 | ;;; Directory tracking |
diff --git a/lisp/simple.el b/lisp/simple.el index 369fbf71923..48c1a9b15d6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -833,7 +833,7 @@ Leave one space or none, according to the context." | |||
| 833 | (interactive "*") | 833 | (interactive "*") |
| 834 | (save-excursion | 834 | (save-excursion |
| 835 | (delete-horizontal-space) | 835 | (delete-horizontal-space) |
| 836 | (if (or (looking-at "^\\|\\s)") | 836 | (if (or (looking-at "^\\|$\\|\\s)") |
| 837 | (save-excursion (forward-char -1) | 837 | (save-excursion (forward-char -1) |
| 838 | (looking-at "$\\|\\s(\\|\\s'"))) | 838 | (looking-at "$\\|\\s(\\|\\s'"))) |
| 839 | nil | 839 | nil |
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 91ebbf6f940..b1feca7ca6b 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el | |||
| @@ -43,11 +43,13 @@ | |||
| 43 | :group 'languages) | 43 | :group 'languages) |
| 44 | 44 | ||
| 45 | (defconst css-pseudo-class-ids | 45 | (defconst css-pseudo-class-ids |
| 46 | '("active" "checked" "disabled" "empty" "enabled" "first" | 46 | '("active" "checked" "default" "disabled" "empty" "enabled" "first" |
| 47 | "first-child" "first-of-type" "focus" "hover" "indeterminate" "lang" | 47 | "first-child" "first-of-type" "focus" "focus-within" "hover" |
| 48 | "last-child" "last-of-type" "left" "link" "not" "nth-child" | 48 | "in-range" "indeterminate" "invalid" "lang" "last-child" |
| 49 | "nth-last-child" "nth-last-of-type" "nth-of-type" "only-child" | 49 | "last-of-type" "left" "link" "not" "nth-child" "nth-last-child" |
| 50 | "only-of-type" "right" "root" "target" "visited") | 50 | "nth-last-of-type" "nth-of-type" "only-child" "only-of-type" |
| 51 | "optional" "out-of-range" "read-only" "read-write" "required" | ||
| 52 | "right" "root" "scope" "target" "valid" "visited") | ||
| 51 | "Identifiers for pseudo-classes.") | 53 | "Identifiers for pseudo-classes.") |
| 52 | 54 | ||
| 53 | (defconst css-pseudo-element-ids | 55 | (defconst css-pseudo-element-ids |
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 9747bd6cc12..db733fe661b 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -1094,10 +1094,10 @@ in the list must have an affix file where Hunspell affix files are kept." | |||
| 1094 | 1094 | ||
| 1095 | (defun ispell-find-hunspell-dictionaries () | 1095 | (defun ispell-find-hunspell-dictionaries () |
| 1096 | "Look for installed Hunspell dictionaries. | 1096 | "Look for installed Hunspell dictionaries. |
| 1097 | Will initialize `ispell-hunspell-dictionary-alist' and | 1097 | Will initialize `ispell-hunspell-dictionary-alist' according |
| 1098 | `ispell-hunspell-dictionary-alist' after values found | 1098 | to dictionaries found, and will remove aliases from the list |
| 1099 | and remove `ispell-dicts-name2locale-equivs-alist' | 1099 | in `ispell-dicts-name2locale-equivs-alist' if an explicit |
| 1100 | entries if a specific dictionary was found." | 1100 | dictionary from that list was found." |
| 1101 | (let ((hunspell-found-dicts | 1101 | (let ((hunspell-found-dicts |
| 1102 | (split-string | 1102 | (split-string |
| 1103 | (with-temp-buffer | 1103 | (with-temp-buffer |
| @@ -1110,18 +1110,27 @@ entries if a specific dictionary was found." | |||
| 1110 | "[\n\r]+" | 1110 | "[\n\r]+" |
| 1111 | t)) | 1111 | t)) |
| 1112 | hunspell-default-dict | 1112 | hunspell-default-dict |
| 1113 | hunspell-default-dict-entry) | 1113 | hunspell-default-dict-entry |
| 1114 | hunspell-multi-dict) | ||
| 1114 | (dolist (dict hunspell-found-dicts) | 1115 | (dolist (dict hunspell-found-dicts) |
| 1115 | (let* ((full-name (file-name-nondirectory dict)) | 1116 | (let* ((full-name (file-name-nondirectory dict)) |
| 1116 | (basename (file-name-sans-extension full-name)) | 1117 | (basename (file-name-sans-extension full-name)) |
| 1117 | (affix-file (concat dict ".aff"))) | 1118 | (affix-file (concat dict ".aff"))) |
| 1118 | (if (string-match "\\.aff$" dict) | 1119 | (if (string-match "\\.aff$" dict) |
| 1119 | ;; Found default dictionary | 1120 | ;; Found default dictionary |
| 1120 | (if hunspell-default-dict | 1121 | (progn |
| 1121 | (error "ispell-fhd: Default dict already defined as %s. Not using %s.\n" | 1122 | (if hunspell-default-dict |
| 1122 | hunspell-default-dict dict) | 1123 | (setq hunspell-multi-dict |
| 1123 | (setq affix-file dict) | 1124 | (concat (or hunspell-multi-dict |
| 1124 | (setq hunspell-default-dict (list basename affix-file))) | 1125 | (car hunspell-default-dict)) |
| 1126 | "," basename)) | ||
| 1127 | (setq affix-file dict) | ||
| 1128 | ;; FIXME: The cdr of the list we cons below is never | ||
| 1129 | ;; used. Why do we need a list? | ||
| 1130 | (setq hunspell-default-dict (list basename affix-file))) | ||
| 1131 | (ispell-print-if-debug | ||
| 1132 | "++ ispell-fhd: default dict-entry:%s name:%s basename:%s\n" | ||
| 1133 | dict full-name basename)) | ||
| 1125 | (if (and (not (assoc basename ispell-hunspell-dict-paths-alist)) | 1134 | (if (and (not (assoc basename ispell-hunspell-dict-paths-alist)) |
| 1126 | (file-exists-p affix-file)) | 1135 | (file-exists-p affix-file)) |
| 1127 | ;; Entry has an associated .aff file and no previous value. | 1136 | ;; Entry has an associated .aff file and no previous value. |
| @@ -1161,7 +1170,8 @@ entries if a specific dictionary was found." | |||
| 1161 | (cl-pushnew (list dict-equiv-key affix-file) | 1170 | (cl-pushnew (list dict-equiv-key affix-file) |
| 1162 | ispell-hunspell-dict-paths-alist :test #'equal))))) | 1171 | ispell-hunspell-dict-paths-alist :test #'equal))))) |
| 1163 | ;; Parse and set values for default dictionary. | 1172 | ;; Parse and set values for default dictionary. |
| 1164 | (setq hunspell-default-dict (car hunspell-default-dict)) | 1173 | (setq hunspell-default-dict (or hunspell-multi-dict |
| 1174 | (car hunspell-default-dict))) | ||
| 1165 | (setq hunspell-default-dict-entry | 1175 | (setq hunspell-default-dict-entry |
| 1166 | (ispell-parse-hunspell-affix-file hunspell-default-dict)) | 1176 | (ispell-parse-hunspell-affix-file hunspell-default-dict)) |
| 1167 | ;; Create an alist of found dicts with only names, except for default dict. | 1177 | ;; Create an alist of found dicts with only names, except for default dict. |
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el index 7b6cdd53790..2885d4e12e2 100644 --- a/lisp/url/url-auth.el +++ b/lisp/url/url-auth.el | |||
| @@ -131,8 +131,8 @@ instead of the filename inheritance method." | |||
| 131 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 131 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 132 | ;;; Digest authorization code | 132 | ;;; Digest authorization code |
| 133 | ;;; ------------------------ | 133 | ;;; ------------------------ |
| 134 | ;;; This implements the DIGEST authorization type. See the internet draft | 134 | ;;; This implements the DIGEST authorization type. See RFC 2617 |
| 135 | ;;; ftp://ds.internic.net/internet-drafts/draft-ietf-http-digest-aa-01.txt | 135 | ;;; https://www.ietf.org/rfc/rfc2617.txt |
| 136 | ;;; for the complete documentation on this type. | 136 | ;;; for the complete documentation on this type. |
| 137 | ;;; | 137 | ;;; |
| 138 | ;;; This is very secure | 138 | ;;; This is very secure |
| @@ -143,107 +143,306 @@ Its value is an assoc list of assoc lists. The first assoc list is | |||
| 143 | keyed by the server name. The cdr of this is an assoc list based | 143 | keyed by the server name. The cdr of this is an assoc list based |
| 144 | on the \"directory\" specified by the url we are looking up.") | 144 | on the \"directory\" specified by the url we are looking up.") |
| 145 | 145 | ||
| 146 | (defsubst url-digest-auth-colonjoin (&rest args) | ||
| 147 | "Concatenate ARGS as strings with colon as a separator." | ||
| 148 | (mapconcat 'identity args ":")) | ||
| 149 | |||
| 150 | (defsubst url-digest-auth-kd (data secret) | ||
| 151 | "Apply digest algorithm to DATA using SECRET and return the result." | ||
| 152 | (md5 (url-digest-auth-colonjoin secret data))) | ||
| 153 | |||
| 154 | (defsubst url-digest-auth-make-ha1 (user realm password) | ||
| 155 | "Compute checksum out of strings USER, REALM, and PASSWORD." | ||
| 156 | (md5 (url-digest-auth-colonjoin user realm password))) | ||
| 157 | |||
| 158 | (defsubst url-digest-auth-make-ha2 (method digest-uri) | ||
| 159 | "Compute checksum out of strings METHOD and DIGEST-URI." | ||
| 160 | (md5 (url-digest-auth-colonjoin method digest-uri))) | ||
| 161 | |||
| 162 | (defsubst url-digest-auth-make-request-digest (ha1 ha2 nonce) | ||
| 163 | "Construct the request-digest from hash strings HA1, HA2, and NONCE. | ||
| 164 | This is the value that server receives as a proof that user knows | ||
| 165 | a password." | ||
| 166 | (url-digest-auth-kd (url-digest-auth-colonjoin nonce ha2) ha1)) | ||
| 167 | |||
| 168 | (defsubst url-digest-auth-make-request-digest-qop (qop ha1 ha2 nonce nc cnonce) | ||
| 169 | "Construct the request-digest with qop. | ||
| 170 | QOP describes the \"quality of protection\" and algorithm to use. | ||
| 171 | All of the strings QOP, HA1, HA2, NONCE, NC, and CNONCE are | ||
| 172 | combined into a single hash value that proves to a server the | ||
| 173 | user knows a password. It's worth noting that HA2 already | ||
| 174 | depends on value of QOP." | ||
| 175 | (url-digest-auth-kd (url-digest-auth-colonjoin | ||
| 176 | nonce nc cnonce qop ha2) ha1)) | ||
| 177 | |||
| 178 | (defsubst url-digest-auth-directory-id (url realm) | ||
| 179 | "Make an identifier for selecting a key in key cache. | ||
| 180 | The identifier is made either from URL or REALM. It represents a | ||
| 181 | protection space within a server so that one server can have | ||
| 182 | multiple authorizations." | ||
| 183 | (or realm (or (url-file-directory (url-filename url)) "/"))) | ||
| 184 | |||
| 185 | (defsubst url-digest-auth-server-id (url) | ||
| 186 | "Make an identifier for selecting a server in key cache. | ||
| 187 | The identifier is made from URL's host and port. Together with | ||
| 188 | `url-digest-auth-directory-id' these identify a single key in the | ||
| 189 | key cache `url-digest-auth-storage'." | ||
| 190 | (format "%s:%d" (url-host url) (url-port url))) | ||
| 191 | |||
| 192 | (defun url-digest-auth-make-cnonce () | ||
| 193 | "Compute a new unique client nonce value." | ||
| 194 | (base64-encode-string | ||
| 195 | (apply 'format "%016x%04x%04x%05x%05x" (random) (current-time)) t)) | ||
| 196 | |||
| 197 | (defun url-digest-auth-nonce-count (nonce) | ||
| 198 | "The number requests sent to server with the given NONCE. | ||
| 199 | This count includes the request we're preparing here. | ||
| 200 | |||
| 201 | Currently, this is not implemented and will always return 1. | ||
| 202 | |||
| 203 | Value returned is in string format with leading zeroes, such as | ||
| 204 | \"00000001\"." | ||
| 205 | (format "%08x" 1)) | ||
| 206 | |||
| 207 | (defun url-digest-auth-name-value-string (pairs) | ||
| 208 | "Concatenate name-value pairs in association list PAIRS. | ||
| 209 | |||
| 210 | Output is formatted as \"name1=\\\"value1\\\", name2=\\\"value2\\\", ...\"" | ||
| 211 | (mapconcat (lambda (pair) | ||
| 212 | (format "%s=\"%s\"" | ||
| 213 | (symbol-name (car pair)) | ||
| 214 | (cdr pair))) | ||
| 215 | pairs ", ")) | ||
| 216 | |||
| 217 | (defun url-digest-auth-source-creds (url) | ||
| 218 | "Find credentials for URL object from the Emacs auth-source. | ||
| 219 | Return value is a plist that has `:user' and `:secret' properties | ||
| 220 | if credentials were found. Otherwise nil." | ||
| 221 | (let ((server (url-digest-auth-server-id url)) | ||
| 222 | (type (url-type url))) | ||
| 223 | (list :user (url-do-auth-source-search server type :user) | ||
| 224 | :secret (url-do-auth-source-search server type :secret)))) | ||
| 225 | |||
| 226 | (defun url-digest-prompt-creds (url realm &optional creds) | ||
| 227 | "Prompt credentials for URL and REALM, defaulting to CREDS. | ||
| 228 | CREDS is a plist that may have properties `:user' and `:secret'." | ||
| 229 | ;; Set explicitly in case creds were nil. This makes the second | ||
| 230 | ;; plist-put modify the same plist. | ||
| 231 | (setq creds | ||
| 232 | (plist-put creds :user | ||
| 233 | (read-string (url-auth-user-prompt url realm) | ||
| 234 | (or (plist-get creds :user) | ||
| 235 | (user-real-login-name))))) | ||
| 236 | (plist-put creds :secret | ||
| 237 | (read-passwd "Password: " nil (plist-get creds :secret)))) | ||
| 238 | |||
| 239 | (defun url-digest-auth-directory-id-assoc (dirkey keylist) | ||
| 240 | "Find the best match for DIRKEY in key alist KEYLIST. | ||
| 241 | |||
| 242 | The string DIRKEY should be obtained using | ||
| 243 | `url-digest-auth-directory-id'. The key list to search through | ||
| 244 | is the alist KEYLIST where car of each element may match DIRKEY. | ||
| 245 | If DIRKEY represents a realm, the list is searched only for an | ||
| 246 | exact match. For directory names, an ancestor is sufficient for | ||
| 247 | a match." | ||
| 248 | (or | ||
| 249 | ;; Check exact match first. | ||
| 250 | (assoc dirkey keylist) | ||
| 251 | ;; No exact match found. Continue to look for partial match if | ||
| 252 | ;; dirkey is not a realm. | ||
| 253 | (and (string-match "/" dirkey) | ||
| 254 | (let (match) | ||
| 255 | (while (and (null match) keylist) | ||
| 256 | (if (or | ||
| 257 | ;; Any realm candidate matches. Why? | ||
| 258 | (not (string-match "/" (caar keylist))) | ||
| 259 | ;; Parent directory matches. | ||
| 260 | (string-prefix-p (caar keylist) dirkey)) | ||
| 261 | (setq match (car keylist)) | ||
| 262 | (setq keylist (cdr keylist)))) | ||
| 263 | match)))) | ||
| 264 | |||
| 265 | (defun url-digest-cached-key (url realm) | ||
| 266 | "Find best match for URL and REALM from `url-digest-auth-storage'. | ||
| 267 | The return value is a list consisting of a realm (or a directory) | ||
| 268 | a user name, and hashed authentication tokens HA1 and HA2. | ||
| 269 | Modifying the contents of the returned list will modify the cache | ||
| 270 | variable `url-digest-auth-storage' itself." | ||
| 271 | (url-digest-auth-directory-id-assoc | ||
| 272 | (url-digest-auth-directory-id url realm) | ||
| 273 | (cdr (assoc (url-digest-auth-server-id url) url-digest-auth-storage)))) | ||
| 274 | |||
| 275 | (defun url-digest-cache-key (key url) | ||
| 276 | "Add key to `url-digest-auth-storage'. | ||
| 277 | KEY has the same format as returned by `url-digest-cached-key'. | ||
| 278 | The key is added to cache hierarchy under server id, deduced from | ||
| 279 | URL." | ||
| 280 | (let ((serverid (url-digest-auth-server-id url))) | ||
| 281 | (push (list serverid key) url-digest-auth-storage))) | ||
| 282 | |||
| 146 | (defun url-digest-auth-create-key (username password realm method uri) | 283 | (defun url-digest-auth-create-key (username password realm method uri) |
| 147 | "Create a key for digest authentication method" | 284 | "Create a key for digest authentication method. |
| 148 | (let* ((info (if (stringp uri) | 285 | The USERNAME and PASSWORD are the credentials for REALM and are |
| 149 | (url-generic-parse-url uri) | 286 | used in making a hashed value named HA1. The HTTP METHOD and URI |
| 150 | uri)) | 287 | makes a second hashed value HA2. These hashes are used in making |
| 151 | (a1 (md5 (concat username ":" realm ":" password))) | 288 | the authentication key that can be stored without saving the |
| 152 | (a2 (md5 (concat method ":" (url-filename info))))) | 289 | password in plain text. The return value is a list (HA1 HA2). |
| 153 | (list a1 a2))) | 290 | |
| 154 | 291 | For backward compatibility, URI is allowed to be a URL cl-struct | |
| 155 | (defun url-digest-auth (url &optional prompt overwrite realm args) | 292 | object." |
| 156 | "Get the username/password for the specified URL. | 293 | (and username password realm |
| 157 | If optional argument PROMPT is non-nil, ask for the username/password | 294 | (list (url-digest-auth-make-ha1 username realm password) |
| 158 | to use for the URL and its descendants. If optional third argument | 295 | (url-digest-auth-make-ha2 method (cond ((stringp uri) uri) |
| 159 | OVERWRITE is non-nil, overwrite the old username/password pair if it | 296 | (t (url-filename uri))))))) |
| 160 | is found in the assoc list. If REALM is specified, use that as the realm | 297 | |
| 161 | instead of hostname:portnum." | 298 | (defun url-digest-auth-build-response (key url realm attrs) |
| 162 | (if args | 299 | "Compute authorization string for the given challenge using KEY. |
| 163 | (let* ((href (if (stringp url) | 300 | |
| 164 | (url-generic-parse-url url) | 301 | The string looks like 'Digest username=\"John\", realm=\"The |
| 165 | url)) | 302 | Realm\", ...' |
| 166 | (server (url-host href)) | 303 | |
| 167 | (type (url-type href)) | 304 | Part of the challenge is already solved in a pre-computed KEY |
| 168 | (port (url-port href)) | 305 | which is list of a realm (or a directory), user name, and hash |
| 169 | (file (url-filename href)) | 306 | tokens HA1 and HA2. |
| 170 | (enable-recursive-minibuffers t) | 307 | |
| 171 | user pass byserv retval data) | 308 | Some fields are filled as is from the given URL, REALM, and |
| 172 | (setq file (cond | 309 | using the contents of alist ATTRS. |
| 173 | (realm realm) | 310 | |
| 174 | ((string-match "/$" file) file) | 311 | ATTRS is expected to contain at least the server's \"nonce\" |
| 175 | (t (url-file-directory file))) | 312 | value. It also might contain the optional \"opaque\" value. |
| 176 | server (format "%s:%d" server port) | 313 | Newer implementations conforming to RFC 2617 should also contain |
| 177 | byserv (cdr-safe (assoc server url-digest-auth-storage))) | 314 | qop (Quality Of Protection) and related attributes. |
| 178 | (cond | 315 | |
| 179 | ((and prompt (not byserv)) | 316 | Restrictions on Quality of Protection scheme: The qop value |
| 180 | (setq user (or | 317 | \"auth-int\" or algorithm any other than \"MD5\" are not |
| 181 | (url-do-auth-source-search server type :user) | 318 | implemented." |
| 182 | (read-string (url-auth-user-prompt url realm) | 319 | |
| 183 | (user-real-login-name))) | 320 | (when key |
| 184 | pass (or | 321 | (let ((user (nth 1 key)) |
| 185 | (url-do-auth-source-search server type :secret) | 322 | (ha1 (nth 2 key)) |
| 186 | (read-passwd "Password: ")) | 323 | (ha2 (nth 3 key)) |
| 187 | url-digest-auth-storage | 324 | (digest-uri (url-filename url)) |
| 188 | (cons (list server | 325 | (qop (cdr-safe (assoc "qop" attrs))) |
| 189 | (cons file | 326 | (nonce (cdr-safe (assoc "nonce" attrs))) |
| 190 | (setq retval | 327 | (opaque (cdr-safe (assoc "opaque" attrs)))) |
| 191 | (cons user | 328 | |
| 192 | (url-digest-auth-create-key | 329 | (concat |
| 193 | user pass realm | 330 | "Digest " |
| 194 | (or url-request-method "GET") | 331 | (url-digest-auth-name-value-string |
| 195 | url))))) | 332 | (append (list (cons 'username user) |
| 196 | url-digest-auth-storage))) | 333 | (cons 'realm realm) |
| 197 | (byserv | 334 | (cons 'nonce nonce) |
| 198 | (setq retval (cdr-safe (assoc file byserv))) | 335 | (cons 'uri digest-uri)) |
| 199 | (if (and (not retval) ; no exact match, check directories | 336 | |
| 200 | (string-match "/" file)) ; not looking for a realm | 337 | (cond |
| 201 | (while (and byserv (not retval)) | 338 | ((null qop) |
| 202 | (setq data (car (car byserv))) | 339 | (list (cons 'response (url-digest-auth-make-request-digest |
| 203 | (if (or (not (string-match "/" data)) | 340 | ha1 ha2 nonce)))) |
| 204 | (and | 341 | ((string= qop "auth") |
| 205 | (>= (length file) (length data)) | 342 | (let ((nc (url-digest-auth-nonce-count nonce)) |
| 206 | (string= data (substring file 0 (length data))))) | 343 | (cnonce (url-digest-auth-make-cnonce))) |
| 207 | (setq retval (cdr (car byserv)))) | 344 | (list (cons 'qop qop) |
| 208 | (setq byserv (cdr byserv)))) | 345 | (cons 'nc nc) |
| 209 | (if overwrite | 346 | (cons 'cnonce cnonce) |
| 210 | (if (and (not retval) prompt) | 347 | (cons 'response |
| 211 | (setq user (or | 348 | (url-digest-auth-make-request-digest-qop |
| 212 | (url-do-auth-source-search server type :user) | 349 | qop ha1 ha2 nonce nc cnonce))))) |
| 213 | (read-string (url-auth-user-prompt url realm) | 350 | (t (message "Quality of protection \"%s\" is not implemented." qop) |
| 214 | (user-real-login-name))) | 351 | nil)) |
| 215 | pass (or | 352 | |
| 216 | (url-do-auth-source-search server type :secret) | 353 | |
| 217 | (read-passwd "Password: ")) | 354 | (if opaque (list (cons 'opaque opaque))))))))) |
| 218 | retval (setq retval | 355 | |
| 219 | (cons user | 356 | (defun url-digest-find-creds (url prompt &optional realm) |
| 220 | (url-digest-auth-create-key | 357 | "Find or ask credentials for URL. |
| 221 | user pass realm | 358 | |
| 222 | (or url-request-method "GET") | 359 | Primary method for finding credentials is from Emacs auth-source. |
| 223 | url))) | 360 | If password isn't found, and PROMPT is non-nil, query credentials |
| 224 | byserv (assoc server url-digest-auth-storage)) | 361 | via minibuffer. Optional REALM may be used when prompting as a |
| 225 | (setcdr byserv | 362 | hint to the user. |
| 226 | (cons (cons file retval) (cdr byserv)))))) | 363 | |
| 227 | (t (setq retval nil))) | 364 | Return value is nil in case either user name or password wasn't |
| 228 | (if retval | 365 | found. Otherwise, it's a plist containing `:user' and `:secret'. |
| 229 | (if (cdr-safe (assoc "opaque" args)) | 366 | Additional `:source' property denotes the origin of the |
| 230 | (let ((nonce (or (cdr-safe (assoc "nonce" args)) "nonegiven")) | 367 | credentials and its value can be either symbol `authsource' or |
| 231 | (opaque (cdr-safe (assoc "opaque" args)))) | 368 | `interactive'." |
| 232 | (format | 369 | (let ((creds (url-digest-auth-source-creds url))) |
| 233 | (concat "Digest username=\"%s\", realm=\"%s\"," | 370 | |
| 234 | "nonce=\"%s\", uri=\"%s\"," | 371 | ;; If credentials weren't found and prompting is allowed, prompt |
| 235 | "response=\"%s\", opaque=\"%s\"") | 372 | ;; the user. |
| 236 | (nth 0 retval) realm nonce (url-filename href) | 373 | (if (and prompt |
| 237 | (md5 (concat (nth 1 retval) ":" nonce ":" | 374 | (or (null creds) |
| 238 | (nth 2 retval))) opaque)) | 375 | (null (plist-get creds :secret)))) |
| 239 | (let ((nonce (or (cdr-safe (assoc "nonce" args)) "nonegiven"))) | 376 | (progn |
| 240 | (format | 377 | (setq creds (url-digest-prompt-creds url realm creds)) |
| 241 | (concat "Digest username=\"%s\", realm=\"%s\"," | 378 | (plist-put creds :source 'interactive)) |
| 242 | "nonce=\"%s\", uri=\"%s\"," | 379 | (plist-put creds :source 'authsource)) |
| 243 | "response=\"%s\"") | 380 | |
| 244 | (nth 0 retval) realm nonce (url-filename href) | 381 | (and (plist-get creds :user) |
| 245 | (md5 (concat (nth 1 retval) ":" nonce ":" | 382 | (plist-get creds :secret) |
| 246 | (nth 2 retval)))))))))) | 383 | creds))) |
| 384 | |||
| 385 | (defun url-digest-find-new-key (url realm prompt) | ||
| 386 | "Find credentials and create a new authorization key for given URL and REALM. | ||
| 387 | |||
| 388 | Return value is the new key, or nil if credentials weren't found. | ||
| 389 | \"New\" in this context means a key that's not yet found in cache | ||
| 390 | variable `url-digest-auth-storage'. You may use `url-digest-cache-key' | ||
| 391 | to put it there. | ||
| 392 | |||
| 393 | This function uses `url-digest-find-creds' to find the | ||
| 394 | credentials. It first looks in auth-source. If not found, and | ||
| 395 | PROMPT is non-nil, user is asked for credentials interactively | ||
| 396 | via minibuffer." | ||
| 397 | (let (creds) | ||
| 398 | (unwind-protect | ||
| 399 | (if (setq creds (url-digest-find-creds url prompt realm)) | ||
| 400 | (cons (url-digest-auth-directory-id url realm) | ||
| 401 | (cons (plist-get creds :user) | ||
| 402 | (url-digest-auth-create-key | ||
| 403 | (plist-get creds :user) | ||
| 404 | (plist-get creds :secret) | ||
| 405 | realm | ||
| 406 | (or url-request-method "GET") | ||
| 407 | (url-filename url))))) | ||
| 408 | (if (and creds | ||
| 409 | ;; Don't clear secret for `authsource' since it will | ||
| 410 | ;; corrupt any future fetches for it. | ||
| 411 | (not (eq (plist-get creds :source) 'authsource))) | ||
| 412 | (clear-string (plist-get creds :secret)))))) | ||
| 413 | |||
| 414 | (defun url-digest-auth (url &optional prompt overwrite realm attrs) | ||
| 415 | "Get the HTTP Digest response string for the specified URL. | ||
| 416 | |||
| 417 | If optional argument PROMPT is non-nil, ask for the username and | ||
| 418 | password to use for the URL and its descendants but only if one | ||
| 419 | cannot be found from cache. Look also in Emacs auth-source. | ||
| 420 | |||
| 421 | If optional third argument OVERWRITE is non-nil, overwrite the | ||
| 422 | old credentials, if they're found in cache, with new ones from | ||
| 423 | user prompt or from Emacs auth-source. | ||
| 424 | |||
| 425 | If REALM is specified, use that instead of the URL descendant | ||
| 426 | method to match cached credentials. | ||
| 427 | |||
| 428 | Alist ATTRS contains additional attributes for the authentication | ||
| 429 | challenge such as nonce and opaque." | ||
| 430 | (if attrs | ||
| 431 | (let* ((href (if (stringp url) (url-generic-parse-url url) url)) | ||
| 432 | (enable-recursive-minibuffers t) | ||
| 433 | (key (url-digest-cached-key href realm))) | ||
| 434 | |||
| 435 | (if (or (null key) overwrite) | ||
| 436 | (let ((newkey (url-digest-find-new-key href realm (cond | ||
| 437 | (key nil) | ||
| 438 | (t prompt))))) | ||
| 439 | (if (and newkey key overwrite) | ||
| 440 | (setcdr key (cdr newkey)) | ||
| 441 | (if (and newkey (null key)) | ||
| 442 | (url-digest-cache-key (setq key newkey) href))))) | ||
| 443 | |||
| 444 | (if key | ||
| 445 | (url-digest-auth-build-response key href realm attrs))))) | ||
| 247 | 446 | ||
| 248 | (defvar url-registered-auth-schemes nil | 447 | (defvar url-registered-auth-schemes nil |
| 249 | "A list of the registered authorization schemes and various and sundry | 448 | "A list of the registered authorization schemes and various and sundry |
diff --git a/lisp/url/url-domsuf.el b/lisp/url/url-domsuf.el index 25a6a423eb4..b24f24531a6 100644 --- a/lisp/url/url-domsuf.el +++ b/lisp/url/url-domsuf.el | |||
| @@ -89,7 +89,7 @@ | |||
| 89 | 89 | ||
| 90 | ;; Tests: | 90 | ;; Tests: |
| 91 | 91 | ||
| 92 | ;; TODO convert to a proper test/automated test. | 92 | ;; TODO convert to a proper test. |
| 93 | ;; (url-domsuf-cookie-allowed-p "com") => nil | 93 | ;; (url-domsuf-cookie-allowed-p "com") => nil |
| 94 | ;; (url-domsuf-cookie-allowed-p "foo.bar.bd") => t | 94 | ;; (url-domsuf-cookie-allowed-p "foo.bar.bd") => t |
| 95 | ;; (url-domsuf-cookie-allowed-p "bar.bd") => nil | 95 | ;; (url-domsuf-cookie-allowed-p "bar.bd") => nil |
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 31c33e6a720..aa8d77882ec 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el | |||
| @@ -504,7 +504,7 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html") | |||
| 504 | ;; "index ", "old mode", "new mode", "new file mode" and | 504 | ;; "index ", "old mode", "new mode", "new file mode" and |
| 505 | ;; "deleted file mode" are output by git-diff. | 505 | ;; "deleted file mode" are output by git-diff. |
| 506 | (defconst diff-file-junk-re | 506 | (defconst diff-file-junk-re |
| 507 | (concat "Index: \\|=\\{20,\\}\\|" ; SVN | 507 | (concat "Index: \\|Prereq: \\|=\\{20,\\}\\|" ; SVN |
| 508 | "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode\\|=== modified file")) | 508 | "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode\\|=== modified file")) |
| 509 | 509 | ||
| 510 | ;; If point is in a diff header, then return beginning | 510 | ;; If point is in a diff header, then return beginning |
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el index 9d2ec51b596..36aebf4aed1 100644 --- a/lisp/vc/ediff-ptch.el +++ b/lisp/vc/ediff-ptch.el | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | ;;; Code: | 25 | ;;; Code: |
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | (require 'diff-mode) ; For `diff-file-junk-re'. | ||
| 29 | |||
| 28 | (provide 'ediff-ptch) | 30 | (provide 'ediff-ptch) |
| 29 | 31 | ||
| 30 | (defgroup ediff-ptch nil | 32 | (defgroup ediff-ptch nil |
| @@ -225,14 +227,11 @@ program." | |||
| 225 | (if (and beg2 end2) | 227 | (if (and beg2 end2) |
| 226 | (buffer-substring beg2 end2) | 228 | (buffer-substring beg2 end2) |
| 227 | "/dev/null"))) | 229 | "/dev/null"))) |
| 228 | ;; check for any `Index:' or `Prereq:' lines, but don't use them | 230 | ;; Remove file junk (Bug#26084). |
| 229 | (if (re-search-backward "^Index:" mark1-end 'noerror) | 231 | (while (re-search-backward |
| 230 | (move-marker mark2 (match-beginning 0))) | 232 | (concat "^" diff-file-junk-re) mark1-end t) |
| 231 | (if (re-search-backward "^Prereq:" mark1-end 'noerror) | 233 | (move-marker mark2 (match-beginning 0))) |
| 232 | (move-marker mark2 (match-beginning 0))) | ||
| 233 | |||
| 234 | (goto-char mark2-end) | 234 | (goto-char mark2-end) |
| 235 | |||
| 236 | (if filenames | 235 | (if filenames |
| 237 | (setq patch-map | 236 | (setq patch-map |
| 238 | (cons (ediff-make-new-meta-list-element | 237 | (cons (ediff-make-new-meta-list-element |
diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in index d6a8f50ce74..ee7a2040e89 100644 --- a/lwlib/Makefile.in +++ b/lwlib/Makefile.in | |||
| @@ -22,6 +22,9 @@ | |||
| 22 | # This was taken from the output of Imake using Lucid's Imakefile. | 22 | # This was taken from the output of Imake using Lucid's Imakefile. |
| 23 | # and set up to be configured by ../configure. | 23 | # and set up to be configured by ../configure. |
| 24 | 24 | ||
| 25 | all: liblw.a | ||
| 26 | .PHONY: all | ||
| 27 | |||
| 25 | srcdir=@srcdir@ | 28 | srcdir=@srcdir@ |
| 26 | # MinGW CPPFLAGS may use this. | 29 | # MinGW CPPFLAGS may use this. |
| 27 | abs_top_srcdir=@abs_top_srcdir@ | 30 | abs_top_srcdir=@abs_top_srcdir@ |
| @@ -71,15 +74,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) | |||
| 71 | am__v_at_0 = @ | 74 | am__v_at_0 = @ |
| 72 | am__v_at_1 = | 75 | am__v_at_1 = |
| 73 | 76 | ||
| 74 | DEPDIR = deps | ||
| 75 | AUTO_DEPEND = @AUTO_DEPEND@ | 77 | AUTO_DEPEND = @AUTO_DEPEND@ |
| 76 | 78 | DEPDIR = deps | |
| 77 | ifeq ($(AUTO_DEPEND),yes) | 79 | ifeq ($(AUTO_DEPEND),yes) |
| 78 | DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP | 80 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP |
| 79 | MKDEPDIR = ${MKDIR_P} ${DEPDIR} | 81 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) |
| 80 | else | 82 | else |
| 81 | DEPFLAGS = | 83 | DEPFLAGS = |
| 82 | MKDEPDIR = : | 84 | include $(srcdir)/deps.mk |
| 83 | endif | 85 | endif |
| 84 | 86 | ||
| 85 | ## ../src is where the generated file (config.h, globals.h) are. | 87 | ## ../src is where the generated file (config.h, globals.h) are. |
| @@ -94,11 +96,7 @@ ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ | |||
| 94 | -Demacs -I../src \ | 96 | -Demacs -I../src \ |
| 95 | -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib | 97 | -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib |
| 96 | 98 | ||
| 97 | all: liblw.a | ||
| 98 | .PHONY: all | ||
| 99 | |||
| 100 | .c.o: | 99 | .c.o: |
| 101 | @$(MKDEPDIR) | ||
| 102 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< | 100 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< |
| 103 | 101 | ||
| 104 | liblw.a: $(OBJS) | 102 | liblw.a: $(OBJS) |
| @@ -110,20 +108,14 @@ globals_h = ../src/globals.h | |||
| 110 | $(globals_h): | 108 | $(globals_h): |
| 111 | $(MAKE) -C ../src globals.h | 109 | $(MAKE) -C ../src globals.h |
| 112 | 110 | ||
| 113 | ifeq ($(AUTO_DEPEND),yes) | ||
| 114 | -include $(ALLOBJS:%.o=${DEPDIR}/%.d) | ||
| 115 | else | ||
| 116 | include $(srcdir)/deps.mk | ||
| 117 | endif | ||
| 118 | |||
| 119 | .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean | 111 | .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean |
| 120 | 112 | ||
| 121 | clean mostlyclean: | 113 | clean mostlyclean: |
| 122 | rm -f *.o liblw.a \#* | 114 | rm -f *.o liblw.a \#* $(DEPDIR)/* |
| 123 | -rm -rf ${DEPDIR} | ||
| 124 | 115 | ||
| 125 | distclean: clean | 116 | distclean: clean |
| 126 | rm -f Makefile | 117 | rm -f Makefile |
| 118 | rm -fr $(DEPDIR) | ||
| 127 | 119 | ||
| 128 | bootstrap-clean maintainer-clean: distclean | 120 | bootstrap-clean maintainer-clean: distclean |
| 129 | rm -f TAGS | 121 | rm -f TAGS |
| @@ -538,12 +538,9 @@ done | |||
| 538 | 538 | ||
| 539 | if [ "$with_tests" = "yes" ]; then | 539 | if [ "$with_tests" = "yes" ]; then |
| 540 | echo "Making links to 'test' and its subdirectories" | 540 | echo "Making links to 'test' and its subdirectories" |
| 541 | for f in `find test -type f`; do | 541 | for f in `find test -type f ! -name '*.log' ! -name a.out \ |
| 542 | case $f in | 542 | ! -path test/Makefile |
| 543 | test/automated/*.log) continue ;; | 543 | `; do |
| 544 | test/automated/flymake/warnpred/a.out) continue ;; | ||
| 545 | test/automated/Makefile) continue ;; | ||
| 546 | esac | ||
| 547 | ln $f $tempdir/$f | 544 | ln $f $tempdir/$f |
| 548 | done | 545 | done |
| 549 | fi | 546 | fi |
diff --git a/modules/mod-test/test.el b/modules/mod-test/test.el index 181f13208ec..caa807d3005 100644 --- a/modules/mod-test/test.el +++ b/modules/mod-test/test.el | |||
| @@ -64,7 +64,21 @@ | |||
| 64 | ;; | 64 | ;; |
| 65 | 65 | ||
| 66 | (ert-deftest mod-test-non-local-exit-signal-test () | 66 | (ert-deftest mod-test-non-local-exit-signal-test () |
| 67 | (should-error (mod-test-signal))) | 67 | (should-error (mod-test-signal)) |
| 68 | (let (debugger-args backtrace) | ||
| 69 | (should-error | ||
| 70 | (let ((debugger (lambda (&rest args) | ||
| 71 | (setq debugger-args args | ||
| 72 | backtrace (with-output-to-string (backtrace))) | ||
| 73 | (cl-incf num-nonmacro-input-events))) | ||
| 74 | (debug-on-signal t)) | ||
| 75 | (mod-test-signal))) | ||
| 76 | (should (equal debugger-args '(error (error . 56)))) | ||
| 77 | (should (string-match-p | ||
| 78 | (rx bol " internal--module-call(" (+ nonl) ?\) ?\n | ||
| 79 | " apply(internal--module-call " (+ nonl) ?\) ?\n | ||
| 80 | " mod-test-signal()" eol) | ||
| 81 | backtrace)))) | ||
| 68 | 82 | ||
| 69 | (ert-deftest mod-test-non-local-exit-throw-test () | 83 | (ert-deftest mod-test-non-local-exit-throw-test () |
| 70 | (should (equal | 84 | (should (equal |
diff --git a/oldXMenu/Makefile.in b/oldXMenu/Makefile.in index 46061ab7ae4..7a5c9985920 100644 --- a/oldXMenu/Makefile.in +++ b/oldXMenu/Makefile.in | |||
| @@ -111,15 +111,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) | |||
| 111 | am__v_at_0 = @ | 111 | am__v_at_0 = @ |
| 112 | am__v_at_1 = | 112 | am__v_at_1 = |
| 113 | 113 | ||
| 114 | DEPDIR = deps | ||
| 115 | AUTO_DEPEND = @AUTO_DEPEND@ | 114 | AUTO_DEPEND = @AUTO_DEPEND@ |
| 116 | 115 | DEPDIR = deps | |
| 117 | ifeq ($(AUTO_DEPEND),yes) | 116 | ifeq ($(AUTO_DEPEND),yes) |
| 118 | DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP | 117 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP |
| 119 | MKDEPDIR = ${MKDIR_P} ${DEPDIR} | 118 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) |
| 120 | else | 119 | else |
| 121 | DEPFLAGS = | 120 | DEPFLAGS = |
| 122 | MKDEPDIR = : | 121 | include $(srcdir)/deps.mk |
| 123 | endif | 122 | endif |
| 124 | 123 | ||
| 125 | ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ | 124 | ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ |
| @@ -129,7 +128,6 @@ ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ | |||
| 129 | -I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib | 128 | -I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib |
| 130 | 129 | ||
| 131 | .c.o: | 130 | .c.o: |
| 132 | @$(MKDEPDIR) | ||
| 133 | $(AM_V_CC)$(CC) -c ${ALL_CFLAGS} $< | 131 | $(AM_V_CC)$(CC) -c ${ALL_CFLAGS} $< |
| 134 | 132 | ||
| 135 | libXMenu11.a: $(OBJS) $(EXTRA) | 133 | libXMenu11.a: $(OBJS) $(EXTRA) |
| @@ -137,20 +135,14 @@ libXMenu11.a: $(OBJS) $(EXTRA) | |||
| 137 | $(AM_V_at)$(AR) $(ARFLAGS) $@ $(OBJS) $(EXTRA) | 135 | $(AM_V_at)$(AR) $(ARFLAGS) $@ $(OBJS) $(EXTRA) |
| 138 | $(AM_V_at)$(RANLIB) $@ | 136 | $(AM_V_at)$(RANLIB) $@ |
| 139 | 137 | ||
| 140 | ifeq ($(AUTO_DEPEND),yes) | ||
| 141 | -include $(ALLOBJS:%.o=${DEPDIR}/%.d) | ||
| 142 | else | ||
| 143 | include $(srcdir)/deps.mk | ||
| 144 | endif | ||
| 145 | |||
| 146 | .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean | 138 | .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean |
| 147 | 139 | ||
| 148 | clean mostlyclean: | 140 | clean mostlyclean: |
| 149 | rm -f libXMenu11.a *.o | 141 | rm -f libXMenu11.a *.o $(DEPDIR)/* |
| 150 | -rm -rf ${DEPDIR} | ||
| 151 | 142 | ||
| 152 | bootstrap-clean maintainer-clean distclean: clean | 143 | bootstrap-clean maintainer-clean distclean: clean |
| 153 | rm -f Makefile | 144 | rm -f Makefile |
| 145 | rm -fr $(DEPDIR) | ||
| 154 | 146 | ||
| 155 | ETAGS = ../lib-src/etags${EXEEXT} | 147 | ETAGS = ../lib-src/etags${EXEEXT} |
| 156 | 148 | ||
diff --git a/src/Makefile.in b/src/Makefile.in index 60aa6866718..5a3d0bd0445 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -347,15 +347,14 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) | |||
| 347 | am__v_at_0 = @ | 347 | am__v_at_0 = @ |
| 348 | am__v_at_1 = | 348 | am__v_at_1 = |
| 349 | 349 | ||
| 350 | DEPDIR=deps | ||
| 351 | AUTO_DEPEND = @AUTO_DEPEND@ | 350 | AUTO_DEPEND = @AUTO_DEPEND@ |
| 352 | 351 | DEPDIR = deps | |
| 353 | ifeq ($(AUTO_DEPEND),yes) | 352 | ifeq ($(AUTO_DEPEND),yes) |
| 354 | DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP | 353 | DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP |
| 355 | MKDEPDIR = ${MKDIR_P} ${DEPDIR} | 354 | -include $(ALLOBJS:%.o=$(DEPDIR)/%.d) |
| 356 | else | 355 | else |
| 357 | DEPFLAGS = | 356 | DEPFLAGS = |
| 358 | MKDEPDIR = : | 357 | include $(srcdir)/deps.mk |
| 359 | endif | 358 | endif |
| 360 | 359 | ||
| 361 | # Flags that might be in WARN_CFLAGS but are not valid for Objective C. | 360 | # Flags that might be in WARN_CFLAGS but are not valid for Objective C. |
| @@ -383,10 +382,8 @@ ALL_OBJC_CFLAGS = $(EMACS_CFLAGS) \ | |||
| 383 | 382 | ||
| 384 | .SUFFIXES: .m | 383 | .SUFFIXES: .m |
| 385 | .c.o: | 384 | .c.o: |
| 386 | @$(MKDEPDIR) | ||
| 387 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $< | 385 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $< |
| 388 | .m.o: | 386 | .m.o: |
| 389 | @$(MKDEPDIR) | ||
| 390 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $< | 387 | $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $< |
| 391 | 388 | ||
| 392 | ## lastfile must follow all files whose initialized data areas should | 389 | ## lastfile must follow all files whose initialized data areas should |
| @@ -650,8 +647,7 @@ mostlyclean: | |||
| 650 | rm -f globals.h gl-stamp | 647 | rm -f globals.h gl-stamp |
| 651 | rm -f *.res *.tmp | 648 | rm -f *.res *.tmp |
| 652 | clean: mostlyclean | 649 | clean: mostlyclean |
| 653 | rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) | 650 | rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) $(DEPDIR)/* |
| 654 | -rm -rf $(DEPDIR) | ||
| 655 | 651 | ||
| 656 | ## bootstrap-clean is used to clean up just before a bootstrap. | 652 | ## bootstrap-clean is used to clean up just before a bootstrap. |
| 657 | ## It should remove all files generated during a compilation/bootstrap, | 653 | ## It should remove all files generated during a compilation/bootstrap, |
| @@ -666,6 +662,7 @@ bootstrap-clean: clean | |||
| 666 | 662 | ||
| 667 | distclean: bootstrap-clean | 663 | distclean: bootstrap-clean |
| 668 | rm -f Makefile lisp.mk | 664 | rm -f Makefile lisp.mk |
| 665 | rm -fr $(DEPDIR) | ||
| 669 | 666 | ||
| 670 | maintainer-clean: distclean | 667 | maintainer-clean: distclean |
| 671 | rm -f TAGS | 668 | rm -f TAGS |
| @@ -755,11 +752,3 @@ else | |||
| 755 | endif | 752 | endif |
| 756 | @: Compile some files earlier to speed up further compilation. | 753 | @: Compile some files earlier to speed up further compilation. |
| 757 | $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" | 754 | $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" |
| 758 | |||
| 759 | ifeq ($(AUTO_DEPEND),yes) | ||
| 760 | -include $(ALLOBJS:%.o=${DEPDIR}/%.d) | ||
| 761 | else | ||
| 762 | include $(srcdir)/deps.mk | ||
| 763 | endif | ||
| 764 | |||
| 765 | ### Makefile.in ends here | ||
diff --git a/src/editfns.c b/src/editfns.c index 65c0c721d11..2dafd8e7b1b 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -4356,7 +4356,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4356 | sprintf_buf[0] = XINT (args[n]); | 4356 | sprintf_buf[0] = XINT (args[n]); |
| 4357 | sprintf_bytes = prec != 0; | 4357 | sprintf_bytes = prec != 0; |
| 4358 | } | 4358 | } |
| 4359 | else if (conversion == 'd') | 4359 | else if (conversion == 'd' || conversion == 'i') |
| 4360 | { | 4360 | { |
| 4361 | /* For float, maybe we should use "%1.0f" | 4361 | /* For float, maybe we should use "%1.0f" |
| 4362 | instead so it also works for values outside | 4362 | instead so it also works for values outside |
| @@ -38,7 +38,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 38 | 38 | ||
| 39 | static void sort_vector_copy (Lisp_Object, ptrdiff_t, | 39 | static void sort_vector_copy (Lisp_Object, ptrdiff_t, |
| 40 | Lisp_Object *restrict, Lisp_Object *restrict); | 40 | Lisp_Object *restrict, Lisp_Object *restrict); |
| 41 | static bool internal_equal (Lisp_Object, Lisp_Object, int, bool, Lisp_Object); | 41 | enum equal_kind { EQUAL_NO_QUIT, EQUAL_PLAIN, EQUAL_INCLUDING_PROPERTIES }; |
| 42 | static bool internal_equal (Lisp_Object, Lisp_Object, | ||
| 43 | enum equal_kind, int, Lisp_Object); | ||
| 42 | 44 | ||
| 43 | DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, | 45 | DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, |
| 44 | doc: /* Return the argument unchanged. */ | 46 | doc: /* Return the argument unchanged. */ |
| @@ -1377,7 +1379,7 @@ The value is actually the tail of LIST whose car is ELT. */) | |||
| 1377 | FOR_EACH_TAIL (tail) | 1379 | FOR_EACH_TAIL (tail) |
| 1378 | { | 1380 | { |
| 1379 | Lisp_Object tem = XCAR (tail); | 1381 | Lisp_Object tem = XCAR (tail); |
| 1380 | if (FLOATP (tem) && internal_equal (elt, tem, 0, 0, Qnil)) | 1382 | if (FLOATP (tem) && equal_no_quit (elt, tem)) |
| 1381 | return tail; | 1383 | return tail; |
| 1382 | } | 1384 | } |
| 1383 | CHECK_LIST_END (tail, list); | 1385 | CHECK_LIST_END (tail, list); |
| @@ -1428,7 +1430,8 @@ The value is actually the first element of LIST whose car equals KEY. */) | |||
| 1428 | } | 1430 | } |
| 1429 | 1431 | ||
| 1430 | /* Like Fassoc but never report an error and do not allow quits. | 1432 | /* Like Fassoc but never report an error and do not allow quits. |
| 1431 | Use only on objects known to be non-circular lists. */ | 1433 | Use only on keys and lists known to be non-circular, and on keys |
| 1434 | that are not too deep and are not window configurations. */ | ||
| 1432 | 1435 | ||
| 1433 | Lisp_Object | 1436 | Lisp_Object |
| 1434 | assoc_no_quit (Lisp_Object key, Lisp_Object list) | 1437 | assoc_no_quit (Lisp_Object key, Lisp_Object list) |
| @@ -1437,7 +1440,7 @@ assoc_no_quit (Lisp_Object key, Lisp_Object list) | |||
| 1437 | { | 1440 | { |
| 1438 | Lisp_Object car = XCAR (list); | 1441 | Lisp_Object car = XCAR (list); |
| 1439 | if (CONSP (car) | 1442 | if (CONSP (car) |
| 1440 | && (EQ (XCAR (car), key) || !NILP (Fequal (XCAR (car), key)))) | 1443 | && (EQ (XCAR (car), key) || equal_no_quit (XCAR (car), key))) |
| 1441 | return car; | 1444 | return car; |
| 1442 | } | 1445 | } |
| 1443 | return Qnil; | 1446 | return Qnil; |
| @@ -2085,7 +2088,7 @@ Floating-point numbers of equal value are `eql', but they may not be `eq'. */) | |||
| 2085 | (Lisp_Object obj1, Lisp_Object obj2) | 2088 | (Lisp_Object obj1, Lisp_Object obj2) |
| 2086 | { | 2089 | { |
| 2087 | if (FLOATP (obj1)) | 2090 | if (FLOATP (obj1)) |
| 2088 | return internal_equal (obj1, obj2, 0, 0, Qnil) ? Qt : Qnil; | 2091 | return equal_no_quit (obj1, obj2) ? Qt : Qnil; |
| 2089 | else | 2092 | else |
| 2090 | return EQ (obj1, obj2) ? Qt : Qnil; | 2093 | return EQ (obj1, obj2) ? Qt : Qnil; |
| 2091 | } | 2094 | } |
| @@ -2098,31 +2101,50 @@ Vectors and strings are compared element by element. | |||
| 2098 | Numbers are compared by value, but integers cannot equal floats. | 2101 | Numbers are compared by value, but integers cannot equal floats. |
| 2099 | (Use `=' if you want integers and floats to be able to be equal.) | 2102 | (Use `=' if you want integers and floats to be able to be equal.) |
| 2100 | Symbols must match exactly. */) | 2103 | Symbols must match exactly. */) |
| 2101 | (register Lisp_Object o1, Lisp_Object o2) | 2104 | (Lisp_Object o1, Lisp_Object o2) |
| 2102 | { | 2105 | { |
| 2103 | return internal_equal (o1, o2, 0, 0, Qnil) ? Qt : Qnil; | 2106 | return internal_equal (o1, o2, EQUAL_PLAIN, 0, Qnil) ? Qt : Qnil; |
| 2104 | } | 2107 | } |
| 2105 | 2108 | ||
| 2106 | DEFUN ("equal-including-properties", Fequal_including_properties, Sequal_including_properties, 2, 2, 0, | 2109 | DEFUN ("equal-including-properties", Fequal_including_properties, Sequal_including_properties, 2, 2, 0, |
| 2107 | doc: /* Return t if two Lisp objects have similar structure and contents. | 2110 | doc: /* Return t if two Lisp objects have similar structure and contents. |
| 2108 | This is like `equal' except that it compares the text properties | 2111 | This is like `equal' except that it compares the text properties |
| 2109 | of strings. (`equal' ignores text properties.) */) | 2112 | of strings. (`equal' ignores text properties.) */) |
| 2110 | (register Lisp_Object o1, Lisp_Object o2) | 2113 | (Lisp_Object o1, Lisp_Object o2) |
| 2111 | { | 2114 | { |
| 2112 | return internal_equal (o1, o2, 0, 1, Qnil) ? Qt : Qnil; | 2115 | return (internal_equal (o1, o2, EQUAL_INCLUDING_PROPERTIES, 0, Qnil) |
| 2116 | ? Qt : Qnil); | ||
| 2113 | } | 2117 | } |
| 2114 | 2118 | ||
| 2115 | /* DEPTH is current depth of recursion. Signal an error if it | 2119 | /* Return true if O1 and O2 are equal. Do not quit or check for cycles. |
| 2116 | gets too deep. | 2120 | Use this only on arguments that are cycle-free and not too large and |
| 2117 | PROPS means compare string text properties too. */ | 2121 | are not window configurations. */ |
| 2122 | |||
| 2123 | bool | ||
| 2124 | equal_no_quit (Lisp_Object o1, Lisp_Object o2) | ||
| 2125 | { | ||
| 2126 | return internal_equal (o1, o2, EQUAL_NO_QUIT, 0, Qnil); | ||
| 2127 | } | ||
| 2128 | |||
| 2129 | /* Return true if O1 and O2 are equal. EQUAL_KIND specifies what kind | ||
| 2130 | of equality test to use: if it is EQUAL_NO_QUIT, do not check for | ||
| 2131 | cycles or large arguments or quits; if EQUAL_PLAIN, do ordinary | ||
| 2132 | Lisp equality; and if EQUAL_INCLUDING_PROPERTIES, do | ||
| 2133 | equal-including-properties. | ||
| 2134 | |||
| 2135 | If DEPTH is the current depth of recursion; signal an error if it | ||
| 2136 | gets too deep. HT is a hash table used to detect cycles; if nil, | ||
| 2137 | it has not been allocated yet. But ignore the last two arguments | ||
| 2138 | if EQUAL_KIND == EQUAL_NO_QUIT. */ | ||
| 2118 | 2139 | ||
| 2119 | static bool | 2140 | static bool |
| 2120 | internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props, | 2141 | internal_equal (Lisp_Object o1, Lisp_Object o2, enum equal_kind equal_kind, |
| 2121 | Lisp_Object ht) | 2142 | int depth, Lisp_Object ht) |
| 2122 | { | 2143 | { |
| 2123 | tail_recurse: | 2144 | tail_recurse: |
| 2124 | if (depth > 10) | 2145 | if (depth > 10) |
| 2125 | { | 2146 | { |
| 2147 | eassert (equal_kind != EQUAL_NO_QUIT); | ||
| 2126 | if (depth > 200) | 2148 | if (depth > 200) |
| 2127 | error ("Stack overflow in equal"); | 2149 | error ("Stack overflow in equal"); |
| 2128 | if (NILP (ht)) | 2150 | if (NILP (ht)) |
| @@ -2138,7 +2160,7 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props, | |||
| 2138 | { /* `o1' was seen already. */ | 2160 | { /* `o1' was seen already. */ |
| 2139 | Lisp_Object o2s = HASH_VALUE (h, i); | 2161 | Lisp_Object o2s = HASH_VALUE (h, i); |
| 2140 | if (!NILP (Fmemq (o2, o2s))) | 2162 | if (!NILP (Fmemq (o2, o2s))) |
| 2141 | return 1; | 2163 | return true; |
| 2142 | else | 2164 | else |
| 2143 | set_hash_value_slot (h, i, Fcons (o2, o2s)); | 2165 | set_hash_value_slot (h, i, Fcons (o2, o2s)); |
| 2144 | } | 2166 | } |
| @@ -2150,9 +2172,9 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props, | |||
| 2150 | } | 2172 | } |
| 2151 | 2173 | ||
| 2152 | if (EQ (o1, o2)) | 2174 | if (EQ (o1, o2)) |
| 2153 | return 1; | 2175 | return true; |
| 2154 | if (XTYPE (o1) != XTYPE (o2)) | 2176 | if (XTYPE (o1) != XTYPE (o2)) |
| 2155 | return 0; | 2177 | return false; |
| 2156 | 2178 | ||
| 2157 | switch (XTYPE (o1)) | 2179 | switch (XTYPE (o1)) |
| 2158 | { | 2180 | { |
| @@ -2166,31 +2188,42 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props, | |||
| 2166 | } | 2188 | } |
| 2167 | 2189 | ||
| 2168 | case Lisp_Cons: | 2190 | case Lisp_Cons: |
| 2169 | { | 2191 | if (equal_kind == EQUAL_NO_QUIT) |
| 2192 | for (; CONSP (o1); o1 = XCDR (o1)) | ||
| 2193 | { | ||
| 2194 | if (! CONSP (o2)) | ||
| 2195 | return false; | ||
| 2196 | if (! equal_no_quit (XCAR (o1), XCAR (o2))) | ||
| 2197 | return false; | ||
| 2198 | o2 = XCDR (o2); | ||
| 2199 | if (EQ (XCDR (o1), o2)) | ||
| 2200 | return true; | ||
| 2201 | } | ||
| 2202 | else | ||
| 2170 | FOR_EACH_TAIL (o1) | 2203 | FOR_EACH_TAIL (o1) |
| 2171 | { | 2204 | { |
| 2172 | if (! CONSP (o2)) | 2205 | if (! CONSP (o2)) |
| 2173 | return false; | 2206 | return false; |
| 2174 | if (! internal_equal (XCAR (o1), XCAR (o2), depth + 1, props, ht)) | 2207 | if (! internal_equal (XCAR (o1), XCAR (o2), |
| 2208 | equal_kind, depth + 1, ht)) | ||
| 2175 | return false; | 2209 | return false; |
| 2176 | o2 = XCDR (o2); | 2210 | o2 = XCDR (o2); |
| 2177 | if (EQ (XCDR (o1), o2)) | 2211 | if (EQ (XCDR (o1), o2)) |
| 2178 | return true; | 2212 | return true; |
| 2179 | } | 2213 | } |
| 2180 | depth++; | 2214 | depth++; |
| 2181 | goto tail_recurse; | 2215 | goto tail_recurse; |
| 2182 | } | ||
| 2183 | 2216 | ||
| 2184 | case Lisp_Misc: | 2217 | case Lisp_Misc: |
| 2185 | if (XMISCTYPE (o1) != XMISCTYPE (o2)) | 2218 | if (XMISCTYPE (o1) != XMISCTYPE (o2)) |
| 2186 | return 0; | 2219 | return false; |
| 2187 | if (OVERLAYP (o1)) | 2220 | if (OVERLAYP (o1)) |
| 2188 | { | 2221 | { |
| 2189 | if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o2), | 2222 | if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o2), |
| 2190 | depth + 1, props, ht) | 2223 | equal_kind, depth + 1, ht) |
| 2191 | || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2), | 2224 | || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2), |
| 2192 | depth + 1, props, ht)) | 2225 | equal_kind, depth + 1, ht)) |
| 2193 | return 0; | 2226 | return false; |
| 2194 | o1 = XOVERLAY (o1)->plist; | 2227 | o1 = XOVERLAY (o1)->plist; |
| 2195 | o2 = XOVERLAY (o2)->plist; | 2228 | o2 = XOVERLAY (o2)->plist; |
| 2196 | depth++; | 2229 | depth++; |
| @@ -2212,20 +2245,23 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props, | |||
| 2212 | actually checks that the objects have the same type as well as the | 2245 | actually checks that the objects have the same type as well as the |
| 2213 | same size. */ | 2246 | same size. */ |
| 2214 | if (ASIZE (o2) != size) | 2247 | if (ASIZE (o2) != size) |
| 2215 | return 0; | 2248 | return false; |
| 2216 | /* Boolvectors are compared much like strings. */ | 2249 | /* Boolvectors are compared much like strings. */ |
| 2217 | if (BOOL_VECTOR_P (o1)) | 2250 | if (BOOL_VECTOR_P (o1)) |
| 2218 | { | 2251 | { |
| 2219 | EMACS_INT size = bool_vector_size (o1); | 2252 | EMACS_INT size = bool_vector_size (o1); |
| 2220 | if (size != bool_vector_size (o2)) | 2253 | if (size != bool_vector_size (o2)) |
| 2221 | return 0; | 2254 | return false; |
| 2222 | if (memcmp (bool_vector_data (o1), bool_vector_data (o2), | 2255 | if (memcmp (bool_vector_data (o1), bool_vector_data (o2), |
| 2223 | bool_vector_bytes (size))) | 2256 | bool_vector_bytes (size))) |
| 2224 | return 0; | 2257 | return false; |
| 2225 | return 1; | 2258 | return true; |
| 2226 | } | 2259 | } |
| 2227 | if (WINDOW_CONFIGURATIONP (o1)) | 2260 | if (WINDOW_CONFIGURATIONP (o1)) |
| 2228 | return compare_window_configurations (o1, o2, 0); | 2261 | { |
| 2262 | eassert (equal_kind != EQUAL_NO_QUIT); | ||
| 2263 | return compare_window_configurations (o1, o2, false); | ||
| 2264 | } | ||
| 2229 | 2265 | ||
| 2230 | /* Aside from them, only true vectors, char-tables, compiled | 2266 | /* Aside from them, only true vectors, char-tables, compiled |
| 2231 | functions, and fonts (font-spec, font-entity, font-object) | 2267 | functions, and fonts (font-spec, font-entity, font-object) |
| @@ -2234,7 +2270,7 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props, | |||
| 2234 | { | 2270 | { |
| 2235 | if (((size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS) | 2271 | if (((size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS) |
| 2236 | < PVEC_COMPILED) | 2272 | < PVEC_COMPILED) |
| 2237 | return 0; | 2273 | return false; |
| 2238 | size &= PSEUDOVECTOR_SIZE_MASK; | 2274 | size &= PSEUDOVECTOR_SIZE_MASK; |
| 2239 | } | 2275 | } |
| 2240 | for (i = 0; i < size; i++) | 2276 | for (i = 0; i < size; i++) |
| @@ -2242,29 +2278,30 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props, | |||
| 2242 | Lisp_Object v1, v2; | 2278 | Lisp_Object v1, v2; |
| 2243 | v1 = AREF (o1, i); | 2279 | v1 = AREF (o1, i); |
| 2244 | v2 = AREF (o2, i); | 2280 | v2 = AREF (o2, i); |
| 2245 | if (!internal_equal (v1, v2, depth + 1, props, ht)) | 2281 | if (!internal_equal (v1, v2, equal_kind, depth + 1, ht)) |
| 2246 | return 0; | 2282 | return false; |
| 2247 | } | 2283 | } |
| 2248 | return 1; | 2284 | return true; |
| 2249 | } | 2285 | } |
| 2250 | break; | 2286 | break; |
| 2251 | 2287 | ||
| 2252 | case Lisp_String: | 2288 | case Lisp_String: |
| 2253 | if (SCHARS (o1) != SCHARS (o2)) | 2289 | if (SCHARS (o1) != SCHARS (o2)) |
| 2254 | return 0; | 2290 | return false; |
| 2255 | if (SBYTES (o1) != SBYTES (o2)) | 2291 | if (SBYTES (o1) != SBYTES (o2)) |
| 2256 | return 0; | 2292 | return false; |
| 2257 | if (memcmp (SDATA (o1), SDATA (o2), SBYTES (o1))) | 2293 | if (memcmp (SDATA (o1), SDATA (o2), SBYTES (o1))) |
| 2258 | return 0; | 2294 | return false; |
| 2259 | if (props && !compare_string_intervals (o1, o2)) | 2295 | if (equal_kind == EQUAL_INCLUDING_PROPERTIES |
| 2260 | return 0; | 2296 | && !compare_string_intervals (o1, o2)) |
| 2261 | return 1; | 2297 | return false; |
| 2298 | return true; | ||
| 2262 | 2299 | ||
| 2263 | default: | 2300 | default: |
| 2264 | break; | 2301 | break; |
| 2265 | } | 2302 | } |
| 2266 | 2303 | ||
| 2267 | return 0; | 2304 | return false; |
| 2268 | } | 2305 | } |
| 2269 | 2306 | ||
| 2270 | 2307 | ||
diff --git a/src/gtkutil.c b/src/gtkutil.c index 3a00e362221..63f01436413 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -783,33 +783,55 @@ xg_set_geometry (struct frame *f) | |||
| 783 | { | 783 | { |
| 784 | if (f->size_hint_flags & (USPosition | PPosition)) | 784 | if (f->size_hint_flags & (USPosition | PPosition)) |
| 785 | { | 785 | { |
| 786 | int left = f->left_pos; | 786 | if (x_gtk_use_window_move) |
| 787 | int xneg = f->size_hint_flags & XNegative; | 787 | { |
| 788 | int top = f->top_pos; | 788 | /* Handle negative positions without consulting |
| 789 | int yneg = f->size_hint_flags & YNegative; | 789 | gtk_window_parse_geometry (Bug#25851). The position will |
| 790 | char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)]; | 790 | be off by scrollbar width + window manager decorations. */ |
| 791 | guint id; | 791 | if (f->size_hint_flags & XNegative) |
| 792 | 792 | f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f)) | |
| 793 | if (xneg) | 793 | - FRAME_PIXEL_WIDTH (f) + f->left_pos); |
| 794 | left = -left; | 794 | |
| 795 | if (yneg) | 795 | if (f->size_hint_flags & YNegative) |
| 796 | top = -top; | 796 | f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) |
| 797 | 797 | - FRAME_PIXEL_HEIGHT (f) + f->top_pos); | |
| 798 | sprintf (geom_str, "=%dx%d%c%d%c%d", | 798 | |
| 799 | FRAME_PIXEL_WIDTH (f), | 799 | gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), |
| 800 | FRAME_PIXEL_HEIGHT (f), | 800 | f->left_pos, f->top_pos); |
| 801 | (xneg ? '-' : '+'), left, | 801 | |
| 802 | (yneg ? '-' : '+'), top); | 802 | /* Reset size hint flags. */ |
| 803 | 803 | f->size_hint_flags &= ~ (XNegative | YNegative); | |
| 804 | /* Silence warning about visible children. */ | 804 | } |
| 805 | id = g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | 805 | else |
| 806 | | G_LOG_FLAG_RECURSION, my_log_handler, NULL); | 806 | { |
| 807 | 807 | int left = f->left_pos; | |
| 808 | if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), | 808 | int xneg = f->size_hint_flags & XNegative; |
| 809 | geom_str)) | 809 | int top = f->top_pos; |
| 810 | fprintf (stderr, "Failed to parse: '%s'\n", geom_str); | 810 | int yneg = f->size_hint_flags & YNegative; |
| 811 | 811 | char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)]; | |
| 812 | g_log_remove_handler ("Gtk", id); | 812 | guint id; |
| 813 | |||
| 814 | if (xneg) | ||
| 815 | left = -left; | ||
| 816 | if (yneg) | ||
| 817 | top = -top; | ||
| 818 | |||
| 819 | sprintf (geom_str, "=%dx%d%c%d%c%d", | ||
| 820 | FRAME_PIXEL_WIDTH (f), | ||
| 821 | FRAME_PIXEL_HEIGHT (f), | ||
| 822 | (xneg ? '-' : '+'), left, | ||
| 823 | (yneg ? '-' : '+'), top); | ||
| 824 | |||
| 825 | /* Silence warning about visible children. */ | ||
| 826 | id = g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | ||
| 827 | | G_LOG_FLAG_RECURSION, my_log_handler, NULL); | ||
| 828 | |||
| 829 | if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), | ||
| 830 | geom_str)) | ||
| 831 | fprintf (stderr, "Failed to parse: '%s'\n", geom_str); | ||
| 832 | |||
| 833 | g_log_remove_handler ("Gtk", id); | ||
| 834 | } | ||
| 813 | } | 835 | } |
| 814 | } | 836 | } |
| 815 | 837 | ||
| @@ -1406,6 +1428,13 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) | |||
| 1406 | else if (win_gravity == StaticGravity) | 1428 | else if (win_gravity == StaticGravity) |
| 1407 | size_hints.win_gravity = GDK_GRAVITY_STATIC; | 1429 | size_hints.win_gravity = GDK_GRAVITY_STATIC; |
| 1408 | 1430 | ||
| 1431 | if (x_gtk_use_window_move) | ||
| 1432 | { | ||
| 1433 | if (flags & PPosition) hint_flags |= GDK_HINT_POS; | ||
| 1434 | if (flags & USPosition) hint_flags |= GDK_HINT_USER_POS; | ||
| 1435 | if (flags & USSize) hint_flags |= GDK_HINT_USER_SIZE; | ||
| 1436 | } | ||
| 1437 | |||
| 1409 | if (user_position) | 1438 | if (user_position) |
| 1410 | { | 1439 | { |
| 1411 | hint_flags &= ~GDK_HINT_POS; | 1440 | hint_flags &= ~GDK_HINT_POS; |
diff --git a/src/inotify.c b/src/inotify.c index 61ef6153286..290701349ef 100644 --- a/src/inotify.c +++ b/src/inotify.c | |||
| @@ -41,24 +41,40 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 41 | #ifndef IN_ONLYDIR | 41 | #ifndef IN_ONLYDIR |
| 42 | # define IN_ONLYDIR 0 | 42 | # define IN_ONLYDIR 0 |
| 43 | #endif | 43 | #endif |
| 44 | #define INOTIFY_DEFAULT_MASK (IN_ALL_EVENTS | IN_EXCL_UNLINK) | ||
| 44 | 45 | ||
| 45 | /* File handle for inotify. */ | 46 | /* File handle for inotify. */ |
| 46 | static int inotifyfd = -1; | 47 | static int inotifyfd = -1; |
| 47 | 48 | ||
| 48 | /* Assoc list of files being watched. | 49 | /* Alist of files being watched. We want the returned descriptor to |
| 49 | Format: (watch-descriptor name callback) | 50 | be unique for every watch, but inotify returns the same descriptor |
| 50 | */ | 51 | WD for multiple calls to inotify_add_watch with the same file. |
| 52 | Supply a nonnegative integer ID, so that WD and ID together | ||
| 53 | uniquely identify a watch/file combination. | ||
| 54 | |||
| 55 | For the same reason, we also need to store the watch's mask and we | ||
| 56 | can't allow the following flags to be used. | ||
| 57 | |||
| 58 | IN_EXCL_UNLINK | ||
| 59 | IN_MASK_ADD | ||
| 60 | IN_ONESHOT | ||
| 61 | IN_ONLYDIR | ||
| 62 | |||
| 63 | Each element of this list is of the form (DESCRIPTOR . WATCHES) | ||
| 64 | where no two DESCRIPTOR values are the same. DESCRIPTOR represents | ||
| 65 | the inotify watch descriptor and WATCHES is a list with elements of | ||
| 66 | the form (ID FILENAME CALLBACK MASK), where ID is the integer | ||
| 67 | described above, FILENAME names the file being watched, CALLBACK is | ||
| 68 | invoked when the event occurs, and MASK represents the aspects | ||
| 69 | being watched. The WATCHES list is sorted by ID. Although | ||
| 70 | DESCRIPTOR and MASK are ordinarily integers, they are conses when | ||
| 71 | representing integers outside of fixnum range. */ | ||
| 72 | |||
| 51 | static Lisp_Object watch_list; | 73 | static Lisp_Object watch_list; |
| 52 | 74 | ||
| 53 | static Lisp_Object | 75 | static Lisp_Object |
| 54 | make_watch_descriptor (int wd) | 76 | mask_to_aspects (uint32_t mask) |
| 55 | { | 77 | { |
| 56 | /* TODO replace this with a Misc Object! */ | ||
| 57 | return make_number (wd); | ||
| 58 | } | ||
| 59 | |||
| 60 | static Lisp_Object | ||
| 61 | mask_to_aspects (uint32_t mask) { | ||
| 62 | Lisp_Object aspects = Qnil; | 78 | Lisp_Object aspects = Qnil; |
| 63 | if (mask & IN_ACCESS) | 79 | if (mask & IN_ACCESS) |
| 64 | aspects = Fcons (Qaccess, aspects); | 80 | aspects = Fcons (Qaccess, aspects); |
| @@ -95,77 +111,6 @@ mask_to_aspects (uint32_t mask) { | |||
| 95 | return aspects; | 111 | return aspects; |
| 96 | } | 112 | } |
| 97 | 113 | ||
| 98 | static Lisp_Object | ||
| 99 | inotifyevent_to_event (Lisp_Object watch_object, struct inotify_event const *ev) | ||
| 100 | { | ||
| 101 | Lisp_Object name = Qnil; | ||
| 102 | if (ev->len > 0) | ||
| 103 | { | ||
| 104 | size_t const len = strlen (ev->name); | ||
| 105 | name = make_unibyte_string (ev->name, min (len, ev->len)); | ||
| 106 | name = DECODE_FILE (name); | ||
| 107 | } | ||
| 108 | else | ||
| 109 | name = XCAR (XCDR (watch_object)); | ||
| 110 | |||
| 111 | return list2 (list4 (make_watch_descriptor (ev->wd), | ||
| 112 | mask_to_aspects (ev->mask), | ||
| 113 | name, | ||
| 114 | make_number (ev->cookie)), | ||
| 115 | Fnth (make_number (2), watch_object)); | ||
| 116 | } | ||
| 117 | |||
| 118 | /* This callback is called when the FD is available for read. The inotify | ||
| 119 | events are read from FD and converted into input_events. */ | ||
| 120 | static void | ||
| 121 | inotify_callback (int fd, void *_) | ||
| 122 | { | ||
| 123 | struct input_event event; | ||
| 124 | Lisp_Object watch_object; | ||
| 125 | int to_read; | ||
| 126 | char *buffer; | ||
| 127 | ssize_t n; | ||
| 128 | size_t i; | ||
| 129 | |||
| 130 | to_read = 0; | ||
| 131 | if (ioctl (fd, FIONREAD, &to_read) == -1) | ||
| 132 | report_file_notify_error ("Error while retrieving file system events", | ||
| 133 | Qnil); | ||
| 134 | buffer = xmalloc (to_read); | ||
| 135 | n = read (fd, buffer, to_read); | ||
| 136 | if (n < 0) | ||
| 137 | { | ||
| 138 | xfree (buffer); | ||
| 139 | report_file_notify_error ("Error while reading file system events", Qnil); | ||
| 140 | } | ||
| 141 | |||
| 142 | EVENT_INIT (event); | ||
| 143 | event.kind = FILE_NOTIFY_EVENT; | ||
| 144 | |||
| 145 | i = 0; | ||
| 146 | while (i < (size_t)n) | ||
| 147 | { | ||
| 148 | struct inotify_event *ev = (struct inotify_event *) &buffer[i]; | ||
| 149 | |||
| 150 | watch_object = Fassoc (make_watch_descriptor (ev->wd), watch_list); | ||
| 151 | if (!NILP (watch_object)) | ||
| 152 | { | ||
| 153 | event.arg = inotifyevent_to_event (watch_object, ev); | ||
| 154 | |||
| 155 | /* If event was removed automatically: Drop it from watch list. */ | ||
| 156 | if (ev->mask & IN_IGNORED) | ||
| 157 | watch_list = Fdelete (watch_object, watch_list); | ||
| 158 | |||
| 159 | if (!NILP (event.arg)) | ||
| 160 | kbd_buffer_store_event (&event); | ||
| 161 | } | ||
| 162 | |||
| 163 | i += sizeof (*ev) + ev->len; | ||
| 164 | } | ||
| 165 | |||
| 166 | xfree (buffer); | ||
| 167 | } | ||
| 168 | |||
| 169 | static uint32_t | 114 | static uint32_t |
| 170 | symbol_to_inotifymask (Lisp_Object symb) | 115 | symbol_to_inotifymask (Lisp_Object symb) |
| 171 | { | 116 | { |
| @@ -200,14 +145,6 @@ symbol_to_inotifymask (Lisp_Object symb) | |||
| 200 | 145 | ||
| 201 | else if (EQ (symb, Qdont_follow)) | 146 | else if (EQ (symb, Qdont_follow)) |
| 202 | return IN_DONT_FOLLOW; | 147 | return IN_DONT_FOLLOW; |
| 203 | else if (EQ (symb, Qexcl_unlink)) | ||
| 204 | return IN_EXCL_UNLINK; | ||
| 205 | else if (EQ (symb, Qmask_add)) | ||
| 206 | return IN_MASK_ADD; | ||
| 207 | else if (EQ (symb, Qoneshot)) | ||
| 208 | return IN_ONESHOT; | ||
| 209 | else if (EQ (symb, Qonlydir)) | ||
| 210 | return IN_ONLYDIR; | ||
| 211 | 148 | ||
| 212 | else if (EQ (symb, Qt) || EQ (symb, Qall_events)) | 149 | else if (EQ (symb, Qt) || EQ (symb, Qall_events)) |
| 213 | return IN_ALL_EVENTS; | 150 | return IN_ALL_EVENTS; |
| @@ -221,21 +158,204 @@ symbol_to_inotifymask (Lisp_Object symb) | |||
| 221 | static uint32_t | 158 | static uint32_t |
| 222 | aspect_to_inotifymask (Lisp_Object aspect) | 159 | aspect_to_inotifymask (Lisp_Object aspect) |
| 223 | { | 160 | { |
| 224 | if (CONSP (aspect)) | 161 | if (CONSP (aspect) || NILP (aspect)) |
| 225 | { | 162 | { |
| 226 | Lisp_Object x = aspect; | 163 | Lisp_Object x = aspect; |
| 227 | uint32_t mask = 0; | 164 | uint32_t mask = 0; |
| 228 | while (CONSP (x)) | 165 | FOR_EACH_TAIL (x) |
| 229 | { | 166 | mask |= symbol_to_inotifymask (XCAR (x)); |
| 230 | mask |= symbol_to_inotifymask (XCAR (x)); | 167 | CHECK_LIST_END (x, aspect); |
| 231 | x = XCDR (x); | ||
| 232 | } | ||
| 233 | return mask; | 168 | return mask; |
| 234 | } | 169 | } |
| 235 | else | 170 | else |
| 236 | return symbol_to_inotifymask (aspect); | 171 | return symbol_to_inotifymask (aspect); |
| 237 | } | 172 | } |
| 238 | 173 | ||
| 174 | static Lisp_Object | ||
| 175 | inotifyevent_to_event (Lisp_Object watch, struct inotify_event const *ev) | ||
| 176 | { | ||
| 177 | Lisp_Object name; | ||
| 178 | uint32_t mask; | ||
| 179 | CONS_TO_INTEGER (Fnth (make_number (3), watch), uint32_t, mask); | ||
| 180 | |||
| 181 | if (! (mask & ev->mask)) | ||
| 182 | return Qnil; | ||
| 183 | |||
| 184 | if (ev->len > 0) | ||
| 185 | { | ||
| 186 | size_t const len = strlen (ev->name); | ||
| 187 | name = make_unibyte_string (ev->name, min (len, ev->len)); | ||
| 188 | name = DECODE_FILE (name); | ||
| 189 | } | ||
| 190 | else | ||
| 191 | name = XCAR (XCDR (watch)); | ||
| 192 | |||
| 193 | return list2 (list4 (Fcons (INTEGER_TO_CONS (ev->wd), XCAR (watch)), | ||
| 194 | mask_to_aspects (ev->mask), | ||
| 195 | name, | ||
| 196 | INTEGER_TO_CONS (ev->cookie)), | ||
| 197 | Fnth (make_number (2), watch)); | ||
| 198 | } | ||
| 199 | |||
| 200 | /* Add a new watch to watch-descriptor WD watching FILENAME and using | ||
| 201 | CALLBACK. Returns a cons (DESCRIPTOR . ID) uniquely identifying the | ||
| 202 | new watch. */ | ||
| 203 | static Lisp_Object | ||
| 204 | add_watch (int wd, Lisp_Object filename, | ||
| 205 | Lisp_Object aspect, Lisp_Object callback) | ||
| 206 | { | ||
| 207 | Lisp_Object descriptor = INTEGER_TO_CONS (wd); | ||
| 208 | Lisp_Object tail = assoc_no_quit (descriptor, watch_list); | ||
| 209 | Lisp_Object watch, watch_id; | ||
| 210 | uint32_t imask = aspect_to_inotifymask (aspect); | ||
| 211 | Lisp_Object mask = INTEGER_TO_CONS (imask); | ||
| 212 | |||
| 213 | EMACS_INT id = 0; | ||
| 214 | if (NILP (tail)) | ||
| 215 | { | ||
| 216 | tail = list1 (descriptor); | ||
| 217 | watch_list = Fcons (tail, watch_list); | ||
| 218 | } | ||
| 219 | else | ||
| 220 | { | ||
| 221 | /* Assign a watch ID that is not already in use, by looking | ||
| 222 | for a gap in the existing sorted list. */ | ||
| 223 | for (; ! NILP (XCDR (tail)); tail = XCDR (tail), id++) | ||
| 224 | if (!EQ (XCAR (XCAR (XCDR (tail))), make_number (id))) | ||
| 225 | break; | ||
| 226 | if (MOST_POSITIVE_FIXNUM < id) | ||
| 227 | emacs_abort (); | ||
| 228 | } | ||
| 229 | |||
| 230 | /* Insert the newly-assigned ID into the previously-discovered gap, | ||
| 231 | which is possibly at the end of the list. Inserting it there | ||
| 232 | keeps the list sorted. */ | ||
| 233 | watch_id = make_number (id); | ||
| 234 | watch = list4 (watch_id, filename, callback, mask); | ||
| 235 | XSETCDR (tail, Fcons (watch, XCDR (tail))); | ||
| 236 | |||
| 237 | return Fcons (descriptor, watch_id); | ||
| 238 | } | ||
| 239 | |||
| 240 | /* Find the watch list element (if any) matching DESCRIPTOR. Return | ||
| 241 | nil if not found. If found, return t if the first element matches | ||
| 242 | DESCRIPTOR; otherwise, return the cons whose cdr matches | ||
| 243 | DESCRIPTOR. This lets the caller easily remove the element | ||
| 244 | matching DESCRIPTOR without having to search for it again, and | ||
| 245 | without calling Fdelete (which might quit). */ | ||
| 246 | |||
| 247 | static Lisp_Object | ||
| 248 | find_descriptor (Lisp_Object descriptor) | ||
| 249 | { | ||
| 250 | Lisp_Object tail, prevtail = Qt; | ||
| 251 | for (tail = watch_list; !NILP (tail); prevtail = tail, tail = XCDR (tail)) | ||
| 252 | if (equal_no_quit (XCAR (XCAR (tail)), descriptor)) | ||
| 253 | return prevtail; | ||
| 254 | return Qnil; | ||
| 255 | } | ||
| 256 | |||
| 257 | /* Remove all watches associated with the watch list element after | ||
| 258 | PREVTAIL, or after the first element if PREVTAIL is t. If INVALID_P | ||
| 259 | is true, the descriptor is already invalid, i.e., it received a | ||
| 260 | IN_IGNORED event. In this case skip calling inotify_rm_watch. */ | ||
| 261 | static void | ||
| 262 | remove_descriptor (Lisp_Object prevtail, bool invalid_p) | ||
| 263 | { | ||
| 264 | Lisp_Object tail = CONSP (prevtail) ? XCDR (prevtail) : watch_list; | ||
| 265 | |||
| 266 | int inotify_errno = 0; | ||
| 267 | if (! invalid_p) | ||
| 268 | { | ||
| 269 | int wd; | ||
| 270 | CONS_TO_INTEGER (XCAR (XCAR (tail)), int, wd); | ||
| 271 | if (inotify_rm_watch (inotifyfd, wd) != 0) | ||
| 272 | inotify_errno = errno; | ||
| 273 | } | ||
| 274 | |||
| 275 | if (CONSP (prevtail)) | ||
| 276 | XSETCDR (prevtail, XCDR (tail)); | ||
| 277 | else | ||
| 278 | { | ||
| 279 | watch_list = XCDR (tail); | ||
| 280 | if (NILP (watch_list)) | ||
| 281 | { | ||
| 282 | delete_read_fd (inotifyfd); | ||
| 283 | emacs_close (inotifyfd); | ||
| 284 | inotifyfd = -1; | ||
| 285 | } | ||
| 286 | } | ||
| 287 | |||
| 288 | if (inotify_errno != 0) | ||
| 289 | { | ||
| 290 | errno = inotify_errno; | ||
| 291 | report_file_notify_error ("Could not rm watch", XCAR (tail)); | ||
| 292 | } | ||
| 293 | } | ||
| 294 | |||
| 295 | /* Remove watch associated with (descriptor, id). */ | ||
| 296 | static void | ||
| 297 | remove_watch (Lisp_Object descriptor, Lisp_Object id) | ||
| 298 | { | ||
| 299 | Lisp_Object prevtail = find_descriptor (descriptor); | ||
| 300 | if (NILP (prevtail)) | ||
| 301 | return; | ||
| 302 | |||
| 303 | Lisp_Object elt = XCAR (CONSP (prevtail) ? XCDR (prevtail) : watch_list); | ||
| 304 | for (Lisp_Object prev = elt; !NILP (XCDR (prev)); prev = XCDR (prev)) | ||
| 305 | if (EQ (id, XCAR (XCAR (XCDR (prev))))) | ||
| 306 | { | ||
| 307 | XSETCDR (prev, XCDR (XCDR (prev))); | ||
| 308 | if (NILP (XCDR (elt))) | ||
| 309 | remove_descriptor (prevtail, false); | ||
| 310 | break; | ||
| 311 | } | ||
| 312 | } | ||
| 313 | |||
| 314 | /* This callback is called when the FD is available for read. The inotify | ||
| 315 | events are read from FD and converted into input_events. */ | ||
| 316 | static void | ||
| 317 | inotify_callback (int fd, void *_) | ||
| 318 | { | ||
| 319 | int to_read; | ||
| 320 | if (ioctl (fd, FIONREAD, &to_read) < 0) | ||
| 321 | report_file_notify_error ("Error while retrieving file system events", | ||
| 322 | Qnil); | ||
| 323 | USE_SAFE_ALLOCA; | ||
| 324 | char *buffer = SAFE_ALLOCA (to_read); | ||
| 325 | ssize_t n = read (fd, buffer, to_read); | ||
| 326 | if (n < 0) | ||
| 327 | report_file_notify_error ("Error while reading file system events", Qnil); | ||
| 328 | |||
| 329 | struct input_event event; | ||
| 330 | EVENT_INIT (event); | ||
| 331 | event.kind = FILE_NOTIFY_EVENT; | ||
| 332 | |||
| 333 | for (ssize_t i = 0; i < n; ) | ||
| 334 | { | ||
| 335 | struct inotify_event *ev = (struct inotify_event *) &buffer[i]; | ||
| 336 | Lisp_Object descriptor = INTEGER_TO_CONS (ev->wd); | ||
| 337 | Lisp_Object prevtail = find_descriptor (descriptor); | ||
| 338 | |||
| 339 | if (! NILP (prevtail)) | ||
| 340 | { | ||
| 341 | Lisp_Object tail = CONSP (prevtail) ? XCDR (prevtail) : watch_list; | ||
| 342 | for (Lisp_Object watches = XCDR (XCAR (tail)); ! NILP (watches); | ||
| 343 | watches = XCDR (watches)) | ||
| 344 | { | ||
| 345 | event.arg = inotifyevent_to_event (XCAR (watches), ev); | ||
| 346 | if (!NILP (event.arg)) | ||
| 347 | kbd_buffer_store_event (&event); | ||
| 348 | } | ||
| 349 | /* If event was removed automatically: Drop it from watch list. */ | ||
| 350 | if (ev->mask & IN_IGNORED) | ||
| 351 | remove_descriptor (prevtail, true); | ||
| 352 | } | ||
| 353 | i += sizeof (*ev) + ev->len; | ||
| 354 | } | ||
| 355 | |||
| 356 | SAFE_FREE (); | ||
| 357 | } | ||
| 358 | |||
| 239 | DEFUN ("inotify-add-watch", Finotify_add_watch, Sinotify_add_watch, 3, 3, 0, | 359 | DEFUN ("inotify-add-watch", Finotify_add_watch, Sinotify_add_watch, 3, 3, 0, |
| 240 | doc: /* Add a watch for FILE-NAME to inotify. | 360 | doc: /* Add a watch for FILE-NAME to inotify. |
| 241 | 361 | ||
| @@ -264,10 +384,6 @@ close | |||
| 264 | The following symbols can also be added to a list of aspects: | 384 | The following symbols can also be added to a list of aspects: |
| 265 | 385 | ||
| 266 | dont-follow | 386 | dont-follow |
| 267 | excl-unlink | ||
| 268 | mask-add | ||
| 269 | oneshot | ||
| 270 | onlydir | ||
| 271 | 387 | ||
| 272 | Watching a directory is not recursive. CALLBACK is passed a single argument | 388 | Watching a directory is not recursive. CALLBACK is passed a single argument |
| 273 | EVENT which contains an event structure of the format | 389 | EVENT which contains an event structure of the format |
| @@ -289,47 +405,56 @@ If a directory is watched then NAME is the name of file that caused the event. | |||
| 289 | COOKIE is an object that can be compared using `equal' to identify two matching | 405 | COOKIE is an object that can be compared using `equal' to identify two matching |
| 290 | renames (moved-from and moved-to). | 406 | renames (moved-from and moved-to). |
| 291 | 407 | ||
| 292 | See inotify(7) and inotify_add_watch(2) for further information. The inotify fd | 408 | See inotify(7) and inotify_add_watch(2) for further information. The |
| 293 | is managed internally and there is no corresponding inotify_init. Use | 409 | inotify fd is managed internally and there is no corresponding |
| 294 | `inotify-rm-watch' to remove a watch. | 410 | inotify_init. Use `inotify-rm-watch' to remove a watch. |
| 295 | */) | 411 | |
| 296 | (Lisp_Object file_name, Lisp_Object aspect, Lisp_Object callback) | 412 | Also note, that the following inotify bit-masks can not be used, due |
| 413 | to the fact that descriptors are shared across different callers. | ||
| 414 | |||
| 415 | IN_EXCL_UNLINK | ||
| 416 | IN_MASK_ADD | ||
| 417 | IN_ONESHOT | ||
| 418 | IN_ONLYDIR */) | ||
| 419 | (Lisp_Object filename, Lisp_Object aspect, Lisp_Object callback) | ||
| 297 | { | 420 | { |
| 298 | uint32_t mask; | ||
| 299 | Lisp_Object watch_object; | ||
| 300 | Lisp_Object encoded_file_name; | 421 | Lisp_Object encoded_file_name; |
| 301 | Lisp_Object watch_descriptor; | 422 | bool dont_follow = (CONSP (aspect) |
| 302 | int watchdesc = -1; | 423 | ? ! NILP (Fmemq (Qdont_follow, aspect)) |
| 424 | : EQ (Qdont_follow, aspect)); | ||
| 425 | int wd = -1; | ||
| 426 | uint32_t mask = (INOTIFY_DEFAULT_MASK | ||
| 427 | | (dont_follow ? IN_DONT_FOLLOW : 0)); | ||
| 303 | 428 | ||
| 304 | CHECK_STRING (file_name); | 429 | CHECK_STRING (filename); |
| 305 | 430 | ||
| 306 | if (inotifyfd < 0) | 431 | if (inotifyfd < 0) |
| 307 | { | 432 | { |
| 308 | inotifyfd = inotify_init1 (IN_NONBLOCK|IN_CLOEXEC); | 433 | inotifyfd = inotify_init1 (IN_NONBLOCK | IN_CLOEXEC); |
| 309 | if (inotifyfd < 0) | 434 | if (inotifyfd < 0) |
| 310 | report_file_notify_error ("File watching is not available", Qnil); | 435 | report_file_notify_error ("File watching is not available", Qnil); |
| 311 | watch_list = Qnil; | 436 | watch_list = Qnil; |
| 312 | add_read_fd (inotifyfd, &inotify_callback, NULL); | 437 | add_read_fd (inotifyfd, &inotify_callback, NULL); |
| 313 | } | 438 | } |
| 314 | 439 | ||
| 315 | mask = aspect_to_inotifymask (aspect); | 440 | encoded_file_name = ENCODE_FILE (filename); |
| 316 | encoded_file_name = ENCODE_FILE (file_name); | 441 | wd = inotify_add_watch (inotifyfd, SSDATA (encoded_file_name), mask); |
| 317 | watchdesc = inotify_add_watch (inotifyfd, SSDATA (encoded_file_name), mask); | 442 | if (wd < 0) |
| 318 | if (watchdesc == -1) | 443 | report_file_notify_error ("Could not add watch for file", filename); |
| 319 | report_file_notify_error ("Could not add watch for file", file_name); | ||
| 320 | |||
| 321 | watch_descriptor = make_watch_descriptor (watchdesc); | ||
| 322 | 444 | ||
| 323 | /* Delete existing watch object. */ | 445 | return add_watch (wd, filename, aspect, callback); |
| 324 | watch_object = Fassoc (watch_descriptor, watch_list); | 446 | } |
| 325 | if (!NILP (watch_object)) | ||
| 326 | watch_list = Fdelete (watch_object, watch_list); | ||
| 327 | |||
| 328 | /* Store watch object in watch list. */ | ||
| 329 | watch_object = list3 (watch_descriptor, encoded_file_name, callback); | ||
| 330 | watch_list = Fcons (watch_object, watch_list); | ||
| 331 | 447 | ||
| 332 | return watch_descriptor; | 448 | static bool |
| 449 | valid_watch_descriptor (Lisp_Object wd) | ||
| 450 | { | ||
| 451 | return (CONSP (wd) | ||
| 452 | && (RANGED_INTEGERP (0, XCAR (wd), INT_MAX) | ||
| 453 | || (CONSP (XCAR (wd)) | ||
| 454 | && RANGED_INTEGERP ((MOST_POSITIVE_FIXNUM >> 16) + 1, | ||
| 455 | XCAR (XCAR (wd)), INT_MAX >> 16) | ||
| 456 | && RANGED_INTEGERP (0, XCDR (XCAR (wd)), (1 << 16) - 1))) | ||
| 457 | && NATNUMP (XCDR (wd))); | ||
| 333 | } | 458 | } |
| 334 | 459 | ||
| 335 | DEFUN ("inotify-rm-watch", Finotify_rm_watch, Sinotify_rm_watch, 1, 1, 0, | 460 | DEFUN ("inotify-rm-watch", Finotify_rm_watch, Sinotify_rm_watch, 1, 1, 0, |
| @@ -337,28 +462,18 @@ DEFUN ("inotify-rm-watch", Finotify_rm_watch, Sinotify_rm_watch, 1, 1, 0, | |||
| 337 | 462 | ||
| 338 | WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'. | 463 | WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'. |
| 339 | 464 | ||
| 340 | See inotify_rm_watch(2) for more information. | 465 | See inotify_rm_watch(2) for more information. */) |
| 341 | */) | ||
| 342 | (Lisp_Object watch_descriptor) | 466 | (Lisp_Object watch_descriptor) |
| 343 | { | 467 | { |
| 344 | Lisp_Object watch_object; | ||
| 345 | int wd = XINT (watch_descriptor); | ||
| 346 | 468 | ||
| 347 | if (inotify_rm_watch (inotifyfd, wd) == -1) | 469 | Lisp_Object descriptor, id; |
| 348 | report_file_notify_error ("Could not rm watch", watch_descriptor); | ||
| 349 | 470 | ||
| 350 | /* Remove watch descriptor from watch list. */ | 471 | if (! valid_watch_descriptor (watch_descriptor)) |
| 351 | watch_object = Fassoc (watch_descriptor, watch_list); | 472 | report_file_notify_error ("Invalid descriptor ", watch_descriptor); |
| 352 | if (!NILP (watch_object)) | ||
| 353 | watch_list = Fdelete (watch_object, watch_list); | ||
| 354 | 473 | ||
| 355 | /* Cleanup if no more files are watched. */ | 474 | descriptor = XCAR (watch_descriptor); |
| 356 | if (NILP (watch_list)) | 475 | id = XCDR (watch_descriptor); |
| 357 | { | 476 | remove_watch (descriptor, id); |
| 358 | emacs_close (inotifyfd); | ||
| 359 | delete_read_fd (inotifyfd); | ||
| 360 | inotifyfd = -1; | ||
| 361 | } | ||
| 362 | 477 | ||
| 363 | return Qt; | 478 | return Qt; |
| 364 | } | 479 | } |
| @@ -374,10 +489,29 @@ reason. Removing the watch by calling `inotify-rm-watch' also makes | |||
| 374 | it invalid. */) | 489 | it invalid. */) |
| 375 | (Lisp_Object watch_descriptor) | 490 | (Lisp_Object watch_descriptor) |
| 376 | { | 491 | { |
| 377 | Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list); | 492 | if (! valid_watch_descriptor (watch_descriptor)) |
| 378 | return NILP (watch_object) ? Qnil : Qt; | 493 | return Qnil; |
| 494 | Lisp_Object tail = assoc_no_quit (XCAR (watch_descriptor), watch_list); | ||
| 495 | if (NILP (tail)) | ||
| 496 | return Qnil; | ||
| 497 | Lisp_Object watch = assq_no_quit (XCDR (watch_descriptor), XCDR (tail)); | ||
| 498 | return ! NILP (watch) ? Qt : Qnil; | ||
| 379 | } | 499 | } |
| 380 | 500 | ||
| 501 | #ifdef INOTIFY_DEBUG | ||
| 502 | DEFUN ("inotify-watch-list", Finotify_watch_list, Sinotify_watch_list, 0, 0, 0, | ||
| 503 | doc: /* Return a copy of the internal watch_list. */) | ||
| 504 | { | ||
| 505 | return Fcopy_sequence (watch_list); | ||
| 506 | } | ||
| 507 | |||
| 508 | DEFUN ("inotify-allocated-p", Finotify_allocated_p, Sinotify_allocated_p, 0, 0, 0, | ||
| 509 | doc: /* Return non-nil, if a inotify instance is allocated. */) | ||
| 510 | { | ||
| 511 | return inotifyfd < 0 ? Qnil : Qt; | ||
| 512 | } | ||
| 513 | #endif | ||
| 514 | |||
| 381 | void | 515 | void |
| 382 | syms_of_inotify (void) | 516 | syms_of_inotify (void) |
| 383 | { | 517 | { |
| @@ -400,10 +534,6 @@ syms_of_inotify (void) | |||
| 400 | DEFSYM (Qclose, "close"); /* IN_CLOSE */ | 534 | DEFSYM (Qclose, "close"); /* IN_CLOSE */ |
| 401 | 535 | ||
| 402 | DEFSYM (Qdont_follow, "dont-follow"); /* IN_DONT_FOLLOW */ | 536 | DEFSYM (Qdont_follow, "dont-follow"); /* IN_DONT_FOLLOW */ |
| 403 | DEFSYM (Qexcl_unlink, "excl-unlink"); /* IN_EXCL_UNLINK */ | ||
| 404 | DEFSYM (Qmask_add, "mask-add"); /* IN_MASK_ADD */ | ||
| 405 | DEFSYM (Qoneshot, "oneshot"); /* IN_ONESHOT */ | ||
| 406 | DEFSYM (Qonlydir, "onlydir"); /* IN_ONLYDIR */ | ||
| 407 | 537 | ||
| 408 | DEFSYM (Qignored, "ignored"); /* IN_IGNORED */ | 538 | DEFSYM (Qignored, "ignored"); /* IN_IGNORED */ |
| 409 | DEFSYM (Qisdir, "isdir"); /* IN_ISDIR */ | 539 | DEFSYM (Qisdir, "isdir"); /* IN_ISDIR */ |
| @@ -414,6 +544,10 @@ syms_of_inotify (void) | |||
| 414 | defsubr (&Sinotify_rm_watch); | 544 | defsubr (&Sinotify_rm_watch); |
| 415 | defsubr (&Sinotify_valid_p); | 545 | defsubr (&Sinotify_valid_p); |
| 416 | 546 | ||
| 547 | #ifdef INOTIFY_DEBUG | ||
| 548 | defsubr (&Sinotify_watch_list); | ||
| 549 | defsubr (&Sinotify_allocated_p); | ||
| 550 | #endif | ||
| 417 | staticpro (&watch_list); | 551 | staticpro (&watch_list); |
| 418 | 552 | ||
| 419 | Fprovide (intern_c_string ("inotify"), Qnil); | 553 | Fprovide (intern_c_string ("inotify"), Qnil); |
diff --git a/src/lisp.h b/src/lisp.h index 4b9cd3c4702..3125bd2a5dd 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3376,6 +3376,7 @@ extern Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object); | |||
| 3376 | extern Lisp_Object do_yes_or_no_p (Lisp_Object); | 3376 | extern Lisp_Object do_yes_or_no_p (Lisp_Object); |
| 3377 | extern Lisp_Object concat2 (Lisp_Object, Lisp_Object); | 3377 | extern Lisp_Object concat2 (Lisp_Object, Lisp_Object); |
| 3378 | extern Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object); | 3378 | extern Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object); |
| 3379 | extern bool equal_no_quit (Lisp_Object, Lisp_Object); | ||
| 3379 | extern Lisp_Object nconc2 (Lisp_Object, Lisp_Object); | 3380 | extern Lisp_Object nconc2 (Lisp_Object, Lisp_Object); |
| 3380 | extern Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object); | 3381 | extern Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object); |
| 3381 | extern Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object); | 3382 | extern Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object); |
diff --git a/src/xdisp.c b/src/xdisp.c index 82668494927..af086d17eb8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2716,6 +2716,7 @@ init_iterator (struct it *it, struct window *w, | |||
| 2716 | if (face_change) | 2716 | if (face_change) |
| 2717 | { | 2717 | { |
| 2718 | face_change = false; | 2718 | face_change = false; |
| 2719 | XFRAME (w->frame)->face_change = 0; | ||
| 2719 | free_all_realized_faces (Qnil); | 2720 | free_all_realized_faces (Qnil); |
| 2720 | } | 2721 | } |
| 2721 | else if (XFRAME (w->frame)->face_change) | 2722 | else if (XFRAME (w->frame)->face_change) |
| @@ -14132,21 +14133,16 @@ redisplay_internal (void) | |||
| 14132 | Therefore, we must redisplay this frame. */ | 14133 | Therefore, we must redisplay this frame. */ |
| 14133 | if (!f_redisplay_flag && f->redisplay) | 14134 | if (!f_redisplay_flag && f->redisplay) |
| 14134 | goto retry_frame; | 14135 | goto retry_frame; |
| 14135 | |||
| 14136 | /* In some case (e.g., window resize), we notice | 14136 | /* In some case (e.g., window resize), we notice |
| 14137 | only during window updating that the window | 14137 | only during window updating that the window |
| 14138 | content changed unpredictably (e.g., a GTK | 14138 | content changed unpredictably (e.g., a GTK |
| 14139 | scrollbar moved) and that our previous estimation | 14139 | scrollbar moved, or some Lisp hook that winds up |
| 14140 | of the frame content was garbage. We have to | 14140 | calling adjust_frame_glyphs) and that our |
| 14141 | start over. These cases should be rare, so going | 14141 | previous estimation of the frame content was |
| 14142 | all the way back to the top of redisplay should | 14142 | garbage. We have to start over. These cases |
| 14143 | be good enough. | 14143 | should be rare, so going all the way back to the |
| 14144 | 14144 | top of redisplay should be good enough. */ | |
| 14145 | Why FRAME_WINDOW_P? See | 14145 | if (FRAME_GARBAGED_P (f)) |
| 14146 | https://lists.gnu.org/archive/html/emacs-devel/2016-10/msg00957.html | ||
| 14147 | |||
| 14148 | */ | ||
| 14149 | if (FRAME_GARBAGED_P (f) && FRAME_WINDOW_P (f)) | ||
| 14150 | goto retry; | 14146 | goto retry; |
| 14151 | 14147 | ||
| 14152 | /* Prevent various kinds of signals during display | 14148 | /* Prevent various kinds of signals during display |
diff --git a/src/xterm.c b/src/xterm.c index 7856793f8dc..4f9eff6c5e6 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10056,11 +10056,26 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_ | |||
| 10056 | f->size_hint_flags |= YNegative; | 10056 | f->size_hint_flags |= YNegative; |
| 10057 | f->win_gravity = NorthWestGravity; | 10057 | f->win_gravity = NorthWestGravity; |
| 10058 | } | 10058 | } |
| 10059 | |||
| 10059 | x_calc_absolute_position (f); | 10060 | x_calc_absolute_position (f); |
| 10060 | 10061 | ||
| 10061 | block_input (); | 10062 | block_input (); |
| 10062 | x_wm_set_size_hint (f, 0, false); | 10063 | x_wm_set_size_hint (f, 0, false); |
| 10063 | 10064 | ||
| 10065 | #ifdef USE_GTK | ||
| 10066 | if (x_gtk_use_window_move) | ||
| 10067 | { | ||
| 10068 | /* When a position change was requested and the outer GTK widget | ||
| 10069 | has been realized already, leave it to gtk_window_move to DTRT | ||
| 10070 | and return. Used for Bug#25851 and Bug#25943. */ | ||
| 10071 | if (change_gravity != 0 && FRAME_GTK_OUTER_WIDGET (f)) | ||
| 10072 | gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), | ||
| 10073 | f->left_pos, f->top_pos); | ||
| 10074 | unblock_input (); | ||
| 10075 | return; | ||
| 10076 | } | ||
| 10077 | #endif /* USE_GTK */ | ||
| 10078 | |||
| 10064 | modified_left = f->left_pos; | 10079 | modified_left = f->left_pos; |
| 10065 | modified_top = f->top_pos; | 10080 | modified_top = f->top_pos; |
| 10066 | 10081 | ||
| @@ -12905,4 +12920,11 @@ state. | |||
| 12905 | Set this variable only if your window manager cannot handle the | 12920 | Set this variable only if your window manager cannot handle the |
| 12906 | transition between the various maximization states. */); | 12921 | transition between the various maximization states. */); |
| 12907 | x_frame_normalize_before_maximize = false; | 12922 | x_frame_normalize_before_maximize = false; |
| 12923 | |||
| 12924 | DEFVAR_BOOL ("x-gtk-use-window-move", x_gtk_use_window_move, | ||
| 12925 | doc: /* Non-nil means rely on gtk_window_move to set frame positions. | ||
| 12926 | If this variable is t, the GTK build uses the function gtk_window_move | ||
| 12927 | to set or store frame positions and disables some time consuming frame | ||
| 12928 | position adjustments. */); | ||
| 12929 | x_gtk_use_window_move = false; | ||
| 12908 | } | 12930 | } |
diff --git a/test/Makefile.in b/test/Makefile.in index 5849e9c3ac9..a1b772de216 100644 --- a/test/Makefile.in +++ b/test/Makefile.in | |||
| @@ -33,6 +33,7 @@ SHELL = @SHELL@ | |||
| 33 | srcdir = @srcdir@ | 33 | srcdir = @srcdir@ |
| 34 | VPATH = $(srcdir) | 34 | VPATH = $(srcdir) |
| 35 | 35 | ||
| 36 | FIND_DELETE = @FIND_DELETE@ | ||
| 36 | MKDIR_P = @MKDIR_P@ | 37 | MKDIR_P = @MKDIR_P@ |
| 37 | 38 | ||
| 38 | SEPCHAR = @SEPCHAR@ | 39 | SEPCHAR = @SEPCHAR@ |
| @@ -123,14 +124,12 @@ endif | |||
| 123 | $(emacs) -l ert -l $$loadfile \ | 124 | $(emacs) -l ert -l $$loadfile \ |
| 124 | --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} | 125 | --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} |
| 125 | 126 | ||
| 126 | ELFILES = $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \ | 127 | ELFILES := $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \ |
| 127 | -path "*resources" -prune -o -name "*el" -print) | 128 | -name "*resources" -prune -o -name "*.el" -print) |
| 128 | ## .elc files may be in a different directory for out of source builds | 129 | ## .log files may be in a different directory for out of source builds |
| 129 | ELCFILES = $(patsubst %.el,%.elc, \ | 130 | LOGFILES := $(patsubst %.el,%.log, \ |
| 130 | $(patsubst $(srcdir)%,.%,$(ELFILES))) | 131 | $(patsubst $(srcdir)/%,%,$(ELFILES))) |
| 131 | LOGFILES = $(patsubst %.elc,%.log,${ELCFILES}) | 132 | TESTS := $(LOGFILES:.log=) |
| 132 | LOGSAVEFILES = $(patsubst %.elc,%.log~,${ELCFILES}) | ||
| 133 | TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=)) | ||
| 134 | 133 | ||
| 135 | ## If we have to interrupt a hanging test, preserve the log so we can | 134 | ## If we have to interrupt a hanging test, preserve the log so we can |
| 136 | ## see what the problem was. | 135 | ## see what the problem was. |
| @@ -138,15 +137,24 @@ TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=)) | |||
| 138 | 137 | ||
| 139 | .PHONY: ${TESTS} | 138 | .PHONY: ${TESTS} |
| 140 | 139 | ||
| 141 | ## The short aliases that always re-run the tests, with no logging. | ||
| 142 | ## Define an alias both with and without the directory name for ease | ||
| 143 | ## of use. | ||
| 144 | define test_template | 140 | define test_template |
| 145 | $(1): | 141 | ## A test FOO-tests depends on the source file with the similar |
| 146 | @test ! -f ./$(1).log || mv ./$(1).log ./$(1).log~ | 142 | ## name, unless FOO itself contains the string '-tests/'. |
| 147 | @${MAKE} ./$(1).log WRITE_LOG= | 143 | ## The similar name is FOO.c if FOO begins with 'src/', FOO.el |
| 148 | 144 | ## otherwise. Although this heuristic does not identify all the | |
| 149 | $(notdir $(1)): $(1) | 145 | ## dependencies, it is better than nothing. |
| 146 | ifeq (,$(patsubst %-tests,,$(1))$(findstring -tests/,$(1))) | ||
| 147 | $(1).log: $(patsubst %-tests,$(srcdir)/../%,$(1))$(if \ | ||
| 148 | $(patsubst src/%,,$(1)),.el,.c) | ||
| 149 | endif | ||
| 150 | |||
| 151 | ## Short aliases that always re-run the tests, with no logging. | ||
| 152 | ## Define both with and without the directory name for ease of use. | ||
| 153 | .PHONY: $(1) $(notdir $(1)) | ||
| 154 | $(1): | ||
| 155 | @test ! -f $(1).log || mv $(1).log $(1).log~ | ||
| 156 | @$(MAKE) $(1).log WRITE_LOG= | ||
| 157 | $(notdir $(1)): $(1) | ||
| 150 | endef | 158 | endef |
| 151 | 159 | ||
| 152 | $(foreach test,${TESTS},$(eval $(call test_template,${test}))) | 160 | $(foreach test,${TESTS},$(eval $(call test_template,${test}))) |
| @@ -158,11 +166,6 @@ $(foreach test,${TESTS},$(eval $(call test_template,${test}))) | |||
| 158 | check-no-automated-subdir: | 166 | check-no-automated-subdir: |
| 159 | test ! -d $(srcdir)/automated | 167 | test ! -d $(srcdir)/automated |
| 160 | 168 | ||
| 161 | ## Include dependencies between test files and the files they test. | ||
| 162 | ## We could do this without the file and eval directly, but then we | ||
| 163 | ## would have to run Emacs for every make invocation, and it might not | ||
| 164 | ## be available during clean. | ||
| 165 | -include make-test-deps.mk | ||
| 166 | ## Rerun all default tests. | 169 | ## Rerun all default tests. |
| 167 | check: mostlyclean check-no-automated-subdir | 170 | check: mostlyclean check-no-automated-subdir |
| 168 | @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" | 171 | @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" |
| @@ -174,9 +177,7 @@ check-expensive: mostlyclean check-no-automated-subdir | |||
| 174 | 177 | ||
| 175 | ## Re-run all tests which are outdated. A test is outdated if its | 178 | ## Re-run all tests which are outdated. A test is outdated if its |
| 176 | ## logfile is out-of-date with either the test file, or the source | 179 | ## logfile is out-of-date with either the test file, or the source |
| 177 | ## files that the tests depend on. The source file dependencies are | 180 | ## files that the tests depend on. See test_template. |
| 178 | ## determined by a heuristic and does not identify the full dependency | ||
| 179 | ## graph. See make-test-deps.emacs-lisp for details. | ||
| 180 | .PHONY: check-maybe | 181 | .PHONY: check-maybe |
| 181 | check-maybe: check-no-automated-subdir | 182 | check-maybe: check-no-automated-subdir |
| 182 | @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" | 183 | @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" |
| @@ -184,7 +185,7 @@ check-maybe: check-no-automated-subdir | |||
| 184 | ## Run the tests. | 185 | ## Run the tests. |
| 185 | .PHONY: check-doit | 186 | .PHONY: check-doit |
| 186 | check-doit: ${LOGFILES} | 187 | check-doit: ${LOGFILES} |
| 187 | $(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^ | 188 | @$(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^ |
| 188 | 189 | ||
| 189 | .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean | 190 | .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean |
| 190 | 191 | ||
| @@ -193,21 +194,12 @@ mostlyclean: | |||
| 193 | rm -f *.tmp | 194 | rm -f *.tmp |
| 194 | 195 | ||
| 195 | clean: | 196 | clean: |
| 196 | -rm -f ${LOGFILES} ${LOGSAVEFILES} | 197 | find . '(' -name '*.log' -o -name '*.log~' ')' $(FIND_DELETE) |
| 197 | -rm make-test-deps.mk | ||
| 198 | 198 | ||
| 199 | bootstrap-clean: clean | 199 | bootstrap-clean: clean |
| 200 | -rm -f ${ELCFILES} | 200 | find $(srcdir) -name '*.elc' $(FIND_DELETE) |
| 201 | 201 | ||
| 202 | distclean: clean | 202 | distclean: clean |
| 203 | rm -f Makefile | 203 | rm -f Makefile |
| 204 | 204 | ||
| 205 | maintainer-clean: distclean bootstrap-clean | 205 | maintainer-clean: distclean bootstrap-clean |
| 206 | |||
| 207 | make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp | ||
| 208 | $(EMACS) --batch -l $(srcdir)/make-test-deps.emacs-lisp \ | ||
| 209 | --eval "(make-test-deps \"$(srcdir)\")" \ | ||
| 210 | 2> $@.tmp | ||
| 211 | # Hack to elide any CANNOT_DUMP=yes chatter. | ||
| 212 | sed '/\.log: /!d' $@.tmp >$@ | ||
| 213 | rm -f $@.tmp | ||
diff --git a/test/file-organization.org b/test/file-organization.org index 8d9c6716372..4d76c0068e3 100644 --- a/test/file-organization.org +++ b/test/file-organization.org | |||
| @@ -50,9 +50,9 @@ not run by the "make check" command and its derivatives. | |||
| 50 | Resource files for tests (containing test data) should reside in a | 50 | Resource files for tests (containing test data) should reside in a |
| 51 | directory named after the feature with a ~-resources~ suffix, and | 51 | directory named after the feature with a ~-resources~ suffix, and |
| 52 | located in the same directory as the feature. Hence, the lisp file | 52 | located in the same directory as the feature. Hence, the lisp file |
| 53 | ~flymake.el~ should have test files in | 53 | ~lisp/progmodes/flymake.el~, with tests in |
| 54 | ~/test/automated/lisp/progmodes/flymake-tests.el~ should reside in a | 54 | ~test/lisp/progmodes/flymake-tests.el~, should have resources in a |
| 55 | directory called ~/test/automated/lisp/progmodes/flymake-resources~. | 55 | directory called ~test/lisp/progmodes/flymake-resources~. |
| 56 | 56 | ||
| 57 | No guidance is given for the organization of resource files inside the | 57 | No guidance is given for the organization of resource files inside the |
| 58 | ~-resource~ directory; files can be organized at the author's | 58 | ~-resource~ directory; files can be organized at the author's |
diff --git a/test/lisp/dired-x-tests.el b/test/lisp/dired-x-tests.el new file mode 100644 index 00000000000..e8352a4ecaf --- /dev/null +++ b/test/lisp/dired-x-tests.el | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | ;;; dired-x-tests.el --- Test suite for dired-x. -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2017 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | (require 'ert) | ||
| 22 | (require 'dired-x) | ||
| 23 | |||
| 24 | |||
| 25 | (ert-deftest dired-test-bug25942 () | ||
| 26 | "Test for http://debbugs.gnu.org/25942 ." | ||
| 27 | (let* ((dirs (list "Public" "Music")) | ||
| 28 | (files (list ".bashrc" "bar.c" "foo.c" "c" ".c")) | ||
| 29 | (all-but-c | ||
| 30 | (sort | ||
| 31 | (append (copy-sequence dirs) | ||
| 32 | (delete "c" (copy-sequence files))) | ||
| 33 | #'string<)) | ||
| 34 | (dir (make-temp-file "Bug25942" 'dir)) | ||
| 35 | (extension "c")) | ||
| 36 | (unwind-protect | ||
| 37 | (progn | ||
| 38 | (dolist (d dirs) | ||
| 39 | (make-directory (expand-file-name d dir))) | ||
| 40 | (dolist (f files) | ||
| 41 | (write-region nil nil (expand-file-name f dir))) | ||
| 42 | (dired dir) | ||
| 43 | (dired-mark-extension extension) | ||
| 44 | (should (equal '("bar.c" "foo.c") | ||
| 45 | (sort (dired-get-marked-files 'local) #'string<))) | ||
| 46 | (dired-unmark-all-marks) | ||
| 47 | (dired-mark-suffix extension) | ||
| 48 | (should (equal all-but-c | ||
| 49 | (sort (dired-get-marked-files 'local) #'string<)))) | ||
| 50 | (delete-directory dir 'recursive)))) | ||
| 51 | |||
| 52 | (provide 'dired-x-tests) | ||
| 53 | ;; dired-x-tests.el ends here | ||
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el index 5edc3e72bf2..093cb3476c1 100644 --- a/test/lisp/emacs-lisp/cl-lib-tests.el +++ b/test/lisp/emacs-lisp/cl-lib-tests.el | |||
| @@ -493,4 +493,30 @@ | |||
| 493 | (should (cl-typep '* 'cl-lib-test-type)) | 493 | (should (cl-typep '* 'cl-lib-test-type)) |
| 494 | (should-not (cl-typep 1 'cl-lib-test-type))) | 494 | (should-not (cl-typep 1 'cl-lib-test-type))) |
| 495 | 495 | ||
| 496 | (ert-deftest cl-lib-symbol-macrolet () | ||
| 497 | ;; bug#26325 | ||
| 498 | :expected-result :failed | ||
| 499 | (should (equal (cl-flet ((f (x) (+ x 5))) | ||
| 500 | (let ((x 5)) | ||
| 501 | (f (+ x 6)))) | ||
| 502 | ;; Go through `eval', otherwise the macro-expansion | ||
| 503 | ;; error prevents running the whole test suite :-( | ||
| 504 | (eval '(cl-symbol-macrolet ((f (+ x 6))) | ||
| 505 | (cl-flet ((f (x) (+ x 5))) | ||
| 506 | (let ((x 5)) | ||
| 507 | (f f)))) | ||
| 508 | t)))) | ||
| 509 | |||
| 510 | (defmacro cl-lib-symbol-macrolet-4+5 () | ||
| 511 | ;; bug#26068 | ||
| 512 | (let* ((sname "x") | ||
| 513 | (s1 (make-symbol sname)) | ||
| 514 | (s2 (make-symbol sname))) | ||
| 515 | `(cl-symbol-macrolet ((,s1 4) | ||
| 516 | (,s2 5)) | ||
| 517 | (+ ,s1 ,s2)))) | ||
| 518 | |||
| 519 | (ert-deftest cl-lib-symbol-macrolet-2 () | ||
| 520 | (should (equal (cl-lib-symbol-macrolet-4+5) (+ 4 5)))) | ||
| 521 | |||
| 496 | ;;; cl-lib.el ends here | 522 | ;;; cl-lib.el ends here |
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index 2801f23df63..8e3f2e185cf 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el | |||
| @@ -77,6 +77,10 @@ noindent\" 3 | |||
| 77 | (search-backward "d2") | 77 | (search-backward "d2") |
| 78 | (up-list -1) | 78 | (up-list -1) |
| 79 | (indent-sexp) | 79 | (indent-sexp) |
| 80 | (should (equal (buffer-string) correct)) | ||
| 81 | (backward-sexp) | ||
| 82 | (end-of-line) | ||
| 83 | (indent-sexp) | ||
| 80 | (should (equal (buffer-string) correct))))) | 84 | (should (equal (buffer-string) correct))))) |
| 81 | 85 | ||
| 82 | (ert-deftest indent-sexp-in-string () | 86 | (ert-deftest indent-sexp-in-string () |
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 72080322379..54e7ebfc0e5 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el | |||
| @@ -294,13 +294,20 @@ This returns only for the local case and gfilenotify; otherwise it is nil. | |||
| 294 | (file-notify-add-watch | 294 | (file-notify-add-watch |
| 295 | temporary-file-directory '(change attribute-change) #'ignore))) | 295 | temporary-file-directory '(change attribute-change) #'ignore))) |
| 296 | (file-notify-rm-watch file-notify--test-desc) | 296 | (file-notify-rm-watch file-notify--test-desc) |
| 297 | (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) | 297 | |
| 298 | ;; File monitors like kqueue insist, that the watched file | ||
| 299 | ;; exists. Directory monitors are not bound to this | ||
| 300 | ;; restriction. | ||
| 301 | (when (string-equal (file-notify--test-library) "kqueue") | ||
| 302 | (write-region | ||
| 303 | "any text" nil file-notify--test-tmpfile nil 'no-message)) | ||
| 298 | (should | 304 | (should |
| 299 | (setq file-notify--test-desc | 305 | (setq file-notify--test-desc |
| 300 | (file-notify-add-watch | 306 | (file-notify-add-watch |
| 301 | file-notify--test-tmpfile '(change attribute-change) #'ignore))) | 307 | file-notify--test-tmpfile '(change attribute-change) #'ignore))) |
| 302 | (file-notify-rm-watch file-notify--test-desc) | 308 | (file-notify-rm-watch file-notify--test-desc) |
| 303 | (delete-file file-notify--test-tmpfile) | 309 | (when (string-equal (file-notify--test-library) "kqueue") |
| 310 | (delete-file file-notify--test-tmpfile)) | ||
| 304 | 311 | ||
| 305 | ;; Check error handling. | 312 | ;; Check error handling. |
| 306 | (should-error (file-notify-add-watch 1 2 3 4) | 313 | (should-error (file-notify-add-watch 1 2 3 4) |
| @@ -340,20 +347,19 @@ This returns only for the local case and gfilenotify; otherwise it is nil. | |||
| 340 | (expand-file-name | 347 | (expand-file-name |
| 341 | (make-temp-name "file-notify-test") temporary-file-directory)) | 348 | (make-temp-name "file-notify-test") temporary-file-directory)) |
| 342 | 349 | ||
| 343 | ;; This test is inspired by Bug#26127. | 350 | ;; This test is inspired by Bug#26126 and Bug#26127. |
| 344 | (ert-deftest file-notify-test02-rm-watch () | 351 | (ert-deftest file-notify-test02-rm-watch () |
| 345 | "Check `file-notify-rm-watch'." | 352 | "Check `file-notify-rm-watch'." |
| 346 | (skip-unless (file-notify--test-local-enabled)) | 353 | (skip-unless (file-notify--test-local-enabled)) |
| 347 | 354 | ||
| 348 | (unwind-protect | 355 | (unwind-protect |
| 356 | ;; Check, that `file-notify-rm-watch' works. | ||
| 349 | (progn | 357 | (progn |
| 350 | ;; Check, that `file-notify-rm-watch' works. | ||
| 351 | (should | 358 | (should |
| 352 | (setq file-notify--test-desc | 359 | (setq file-notify--test-desc |
| 353 | (file-notify-add-watch | 360 | (file-notify-add-watch |
| 354 | temporary-file-directory '(change) #'ignore))) | 361 | temporary-file-directory '(change) #'ignore))) |
| 355 | (file-notify-rm-watch file-notify--test-desc) | 362 | (file-notify-rm-watch file-notify--test-desc) |
| 356 | |||
| 357 | ;; Check, that any parameter is accepted. | 363 | ;; Check, that any parameter is accepted. |
| 358 | (condition-case err | 364 | (condition-case err |
| 359 | (progn | 365 | (progn |
| @@ -363,9 +369,19 @@ This returns only for the local case and gfilenotify; otherwise it is nil. | |||
| 363 | (file-notify-rm-watch 'foo)) | 369 | (file-notify-rm-watch 'foo)) |
| 364 | (error (ert-fail err))) | 370 | (error (ert-fail err))) |
| 365 | 371 | ||
| 366 | ;; Check, that no error is returned removing a watch descriptor twice. | 372 | ;; The environment shall be cleaned up. |
| 373 | (file-notify--test-cleanup-p)) | ||
| 374 | |||
| 375 | ;; Cleanup. | ||
| 376 | (file-notify--test-cleanup)) | ||
| 377 | |||
| 378 | (unwind-protect | ||
| 379 | ;; Check, that no error is returned removing a watch descriptor twice. | ||
| 380 | (progn | ||
| 367 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) | 381 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) |
| 368 | file-notify--test-tmpfile1 (file-notify--test-make-temp-name)) | 382 | file-notify--test-tmpfile1 (file-notify--test-make-temp-name)) |
| 383 | (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) | ||
| 384 | (write-region "any text" nil file-notify--test-tmpfile1 nil 'no-message) | ||
| 369 | (should | 385 | (should |
| 370 | (setq file-notify--test-desc | 386 | (setq file-notify--test-desc |
| 371 | (file-notify-add-watch | 387 | (file-notify-add-watch |
| @@ -374,14 +390,51 @@ This returns only for the local case and gfilenotify; otherwise it is nil. | |||
| 374 | (setq file-notify--test-desc1 | 390 | (setq file-notify--test-desc1 |
| 375 | (file-notify-add-watch | 391 | (file-notify-add-watch |
| 376 | file-notify--test-tmpfile1 '(change) #'ignore))) | 392 | file-notify--test-tmpfile1 '(change) #'ignore))) |
| 393 | ;; Remove `file-notify--test-desc' twice. | ||
| 377 | (file-notify-rm-watch file-notify--test-desc) | 394 | (file-notify-rm-watch file-notify--test-desc) |
| 378 | (file-notify-rm-watch file-notify--test-desc) | 395 | (file-notify-rm-watch file-notify--test-desc) |
| 379 | (file-notify-rm-watch file-notify--test-desc1) | 396 | (file-notify-rm-watch file-notify--test-desc1) |
| 397 | (delete-file file-notify--test-tmpfile) | ||
| 398 | (delete-file file-notify--test-tmpfile1) | ||
| 380 | 399 | ||
| 381 | ;; The environment shall be cleaned up. | 400 | ;; The environment shall be cleaned up. |
| 382 | (file-notify--test-cleanup-p)) | 401 | (file-notify--test-cleanup-p)) |
| 383 | 402 | ||
| 384 | ;; Cleanup. | 403 | ;; Cleanup. |
| 404 | (file-notify--test-cleanup)) | ||
| 405 | |||
| 406 | (unwind-protect | ||
| 407 | ;; Check, that removing watch descriptors out of order do not harm. | ||
| 408 | (let (results) | ||
| 409 | (cl-flet ((first-callback (event) | ||
| 410 | (when (eq (nth 1 event) 'deleted) (push 1 results))) | ||
| 411 | (second-callback (event) | ||
| 412 | (when (eq (nth 1 event) 'deleted) (push 2 results)))) | ||
| 413 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) | ||
| 414 | (write-region | ||
| 415 | "any text" nil file-notify--test-tmpfile nil 'no-message) | ||
| 416 | (should | ||
| 417 | (setq file-notify--test-desc | ||
| 418 | (file-notify-add-watch | ||
| 419 | file-notify--test-tmpfile | ||
| 420 | '(change) #'first-callback))) | ||
| 421 | (should | ||
| 422 | (setq file-notify--test-desc1 | ||
| 423 | (file-notify-add-watch | ||
| 424 | file-notify--test-tmpfile | ||
| 425 | '(change) #'second-callback))) | ||
| 426 | ;; Remove first watch. | ||
| 427 | (file-notify-rm-watch file-notify--test-desc) | ||
| 428 | ;; Only the second callback shall run. | ||
| 429 | (delete-file file-notify--test-tmpfile) | ||
| 430 | (file-notify--wait-for-events | ||
| 431 | (file-notify--test-timeout) results) | ||
| 432 | (should (equal results (list 2))) | ||
| 433 | |||
| 434 | ;; The environment shall be cleaned up. | ||
| 435 | (file-notify--test-cleanup-p))) | ||
| 436 | |||
| 437 | ;; Cleanup. | ||
| 385 | (file-notify--test-cleanup))) | 438 | (file-notify--test-cleanup))) |
| 386 | 439 | ||
| 387 | (file-notify--deftest-remote file-notify-test02-rm-watch | 440 | (file-notify--deftest-remote file-notify-test02-rm-watch |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 45b4ff2f5ab..2a4ef740a04 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; tramp-tests.el --- Tests of remote file access | 1 | ;;; tramp-tests.el --- Tests of remote file access -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2013-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2013-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -37,6 +37,7 @@ | |||
| 37 | 37 | ||
| 38 | ;;; Code: | 38 | ;;; Code: |
| 39 | 39 | ||
| 40 | (require 'dired) | ||
| 40 | (require 'ert) | 41 | (require 'ert) |
| 41 | (require 'tramp) | 42 | (require 'tramp) |
| 42 | (require 'vc) | 43 | (require 'vc) |
| @@ -44,11 +45,11 @@ | |||
| 44 | (require 'vc-git) | 45 | (require 'vc-git) |
| 45 | (require 'vc-hg) | 46 | (require 'vc-hg) |
| 46 | 47 | ||
| 47 | (autoload 'dired-uncache "dired") | ||
| 48 | (declare-function tramp-find-executable "tramp-sh") | 48 | (declare-function tramp-find-executable "tramp-sh") |
| 49 | (declare-function tramp-get-remote-path "tramp-sh") | 49 | (declare-function tramp-get-remote-path "tramp-sh") |
| 50 | (declare-function tramp-get-remote-stat "tramp-sh") | 50 | (declare-function tramp-get-remote-stat "tramp-sh") |
| 51 | (declare-function tramp-get-remote-perl "tramp-sh") | 51 | (declare-function tramp-get-remote-perl "tramp-sh") |
| 52 | (defvar auto-save-file-name-transforms) | ||
| 52 | (defvar tramp-copy-size-limit) | 53 | (defvar tramp-copy-size-limit) |
| 53 | (defvar tramp-persistency-file-name) | 54 | (defvar tramp-persistency-file-name) |
| 54 | (defvar tramp-remote-process-environment) | 55 | (defvar tramp-remote-process-environment) |
| @@ -2083,17 +2084,20 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2083 | (skip-unless | 2084 | (skip-unless |
| 2084 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) | 2085 | (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) |
| 2085 | 2086 | ||
| 2087 | ;; `make-nearby-temp-file' and `temporary-file-directory' exists | ||
| 2088 | ;; since Emacs 26. We don't want to see compiler warnings for older | ||
| 2089 | ;; Emacsen." | ||
| 2086 | (let ((default-directory tramp-test-temporary-file-directory) | 2090 | (let ((default-directory tramp-test-temporary-file-directory) |
| 2087 | tmp-file) | 2091 | tmp-file) |
| 2088 | ;; The remote host shall know a temporary file directory. | 2092 | ;; The remote host shall know a temporary file directory. |
| 2089 | (should (stringp (temporary-file-directory))) | 2093 | (should (stringp (with-no-warnings (temporary-file-directory)))) |
| 2090 | (should | 2094 | (should |
| 2091 | (string-equal | 2095 | (string-equal |
| 2092 | (file-remote-p default-directory) | 2096 | (file-remote-p default-directory) |
| 2093 | (file-remote-p (temporary-file-directory)))) | 2097 | (file-remote-p (with-no-warnings (temporary-file-directory))))) |
| 2094 | 2098 | ||
| 2095 | ;; The temporary file shall be located on the remote host. | 2099 | ;; The temporary file shall be located on the remote host. |
| 2096 | (setq tmp-file (make-nearby-temp-file "tramp-test")) | 2100 | (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test"))) |
| 2097 | (should (file-exists-p tmp-file)) | 2101 | (should (file-exists-p tmp-file)) |
| 2098 | (should (file-regular-p tmp-file)) | 2102 | (should (file-regular-p tmp-file)) |
| 2099 | (should | 2103 | (should |
| @@ -2103,7 +2107,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2103 | (delete-file tmp-file) | 2107 | (delete-file tmp-file) |
| 2104 | (should-not (file-exists-p tmp-file)) | 2108 | (should-not (file-exists-p tmp-file)) |
| 2105 | 2109 | ||
| 2106 | (setq tmp-file (make-nearby-temp-file "tramp-test" 'dir)) | 2110 | (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test" 'dir))) |
| 2107 | (should (file-exists-p tmp-file)) | 2111 | (should (file-exists-p tmp-file)) |
| 2108 | (should (file-directory-p tmp-file)) | 2112 | (should (file-directory-p tmp-file)) |
| 2109 | (delete-directory tmp-file) | 2113 | (delete-directory tmp-file) |
| @@ -2582,7 +2586,7 @@ process sentinels. They shall not disturb each other." | |||
| 2582 | ;; Create temporary buffers. The number of buffers | 2586 | ;; Create temporary buffers. The number of buffers |
| 2583 | ;; corresponds to the number of processes; it could be | 2587 | ;; corresponds to the number of processes; it could be |
| 2584 | ;; increased in order to make pressure on Tramp. | 2588 | ;; increased in order to make pressure on Tramp. |
| 2585 | (dotimes (i 5) | 2589 | (dotimes (_i 5) |
| 2586 | (add-to-list 'buffers (generate-new-buffer "*temp*"))) | 2590 | (add-to-list 'buffers (generate-new-buffer "*temp*"))) |
| 2587 | 2591 | ||
| 2588 | ;; Open asynchronous processes. Set process sentinel. | 2592 | ;; Open asynchronous processes. Set process sentinel. |
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index e030675e07c..8e1bac10cd1 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el | |||
| @@ -140,6 +140,43 @@ if (!/[ (:,='\"]/.test(value)) { | |||
| 140 | (font-lock-ensure) | 140 | (font-lock-ensure) |
| 141 | (should (eq (get-text-property (point) 'face) (caddr test)))))) | 141 | (should (eq (get-text-property (point) 'face) (caddr test)))))) |
| 142 | 142 | ||
| 143 | (ert-deftest js-mode-propertize-bug-1 () | ||
| 144 | (with-temp-buffer | ||
| 145 | (js-mode) | ||
| 146 | (save-excursion (insert "x")) | ||
| 147 | (insert "/") | ||
| 148 | ;; The bug was a hang. | ||
| 149 | (should t))) | ||
| 150 | |||
| 151 | (ert-deftest js-mode-propertize-bug-2 () | ||
| 152 | (with-temp-buffer | ||
| 153 | (js-mode) | ||
| 154 | (insert "function f() { | ||
| 155 | function g() | ||
| 156 | { | ||
| 157 | 1 / 2; | ||
| 158 | } | ||
| 159 | |||
| 160 | function h() { | ||
| 161 | ") | ||
| 162 | (save-excursion | ||
| 163 | (insert " | ||
| 164 | 00000000000000000000000000000000000000000000000000; | ||
| 165 | 00000000000000000000000000000000000000000000000000; | ||
| 166 | 00000000000000000000000000000000000000000000000000; | ||
| 167 | 00000000000000000000000000000000000000000000000000; | ||
| 168 | 00000000000000000000000000000000000000000000000000; | ||
| 169 | 00000000000000000000000000000000000000000000000000; | ||
| 170 | 00000000000000000000000000000000000000000000000000; | ||
| 171 | 00000000000000000000000000000000000000000000000000; | ||
| 172 | 00; | ||
| 173 | } | ||
| 174 | } | ||
| 175 | ")) | ||
| 176 | (insert "/") | ||
| 177 | ;; The bug was a hang. | ||
| 178 | (should t))) | ||
| 179 | |||
| 143 | (provide 'js-tests) | 180 | (provide 'js-tests) |
| 144 | 181 | ||
| 145 | ;;; js-tests.el ends here | 182 | ;;; js-tests.el ends here |
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 1e6b867d30b..2f4c2fb849d 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el | |||
| @@ -5314,6 +5314,25 @@ class SomeClass: | |||
| 5314 | (or enabled (hs-minor-mode -1))))) | 5314 | (or enabled (hs-minor-mode -1))))) |
| 5315 | 5315 | ||
| 5316 | 5316 | ||
| 5317 | (ert-deftest python-tests--python-nav-end-of-statement--infloop () | ||
| 5318 | "Checks that `python-nav-end-of-statement' doesn't infloop in a | ||
| 5319 | buffer with overlapping strings." | ||
| 5320 | (python-tests-with-temp-buffer "''' '\n''' ' '\n" | ||
| 5321 | (syntax-propertize (point-max)) | ||
| 5322 | ;; Create a situation where strings nominally overlap. This | ||
| 5323 | ;; shouldn't happen in practice, but apparently it can happen when | ||
| 5324 | ;; a package calls `syntax-ppss' in a narrowed buffer during JIT | ||
| 5325 | ;; lock. | ||
| 5326 | (put-text-property 4 5 'syntax-table (string-to-syntax "|")) | ||
| 5327 | (remove-text-properties 8 9 '(syntax-table nil)) | ||
| 5328 | (goto-char 4) | ||
| 5329 | (setq-local syntax-propertize-function nil) | ||
| 5330 | ;; The next form should not infloop. We have to disable | ||
| 5331 | ;; ‘debug-on-error’ so that ‘cl-assert’ doesn’t call the debugger. | ||
| 5332 | (should-error (let ((debug-on-error nil)) | ||
| 5333 | (python-nav-end-of-statement))) | ||
| 5334 | (should (eolp)))) | ||
| 5335 | |||
| 5317 | 5336 | ||
| 5318 | (provide 'python-tests) | 5337 | (provide 'python-tests) |
| 5319 | 5338 | ||
diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el index 11e5a479720..30636db083c 100644 --- a/test/lisp/url/url-auth-tests.el +++ b/test/lisp/url/url-auth-tests.el | |||
| @@ -77,6 +77,49 @@ server's WWW-Authenticate header field.") | |||
| 77 | :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863" | 77 | :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863" |
| 78 | :expected-response "0d84884d967e04440efc77e9e2b5b561"))) | 78 | :expected-response "0d84884d967e04440efc77e9e2b5b561"))) |
| 79 | 79 | ||
| 80 | (ert-deftest url-auth-test-colonjoin () | ||
| 81 | "Check joining strings with `:'." | ||
| 82 | (should (string= (url-digest-auth-colonjoin) "")) | ||
| 83 | (should (string= (url-digest-auth-colonjoin nil) "")) | ||
| 84 | (should (string= (url-digest-auth-colonjoin nil nil nil) "::")) | ||
| 85 | (should (string= (url-digest-auth-colonjoin "") "")) | ||
| 86 | (should (string= (url-digest-auth-colonjoin "" "") ":")) | ||
| 87 | (should (string= (url-digest-auth-colonjoin "one") "one")) | ||
| 88 | (should (string= (url-digest-auth-colonjoin "one" "two" "three") "one:two:three"))) | ||
| 89 | |||
| 90 | (ert-deftest url-auth-test-digest-ha1 () | ||
| 91 | "Check HA1 computation." | ||
| 92 | (dolist (row url-auth-test-challenges) | ||
| 93 | (should (string= (url-digest-auth-make-ha1 (plist-get row :username) | ||
| 94 | (plist-get row :realm) | ||
| 95 | (plist-get row :password)) | ||
| 96 | (plist-get row :expected-ha1) | ||
| 97 | )))) | ||
| 98 | |||
| 99 | (ert-deftest url-auth-test-digest-ha2 () | ||
| 100 | "Check HA2 computation." | ||
| 101 | (dolist (row url-auth-test-challenges) | ||
| 102 | (should (string= (url-digest-auth-make-ha2 (plist-get row :method) | ||
| 103 | (plist-get row :uri)) | ||
| 104 | (plist-get row :expected-ha2))))) | ||
| 105 | |||
| 106 | (ert-deftest url-auth-test-digest-request-digest () | ||
| 107 | "Check digest response value." | ||
| 108 | (dolist (row url-auth-test-challenges) | ||
| 109 | (should (string= (plist-get row :expected-response) | ||
| 110 | (if (plist-member row :qop) | ||
| 111 | (url-digest-auth-make-request-digest-qop | ||
| 112 | (plist-get row :qop) | ||
| 113 | (plist-get row :expected-ha1) | ||
| 114 | (plist-get row :expected-ha2) | ||
| 115 | (plist-get row :nonce) | ||
| 116 | (plist-get row :nc) | ||
| 117 | (plist-get row :cnonce)) | ||
| 118 | (url-digest-auth-make-request-digest | ||
| 119 | (plist-get row :expected-ha1) | ||
| 120 | (plist-get row :expected-ha2) | ||
| 121 | (plist-get row :nonce))))))) | ||
| 122 | |||
| 80 | (ert-deftest url-auth-test-digest-create-key () | 123 | (ert-deftest url-auth-test-digest-create-key () |
| 81 | "Check user credentials in their hashed form." | 124 | "Check user credentials in their hashed form." |
| 82 | (dolist (challenge url-auth-test-challenges) | 125 | (dolist (challenge url-auth-test-challenges) |
| @@ -223,14 +266,12 @@ test and cannot be passed by arguments to `url-digest-auth'." | |||
| 223 | (progn | 266 | (progn |
| 224 | ;; We don't know these, just check that they exists. | 267 | ;; We don't know these, just check that they exists. |
| 225 | (should (string-match-p ".*response=\".*?\".*" auth)) | 268 | (should (string-match-p ".*response=\".*?\".*" auth)) |
| 226 | ;; url-digest-auth doesn't return these AFAICS. | 269 | (should (string-match-p ".*nc=\".*?\".*" auth)) |
| 227 | ;;; (should (string-match-p ".*nc=\".*?\".*" auth)) | 270 | (should (string-match-p ".*cnonce=\".*?\".*" auth))) |
| 228 | ;;; (should (string-match-p ".*cnonce=\".*?\".*" auth)) | ||
| 229 | ) | ||
| 230 | (should (string-match ".*response=\"\\(.*?\\)\".*" auth)) | 271 | (should (string-match ".*response=\"\\(.*?\\)\".*" auth)) |
| 231 | (should (string= (match-string 1 auth) | 272 | (should (string= (match-string 1 auth) |
| 232 | (plist-get challenge :expected-response)))) | 273 | (plist-get challenge :expected-response)))) |
| 233 | ))) | 274 | ))) |
| 234 | 275 | ||
| 235 | (ert-deftest url-auth-test-digest-auth-opaque () | 276 | (ert-deftest url-auth-test-digest-auth-opaque () |
| 236 | "Check that `opaque' value is added to result when presented by | 277 | "Check that `opaque' value is added to result when presented by |
diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el index 912c6b1e818..387786ced06 100644 --- a/test/lisp/vc/ediff-ptch-tests.el +++ b/test/lisp/vc/ediff-ptch-tests.el | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'ediff-ptch) | 23 | (require 'ediff-ptch) |
| 24 | 24 | ||
| 25 | (ert-deftest ibuffer-test-bug25010 () | 25 | (ert-deftest ediff-ptch-test-bug25010 () |
| 26 | "Test for http://debbugs.gnu.org/25010 ." | 26 | "Test for http://debbugs.gnu.org/25010 ." |
| 27 | (with-temp-buffer | 27 | (with-temp-buffer |
| 28 | (insert "diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el | 28 | (insert "diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el |
| @@ -38,5 +38,72 @@ index 6a07f80..6e8e947 100644 | |||
| 38 | (match-string 1)))) | 38 | (match-string 1)))) |
| 39 | (should-not (string-suffix-p "@@" filename))))) | 39 | (should-not (string-suffix-p "@@" filename))))) |
| 40 | 40 | ||
| 41 | |||
| 42 | (ert-deftest ediff-ptch-test-bug26084 () | ||
| 43 | "Test for http://debbugs.gnu.org/26084 ." | ||
| 44 | (skip-unless (executable-find "git")) | ||
| 45 | (skip-unless (executable-find ediff-patch-program)) | ||
| 46 | (let* ((tmpdir (make-temp-file "ediff-ptch-test" t)) | ||
| 47 | (default-directory (file-name-as-directory tmpdir)) | ||
| 48 | (patch (make-temp-file "ediff-ptch-test")) | ||
| 49 | (qux (expand-file-name "qux.txt" tmpdir)) | ||
| 50 | (bar (expand-file-name "bar.txt" tmpdir)) | ||
| 51 | (git-program (executable-find "git"))) | ||
| 52 | ;; Create repository. | ||
| 53 | (with-temp-buffer | ||
| 54 | (insert "qux here\n") | ||
| 55 | (write-region nil nil qux nil 'silent) | ||
| 56 | (erase-buffer) | ||
| 57 | (insert "bar here\n") | ||
| 58 | (write-region nil nil bar nil 'silent)) | ||
| 59 | (call-process git-program nil nil nil "init") | ||
| 60 | (call-process git-program nil nil nil "add" ".") | ||
| 61 | (call-process git-program nil nil nil "commit" "-m" "Test repository.") | ||
| 62 | ;; Update repo., save the diff and reset to initial state. | ||
| 63 | (with-temp-buffer | ||
| 64 | (insert "foo here\n") | ||
| 65 | (write-region nil nil qux nil 'silent) | ||
| 66 | (write-region nil nil bar nil 'silent)) | ||
| 67 | (call-process git-program nil `(:file ,patch) nil "diff") | ||
| 68 | (call-process git-program nil nil nil "reset" "--hard" "HEAD") | ||
| 69 | (find-file patch) | ||
| 70 | (unwind-protect | ||
| 71 | (let* ((info | ||
| 72 | (progn (ediff-map-patch-buffer (current-buffer)) ediff-patch-map)) | ||
| 73 | (patch1 | ||
| 74 | (buffer-substring-no-properties | ||
| 75 | (car (nth 3 (car info))) | ||
| 76 | (car (nth 4 (car info))))) | ||
| 77 | (patch2 | ||
| 78 | (buffer-substring-no-properties | ||
| 79 | (car (nth 3 (cadr info))) | ||
| 80 | (car (nth 4 (cadr info)))))) | ||
| 81 | ;; Apply both patches. | ||
| 82 | (dolist (x (list (cons patch1 bar) (cons patch2 qux))) | ||
| 83 | (with-temp-buffer | ||
| 84 | (insert (car x)) | ||
| 85 | (call-process-region (point-min) | ||
| 86 | (point-max) | ||
| 87 | ediff-patch-program | ||
| 88 | nil nil nil | ||
| 89 | "-b" (cdr x)))) | ||
| 90 | ;; Check backup files were saved correctly. | ||
| 91 | (dolist (x (list qux bar)) | ||
| 92 | (let ((backup | ||
| 93 | (car | ||
| 94 | (directory-files | ||
| 95 | tmpdir 'full | ||
| 96 | (concat (file-name-nondirectory x) "."))))) | ||
| 97 | (should-not | ||
| 98 | (string= (with-temp-buffer | ||
| 99 | (insert-file-contents x) | ||
| 100 | (buffer-string)) | ||
| 101 | (with-temp-buffer | ||
| 102 | (insert-file-contents backup) | ||
| 103 | (buffer-string)))))) | ||
| 104 | (delete-directory tmpdir 'recursive) | ||
| 105 | (delete-file patch))))) | ||
| 106 | |||
| 107 | |||
| 41 | (provide 'ediff-ptch-tests) | 108 | (provide 'ediff-ptch-tests) |
| 42 | ;;; ediff-ptch-tests.el ends here | 109 | ;;; ediff-ptch-tests.el ends here |
diff --git a/test/make-test-deps.emacs-lisp b/test/make-test-deps.emacs-lisp deleted file mode 100644 index 609e9276186..00000000000 --- a/test/make-test-deps.emacs-lisp +++ /dev/null | |||
| @@ -1,98 +0,0 @@ | |||
| 1 | ;; -*- emacs-lisp -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2015-2017 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Commentary: | ||
| 21 | |||
| 22 | ;; This file generates dependencies between test files and the files | ||
| 23 | ;; that they test. | ||
| 24 | |||
| 25 | ;; It has an .emacs-lisp extension because it makes the Makefile easier! | ||
| 26 | |||
| 27 | (require 'seq) | ||
| 28 | |||
| 29 | (defun make-test-deps (src-dir) | ||
| 30 | (let ((src-dir (file-truename src-dir))) | ||
| 31 | (message | ||
| 32 | "%s" | ||
| 33 | (concat | ||
| 34 | (make-test-deps-lisp src-dir) | ||
| 35 | (make-test-deps-src src-dir))))) | ||
| 36 | |||
| 37 | (defun make-test-deps-lisp (src-dir) | ||
| 38 | (mapconcat | ||
| 39 | (lambda (file-without-suffix) | ||
| 40 | (format "./%s-tests.log: %s/../%s.el\n" | ||
| 41 | file-without-suffix | ||
| 42 | src-dir | ||
| 43 | file-without-suffix)) | ||
| 44 | (make-test-test-files src-dir "lisp") "")) | ||
| 45 | |||
| 46 | (defun make-test-deps-src (src-dir) | ||
| 47 | (mapconcat | ||
| 48 | (lambda (file-without-suffix) | ||
| 49 | (format "./%s-tests.log: %s/../%s.c\n" | ||
| 50 | file-without-suffix | ||
| 51 | src-dir | ||
| 52 | file-without-suffix)) | ||
| 53 | (make-test-test-files src-dir "src") "")) | ||
| 54 | |||
| 55 | (defun make-test-test-files (src-dir sub-src-dir) | ||
| 56 | (make-test-munge-files | ||
| 57 | src-dir | ||
| 58 | (directory-files-recursively | ||
| 59 | (concat src-dir "/" sub-src-dir) | ||
| 60 | ".*-tests.el$"))) | ||
| 61 | |||
| 62 | (defun make-test-munge-files (src-dir files) | ||
| 63 | (make-test-sans-suffix | ||
| 64 | (make-test-de-stem | ||
| 65 | src-dir | ||
| 66 | (make-test-no-legacy | ||
| 67 | (make-test-no-test-dir | ||
| 68 | (make-test-no-resources | ||
| 69 | files)))))) | ||
| 70 | |||
| 71 | (defun make-test-sans-suffix (files) | ||
| 72 | (mapcar | ||
| 73 | (lambda (file) | ||
| 74 | (substring file 0 -9)) | ||
| 75 | files)) | ||
| 76 | |||
| 77 | (defun make-test-de-stem (stem files) | ||
| 78 | (mapcar | ||
| 79 | (lambda (file) | ||
| 80 | (substring | ||
| 81 | file | ||
| 82 | (+ 1 (length stem)))) | ||
| 83 | files)) | ||
| 84 | |||
| 85 | (defun make-test-no-legacy (list) | ||
| 86 | (make-test-remove list "legacy/")) | ||
| 87 | |||
| 88 | (defun make-test-no-resources (list) | ||
| 89 | (make-test-remove list "-resources/")) | ||
| 90 | |||
| 91 | (defun make-test-no-test-dir (list) | ||
| 92 | (make-test-remove list "-tests/")) | ||
| 93 | |||
| 94 | (defun make-test-remove (list match) | ||
| 95 | (seq-remove | ||
| 96 | (lambda (file) | ||
| 97 | (string-match-p match file)) | ||
| 98 | list)) | ||
diff --git a/test/src/inotify-tests.el b/test/src/inotify-tests.el index f30aecc9c4f..987e1fc0777 100644 --- a/test/src/inotify-tests.el +++ b/test/src/inotify-tests.el | |||
| @@ -28,6 +28,13 @@ | |||
| 28 | (declare-function inotify-add-watch "inotify.c" (file-name aspect callback)) | 28 | (declare-function inotify-add-watch "inotify.c" (file-name aspect callback)) |
| 29 | (declare-function inotify-rm-watch "inotify.c" (watch-descriptor)) | 29 | (declare-function inotify-rm-watch "inotify.c" (watch-descriptor)) |
| 30 | 30 | ||
| 31 | (ert-deftest inotify-valid-p-simple () | ||
| 32 | "Simple tests for `inotify-valid-p'." | ||
| 33 | (skip-unless (featurep 'inotify)) | ||
| 34 | (should-not (inotify-valid-p 0)) | ||
| 35 | (should-not (inotify-valid-p nil)) | ||
| 36 | (should-not (inotify-valid-p '(0 . 0)))) | ||
| 37 | |||
| 31 | ;; (ert-deftest filewatch-file-watch-aspects-check () | 38 | ;; (ert-deftest filewatch-file-watch-aspects-check () |
| 32 | ;; "Test whether `file-watch' properly checks the aspects." | 39 | ;; "Test whether `file-watch' properly checks the aspects." |
| 33 | ;; (let ((temp-file (make-temp-file "filewatch-aspects"))) | 40 | ;; (let ((temp-file (make-temp-file "filewatch-aspects"))) |
| @@ -56,7 +63,9 @@ | |||
| 56 | (insert "Foo\n")) | 63 | (insert "Foo\n")) |
| 57 | (read-event nil nil 5) | 64 | (read-event nil nil 5) |
| 58 | (should (> events 0))) | 65 | (should (> events 0))) |
| 66 | (should (inotify-valid-p wd)) | ||
| 59 | (inotify-rm-watch wd) | 67 | (inotify-rm-watch wd) |
| 68 | (should-not (inotify-valid-p wd)) | ||
| 60 | (delete-file temp-file))))) | 69 | (delete-file temp-file))))) |
| 61 | 70 | ||
| 62 | (provide 'inotify-tests) | 71 | (provide 'inotify-tests) |