commit e6d8f700571967f69e61692ac76c98e24db52751 (HEAD, refs/remotes/origin/master) Author: YAMAMOTO Mitsuharu Date: Wed Jun 3 15:21:08 2015 +0900 Undo previous changes in non-toolkit scroll bar drawing. * src/xterm.c (x_scroll_bar_set_handle, x_scroll_bar_expose) [!USE_TOOLKIT_SCROLL_BARS]: Draw into scroll bar window. (Bug#20668) diff --git a/src/xterm.c b/src/xterm.c index 17c1a64..25c0d87 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6409,7 +6409,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, f->output_data.x->scroll_bar_foreground_pixel); /* Draw the handle itself. */ - x_fill_rectangle (f, gc, + XFillRectangle (FRAME_X_DISPLAY (f), w, gc, /* x, y, width, height */ VERTICAL_SCROLL_BAR_LEFT_BORDER, VERTICAL_SCROLL_BAR_TOP_BORDER + start, @@ -6884,7 +6884,7 @@ x_scroll_bar_expose (struct scroll_bar *bar, const XEvent *event) f->output_data.x->scroll_bar_foreground_pixel); /* Draw a one-pixel border just inside the edges of the scroll bar. */ - x_draw_rectangle (f, gc, + XDrawRectangle (FRAME_X_DISPLAY (f), w, gc, /* x, y, width, height */ 0, 0, bar->width - 1, bar->height - 1); commit 9204b0c622b610493d2457af16cdcdd88331744c Author: Paul Eggert Date: Tue Jun 2 22:51:49 2015 -0700 * .gitignore: Also ignore doc/*/*/*.html and .ps. diff --git a/.gitignore b/.gitignore index bc6be66..092fd03 100644 --- a/.gitignore +++ b/.gitignore @@ -233,7 +233,9 @@ lisp/international/uni-*.el *.vr *.vrs doc/*/*.html +doc/*/*/*.html doc/*/*.ps +doc/*/*/*.ps doc/emacs/emacsver.texi doc/man/emacs.1 doc/misc/cc-mode.ss commit 8e06d22bb654c649da6f32bd235a84eb2f4d188d Author: Paul Eggert Date: Tue Jun 2 22:50:57 2015 -0700 Support quotes 'like this' in info files This is possible when 'makeinfo --disable-encoding' is used in Texinfo 5. * lisp/calc/calc-help.el (calc-describe-thing): * lisp/gnus/gnus-art.el (gnus-button-alist): * lisp/info.el (Info-find-index-name): * lisp/vc/ediff-help.el (ediff-help-for-quick-help): Also support quotes 'like this'. * lisp/calc/calc-help.el (calc-describe-thing): Simplify. * lisp/finder.el (finder-font-lock-keywords): Remove var that hasn't been used in years, instead of bothering to fix its quoting. diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el index aace2a9..b2e7df1 100644 --- a/lisp/calc/calc-help.el +++ b/lisp/calc/calc-help.el @@ -364,25 +364,21 @@ C-w Describe how there is no warranty for Calc." (error "Can't find `%s' in %s" thing where))) (let (Info-history) (Info-goto-node (buffer-substring (match-beginning 1) (match-end 1)))) - (or (let ((case-fold-search nil)) - (or (re-search-forward - (format "\\[[`‘]%s['’]\\]\\|([`‘]%s['’])\\|\\[^.?]" ;; Exclude [.?] for URLs in gmane.emacs.cvs 1 (>= gnus-button-emacs-level 8) gnus-button-handle-library 1) - ("[`‘]\\([a-z][-a-z0-9]+\\.el\\)['’]" + ("['`‘]\\([a-z][-a-z0-9]+\\.el\\)['’]" 1 (>= gnus-button-emacs-level 8) gnus-button-handle-library 1) - ("[`‘]\\([a-z][a-z0-9]+-[a-z0-9]+-[-a-z0-9]*[a-z]\\|\\(gnus\\|message\\)-[-a-z]+\\)['’]" + ("['`‘]\\([a-z][a-z0-9]+-[a-z0-9]+-[-a-z0-9]*[a-z]\\|\\(gnus\\|message\\)-[-a-z]+\\)['’]" 0 (>= gnus-button-emacs-level 8) gnus-button-handle-symbol 1) - ("[`‘]\\([a-z][a-z0-9]+-[a-z]+\\)['’]" + ("['`‘]\\([a-z][a-z0-9]+-[a-z]+\\)['’]" 0 (>= gnus-button-emacs-level 9) gnus-button-handle-symbol 1) ("(setq[ \t\n]+\\([a-z][a-z0-9]+-[-a-z0-9]+\\)[ \t\n]+.+)" 1 (>= gnus-button-emacs-level 7) gnus-button-handle-describe-variable 1) @@ -7841,7 +7841,7 @@ positives are possible." 0 (>= gnus-button-emacs-level 1) gnus-button-handle-describe-function 2) ("\\b\\(C-h\\|?\\)[ \t\n]+v[ \t\n]+\\([^ \t\n]+\\)[ \t\n]+RET\\>" 0 (>= gnus-button-emacs-level 1) gnus-button-handle-describe-variable 2) - ("[`‘]\\(\\(C-h\\|?\\)[ \t\n]+k[ \t\n]+\\([^'’]+\\)\\)['’]" + ("['`‘]\\(\\(C-h\\|?\\)[ \t\n]+k[ \t\n]+\\([^'’]+\\)\\)['’]" ;; Unlike the other regexps we really have to require quoting ;; here to determine where it ends. 1 (>= gnus-button-emacs-level 1) gnus-button-handle-describe-key 3) diff --git a/lisp/info.el b/lisp/info.el index 80428e7..59ce465 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -3378,10 +3378,10 @@ Give an empty topic name to go to the Index node itself." (re-search-forward (format "[a-zA-Z]+: [a-zA-Z0-9_ *&]+ %s\\( \\|$\\)" (regexp-quote name)) nil t) - (search-forward (format "[`‘]%s['’]" name) nil t) + (search-forward (format "['`‘]%s['’]" name) nil t) (and (string-match "\\`.*\\( (.*)\\)\\'" name) (search-forward - (format "[`‘]%s['’]" (substring name 0 (match-beginning 1))) + (format "['`‘]%s['’]" (substring name 0 (match-beginning 1))) nil t)) (search-forward name nil t) ;; Try again without the " <1>" makeinfo can append diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el index 67acc66..3d46869 100644 --- a/lisp/vc/ediff-help.el +++ b/lisp/vc/ediff-help.el @@ -195,47 +195,47 @@ the value of this variable and the variables `ediff-help-message-*' in (ediff-documentation "Quick Help Commands") (let (case-fold-search) - (cond ((string= cmd "?") (re-search-forward "^[`‘]\\?['’]")) - ((string= cmd "G") (re-search-forward "^[`‘]G['’]")) - ((string= cmd "E") (re-search-forward "^[`‘]E['’]")) - ((string= cmd "wd") (re-search-forward "^[`‘]wd['’]")) - ((string= cmd "wx") (re-search-forward "^[`‘]wa['’]")) - ((string= cmd "a/b") (re-search-forward "^[`‘]a['’]")) - ((string= cmd "x") (re-search-forward "^[`‘]a['’]")) - ((string= cmd "xy") (re-search-forward "^[`‘]ab['’]")) - ((string= cmd "p,DEL") (re-search-forward "^[`‘]p['’]")) - ((string= cmd "n,SPC") (re-search-forward "^[`‘]n['’]")) - ((string= cmd "j") (re-search-forward "^[`‘]j['’]")) - ((string= cmd "gx") (re-search-forward "^[`‘]ga['’]")) - ((string= cmd "!") (re-search-forward "^[`‘]!['’]")) - ((string= cmd "*") (re-search-forward "^[`‘]\\*['’]")) - ((string= cmd "m") (re-search-forward "^[`‘]m['’]")) - ((string= cmd "|") (re-search-forward "^[`‘]|['’]")) - ((string= cmd "@") (re-search-forward "^[`‘]@['’]")) - ((string= cmd "h") (re-search-forward "^[`‘]h['’]")) - ((string= cmd "r") (re-search-forward "^[`‘]r['’]")) - ((string= cmd "rx") (re-search-forward "^[`‘]ra['’]")) - ((string= cmd "##") (re-search-forward "^[`‘]##['’]")) - ((string= cmd "#c") (re-search-forward "^[`‘]#c['’]")) - ((string= cmd "#f/#h") (re-search-forward "^[`‘]#f['’]")) - ((string= cmd "X") (re-search-forward "^[`‘]A['’]")) - ((string= cmd "v/V") (re-search-forward "^[`‘]v['’]")) - ((string= cmd "") (re-search-forward "^[`‘]<['’]")) - ((string= cmd "~") (re-search-forward "^[`‘]~['’]")) - ((string= cmd "i") (re-search-forward "^[`‘]i['’]")) - ((string= cmd "D") (re-search-forward "^[`‘]D['’]")) - ((string= cmd "R") (re-search-forward "^[`‘]R['’]")) - ((string= cmd "M") (re-search-forward "^[`‘]M['’]")) - ((string= cmd "z/q") (re-search-forward "^[`‘]z['’]")) - ((string= cmd "%") (re-search-forward "^[`‘]%['’]")) - ((string= cmd "C-l") (re-search-forward "^[`‘]C-l['’]")) - ((string= cmd "$$") (re-search-forward "^[`‘]\\$\\$['’]")) - ((string= cmd "$*") (re-search-forward "^[`‘]\\$\\*['’]")) - ((string= cmd "/") (re-search-forward "^[`‘]/['’]")) - ((string= cmd "&") (re-search-forward "^[`‘]&['’]")) - ((string= cmd "s") (re-search-forward "^[`‘]s['’]")) - ((string= cmd "+") (re-search-forward "^[`‘]\\+['’]")) - ((string= cmd "=") (re-search-forward "^[`‘]=['’]")) + (cond ((string= cmd "?") (re-search-forward "^['`‘]\\?['’]")) + ((string= cmd "G") (re-search-forward "^['`‘]G['’]")) + ((string= cmd "E") (re-search-forward "^['`‘]E['’]")) + ((string= cmd "wd") (re-search-forward "^['`‘]wd['’]")) + ((string= cmd "wx") (re-search-forward "^['`‘]wa['’]")) + ((string= cmd "a/b") (re-search-forward "^['`‘]a['’]")) + ((string= cmd "x") (re-search-forward "^['`‘]a['’]")) + ((string= cmd "xy") (re-search-forward "^['`‘]ab['’]")) + ((string= cmd "p,DEL") (re-search-forward "^['`‘]p['’]")) + ((string= cmd "n,SPC") (re-search-forward "^['`‘]n['’]")) + ((string= cmd "j") (re-search-forward "^['`‘]j['’]")) + ((string= cmd "gx") (re-search-forward "^['`‘]ga['’]")) + ((string= cmd "!") (re-search-forward "^['`‘]!['’]")) + ((string= cmd "*") (re-search-forward "^['`‘]\\*['’]")) + ((string= cmd "m") (re-search-forward "^['`‘]m['’]")) + ((string= cmd "|") (re-search-forward "^['`‘]|['’]")) + ((string= cmd "@") (re-search-forward "^['`‘]@['’]")) + ((string= cmd "h") (re-search-forward "^['`‘]h['’]")) + ((string= cmd "r") (re-search-forward "^['`‘]r['’]")) + ((string= cmd "rx") (re-search-forward "^['`‘]ra['’]")) + ((string= cmd "##") (re-search-forward "^['`‘]##['’]")) + ((string= cmd "#c") (re-search-forward "^['`‘]#c['’]")) + ((string= cmd "#f/#h") (re-search-forward "^['`‘]#f['’]")) + ((string= cmd "X") (re-search-forward "^['`‘]A['’]")) + ((string= cmd "v/V") (re-search-forward "^['`‘]v['’]")) + ((string= cmd "") (re-search-forward "^['`‘]<['’]")) + ((string= cmd "~") (re-search-forward "^['`‘]~['’]")) + ((string= cmd "i") (re-search-forward "^['`‘]i['’]")) + ((string= cmd "D") (re-search-forward "^['`‘]D['’]")) + ((string= cmd "R") (re-search-forward "^['`‘]R['’]")) + ((string= cmd "M") (re-search-forward "^['`‘]M['’]")) + ((string= cmd "z/q") (re-search-forward "^['`‘]z['’]")) + ((string= cmd "%") (re-search-forward "^['`‘]%['’]")) + ((string= cmd "C-l") (re-search-forward "^['`‘]C-l['’]")) + ((string= cmd "$$") (re-search-forward "^['`‘]\\$\\$['’]")) + ((string= cmd "$*") (re-search-forward "^['`‘]\\$\\*['’]")) + ((string= cmd "/") (re-search-forward "^['`‘]/['’]")) + ((string= cmd "&") (re-search-forward "^['`‘]&['’]")) + ((string= cmd "s") (re-search-forward "^['`‘]s['’]")) + ((string= cmd "+") (re-search-forward "^['`‘]\\+['’]")) + ((string= cmd "=") (re-search-forward "^['`‘]=['’]")) (t (error "Undocumented command! Type `G' in Ediff Control Panel to drop a note to the Ediff maintainer"))) ) ; let case-fold-search )) commit f2211e51b7bd5247dfc22ecde8e6c4be3821b6fb Author: Paul Eggert Date: Tue Jun 2 18:27:13 2015 -0700 * .gitignore: Remove !test/etags/html-src/*.html. It's no longer needed, since *.html was removed. Sort. diff --git a/.gitignore b/.gitignore index d7be846..bc6be66 100644 --- a/.gitignore +++ b/.gitignore @@ -208,8 +208,6 @@ lisp/international/uni-*.el *.dvi *.fn *.fns -doc/*/*.html -!test/etags/html-src/*.html *.info *.ky *.kys @@ -224,7 +222,6 @@ doc/*/*.html *.pgs *.pj *.pjs -doc/*/*.ps *.sc *.scs *.t2d/ @@ -235,6 +232,8 @@ doc/*/*.ps *.tps *.vr *.vrs +doc/*/*.html +doc/*/*.ps doc/emacs/emacsver.texi doc/man/emacs.1 doc/misc/cc-mode.ss commit c6ee95ddeefc17410e15090539d0cb220ab6947c Author: Dmitry Gutov Date: Wed Jun 3 05:44:48 2015 +0300 Restore instead of '.' in grep-find-template * lisp/cedet/semantic/symref/grep.el (semantic-symref-grep-use-template): Update a comment. * lisp/progmodes/grep.el (grep-compute-defaults): Restore instead of '.' in grep-find-template (bug#20719). (rgrep): Pass nil as the directory to rgrep-default-command. * lisp/progmodes/grep.el (grep-expand-keywords): Use '.' as the default value for DIR. * lisp/progmodes/xref.el (xref-collect-matches): Drop the workaround. diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 6325eb4..cea6d4f 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -125,7 +125,7 @@ GREPPATTERN is the pattern used by grep." greppattern filepattern rootdir))) - ;; For some reason, my default has no in it. + ;; http://debbugs.gnu.org/20719 (when (string-match "find \\(\\.\\)" cmd) (setq cmd (replace-match rootdir t t cmd 1))) ;;(message "New command: %s" cmd) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 6981d38..68852f7 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -633,17 +633,17 @@ This function is called from `compilation-filter-hook'." (format "%s " null-device) ""))) (cond ((eq grep-find-use-xargs 'gnu) - (format "%s . -type f -print0 | \"%s\" -0 %s" + (format "%s -type f -print0 | \"%s\" -0 %s" find-program xargs-program gcmd)) ((eq grep-find-use-xargs 'exec) - (format "%s . -type f -exec %s {} %s%s" + (format "%s -type f -exec %s {} %s%s" find-program gcmd null (shell-quote-argument ";"))) ((eq grep-find-use-xargs 'exec-plus) - (format "%s . -type f -exec %s %s{} +" + (format "%s -type f -exec %s %s{} +" find-program gcmd null)) (t - (format "%s . -type f -print | \"%s\" %s" + (format "%s -type f -print | \"%s\" %s" find-program xargs-program gcmd)))))))) ;; Save defaults for this host. @@ -792,7 +792,7 @@ easily repeat a find command." (defconst grep-expand-keywords '(("" . (and cf (isearch-no-upper-case-p regexp t) "-i")) - ("" . dir) + ("" . (or dir ".")) ("" . files) ("" . null-device) ("" . excl) @@ -992,7 +992,7 @@ to specify a command to run." grep-find-command))) (compilation-start regexp 'grep-mode)) (setq dir (file-name-as-directory (expand-file-name dir))) - (let ((command (rgrep-default-command regexp files dir))) + (let ((command (rgrep-default-command regexp files nil))) (when command (if confirm (setq command diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index d6f6ba8..f786d4e 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -757,11 +757,6 @@ tools are used, and when." (buf (get-buffer-create " *xref-grep*")) (grep-re (caar grep-regexp-alist)) hits) - ;; http://debbugs.gnu.org/20719 - ;; We want to pass the exact directory to `find', because then - ;; `grep' output features absolute file names. - (when (string-match "find \\(\\.\\)" command) - (setq command (replace-match (shell-quote-argument dir) t t command 1))) (with-current-buffer buf (erase-buffer) (when (eq (call-process-shell-command command nil t) 0) commit 0a9e3248af3bab4f35da1473a6330292f5857ccd Author: Glenn Morris Date: Tue Jun 2 21:25:11 2015 -0400 * configure.ac (emacs_config_features): Add X toolkit and scroll-bars. diff --git a/configure.ac b/configure.ac index 8b1556b..9c6a74a 100644 --- a/configure.ac +++ b/configure.ac @@ -5144,14 +5144,24 @@ optsep= emacs_config_features= for opt in XAW3D XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS \ GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT \ - LIBOTF XFT ZLIB; do + LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS X_TOOLKIT; do case $opt in NOTIFY|ACL) eval val=\${${opt}_SUMMARY} ;; - CAIRO) eval val=\${USE_$opt} ;; + CAIRO|TOOLKIT_SCROLL_BARS|X_TOOLKIT) eval val=\${USE_$opt} ;; *) eval val=\${HAVE_$opt} ;; esac - test x"$val" = xno && continue + case x$val in + xno|xnone|x) continue ;; + esac + case $opt in + X_TOOLKIT) + case $val in + GTK*|LUCID|MOTIF) opt=$val ;; + *) continue ;; + esac + ;; + esac AS_VAR_APPEND([emacs_config_features], ["$optsep$opt"]) optsep=' ' done commit 7714add63046b7301e8e8790884ac3c8b4f06bda Author: Glenn Morris Date: Tue Jun 2 20:46:09 2015 -0400 ; * etc/NEWS: Tiny edit. diff --git a/etc/NEWS b/etc/NEWS index 1c320b3..d663795 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -30,6 +30,7 @@ otherwise leave it unmarked. ** Building Emacs now requires GNU make, version 3.81 or later. ** New configure option --with-cairo. +Maybe add text based on http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00689.html ** By default, Emacs no longer works on IRIX. We expect that Emacs users are not affected by this, as SGI stopped supporting IRIX in commit f0380bb6cf1f6aaa5a6e61b44d6af6eb9ef9054f Author: Glenn Morris Date: Tue Jun 2 20:22:35 2015 -0400 * configure.ac (emacs_config_features): Add Cairo. diff --git a/configure.ac b/configure.ac index 2df3852..8b1556b 100644 --- a/configure.ac +++ b/configure.ac @@ -5142,12 +5142,13 @@ fi optsep= emacs_config_features= -for opt in XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS \ +for opt in XAW3D XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS \ GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT \ LIBOTF XFT ZLIB; do case $opt in NOTIFY|ACL) eval val=\${${opt}_SUMMARY} ;; + CAIRO) eval val=\${USE_$opt} ;; *) eval val=\${HAVE_$opt} ;; esac test x"$val" = xno && continue commit b459d945c05857f53aa5649ca9c28860e93a3266 Author: Glenn Morris Date: Tue Jun 2 20:20:06 2015 -0400 ; * etc/NEWS: Add Cairo placeholder. diff --git a/etc/NEWS b/etc/NEWS index 57e63b1..1c320b3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -29,6 +29,8 @@ otherwise leave it unmarked. ** Building Emacs now requires GNU make, version 3.81 or later. +** New configure option --with-cairo. + ** By default, Emacs no longer works on IRIX. We expect that Emacs users are not affected by this, as SGI stopped supporting IRIX in December 2013. If you are affected, please send a bug report. You commit 73dee110de8a1adb25fd67a0089941512d08d6e4 Author: Glenn Morris Date: Tue Jun 2 20:19:06 2015 -0400 * configure.ac [HAVE_GTK3]: Remove USE_CAIRO that gets reset later. diff --git a/configure.ac b/configure.ac index a9fe095..2df3852 100644 --- a/configure.ac +++ b/configure.ac @@ -2408,7 +2408,6 @@ if test "${opsys}" != "mingw32"; then AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.]) GTK_OBJ=emacsgtkfixed.o gtk_term_header=gtkutil.h - USE_CAIRO=yes USE_GTK_TOOLKIT="GTK3" if test "x$ac_enable_gtk_deprecation_warnings" = x; then AC_DEFINE([GDK_DISABLE_DEPRECATION_WARNINGS], [1], commit 420b293c7da575f800a5048e245c25905472697f Author: Michael Albinus Date: Tue Jun 2 23:47:17 2015 +0200 Ensure, that autorevert works for remote files in file-notify-tests.el * test/automated/file-notify-tests.el (file-notify--test-desc): New defvar. (file-notify--test-remote-enabled) (file-notify-test00-availability, file-notify-test01-add-watch) (file-notify-test02-events): Use it. (file-notify--test-event-test): Check proper descriptor. (file-notify-test03-autorevert): Ensure, that `visited-file-modtime' has changed. Fixes: debbugs:20392 diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el index 46d287f..a45eff7 100644 --- a/test/automated/file-notify-tests.el +++ b/test/automated/file-notify-tests.el @@ -57,6 +57,7 @@ (defvar file-notify--test-tmpfile nil) (defvar file-notify--test-tmpfile1 nil) +(defvar file-notify--test-desc nil) (defvar file-notify--test-results nil) (defvar file-notify--test-event nil) @@ -84,20 +85,21 @@ being the result.") (defun file-notify--test-remote-enabled () "Whether remote file notification is enabled." (unless (consp file-notify--test-remote-enabled-checked) - (let (desc) - (unwind-protect - (ignore-errors - (and - (file-remote-p file-notify-test-remote-temporary-file-directory) - (file-directory-p file-notify-test-remote-temporary-file-directory) - (file-writable-p file-notify-test-remote-temporary-file-directory) - (setq desc - (file-notify-add-watch - file-notify-test-remote-temporary-file-directory - '(change) 'ignore)))) - ;; Unwind forms. - (setq file-notify--test-remote-enabled-checked (cons t desc)) - (when desc (file-notify-rm-watch desc))))) + (unwind-protect + (ignore-errors + (and + (file-remote-p file-notify-test-remote-temporary-file-directory) + (file-directory-p file-notify-test-remote-temporary-file-directory) + (file-writable-p file-notify-test-remote-temporary-file-directory) + (setq file-notify--test-desc + (file-notify-add-watch + file-notify-test-remote-temporary-file-directory + '(change) 'ignore)))) + ;; Unwind forms. + (setq file-notify--test-remote-enabled-checked + (cons t file-notify--test-desc)) + (when file-notify--test-desc + (file-notify-rm-watch file-notify--test-desc)))) ;; Return result. (cdr file-notify--test-remote-enabled-checked)) @@ -116,11 +118,11 @@ being the result.") (ert-deftest file-notify-test00-availability () "Test availability of `file-notify'." (skip-unless (file-notify--test-local-enabled)) - (let (desc) - ;; Check, that different valid parameters are accepted. - (should (setq desc (file-notify-add-watch - temporary-file-directory '(change) 'ignore))) - (file-notify-rm-watch desc))) + ;; Check, that different valid parameters are accepted. + (should + (setq file-notify--test-desc + (file-notify-add-watch temporary-file-directory '(change) 'ignore))) + (file-notify-rm-watch file-notify--test-desc)) (file-notify--deftest-remote file-notify-test00-availability "Test availability of `file-notify' for remote files.") @@ -128,34 +130,37 @@ being the result.") (ert-deftest file-notify-test01-add-watch () "Check `file-notify-add-watch'." (skip-unless (file-notify--test-local-enabled)) - (let (desc) - ;; Check, that different valid parameters are accepted. - (should (setq desc (file-notify-add-watch - temporary-file-directory '(change) 'ignore))) - (file-notify-rm-watch desc) - (should (setq desc (file-notify-add-watch - temporary-file-directory - '(attribute-change) 'ignore))) - (file-notify-rm-watch desc) - (should (setq desc (file-notify-add-watch - temporary-file-directory - '(change attribute-change) 'ignore))) - (file-notify-rm-watch desc) - - ;; Check error handling. - (should-error (file-notify-add-watch 1 2 3 4) - :type 'wrong-number-of-arguments) - (should - (equal (should-error (file-notify-add-watch 1 2 3)) - '(wrong-type-argument 1))) - (should - (equal (should-error (file-notify-add-watch - temporary-file-directory 2 3)) - '(wrong-type-argument 2))) - (should - (equal (should-error (file-notify-add-watch - temporary-file-directory '(change) 3)) - '(wrong-type-argument 3))))) + ;; Check, that different valid parameters are accepted. + (should + (setq file-notify--test-desc + (file-notify-add-watch temporary-file-directory '(change) 'ignore))) + (file-notify-rm-watch file-notify--test-desc) + (should + (setq file-notify--test-desc + (file-notify-add-watch + temporary-file-directory '(attribute-change) 'ignore))) + (file-notify-rm-watch file-notify--test-desc) + (should + (setq file-notify--test-desc + (file-notify-add-watch + temporary-file-directory '(change attribute-change) 'ignore))) + (file-notify-rm-watch file-notify--test-desc) + + ;; Check error handling. + (should-error (file-notify-add-watch 1 2 3 4) + :type 'wrong-number-of-arguments) + (should + (equal (should-error + (file-notify-add-watch 1 2 3)) + '(wrong-type-argument 1))) + (should + (equal (should-error + (file-notify-add-watch temporary-file-directory 2 3)) + '(wrong-type-argument 2))) + (should + (equal (should-error + (file-notify-add-watch temporary-file-directory '(change) 3)) + '(wrong-type-argument 3)))) (file-notify--deftest-remote file-notify-test01-add-watch "Check `file-notify-add-watch' for remote files.") @@ -165,6 +170,8 @@ being the result.") We cannot pass arguments, so we assume that `file-notify--test-event' is bound somewhere." ;(message "Event %S" file-notify--test-event) + ;; Check the descriptor. + (should (equal (car file-notify--test-event) file-notify--test-desc)) ;; Check the file name. (should (string-equal (file-notify--event-file-name file-notify--test-event) @@ -199,42 +206,42 @@ TIMEOUT is the maximum time to wait for, in seconds." (ert-deftest file-notify-test02-events () "Check file creation/removal notifications." (skip-unless (file-notify--test-local-enabled)) - (let (desc) - (unwind-protect - (progn - (setq file-notify--test-results nil - file-notify--test-tmpfile (file-notify--test-make-temp-name) - file-notify--test-tmpfile1 (file-notify--test-make-temp-name) - desc - (file-notify-add-watch - file-notify--test-tmpfile - '(change) 'file-notify--test-event-handler)) - - ;; Check creation and removal. - (write-region - "any text" nil file-notify--test-tmpfile nil 'no-message) - (delete-file file-notify--test-tmpfile) - (sleep-for 0.1) - - ;; Check copy and rename. - (write-region - "any text" nil file-notify--test-tmpfile nil 'no-message) - (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) - (delete-file file-notify--test-tmpfile) - (delete-file file-notify--test-tmpfile1) - (sleep-for 0.1) - - (write-region - "any text" nil file-notify--test-tmpfile nil 'no-message) - (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) - (delete-file file-notify--test-tmpfile1) - (sleep-for 0.1)) - - ;; Wait for events, and exit. - (file-notify--wait-for-events 5 file-notify--test-results) - (file-notify-rm-watch desc) - (ignore-errors (delete-file file-notify--test-tmpfile)) - (ignore-errors (delete-file file-notify--test-tmpfile1)))) + (unwind-protect + (progn + (setq file-notify--test-results nil + file-notify--test-tmpfile (file-notify--test-make-temp-name) + file-notify--test-tmpfile1 (file-notify--test-make-temp-name) + file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile + '(change) 'file-notify--test-event-handler)) + (should file-notify--test-desc) + + ;; Check creation and removal. + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) + (delete-file file-notify--test-tmpfile) + (sleep-for 0.1) + + ;; Check copy and rename. + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) + (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) + (delete-file file-notify--test-tmpfile) + (delete-file file-notify--test-tmpfile1) + (sleep-for 0.1) + + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) + (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) + (delete-file file-notify--test-tmpfile1) + (sleep-for 0.1)) + + ;; Wait for events, and exit. + (file-notify--wait-for-events 5 file-notify--test-results) + (file-notify-rm-watch file-notify--test-desc) + (ignore-errors (delete-file file-notify--test-tmpfile)) + (ignore-errors (delete-file file-notify--test-tmpfile1))) (should file-notify--test-results) (dolist (result file-notify--test-results) @@ -245,11 +252,10 @@ TIMEOUT is the maximum time to wait for, in seconds." (file-notify--deftest-remote file-notify-test02-events "Check file creation/removal notifications for remote files.") -(defvar auto-revert-remote-files) -(defvar auto-revert-stop-on-user-input) -(setq auto-revert-remote-files t - auto-revert-stop-on-user-input nil) (require 'autorevert) +(setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded" + auto-revert-remote-files t + auto-revert-stop-on-user-input nil) (ert-deftest file-notify-test03-autorevert () "Check autorevert via file notification. @@ -257,9 +263,8 @@ This test is skipped in batch mode." (skip-unless (file-notify--test-local-enabled)) ;; `auto-revert-buffers' runs every 5". And we must wait, until the ;; file has been reverted. - (let* ((remote (file-remote-p temporary-file-directory)) - (timeout (if remote 60 10)) - buf) + (let ((timeout (if (file-remote-p temporary-file-directory) 60 10)) + buf) (unwind-protect (progn (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) @@ -269,6 +274,10 @@ This test is skipped in batch mode." (setq buf (find-file-noselect file-notify--test-tmpfile)) (with-current-buffer buf (should (string-equal (buffer-string) "any text")) + ;; `buffer-stale--default-function' checks for + ;; `verify-visited-file-modtime'. We must ensure that it + ;; returns nil. + (sleep-for 1) (auto-revert-mode 1) ;; `auto-revert-buffers' runs every 5". @@ -284,10 +293,8 @@ This test is skipped in batch mode." ;; Modify file. We wait for a second, in order to ;; have another timestamp. (sleep-for 1) - (shell-command - (format "echo -n 'another text' >%s" - (or (file-remote-p file-notify--test-tmpfile 'localname) - file-notify--test-tmpfile))) + (write-region + "another text" nil file-notify--test-tmpfile nil 'no-message) ;; Check, that the buffer has been reverted. (with-current-buffer (get-buffer-create "*Messages*") commit 7f01832e1360b5203695d48605a45228f1362b42 Author: Dmitry Gutov Date: Tue Jun 2 18:46:42 2015 +0300 Reuse rgrep mechanics in xref-find-regexp * lisp/progmodes/grep.el (rgrep-default-command): Extract from `rgrep'. * lisp/progmodes/xref.el (xref-collect-references): Split from `xref-collect-matches'. Only handle the case of symbol search. (xref-collect-matches): Instead of Semantic Symref, use `rgrep-default-command', to take advantage of its directory and file ignore settings. (xref--collect-match): Remove the last argument, leaving the regexp construction up to the caller. * lisp/progmodes/elisp-mode.el (elisp--xref-find-matches): Change to take the xref-collect- function to use as an argument. (elisp-xref-find): Update accordingly. * lisp/progmodes/etags.el (etags--xref-find-matches) (etags-xref-find): Same. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 968bb21..61709c3 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -591,9 +591,9 @@ It can be quoted, or be inside a quoted form." (when sym (elisp--xref-find-definitions sym)))) (`references - (elisp--xref-find-matches id 'symbol)) + (elisp--xref-find-matches id #'xref-collect-references)) (`matches - (elisp--xref-find-matches id 'regexp)) + (elisp--xref-find-matches id #'xref-collect-matches)) (`apropos (elisp--xref-find-apropos id)))) @@ -654,7 +654,7 @@ It can be quoted, or be inside a quoted form." (defvar package-user-dir) -(defun elisp--xref-find-matches (symbol kind) +(defun elisp--xref-find-matches (symbol fun) (let* ((dirs (sort (mapcar (lambda (dir) @@ -673,7 +673,7 @@ It can be quoted, or be inside a quoted form." (cl-mapcan (lambda (dir) (and (file-exists-p dir) - (xref-collect-matches symbol dir kind))) + (funcall fun symbol dir))) dirs))) (defun elisp--xref-find-apropos (regexp) diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index d03032d..bf57770 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -2087,19 +2087,18 @@ for \\[find-tag] (which see)." (defun etags-xref-find (action id) (pcase action (`definitions (etags--xref-find-definitions id)) - (`references (etags--xref-find-matches id 'symbol)) - (`matches (etags--xref-find-matches id 'regexp)) + (`references + (etags--xref-find-matches id #'xref-collect-references)) + (`matches + (etags--xref-find-matches id #'xref-collect-matches)) (`apropos (etags--xref-find-definitions id t)))) -(defun etags--xref-find-matches (input kind) +(defun etags--xref-find-matches (input fun) (let ((dirs (if tags-table-list (mapcar #'file-name-directory tags-table-list) ;; If no tags files are loaded, prompt for the dir. (list (read-directory-name "In directory: " nil nil t))))) - (cl-mapcan - (lambda (dir) - (xref-collect-matches input dir kind)) - dirs))) + (cl-mapcan (lambda (dir) (funcall fun input dir)) dirs))) (defun etags--xref-find-definitions (pattern &optional regexp?) ;; This emulates the behaviour of `find-tag-in-order' but instead of diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 048fa11..6981d38 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -992,58 +992,7 @@ to specify a command to run." grep-find-command))) (compilation-start regexp 'grep-mode)) (setq dir (file-name-as-directory (expand-file-name dir))) - (require 'find-dired) ; for `find-name-arg' - (let ((command (grep-expand-template - grep-find-template - regexp - (concat (shell-quote-argument "(") - " " find-name-arg " " - (mapconcat - #'shell-quote-argument - (split-string files) - (concat " -o " find-name-arg " ")) - " " - (shell-quote-argument ")")) - dir - (concat - (and grep-find-ignored-directories - (concat "-type d " - (shell-quote-argument "(") - ;; we should use shell-quote-argument here - " -path " - (mapconcat - #'(lambda (ignore) - (cond ((stringp ignore) - (shell-quote-argument - (concat "*/" ignore))) - ((consp ignore) - (and (funcall (car ignore) dir) - (shell-quote-argument - (concat "*/" - (cdr ignore))))))) - grep-find-ignored-directories - " -o -path ") - " " - (shell-quote-argument ")") - " -prune -o ")) - (and grep-find-ignored-files - (concat (shell-quote-argument "!") " -type d " - (shell-quote-argument "(") - ;; we should use shell-quote-argument here - " -name " - (mapconcat - #'(lambda (ignore) - (cond ((stringp ignore) - (shell-quote-argument ignore)) - ((consp ignore) - (and (funcall (car ignore) dir) - (shell-quote-argument - (cdr ignore)))))) - grep-find-ignored-files - " -o -name ") - " " - (shell-quote-argument ")") - " -prune -o ")))))) + (let ((command (rgrep-default-command regexp files dir))) (when command (if confirm (setq command @@ -1056,6 +1005,61 @@ to specify a command to run." (if (eq next-error-last-buffer (current-buffer)) (setq default-directory dir))))))) +(defun rgrep-default-command (regexp files dir) + "Compute the command for \\[rgrep] to use by default." + (require 'find-dired) ; for `find-name-arg' + (grep-expand-template + grep-find-template + regexp + (concat (shell-quote-argument "(") + " " find-name-arg " " + (mapconcat + #'shell-quote-argument + (split-string files) + (concat " -o " find-name-arg " ")) + " " + (shell-quote-argument ")")) + dir + (concat + (and grep-find-ignored-directories + (concat "-type d " + (shell-quote-argument "(") + ;; we should use shell-quote-argument here + " -path " + (mapconcat + #'(lambda (ignore) + (cond ((stringp ignore) + (shell-quote-argument + (concat "*/" ignore))) + ((consp ignore) + (and (funcall (car ignore) dir) + (shell-quote-argument + (concat "*/" + (cdr ignore))))))) + grep-find-ignored-directories + " -o -path ") + " " + (shell-quote-argument ")") + " -prune -o ")) + (and grep-find-ignored-files + (concat (shell-quote-argument "!") " -type d " + (shell-quote-argument "(") + ;; we should use shell-quote-argument here + " -name " + (mapconcat + #'(lambda (ignore) + (cond ((stringp ignore) + (shell-quote-argument ignore)) + ((consp ignore) + (and (funcall (car ignore) dir) + (shell-quote-argument + (cdr ignore)))))) + grep-find-ignored-files + " -o -name ") + " " + (shell-quote-argument ")") + " -prune -o "))))) + ;;;###autoload (defun zrgrep (regexp &optional files dir confirm template) "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 3bc66f8..d6f6ba8 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -720,32 +720,59 @@ and just use etags." (declare-function semantic-symref-find-references-by-name "semantic/symref") (declare-function semantic-symref-find-text "semantic/symref") (declare-function semantic-find-file-noselect "semantic/fw") +(declare-function rgrep-default-command "grep") -(defun xref-collect-matches (input dir &optional kind) - "Collect KIND matches for INPUT inside DIR according. -KIND can be `symbol', `regexp' or nil, the last of which means -literal matches. This function uses the Semantic Symbol -Reference API, see `semantic-symref-find-references-by-name' for -details on which tools are used, and when." +(defun xref-collect-references (symbol dir) + "Collect references to SYMBOL inside DIR. +This function uses the Semantic Symbol Reference API, see +`semantic-symref-find-references-by-name' for details on which +tools are used, and when." + (cl-assert (directory-name-p dir)) (require 'semantic/symref) (defvar semantic-symref-tool) - (cl-assert (directory-name-p dir)) - (when (null kind) - (setq input (regexp-quote input))) - ;; FIXME: When regexp, search in all files, except - ;; `grep-find-ignored-directories' and `grep-find-ignored-files', - ;; like `rgrep' does. (let* ((default-directory dir) (semantic-symref-tool 'detect) - (res (if (eq kind 'symbol) - (semantic-symref-find-references-by-name input 'subdirs) - (semantic-symref-find-text (xref--regexp-to-extended input) - 'subdirs))) + (res (semantic-symref-find-references-by-name symbol 'subdirs)) (hits (and res (oref res :hit-lines))) (orig-buffers (buffer-list))) (unwind-protect (delq nil - (mapcar (lambda (hit) (xref--collect-match hit input kind)) hits)) + (mapcar (lambda (hit) (xref--collect-match + hit (format "\\_<%s\\_>" (regexp-quote symbol)))) + hits)) + (mapc #'kill-buffer + (cl-set-difference (buffer-list) orig-buffers))))) + +(defun xref-collect-matches (regexp dir) + "Collect matches for REGEXP inside DIR using rgrep." + (cl-assert (directory-name-p dir)) + (require 'semantic/fw) + (grep-compute-defaults) + (defvar grep-find-template) + (let* ((grep-find-template (replace-regexp-in-string "-e " "-E " + grep-find-template t t)) + (command (rgrep-default-command (xref--regexp-to-extended regexp) + "*.*" dir)) + (orig-buffers (buffer-list)) + (buf (get-buffer-create " *xref-grep*")) + (grep-re (caar grep-regexp-alist)) + hits) + ;; http://debbugs.gnu.org/20719 + ;; We want to pass the exact directory to `find', because then + ;; `grep' output features absolute file names. + (when (string-match "find \\(\\.\\)" command) + (setq command (replace-match (shell-quote-argument dir) t t command 1))) + (with-current-buffer buf + (erase-buffer) + (when (eq (call-process-shell-command command nil t) 0) + (goto-char (point-min)) + (while (re-search-forward grep-re nil t) + (push (cons (string-to-number (match-string 2)) + (match-string 1)) + hits)))) + (unwind-protect + (delq nil + (mapcar (lambda (hit) (xref--collect-match hit regexp)) hits)) (mapc #'kill-buffer (cl-set-difference (buffer-list) orig-buffers))))) @@ -767,18 +794,15 @@ details on which tools are used, and when." (match-string 1 str))))) str t t)) -(defun xref--collect-match (hit input kind) +(defun xref--collect-match (hit regexp) (pcase-let* ((`(,line . ,file) hit) (buf (or (find-buffer-visiting file) - (semantic-find-file-noselect file))) - (input (if (eq kind 'symbol) - (format "\\_<%s\\_>" (regexp-quote input)) - input))) + (semantic-find-file-noselect file)))) (with-current-buffer buf (save-excursion (goto-char (point-min)) (forward-line (1- line)) - (when (re-search-forward input (line-end-position) t) + (when (re-search-forward regexp (line-end-position) t) (goto-char (match-beginning 0)) (xref-make (buffer-substring (line-beginning-position) commit 64f2d346b762a6e3180eba92b5cc96f82f370687 Author: Dmitry Gutov Date: Mon Jun 1 22:45:15 2015 +0300 Move xref-elisp-location to elisp-mode.el * lisp/progmodes/xref.el (xref-elisp-location) (xref-make-elisp-location, xref-location-marker): Remove here. (xref--xref): Don't limit the type of the location slot. * lisp/progmodes/elisp-mode.el (xref-elisp-location): Define as a cl-struct here. (xref-location-marker): Move here. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index bcbf1d5..968bb21 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -579,7 +579,6 @@ It can be quoted, or be inside a quoted form." ;;; Xref backend -(declare-function xref-make-elisp-location "xref" (symbol type file)) (declare-function xref-make-bogus-location "xref" (message)) (declare-function xref-make "xref" (description location)) (declare-function xref-collect-matches "xref" (input dir &optional kind)) @@ -697,6 +696,24 @@ It can be quoted, or be inside a quoted form." (defun elisp--xref-identifier-completion-table () elisp--xref-identifier-completion-table) +(cl-defstruct (xref-elisp-location + (:constructor xref-make-elisp-location (symbol type file))) + "Location of an Emacs Lisp symbol definition." + symbol type file) + +(cl-defmethod xref-location-marker ((l xref-elisp-location)) + (pcase-let (((cl-struct xref-elisp-location symbol type file) l)) + (let ((buffer-point + (pcase type + (`defun (find-function-search-for-symbol symbol nil file)) + ((or `defvar `defface) + (find-function-search-for-symbol symbol type file)) + (`feature + (cons (find-file-noselect file) 1))))) + (with-current-buffer (car buffer-point) + (goto-char (or (cdr buffer-point) (point-min))) + (point-marker))))) + ;;; Elisp Interaction mode (defvar lisp-interaction-mode-map diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index c9bffc6..3bc66f8 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -143,38 +143,13 @@ actual location is not known.") (cl-defmethod xref-location-group ((_ xref-bogus-location)) "(No location)") -;; This should be in elisp-mode.el, but it's preloaded, and we can't -;; preload defclass and defmethod (at least, not yet). -(defclass xref-elisp-location (xref-location) - ((symbol :type symbol :initarg :symbol) - (type :type symbol :initarg :type) - (file :type string :initarg :file - :reader xref-location-group)) - :documentation "Location of an Emacs Lisp symbol definition.") - -(defun xref-make-elisp-location (symbol type file) - (make-instance 'xref-elisp-location :symbol symbol :type type :file file)) - -(cl-defmethod xref-location-marker ((l xref-elisp-location)) - (with-slots (symbol type file) l - (let ((buffer-point - (pcase type - (`defun (find-function-search-for-symbol symbol nil file)) - ((or `defvar `defface) - (find-function-search-for-symbol symbol type file)) - (`feature - (cons (find-file-noselect file) 1))))) - (with-current-buffer (car buffer-point) - (goto-char (or (cdr buffer-point) (point-min))) - (point-marker))))) - ;;; Cross-reference (defclass xref--xref () ((description :type string :initarg :description :reader xref--xref-description) - (location :type xref-location :initarg :location + (location :initarg :location :reader xref--xref-location)) :comment "An xref is used to display and locate constructs like variables or functions.") commit 98cb43fb0d6b29260c96662ee18f3cfbc4878c97 Author: Eli Zaretskii Date: Tue Jun 2 18:27:28 2015 +0300 Minor tweaks for .gitignore * .gitignore: Don't ignore versioned *.html and *.ps files. Don't ignore admin/notes/tags that might be ignored as TAGS on case-insensitive filesystems. (Bug#20710) diff --git a/.gitignore b/.gitignore index 2f47e3c..d7be846 100644 --- a/.gitignore +++ b/.gitignore @@ -155,6 +155,7 @@ test/etags/CTAGS # ctags, etags. TAGS +!admin/notes/tags # GNU global. GPATH @@ -207,7 +208,7 @@ lisp/international/uni-*.el *.dvi *.fn *.fns -*.html +doc/*/*.html !test/etags/html-src/*.html *.info *.ky @@ -223,8 +224,7 @@ lisp/international/uni-*.el *.pgs *.pj *.pjs -*.ps -!test/etags/ps-src/*.ps +doc/*/*.ps *.sc *.scs *.t2d/ commit a158324abdab59ea28f58a4af9311d447d4a1879 Author: Paul Eggert Date: Tue Jun 2 07:31:06 2015 -0700 Generate curved quotes in ert doc * lisp/emacs-lisp/ert.el (ert--print-test-for-ewoc) (ert-results-mode-menu) (ert-results-pop-to-backtrace-for-test-at-point) (ert-results-pop-to-messages-for-test-at-point) (ert-results-pop-to-should-forms-for-test-at-point) (ert-describe-test): Quote ‘like this’, not `like this', when generating doc strings and the like. * test/automated/ert-x-tests.el (ert-test-describe-test): Allow quoting ‘like this’. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index b678e12..99c5ede 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1849,7 +1849,9 @@ non-nil, returns the face for expected results.." (when (ert-test-documentation test) (insert " " (propertize - (ert--string-first-line (ert-test-documentation test)) + (ert--string-first-line + (substitute-command-keys + (ert-test-documentation test))) 'font-lock-face 'font-lock-doc-face) "\n")) (cl-etypecase result @@ -2063,7 +2065,7 @@ and how to display message." "--" ["Show backtrace" ert-results-pop-to-backtrace-for-test-at-point] ["Show messages" ert-results-pop-to-messages-for-test-at-point] - ["Show `should' forms" ert-results-pop-to-should-forms-for-test-at-point] + ["Show ‘should’ forms" ert-results-pop-to-should-forms-for-test-at-point] ["Describe test" ert-results-describe-test-at-point] "--" ["Delete test" ert-delete-test] @@ -2375,9 +2377,9 @@ To be used in the ERT results buffer." (ert--print-backtrace backtrace) (debugger-make-xrefs) (goto-char (point-min)) - (insert "Backtrace for test `") + (insert "Backtrace for test ‘") (ert-insert-test-name-button (ert-test-name test)) - (insert "':\n"))))))) + (insert "’:\n"))))))) (defun ert-results-pop-to-messages-for-test-at-point () "Display the part of the *Messages* buffer generated during the test at point. @@ -2396,9 +2398,9 @@ To be used in the ERT results buffer." (ert-simple-view-mode) (insert (ert-test-result-messages result)) (goto-char (point-min)) - (insert "Messages for test `") + (insert "Messages for test ‘") (ert-insert-test-name-button (ert-test-name test)) - (insert "':\n"))))) + (insert "’:\n"))))) (defun ert-results-pop-to-should-forms-for-test-at-point () "Display the list of `should' forms executed during the test at point. @@ -2426,9 +2428,9 @@ To be used in the ERT results buffer." (ert--pp-with-indentation-and-newline form-description) (ert--make-xrefs-region begin (point))))) (goto-char (point-min)) - (insert "`should' forms executed during test `") + (insert "‘should’ forms executed during test ‘") (ert-insert-test-name-button (ert-test-name test)) - (insert "':\n") + (insert "’:\n") (insert "\n") (insert (concat "(Values are shallow copies and may have " "looked different during the test if they\n" @@ -2505,9 +2507,9 @@ To be used in the ERT results buffer." (let ((file-name (and test-name (symbol-file test-name 'ert-deftest)))) (when file-name - (insert " defined in `" (file-name-nondirectory file-name) "'") + (insert " defined in ‘" (file-name-nondirectory file-name) "’") (save-excursion - (re-search-backward "`\\([^`']+\\)'" nil t) + (re-search-backward "‘\\([^‘’]+\\)’" nil t) (help-xref-button 1 'help-function-def test-name file-name))) (insert ".") (fill-region-as-paragraph (point-min) (point)) @@ -2519,8 +2521,9 @@ To be used in the ERT results buffer." "this documentation refers to an old definition.") (fill-region-as-paragraph begin (point))) (insert "\n\n")) - (insert (or (ert-test-documentation test-definition) - "It is not documented.") + (insert (substitute-command-keys + (or (ert-test-documentation test-definition) + "It is not documented.")) "\n"))))))) (defun ert-results-describe-test-at-point () diff --git a/test/automated/ert-x-tests.el b/test/automated/ert-x-tests.el index 81d0f7c..6172133 100644 --- a/test/automated/ert-x-tests.el +++ b/test/automated/ert-x-tests.el @@ -195,8 +195,9 @@ (let ((case-fold-search nil)) (should (string-match (concat "\\`ert-test-describe-test is a test" - " defined in `ert-x-tests.elc?'\\.\n\n" - "Tests `ert-describe-test'\\.\n\\'") + " defined in" + " [`‘]ert-x-tests.elc?['’]\\.\n\n" + "Tests [`‘]ert-describe-test['’]\\.\n\\'") (buffer-string))))))))) (ert-deftest ert-test-message-log-truncation () commit c7695d0adb125a3817f3df015137287e801e457a Author: Nicolas Richard Date: Fri May 29 10:33:35 2015 +0200 Add test for previous commit * test/automated/replace-tests.el: New file. (query-replace--split-string-tests): Add test for previous commit. diff --git a/test/automated/replace-tests.el b/test/automated/replace-tests.el new file mode 100644 index 0000000..f4e474b --- /dev/null +++ b/test/automated/replace-tests.el @@ -0,0 +1,35 @@ +;;; replace-tests.el --- tests for replace.el. + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) + +(ert-deftest query-replace--split-string-tests () + (let ((sep (propertize "\0" 'separator t))) + (dolist (before '("" "b")) + (dolist (after '("" "a")) + (should (equal + (query-replace--split-string (concat before sep after)) + (cons before after))) + (should (equal + (query-replace--split-string (concat before "\0" after)) + (concat before "\0" after))))))) + +;;; replace-tests.el ends here commit bc9d9bc7a8d56303595899cd66db67ef90d3a4cd Author: Nicolas Richard Date: Fri May 29 10:32:05 2015 +0200 Avoid confusion in query-replace history when replacing NUL chars * lisp/replace.el (query-replace--split-string): New function. (query-replace-read-from): Rely on the 'separator' property instead of searching for the NUL character (Bug#20690). diff --git a/lisp/replace.el b/lisp/replace.el index 8e71615..1bf1343 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -136,6 +136,16 @@ See `replace-regexp' and `query-replace-regexp-eval'.") (defun query-replace-descr (string) (mapconcat 'isearch-text-char-description string "")) +(defun query-replace--split-string (string) + "Split string STRING at a character with property `separator'" + (let* ((length (length string)) + (split-pos (text-property-any 0 length 'separator t string))) + (if (not split-pos) + (substring-no-properties string) + (cl-assert (not (text-property-any (1+ split-pos) length 'separator t string))) + (cons (substring-no-properties string 0 split-pos) + (substring-no-properties string (1+ split-pos) length))))) + (defun query-replace-read-from (prompt regexp-flag) "Query and return the `from' argument of a query-replace operation. The return value can also be a pair (FROM . TO) indicating that the user @@ -174,32 +184,30 @@ wants to replace FROM with TO." (read-regexp prompt nil 'query-replace-from-to-history) (read-from-minibuffer prompt nil nil nil 'query-replace-from-to-history - (car (if regexp-flag regexp-search-ring search-ring)) t))))) + (car (if regexp-flag regexp-search-ring search-ring)) t)))) + (to)) (if (and (zerop (length from)) query-replace-defaults) (cons (caar query-replace-defaults) (query-replace-compile-replacement (cdar query-replace-defaults) regexp-flag)) - (let* ((to (if (and (string-match separator from) - (get-text-property (match-beginning 0) 'separator from)) - (substring-no-properties from (match-end 0)))) - (from (if to (substring-no-properties from 0 (match-beginning 0)) - (substring-no-properties from)))) - (add-to-history query-replace-from-history-variable from nil t) - ;; Warn if user types \n or \t, but don't reject the input. - (and regexp-flag - (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from) - (let ((match (match-string 3 from))) - (cond - ((string= match "\\n") - (message "Note: `\\n' here doesn't match a newline; to do that, type C-q C-j instead")) - ((string= match "\\t") - (message "Note: `\\t' here doesn't match a tab; to do that, just type TAB"))) - (sit-for 2))) - (if (not to) - from - (add-to-history query-replace-to-history-variable to nil t) - (add-to-history 'query-replace-defaults (cons from to) nil t) - (cons from (query-replace-compile-replacement to regexp-flag)))))))) + (setq from (query-replace--split-string from)) + (when (consp from) (setq to (cdr from) from (car from))) + (add-to-history query-replace-from-history-variable from nil t) + ;; Warn if user types \n or \t, but don't reject the input. + (and regexp-flag + (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from) + (let ((match (match-string 3 from))) + (cond + ((string= match "\\n") + (message "Note: `\\n' here doesn't match a newline; to do that, type C-q C-j instead")) + ((string= match "\\t") + (message "Note: `\\t' here doesn't match a tab; to do that, just type TAB"))) + (sit-for 2))) + (if (not to) + from + (add-to-history query-replace-to-history-variable to nil t) + (add-to-history 'query-replace-defaults (cons from to) nil t) + (cons from (query-replace-compile-replacement to regexp-flag))))))) (defun query-replace-compile-replacement (to regexp-flag) "Maybe convert a regexp replacement TO to Lisp.