------------------------------------------------------------ revno: 117056 fixes bug: http://debbugs.gnu.org/17393 committer: Leo Liu branch nick: trunk timestamp: Sun 2014-05-04 08:16:58 +0800 message: Support Chinese diary entries in calendar and diary * doc/emacs/cal-xtra.texi (Non-Gregorian Diary): Document new features for Chinese calendar and diary. * etc/NEWS: Mention support for Chinese dates in calendar and diary. * lisp/calendar/cal-china.el (calendar-chinese-month-name-array): New var. (calendar-chinese-from-absolute-for-diary) (calendar-chinese-to-absolute-for-diary) (calendar-chinese-mark-date-pattern, diary-chinese-mark-entries) (diary-chinese-list-entries): New functions to list and mark Chinese diary entries in the calendar window. (diary-chinese-anniversary) (diary-chinese-insert-anniversary-entry) (diary-chinese-insert-entry, diary-chinese-insert-monthly-entry) (diary-chinese-insert-yearly-entry): New commands to insert Chinese diary entries. * lisp/calendar/cal-menu.el (cal-menu-diary-menu): Add entries for inserting Chinese diary entries. * lisp/calendar/calendar.el (diary-chinese-entry-symbol): New customizable variable. (calendar-mode-map): Add bindings for inserting Chinese diary entries. * lisp/calendar/diary-lib.el (diary-font-lock-keywords): Support font-locking Chinese dates. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2014-04-30 19:54:52 +0000 +++ doc/emacs/ChangeLog 2014-05-04 00:16:58 +0000 @@ -1,3 +1,8 @@ +2014-05-04 Leo Liu + + * cal-xtra.texi (Non-Gregorian Diary): Document new features for + Chinese calendar and diary. + 2014-04-30 Eli Zaretskii * trouble.texi (Quitting, DEL Does Not Delete, Emergency Escape) === modified file 'doc/emacs/cal-xtra.texi' --- doc/emacs/cal-xtra.texi 2014-01-07 01:46:23 +0000 +++ doc/emacs/cal-xtra.texi 2014-05-04 00:16:58 +0000 @@ -517,7 +517,7 @@ @subsection Diary Entries Using non-Gregorian Calendars As well as entries based on the standard Gregorian calendar, your -diary can have entries based on Bahá'í, Hebrew, or Islamic dates. +diary can have entries based on Bahá'í, Chinese, Hebrew, or Islamic dates. Recognition of such entries can be time-consuming, however, and since most people don't use them, you must explicitly enable their use. If you want the diary to recognize Hebrew-date diary entries, for example, @@ -531,22 +531,27 @@ @findex diary-islamic-mark-entries @findex diary-bahai-list-entries @findex diary-bahai-mark-entries +@findex diary-chinese-list-entries +@findex diary-chinese-mark-entries @smallexample (add-hook 'diary-nongregorian-listing-hook 'diary-hebrew-list-entries) (add-hook 'diary-nongregorian-marking-hook 'diary-hebrew-mark-entries) @end smallexample @noindent -Similarly, for Islamic and Bahá'í entries, add -@code{diary-islamic-list-entries} and @code{diary-islamic-mark-entries}, or -@code{diary-bahai-list-entries} and @code{diary-bahai-mark-entries}. +Similarly, for Islamic, Bahá'í and Chinese entries, add +@code{diary-islamic-list-entries} and @code{diary-islamic-mark-entries}, +@code{diary-bahai-list-entries} and @code{diary-bahai-mark-entries}, +or @code{diary-chinese-list-entries} and @code{diary-chinese-mark-entries}. @vindex diary-bahai-entry-symbol +@vindex diary-chinese-entry-symbol @vindex diary-hebrew-entry-symbol @vindex diary-islamic-entry-symbol These diary entries have the same formats as Gregorian-date diary entries; except that @code{diary-bahai-entry-symbol} (default @samp{B}) -must precede a Bahá'í date, @code{diary-hebrew-entry-symbol} (default +must precede a Bahá'í date, @code{diary-chinese-entry-symbol} (default +@samp{C}) a Chinese date, @code{diary-hebrew-entry-symbol} (default @samp{H}) a Hebrew date, and @code{diary-islamic-entry-symbol} (default @samp{I}) an Islamic date. Moreover, non-Gregorian month names may not be abbreviated (because the first three letters are often not unique). @@ -573,7 +578,7 @@ Here is a table of commands used in the calendar to create diary entries that match the selected date and other dates that are similar in -the Bahá'í, Hebrew, or Islamic calendars: +the Bahá'í, Chinese, Hebrew, or Islamic calendars: @table @kbd @item i h d @@ -594,6 +599,14 @@ @code{diary-bahai-insert-monthly-entry} @item i B y @code{diary-bahai-insert-yearly-entry} +@item i C d +@code{diary-chinese-insert-entry} +@item i C m +@code{diary-chinese-insert-monthly-entry} +@item i C y +@code{diary-chinese-insert-yearly-entry} +@item i C a +@code{diary-chinese-insert-anniversary-entry} @end table @findex diary-hebrew-insert-entry @@ -605,6 +618,11 @@ @findex diary-bahai-insert-entry @findex diary-bahai-insert-monthly-entry @findex diary-bahai-insert-yearly-entry +@findex diary-chinese-insert-entry +@findex diary-chinese-insert-monthly-entry +@findex diary-chinese-insert-yearly-entry +@findex diary-chinese-insert-anniversary-entry + These commands work much like the corresponding commands for ordinary diary entries: they apply to the date that point is on in the calendar window, and what they do is insert just the date portion of a diary === modified file 'etc/ChangeLog' --- etc/ChangeLog 2014-04-20 02:50:36 +0000 +++ etc/ChangeLog 2014-05-04 00:16:58 +0000 @@ -1,3 +1,7 @@ +2014-05-04 Leo Liu + + * NEWS: Mention support for Chinese dates in calendar and diary. + 2014-04-20 Daniel Colascione * NEWS: Mention new struct functions and changes to `cl-the'. === modified file 'etc/NEWS' --- etc/NEWS 2014-05-02 23:29:57 +0000 +++ etc/NEWS 2014-05-04 00:16:58 +0000 @@ -74,6 +74,18 @@ ** The Rmail commands d, C-d and u now handle repeat counts to delete or undelete multiple messages. +** Calendar and diary + ++++ +*** New commands to insert diary entries with Chinese dates: +`diary-chinese-insert-anniversary-entry' `diary-chinese-insert-entry' +`diary-chinese-insert-monthly-entry' +`diary-chinese-insert-yearly-entry' + ++++ +*** Calendar can list and mark diary entires with Chinese dates: +`diary-chinese-list-entries' and `diary-chinese-mark-entries'. + ** The URL package accepts now the protocols "ssh", "scp" and "rsync". When `url-handler-mode' is enabled, file operations for these protocols as well as for "telnet" and "ftp" are passed to Tramp. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-05-03 14:42:26 +0000 +++ lisp/ChangeLog 2014-05-04 00:16:58 +0000 @@ -1,3 +1,29 @@ +2014-05-04 Leo Liu + + Support Chinese diary entries in calendar and diary. (Bug#17393) + * calendar/cal-china.el (calendar-chinese-month-name-array): New var. + (calendar-chinese-from-absolute-for-diary) + (calendar-chinese-to-absolute-for-diary) + (calendar-chinese-mark-date-pattern, diary-chinese-mark-entries) + (diary-chinese-list-entries): New functions to list and mark + Chinese diary entries in the calendar window. + (diary-chinese-anniversary) + (diary-chinese-insert-anniversary-entry) + (diary-chinese-insert-entry, diary-chinese-insert-monthly-entry) + (diary-chinese-insert-yearly-entry): New commands to insert + Chinese diary entries. + + * calendar/diary-lib.el (diary-font-lock-keywords): Support + font-locking Chinese dates. + + * calendar/cal-menu.el (cal-menu-diary-menu): Add entries for + inserting Chinese diary entries. + + * calendar/calendar.el (diary-chinese-entry-symbol): New + customizable variable. + (calendar-mode-map): Add bindings for inserting Chinese diary + entries. + 2014-05-03 Juri Linkov * dired.el (dired-check-switches, dired-switches-recursive-p): === modified file 'lisp/calendar/cal-china.el' --- lisp/calendar/cal-china.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-china.el 2014-05-04 00:16:58 +0000 @@ -682,6 +682,124 @@ "Chinese calendar equivalent of date diary entry." (format "Chinese date: %s" (calendar-chinese-date-string date))) +;;;; diary support + +(autoload 'calendar-mark-1 "diary-lib") +(autoload 'diary-mark-entries-1 "diary-lib") +(autoload 'diary-list-entries-1 "diary-lib") +(autoload 'diary-insert-entry-1 "diary-lib") +(autoload 'diary-date-display-form "diary-lib") +(autoload 'diary-make-date "diary-lib") +(autoload 'diary-ordinal-suffix "diary-lib") +(defvar diary-sexp-entry-symbol) +(defvar entry) ;used by `diary-chinese-anniversary' + +(defvar calendar-chinese-month-name-array + ["正月" "二月" "三月" "四月" "五月" "六月" + "七月" "八月" "九月" "十月" "冬月" "臘月"]) + +;;; NOTE: In the diary the cycle and year of a Chinese date is +;;; combined using this formula: (+ (* cycle 100) year). +;;; +;;; These two functions convert to and back from this representation. +(defun calendar-chinese-from-absolute-for-diary (date) + (pcase-let ((`(,c ,y ,m ,d) (calendar-chinese-from-absolute date))) + (list m d (+ (* c 100) y)))) + +(defun calendar-chinese-to-absolute-for-diary (date) + (pcase-let ((`(,m ,d ,y) date)) + (calendar-chinese-to-absolute + (list (floor y 100) (mod y 100) m d)))) + +(defun calendar-chinese-mark-date-pattern (month day year &optional color) + (calendar-mark-1 month day year + #'calendar-chinese-from-absolute-for-diary + #'calendar-chinese-to-absolute-for-diary + color)) + +;;;###cal-autoload +(defun diary-chinese-mark-entries () + "Mark days in the calendar window that have Chinese date diary entries. +Marks each entry in `diary-file' (or included files) visible in the calendar +window. See `diary-chinese-list-entries' for more information. + +This function is provided for use with `diary-nongregorian-marking-hook'." + (diary-mark-entries-1 #'calendar-chinese-mark-date-pattern + calendar-chinese-month-name-array + diary-chinese-entry-symbol + #'calendar-chinese-from-absolute-for-diary)) + +;;;###cal-autoload +(defun diary-chinese-list-entries () + "Add any Chinese date entries from the diary file to `diary-entries-list'. +Chinese date diary entries must be prefixed by `diary-chinese-entry-symbol' +\(normally a `C'). The same `diary-date-forms' govern the style +of the Chinese calendar entries. If a Chinese date diary entry begins with +`diary-nonmarking-symbol', the entry will appear in the diary listing, +but will not be marked in the calendar. + +This function is provided for use with `diary-nongregorian-listing-hook'." + (diary-list-entries-1 calendar-chinese-month-name-array + diary-chinese-entry-symbol + #'calendar-chinese-from-absolute-for-diary)) + +;;;###cal-autoload +(defun diary-chinese-anniversary (month day &optional year mark) + "Like `diary-anniversary' (which see) but accepts Chinese date." + (pcase-let* ((ddate (diary-make-date month day year)) + (`(,dc ,dy ,dm ,dd) ;diary chinese date + (if year + (calendar-chinese-from-absolute + (calendar-chinese-to-absolute-for-diary ddate)) + (list nil nil (calendar-extract-month ddate) + (calendar-extract-day ddate)))) + (`(,cc ,cy ,cm ,cd) ;current chinese date + (calendar-chinese-from-absolute + (calendar-absolute-from-gregorian date))) + (diff (if (and dc dy) + (+ (* 60 (- cc dc)) (- cy dy)) + 100))) + (and (> diff 0) (= dm cm) (= dd cd) + (cons mark (format entry diff (diary-ordinal-suffix diff)))))) + +;;;###cal-autoload +(defun diary-chinese-insert-anniversary-entry (&optional arg) + "Insert an anniversary diary entry for the Chinese date at point. +Prefix argument ARG makes the entry nonmarking." + (interactive "P") + (let ((calendar-date-display-form (diary-date-display-form))) + (diary-make-entry + (format "%s(diary-chinese-anniversary %s)" + diary-sexp-entry-symbol + (calendar-date-string + (calendar-chinese-from-absolute-for-diary + (calendar-absolute-from-gregorian (calendar-cursor-to-date t))))) + arg))) + +;;;###cal-autoload +(defun diary-chinese-insert-entry (&optional arg) + "Insert a diary entry for the Chinese date at point." + (interactive "P") + (diary-insert-entry-1 nil arg calendar-chinese-month-name-array + diary-chinese-entry-symbol + #'calendar-chinese-from-absolute-for-diary)) + +;;;###cal-autoload +(defun diary-chinese-insert-monthly-entry (&optional arg) + "Insert a monthly diary entry for the Chinese date at point." + (interactive "P") + (diary-insert-entry-1 'monthly arg calendar-chinese-month-name-array + diary-chinese-entry-symbol + #'calendar-chinese-from-absolute-for-diary)) + +;;;###cal-autoload +(defun diary-chinese-insert-yearly-entry (&optional arg) + "Insert a yearly diary entry for the Chinese date at point." + (interactive "P") + (diary-insert-entry-1 'yearly arg calendar-chinese-month-name-array + diary-chinese-entry-symbol + #'calendar-chinese-from-absolute-for-diary)) + (provide 'cal-china) ;;; cal-china.el ends here === modified file 'lisp/calendar/cal-menu.el' --- lisp/calendar/cal-menu.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/cal-menu.el 2014-05-04 00:16:58 +0000 @@ -56,6 +56,11 @@ ["One time" diary-bahai-insert-entry] ["Monthly" diary-bahai-insert-monthly-entry] ["Yearly" diary-bahai-insert-yearly-entry]) + ("Insert Chinese" + ["One time" diary-chinese-insert-entry] + ["Monthly" diary-chinese-insert-monthly-entry] + ["Yearly" diary-chinese-insert-yearly-entry] + ["Anniversary" diary-chinese-insert-anniversary-entry]) ("Insert Islamic" ["One time" diary-islamic-insert-entry] ["Monthly" diary-islamic-insert-monthly-entry] === modified file 'lisp/calendar/calendar.el' --- lisp/calendar/calendar.el 2014-03-17 16:04:32 +0000 +++ lisp/calendar/calendar.el 2014-05-04 00:16:58 +0000 @@ -689,6 +689,12 @@ :type 'string :group 'diary) +(defcustom diary-chinese-entry-symbol "C" + "Symbol indicating a diary entry according to the Chinese calendar." + :type 'string + :group 'diary + :version "24.5") + (define-obsolete-variable-alias 'hebrew-diary-entry-symbol 'diary-hebrew-entry-symbol "23.1") @@ -1709,6 +1715,10 @@ (define-key map "iBd" 'diary-bahai-insert-entry) (define-key map "iBm" 'diary-bahai-insert-monthly-entry) (define-key map "iBy" 'diary-bahai-insert-yearly-entry) + (define-key map "iCd" 'diary-chinese-insert-entry) + (define-key map "iCm" 'diary-chinese-insert-monthly-entry) + (define-key map "iCy" 'diary-chinese-insert-yearly-entry) + (define-key map "iCa" 'diary-chinese-insert-anniversary-entry) (define-key map "?" 'calendar-goto-info-node) (define-key map "Hm" 'cal-html-cursor-month) (define-key map "Hy" 'cal-html-cursor-year) === modified file 'lisp/calendar/diary-lib.el' --- lisp/calendar/diary-lib.el 2014-01-01 07:43:34 +0000 +++ lisp/calendar/diary-lib.el 2014-05-04 00:16:58 +0000 @@ -2396,6 +2396,11 @@ cal-bahai calendar-bahai-month-name-array diary-bahai-entry-symbol) + (diary-font-lock-keywords-1 diary-chinese-mark-entries + diary-chinese-list-entries + cal-china + calendar-chinese-month-name-array + diary-chinese-entry-symbol) (list (cons (format "^%s.*$" (regexp-quote diary-include-string)) @@ -2412,7 +2417,8 @@ (regexp-opt (mapcar 'regexp-quote (list diary-hebrew-entry-symbol diary-islamic-entry-symbol - diary-bahai-entry-symbol)) + diary-bahai-entry-symbol + diary-chinese-entry-symbol)) t)) '(1 font-lock-constant-face)) '(diary-font-lock-sexps . font-lock-keyword-face) ------------------------------------------------------------ revno: 117055 committer: Glenn Morris branch nick: trunk timestamp: Sat 2014-05-03 11:24:10 -0700 message: * autogen.sh: If all else fails, try using pkg-config to find pkg.m4. This is an attempt to get hydra builds working again. diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-03 16:27:17 +0000 +++ ChangeLog 2014-05-03 18:24:10 +0000 @@ -1,3 +1,7 @@ +2014-05-03 Glenn Morris + + * autogen.sh: If all else fails, try using pkg-config to find pkg.m4. + 2014-05-03 Paul Eggert Get --enable-gcc-warnings to work after touching configure.ac. === modified file 'autogen.sh' --- autogen.sh 2014-05-03 16:27:17 +0000 +++ autogen.sh 2014-05-03 18:24:10 +0000 @@ -234,6 +234,28 @@ done IFS=$oIFS + ## OK, maybe pkg-config is in a weird place (eg on hydra). + if test -z "$AUTORECONF_ENV"; then + oIFS=$IFS + IFS=: + for dir in $PATH; do + if test -x "$dir/pkg-config"; then + ac_dir=`echo "$dir" | sed 's|bin$|share/aclocal|'` + if test -r "$ac_dir/pkg.m4"; then + case $ACLOCAL_PATH in + '') ACLOCAL_PATH=$ac_dir;; + ?*) ACLOCAL_PATH=$ACLOCAL_PATH:$ac_dir;; + esac + export ACLOCAL_PATH + AUTORECONF_ENV="ACLOCAL_PATH='$ACLOCAL_PATH'" + env_space=' ' + break + fi + fi + done + IFS=$oIFS + fi + if test -z "$AUTORECONF_ENV"; then cat < committer: Paul Eggert branch nick: trunk timestamp: Sat 2014-05-03 09:27:17 -0700 message: Get --enable-gcc-warnings to work after touching configure.ac. Preserve ACLOCAL_PATH in later builds, so that by default it has the same value as it did in the first build after initial checkout. * Makefile.in (ACLOCAL_PATH): New macro. ($(srcdir)/aclocal.m4): Use it. * configure.ac (ACLOCAL_PATH): AC_SUBST it. * autogen.sh (env_space): New var. Tell user what variables, if any, to pass to 'configure'. diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-03 08:12:06 +0000 +++ ChangeLog 2014-05-03 16:27:17 +0000 @@ -1,5 +1,14 @@ 2014-05-03 Paul Eggert + Get --enable-gcc-warnings to work after touching configure.ac. + Preserve ACLOCAL_PATH in later builds, so that by default it has + the same value as it did in the first build after initial checkout. + * Makefile.in (ACLOCAL_PATH): New macro. + ($(srcdir)/aclocal.m4): Use it. + * configure.ac (ACLOCAL_PATH): AC_SUBST it. + * autogen.sh (env_space): New var. + Tell user what variables, if any, to pass to 'configure'. + Get --enable-gcc-warnings working again. The recent changes to configure.ac removed the transliteration of -I to -isystem in CFLAGS, which is needed for --enable-gcc-warnings. === modified file 'Makefile.in' --- Makefile.in 2014-04-17 06:02:38 +0000 +++ Makefile.in 2014-05-03 16:27:17 +0000 @@ -425,9 +425,10 @@ $(srcdir)/configure: $(AUTOCONF_INPUTS) cd ${srcdir} && autoconf +ACLOCAL_PATH = @ACLOCAL_PATH@ ACLOCAL_INPUTS = $(srcdir)/configure.ac $(srcdir)/m4/gnulib-comp.m4 $(srcdir)/aclocal.m4: $(ACLOCAL_INPUTS) - cd $(srcdir) && aclocal -I m4 + cd $(srcdir) && ACLOCAL_PATH='$(ACLOCAL_PATH)' aclocal -I m4 AUTOMAKE_INPUTS = $(srcdir)/aclocal.m4 $(srcdir)/lib/Makefile.am \ $(srcdir)/lib/gnulib.mk === modified file 'autogen.sh' --- autogen.sh 2014-05-03 07:09:16 +0000 +++ autogen.sh 2014-05-03 16:27:17 +0000 @@ -210,6 +210,7 @@ # find the pkg.m4 that is installed in the standard location. echo "Checking for pkg.m4..." AUTORECONF_ENV= +env_space= ac_dir=`aclocal --print-ac-dir` && test -r "$ac_dir/pkg.m4" || { oIFS=$IFS IFS=: @@ -225,7 +226,8 @@ ?*) ACLOCAL_PATH=$ACLOCAL_PATH:$ac_dir;; esac export ACLOCAL_PATH - AUTORECONF_ENV="ACLOCAL_PATH='$ACLOCAL_PATH' " + AUTORECONF_ENV="ACLOCAL_PATH='$ACLOCAL_PATH'" + env_space=' ' break fi fi @@ -244,7 +246,7 @@ echo ok echo 'Your system has the required tools.' -echo "Running \"${AUTORECONF_ENV}autoreconf -fi -I m4\" ..." +echo "Running \"$AUTORECONF_ENV${env_space}autoreconf -fi -I m4\" ..." ## Let autoreconf figure out what, if anything, needs doing. @@ -255,7 +257,7 @@ ## cause 'make' to needlessly run 'autoheader'. echo timestamp > src/stamp-h.in || exit -echo "You can now run \`./configure'." +echo "You can now run \`./configure$env_space$AUTORECONF_ENV'." exit 0 === modified file 'configure.ac' --- configure.ac 2014-05-03 08:12:06 +0000 +++ configure.ac 2014-05-03 16:27:17 +0000 @@ -295,6 +295,9 @@ dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals]) +## This might be a 'configure' arg, e.g., autogen.sh might set it. +AC_SUBST([ACLOCAL_PATH]) + ## Makefile.in needs the cache file name. AC_SUBST(cache_file) ------------------------------------------------------------ revno: 117053 committer: Barry O'Reilly branch nick: trunk timestamp: Sat 2014-05-03 10:42:26 -0400 message: Fix ChangeLogs of 2014-05-01 commit. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-05-03 09:22:59 +0000 +++ lisp/ChangeLog 2014-05-03 14:42:26 +0000 @@ -9,10 +9,12 @@ 2014-05-01 Barry O'Reilly - * automated/undo-tests.el (undo-test-region-deletion): New test to - demonstrate bug#17235. - (undo-test-region-example): New test to verify example given in - comments for undo-make-selective-list. + * simple.el (undo-make-selective-list): New algorithm fixes + incorrectness of position adjustments when undoing in region. + (Bug#17235) + (undo-elt-crosses-region): Make obsolete. + (undo-adjust-elt, undo-adjust-beg-end, undo-adjust-pos): New + functions to adjust positions using undo-deltas. 2014-05-01 Stefan Monnier === modified file 'test/ChangeLog' --- test/ChangeLog 2014-05-01 23:25:28 +0000 +++ test/ChangeLog 2014-05-03 14:42:26 +0000 @@ -1,11 +1,9 @@ 2014-05-01 Barry O'Reilly - * simple.el (undo-make-selective-list): New algorithm fixes - incorrectness of position adjustments when undoing in region. - (Bug#17235) - (undo-elt-crosses-region): Make obsolete. - (undo-adjust-elt, undo-adjust-beg-end, undo-adjust-pos): New - functions to adjust positions using undo-deltas. + * automated/undo-tests.el (undo-test-region-deletion): New test to + demonstrate bug#17235. + (undo-test-region-example): New test to verify example given in + comments for undo-make-selective-list. 2014-04-25 Michael Albinus ------------------------------------------------------------ revno: 117052 fixes bug: http://debbugs.gnu.org/17218 committer: Juri Linkov branch nick: trunk timestamp: Sat 2014-05-03 12:22:59 +0300 message: * lisp/dired.el (dired-check-switches, dired-switches-recursive-p): New functions. (dired-switches-escape-p, dired-move-to-end-of-filename): Use `dired-check-switches'. (dired-insert-old-subdirs, dired-build-subdir-alist) (dired-sort-R-check): Use `dired-switches-recursive-p'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-05-01 23:25:28 +0000 +++ lisp/ChangeLog 2014-05-03 09:22:59 +0000 @@ -1,3 +1,12 @@ +2014-05-03 Juri Linkov + + * dired.el (dired-check-switches, dired-switches-recursive-p): + New functions. (Bug#17218) + (dired-switches-escape-p, dired-move-to-end-of-filename): + Use `dired-check-switches'. + (dired-insert-old-subdirs, dired-build-subdir-alist) + (dired-sort-R-check): Use `dired-switches-recursive-p'. + 2014-05-01 Barry O'Reilly * automated/undo-tests.el (undo-test-region-deletion): New test to === modified file 'lisp/dired.el' --- lisp/dired.el 2014-04-30 21:39:57 +0000 +++ lisp/dired.el 2014-05-03 09:22:59 +0000 @@ -1142,10 +1142,22 @@ (defvar ls-lisp-use-insert-directory-program) +(defun dired-check-switches (switches short &optional long) + "Return non-nil if the string SWITCHES matches LONG or SHORT format." + (let (case-fold-search) + (and (stringp switches) + (string-match-p (concat "\\(\\`\\| \\)-[[:alnum:]]*" short + (if long (concat "\\|--" long "\\>") "")) + switches)))) + (defun dired-switches-escape-p (switches) "Return non-nil if the string SWITCHES contains -b or --escape." ;; Do not match things like "--block-size" that happen to contain "b". - (string-match-p "\\(\\`\\| \\)-[[:alnum:]]*b\\|--escape\\>" switches)) + (dired-check-switches switches "b" "escape")) + +(defun dired-switches-recursive-p (switches) + "Return non-nil if the string SWITCHES contains -R or --recursive." + (dired-check-switches switches "R" "recursive")) (defun dired-insert-directory (dir switches &optional file-list wildcard hdr) "Insert a directory listing of DIR, Dired style. @@ -1402,7 +1414,7 @@ (defun dired-insert-old-subdirs (old-subdir-alist) "Try to insert all subdirs that were displayed before. Do so according to the former subdir alist OLD-SUBDIR-ALIST." - (or (string-match-p "R" dired-actual-switches) + (or (dired-switches-recursive-p dired-actual-switches) (let (elt dir) (while old-subdir-alist (setq elt (car old-subdir-alist) @@ -2349,9 +2361,8 @@ ;; This is the UNIX version. (if (get-text-property (point) 'dired-filename) (goto-char (next-single-property-change (point) 'dired-filename)) - (let (opoint file-type executable symlink hidden case-fold-search used-F eol) - ;; case-fold-search is nil now, so we can test for capital F: - (setq used-F (string-match-p "F" dired-actual-switches) + (let (opoint file-type executable symlink hidden used-F eol) + (setq used-F (dired-check-switches dired-actual-switches "F" "classify") opoint (point) eol (line-end-position) hidden (and selective-display @@ -2613,7 +2624,7 @@ (R-ftp-base-dir-regex ;; Used to expand subdirectory names correctly in recursive ;; ange-ftp listings. - (and (string-match-p "R" switches) + (and (dired-switches-recursive-p switches) (string-match "\\`/.*:\\(/.*\\)" default-directory) (concat "\\`" (match-string 1 default-directory))))) (goto-char (point-min)) @@ -3692,12 +3703,12 @@ minus any directories explicitly deleted when R is cleared. To be called first in body of `dired-sort-other', etc." (cond - ((and (string-match-p "R" switches) - (not (string-match-p "R" dired-actual-switches))) + ((and (dired-switches-recursive-p switches) + (not (dired-switches-recursive-p dired-actual-switches))) ;; Adding -R to ls switches -- save `dired-subdir-alist': (setq dired-subdir-alist-pre-R dired-subdir-alist)) - ((and (string-match-p "R" dired-actual-switches) - (not (string-match-p "R" switches))) + ((and (dired-switches-recursive-p dired-actual-switches) + (not (dired-switches-recursive-p switches))) ;; Deleting -R from ls switches -- revert to pre-R subdirs ;; that are still present: (setq dired-subdir-alist ------------------------------------------------------------ revno: 117051 author: Paul Eggert committer: Paul Eggert branch nick: trunk timestamp: Sat 2014-05-03 01:12:06 -0700 message: Get --enable-gcc-warnings working again. The recent changes to configure.ac removed the transliteration of -I to -isystem in CFLAGS, which is needed for --enable-gcc-warnings. Bring this back while keeping the spirit of the recent changes. * configure.ac (edit_cflags): Restore this shell var, and put it at the top level, where it'll be useful when emacs-24 is next merged. (EMACS_CHECK_MODULES): New macro. All uses of PKG_CHECK_MODULES changed to use it. diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-03 07:09:16 +0000 +++ ChangeLog 2014-05-03 08:12:06 +0000 @@ -1,5 +1,14 @@ 2014-05-03 Paul Eggert + Get --enable-gcc-warnings working again. + The recent changes to configure.ac removed the transliteration of + -I to -isystem in CFLAGS, which is needed for --enable-gcc-warnings. + Bring this back while keeping the spirit of the recent changes. + * configure.ac (edit_cflags): Restore this shell var, and put it + at the top level, where it'll be useful when emacs-24 is next merged. + (EMACS_CHECK_MODULES): New macro. All uses of PKG_CHECK_MODULES + changed to use it. + Make it easier on maintainers who use their own Automake. * autogen.sh (ACLOCAL_PATH, AUTORECONF_ENV): New vars. Set them to avoid problems when maintainers prepend their own === modified file 'configure.ac' --- configure.ac 2014-05-02 23:31:41 +0000 +++ configure.ac 2014-05-03 08:12:06 +0000 @@ -902,6 +902,13 @@ AC_SUBST([GNULIB_WARN_CFLAGS]) fi +edit_cflags=" + s,///*,/,g + s/^/ / + s/ -I/ $isystem/g + s/^ // +" + dnl Some other nice autoconf tests. @@ -1340,6 +1347,19 @@ PKG_PROG_PKG_CONFIG(0.9.0) +dnl EMACS_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4) +dnl acts like PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, +dnl HAVE_GSTUFF=yes, HAVE_GSTUFF=no) -- see pkg-config man page -- +dnl except that it postprocesses CFLAGS as needed for --enable-gcc-warnings. +dnl EMACS_CHECK_MODULES accepts optional 3rd and 4th arguments that +dnl can take the place of the default HAVE_GSTUFF=yes and HAVE_GSTUFF=no +dnl actions. +AC_DEFUN([EMACS_CHECK_MODULES], + [PKG_CHECK_MODULES([$1], [$2], + [$1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"` + m4_default([$3], [HAVE_$1=yes])], + [m4_default([$4], [HAVE_$1=no])])]) + HAVE_SOUND=no if test "${with_sound}" != "no"; then # Sound support for GNU/Linux, the free BSDs, and MinGW. @@ -1366,7 +1386,7 @@ if test "${with_sound}" = "alsa" || test "${with_sound}" = "yes"; then ALSA_REQUIRED=1.0.0 ALSA_MODULES="alsa >= $ALSA_REQUIRED" - PKG_CHECK_MODULES(ALSA, $ALSA_MODULES, HAVE_ALSA=yes, HAVE_ALSA=no) + EMACS_CHECK_MODULES([ALSA], [$ALSA_MODULES]) if test $HAVE_ALSA = yes; then SAVE_CFLAGS="$CFLAGS" SAVE_LIBS="$LIBS" @@ -2134,7 +2154,7 @@ RSVG_REQUIRED=2.11.0 RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED" - PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, HAVE_RSVG=yes, :) + EMACS_CHECK_MODULES([RSVG], [$RSVG_MODULE]) AC_SUBST(RSVG_CFLAGS) AC_SUBST(RSVG_LIBS) @@ -2157,7 +2177,7 @@ ## 6.0.7 does not work. See bug#7955. ## 6.8.2 makes Emacs crash; see Bug#13867. IMAGEMAGICK_MODULE="Wand >= 6.2.8 Wand != 6.8.2" - PKG_CHECK_MODULES(IMAGEMAGICK, $IMAGEMAGICK_MODULE, HAVE_IMAGEMAGICK=yes, :) + EMACS_CHECK_MODULES([IMAGEMAGICK], [$IMAGEMAGICK_MODULE]) AC_SUBST(IMAGEMAGICK_CFLAGS) AC_SUBST(IMAGEMAGICK_LIBS) @@ -2187,7 +2207,8 @@ GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" dnl Checks for libraries. - PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no) + EMACS_CHECK_MODULES([GTK], [$GTK_MODULES], + [pkg_check_gtk=yes], [pkg_check_gtk=no]) if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then AC_MSG_ERROR($GTK_PKG_ERRORS) fi @@ -2214,7 +2235,8 @@ GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED" dnl Checks for libraries. - PKG_CHECK_MODULES(GTK, $GTK_MODULES, pkg_check_gtk=yes, pkg_check_gtk=no) + EMACS_CHECK_MODULES([GTK], [$GTK_MODULES], + [pkg_check_gtk=yes], [pkg_check_gtk=no]) if test "$pkg_check_gtk" = "no" && { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; } then @@ -2338,7 +2360,7 @@ HAVE_DBUS=no DBUS_OBJ= if test "${with_dbus}" = "yes"; then - PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no) + EMACS_CHECK_MODULES([DBUS], [dbus-1 >= 1.0]) if test "$HAVE_DBUS" = yes; then AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.]) dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1. @@ -2363,7 +2385,7 @@ dnl GSettings has been tested under GNU/Linux only. HAVE_GSETTINGS=no if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then - PKG_CHECK_MODULES(GSETTINGS, gio-2.0 >= 2.26, HAVE_GSETTINGS=yes, HAVE_GSETTINGS=no) + EMACS_CHECK_MODULES([GSETTINGS], [gio-2.0 >= 2.26]) if test "$HAVE_GSETTINGS" = "yes"; then old_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $GSETTINGS_CFLAGS" @@ -2397,7 +2419,7 @@ dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6. HAVE_GCONF=no if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then - PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.13, HAVE_GCONF=yes, HAVE_GCONF=no) + EMACS_CHECK_MODULES([GCONF], [gconf-2.0 >= 2.13]) if test "$HAVE_GCONF" = yes; then AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.]) dnl Newer GConf doesn't link with g_objects, so this is not defined. @@ -2407,7 +2429,7 @@ fi if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then - PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= 2.0, HAVE_GOBJECT=yes, HAVE_GOBJECT=no) + EMACS_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.0]) if test "$HAVE_GOBJECT" = "yes"; then SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS" SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS" @@ -2438,12 +2460,14 @@ HAVE_GNUTLS=no HAVE_GNUTLS3=no if test "${with_gnutls}" = "yes" ; then - PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.0.0], HAVE_GNUTLS3=yes, HAVE_GNUTLS3=no) + EMACS_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.0.0], + [HAVE_GNUTLS3=yes], [HAVE_GNUTLS3=no]) if test "${HAVE_GNUTLS3}" = "yes"; then AC_DEFINE(HAVE_GNUTLS3, 1, [Define if using GnuTLS v3.]) HAVE_GNUTLS="yes" else - PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no) + EMACS_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], + [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no]) fi if test "${HAVE_GNUTLS}" = "yes"; then AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.]) @@ -2485,7 +2509,7 @@ dnl to check? case $with_file_notification,$NOTIFY_OBJ in gfile, | yes,) - PKG_CHECK_MODULES(GFILENOTIFY, gio-2.0 >= 2.24, HAVE_GFILENOTIFY=yes, HAVE_GFILENOTIFY=no) + EMACS_CHECK_MODULES([GFILENOTIFY], [gio-2.0 >= 2.24]) if test "$HAVE_GFILENOTIFY" = "yes"; then AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.]) NOTIFY_OBJ=gfilenotify.o @@ -2759,7 +2783,8 @@ ### Start of font-backend (under X11) section. if test "${HAVE_X11}" = "yes"; then - PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0, HAVE_FC=yes, HAVE_FC=no) + EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0], + [HAVE_FC=yes], [HAVE_FC=no]) ## Use -lXft if available, unless `--with-xft=no'. HAVE_XFT=maybe @@ -2768,7 +2793,7 @@ fi if test "x${with_xft}" != "xno"; then - PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no) + EMACS_CHECK_MODULES([XFT], [xft >= 0.13.0], [], [HAVE_XFT=no]) ## Because xftfont.c uses XRenderQueryExtension, we also ## need to link to -lXrender. HAVE_XRENDER=no @@ -2807,8 +2832,7 @@ dnl ftfont.o: undefined reference to symbol 'FT_New_Face' dnl if -lfreetype is not specified. dnl The following is needed to set FREETYPE_LIBS. - PKG_CHECK_MODULES(FREETYPE, freetype2, HAVE_FREETYPE=yes, - HAVE_FREETYPE=no) + EMACS_CHECK_MODULES([FREETYPE], [freetype2]) test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR(libxft requires libfreetype) fi @@ -2818,8 +2842,7 @@ AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if using the freetype and fontconfig libraries.]) if test "${with_libotf}" != "no"; then - PKG_CHECK_MODULES(LIBOTF, libotf, HAVE_LIBOTF=yes, - HAVE_LIBOTF=no) + EMACS_CHECK_MODULES([LIBOTF], [libotf]) if test "$HAVE_LIBOTF" = "yes"; then AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.]) AC_CHECK_LIB(otf, OTF_get_variation_glyphs, @@ -2838,7 +2861,7 @@ HAVE_M17N_FLT=no if test "${HAVE_LIBOTF}" = yes; then if test "${with_m17n_flt}" != "no"; then - PKG_CHECK_MODULES(M17N_FLT, m17n-flt, HAVE_M17N_FLT=yes, HAVE_M17N_FLT=no) + EMACS_CHECK_MODULES([M17N_FLT], [m17n-flt]) if test "$HAVE_M17N_FLT" = "yes"; then AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.]) fi @@ -3204,7 +3227,7 @@ if test "${HAVE_X11}" = "yes"; then XRANDR_REQUIRED=1.2.2 XRANDR_MODULES="xrandr >= $XRANDR_REQUIRED" - PKG_CHECK_MODULES(XRANDR, $XRANDR_MODULES, HAVE_XRANDR=yes, HAVE_XRANDR=no) + EMACS_CHECK_MODULES([XRANDR], [$XRANDR_MODULES]) if test $HAVE_XRANDR = no; then # Test old way in case pkg-config doesn't have it (older machines). AC_CHECK_HEADER(X11/extensions/Xrandr.h, @@ -3233,8 +3256,7 @@ if test "${HAVE_X11}" = "yes"; then XINERAMA_REQUIRED=1.0.2 XINERAMA_MODULES="xinerama >= $XINERAMA_REQUIRED" - PKG_CHECK_MODULES(XINERAMA, $XINERAMA_MODULES, HAVE_XINERAMA=yes, - HAVE_XINERAMA=no) + EMACS_CHECK_MODULES([XINERAMA], [$XINERAMA_MODULES]) if test $HAVE_XINERAMA = no; then # Test old way in case pkg-config doesn't have it (older machines). AC_CHECK_HEADER(X11/extensions/Xinerama.h, @@ -3256,7 +3278,7 @@ HAVE_LIBXML2=no if test "${with_xml2}" != "no"; then ### I'm not sure what the version number should be, so I just guessed. - PKG_CHECK_MODULES(LIBXML2, libxml-2.0 > 2.6.17, HAVE_LIBXML2=yes, HAVE_LIBXML2=no) + EMACS_CHECK_MODULES([LIBXML2], [libxml-2.0 > 2.6.17]) # Built-in libxml2 on OS X 10.8 lacks libxml-2.0.pc. if test "${HAVE_LIBXML2}" != "yes" -a "$opsys" = "darwin"; then SAVE_CPPFLAGS="$CPPFLAGS" ------------------------------------------------------------ revno: 117050 committer: Paul Eggert branch nick: trunk timestamp: Sat 2014-05-03 00:09:16 -0700 message: Make it easier on maintainers who use their own Automake. * autogen.sh (ACLOCAL_PATH, AUTORECONF_ENV): New vars. Set them to avoid problems when maintainers prepend their own Automake installations to their PATH. Report an error if pkg.m4 can't be found. diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-02 23:31:41 +0000 +++ ChangeLog 2014-05-03 07:09:16 +0000 @@ -1,3 +1,11 @@ +2014-05-03 Paul Eggert + + Make it easier on maintainers who use their own Automake. + * autogen.sh (ACLOCAL_PATH, AUTORECONF_ENV): New vars. + Set them to avoid problems when maintainers prepend their own + Automake installations to their PATH. Report an error if pkg.m4 + can't be found. + 2014-05-02 Glenn Morris * configure.ac (PKG_CONFIG_PATH): Declare with AC_ARG_VAR. === modified file 'autogen.sh' --- autogen.sh 2014-05-02 23:18:11 +0000 +++ autogen.sh 2014-05-03 07:09:16 +0000 @@ -195,7 +195,7 @@ If you know that the required versions are in your PATH, but this script has made an error, then you can simply run -autoreconf -i -I m4 +autoreconf -fi -I m4 instead of this script. @@ -205,12 +205,51 @@ exit 1 fi -echo "Your system has the required tools, running autoreconf..." +# If automake is installed in a nonstandard location, find the standard +# location if possible and append it to ACLOCAL_PATH. That way, it will +# find the pkg.m4 that is installed in the standard location. +echo "Checking for pkg.m4..." +AUTORECONF_ENV= +ac_dir=`aclocal --print-ac-dir` && test -r "$ac_dir/pkg.m4" || { + oIFS=$IFS + IFS=: + before_first_aclocal=true + for dir in $PATH; do + if test -x "$dir/aclocal"; then + if $before_first_aclocal; then + before_first_aclocal=false + elif ac_dir=`"$dir/aclocal" --print-ac-dir` && test -r "$ac_dir/pkg.m4" + then + case $ACLOCAL_PATH in + '') ACLOCAL_PATH=$ac_dir;; + ?*) ACLOCAL_PATH=$ACLOCAL_PATH:$ac_dir;; + esac + export ACLOCAL_PATH + AUTORECONF_ENV="ACLOCAL_PATH='$ACLOCAL_PATH' " + break + fi + fi + done + IFS=$oIFS + + if test -z "$AUTORECONF_ENV"; then + cat < branch nick: trunk timestamp: Fri 2014-05-02 19:31:41 -0400 message: * configure.ac (PKG_CONFIG_PATH): Declare with AC_ARG_VAR. diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-02 23:29:57 +0000 +++ ChangeLog 2014-05-02 23:31:41 +0000 @@ -1,5 +1,7 @@ 2014-05-02 Glenn Morris + * configure.ac (PKG_CONFIG_PATH): Declare with AC_ARG_VAR. + * configure.ac (--with-pkg-config-prog): Remove. Use the PKG_CONFIG environment variable instead if you need it. === modified file 'configure.ac' --- configure.ac 2014-05-02 23:29:57 +0000 +++ configure.ac 2014-05-02 23:31:41 +0000 @@ -1332,6 +1332,9 @@ m4_pattern_forbid([^PKG_]) +AC_ARG_VAR(PKG_CONFIG_PATH, [Colon-separated list of directories +searched by pkg-config]) + pre_PKG_CONFIG_CFLAGS=$CFLAGS pre_PKG_CONFIG_LIBS=$LIBS ------------------------------------------------------------ revno: 117048 committer: Glenn Morris branch nick: trunk timestamp: Fri 2014-05-02 19:29:57 -0400 message: Remove the --with-pkg-config-prog configure option * configure.ac (--with-pkg-config-prog): Remove. Use the PKG_CONFIG environment variable instead if you need it. * etc/NEWS: Mention this. diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-02 23:18:11 +0000 +++ ChangeLog 2014-05-02 23:29:57 +0000 @@ -1,5 +1,8 @@ 2014-05-02 Glenn Morris + * configure.ac (--with-pkg-config-prog): Remove. + Use the PKG_CONFIG environment variable instead if you need it. + * configure.ac: Use pkg-config's pkg.m4, rather than reinventing it. Add explicit AC_SUBST's where needed. * autogen.sh (progs): Add pkg-config. === modified file 'configure.ac' --- configure.ac 2014-05-02 23:18:11 +0000 +++ configure.ac 2014-05-02 23:29:57 +0000 @@ -304,15 +304,6 @@ [don't compress some files (.el, .info, etc.) when installing. Equivalent to: make GZIP_PROG= install]) -AC_ARG_WITH([pkg-config-prog],dnl -[AS_HELP_STRING([--with-pkg-config-prog=FILENAME], - [file name of pkg-config for finding GTK and librsvg])]) -if test "X${with_pkg_config_prog}" != X; then - if test "${with_pkg_config_prog}" != yes; then - PKG_CONFIG="${with_pkg_config_prog}" - fi -fi - AC_ARG_WITH(gameuser,dnl [AS_HELP_STRING([--with-gameuser=USER],[user for shared game score files])]) test "X${with_gameuser}" != X && test "${with_gameuser}" != yes \ === modified file 'etc/NEWS' --- etc/NEWS 2014-04-29 15:16:07 +0000 +++ etc/NEWS 2014-05-02 23:29:57 +0000 @@ -34,6 +34,10 @@ undumping code to GCC under IRIX, or by configuring --with-wide-int, or by sticking with Emacs 24.4. +--- +** The configure option `--with-pkg-config-prog' has been removed. +Use the PKG_CONFIG environment variable instead if you need to. + * Startup Changes in Emacs 24.5 ------------------------------------------------------------ revno: 117047 committer: Glenn Morris branch nick: trunk timestamp: Fri 2014-05-02 19:18:11 -0400 message: Use pkg-config's pkg.m4 * configure.ac: Use pkg-config's pkg.m4, rather than reinventing it. Add explicit AC_SUBST's where needed. * autogen.sh (progs): Add pkg-config. (pkg_config_min): New variable. * INSTALL.REPO: Mention pkg-config. * etc/PROBLEMS: Mention a related issue that can occur with a local automake. diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-02 21:57:58 +0000 +++ ChangeLog 2014-05-02 23:18:11 +0000 @@ -1,5 +1,10 @@ 2014-05-02 Glenn Morris + * configure.ac: Use pkg-config's pkg.m4, rather than reinventing it. + Add explicit AC_SUBST's where needed. + * autogen.sh (progs): Add pkg-config. + (pkg_config_min): New variable. + * configure.ac (AC_CONFIG_MACRO_DIR): Use it. * autogen.sh (get_version): Handle no leading whitespace. === modified file 'INSTALL.REPO' --- INSTALL.REPO 2014-04-17 06:40:25 +0000 +++ INSTALL.REPO 2014-05-02 23:18:11 +0000 @@ -12,6 +12,8 @@ configure.ac (in the AC_PREREQ command). automake - at least the version specified near the start of configure.ac (in the AM_INIT_AUTOMAKE command). +pkg-config - at least version specified in the PKG_PROG_PKG_CONFIG + command in configure.ac makeinfo - not strictly necessary, but highly recommended, so that you can build the manuals. === modified file 'autogen.sh' --- autogen.sh 2014-05-02 17:40:09 +0000 +++ autogen.sh 2014-05-02 23:18:11 +0000 @@ -32,7 +32,7 @@ ## Tools we need: ## Note that we respect the values of AUTOCONF etc, like autoreconf does. -progs="autoconf automake" +progs="autoconf automake pkg-config" ## Minimum versions we need: autoconf_min=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.ac` @@ -41,6 +41,7 @@ ## AM_INIT_AUTOMAKE call. automake_min=`sed -n 's/^ *AM_INIT_AUTOMAKE(\([0-9\.]*\)).*/\1/p' configure.ac` +pkg_config_min=`sed -n 's/^ *PKG_PROG_PKG_CONFIG(\([0-9\.]*\)).*/\1/p' configure.ac` ## $1 = program, eg "autoconf". ## Echo the version string, eg "2.59". === modified file 'configure.ac' --- configure.ac 2014-05-02 21:57:58 +0000 +++ configure.ac 2014-05-02 23:18:11 +0000 @@ -1339,65 +1339,12 @@ AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE", [The type of system you are compiling for; sets `system-type'.]) +m4_pattern_forbid([^PKG_]) pre_PKG_CONFIG_CFLAGS=$CFLAGS pre_PKG_CONFIG_LIBS=$LIBS -AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - -dnl This function definition taken from Gnome 2.0 -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ - succeeded=no - - if test "$PKG_CONFIG" = "no" ; then - ifelse([$4], , [AC_MSG_ERROR([ - *** The pkg-config script could not be found. Make sure it is in your path, or give the full name of pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog. Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config.])], [$4]) - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) - - if "$PKG_CONFIG" --exists "$2" 2>&AS_MESSAGE_LOG_FD && - $1_CFLAGS=`"$PKG_CONFIG" --cflags "$2" 2>&AS_MESSAGE_LOG_FD` && - $1_LIBS=`"$PKG_CONFIG" --libs "$2" 2>&AS_MESSAGE_LOG_FD`; then - edit_cflags=" - s,///*,/,g - s/^/ / - s/ -I/ $isystem/g - s/^ // - " - $1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"` - $1_LIBS=`AS_ECHO(["$$1_LIBS"]) | sed -e 's,///*,/,g'` - AC_MSG_RESULT([yes CFLAGS='$$1_CFLAGS' LIBS='$$1_LIBS']) - succeeded=yes - else - AC_MSG_RESULT(no) - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. Do it in a subshell - ## to capture any diagnostics in invoking pkg-config. - $1_PKG_ERRORS=`("$PKG_CONFIG" --print-errors "$2") 2>&1` - ifelse([$4], ,echo "$$1_PKG_ERRORS",) - fi - - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , [AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])], [$4]) - fi -]) +PKG_PROG_PKG_CONFIG(0.9.0) HAVE_SOUND=no if test "${with_sound}" != "no"; then @@ -2415,6 +2362,8 @@ DBUS_OBJ=dbusbind.o fi fi +AC_SUBST(DBUS_CFLAGS) +AC_SUBST(DBUS_LIBS) AC_SUBST(DBUS_OBJ) dnl GSettings has been tested under GNU/Linux only. @@ -3268,7 +3217,6 @@ [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)]) if test $HAVE_XRANDR = yes; then XRANDR_LIBS=-lXrandr - AC_SUBST(XRANDR_LIBS) fi fi if test $HAVE_XRANDR = yes; then @@ -3283,6 +3231,8 @@ AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have the XRandr extension.]) fi fi +AC_SUBST(XRANDR_CFLAGS) +AC_SUBST(XRANDR_LIBS) ### Use Xinerama (-lXinerama) if available HAVE_XINERAMA=no @@ -3297,13 +3247,14 @@ [AC_CHECK_LIB(Xinerama, XineramaQueryExtension, HAVE_XINERAMA=yes)]) if test $HAVE_XINERAMA = yes; then XINERAMA_LIBS=-lXinerama - AC_SUBST(XINERAMA_LIBS) fi fi if test $HAVE_XINERAMA = yes; then AC_DEFINE(HAVE_XINERAMA, 1, [Define to 1 if you have the Xinerama extension.]) fi fi +AC_SUBST(XINERAMA_CFLAGS) +AC_SUBST(XINERAMA_LIBS) ### Use libxml (-lxml2) if available === modified file 'etc/PROBLEMS' --- etc/PROBLEMS 2014-03-27 19:41:57 +0000 +++ etc/PROBLEMS 2014-05-02 23:18:11 +0000 @@ -2223,6 +2223,17 @@ * Build-time problems +** Autogen.sh / Autoreconf + +*** Running `autogen.sh' or `autoreconf' fails with an error of the form +"possibly undefined macro: PKG_CONFIG". This indicates that the version +of aclocal that you are using cannot find the pkg.m4 file that +pkg-config provides. If you installed your own version of automake in +a non-standard location /prefix, then add a line to the +/prefix/share/aclocal/dirlist file (create the file if necessary) +that gives the location of the directory that contains pkg.m4 +(e.g. /usr/share/aclocal). + ** Configuration *** `configure' warns ``accepted by the compiler, rejected by the preprocessor''. ------------------------------------------------------------ revno: 117046 committer: Glenn Morris branch nick: trunk timestamp: Fri 2014-05-02 17:57:58 -0400 message: * configure.ac (AC_CONFIG_MACRO_DIR): Use it. diff: === modified file 'ChangeLog' --- ChangeLog 2014-05-02 17:40:09 +0000 +++ ChangeLog 2014-05-02 21:57:58 +0000 @@ -1,5 +1,7 @@ 2014-05-02 Glenn Morris + * configure.ac (AC_CONFIG_MACRO_DIR): Use it. + * autogen.sh (get_version): Handle no leading whitespace. (check_version, main): Handle program names with hyphens. === modified file 'configure.ac' --- configure.ac 2014-04-30 19:54:52 +0000 +++ configure.ac 2014-05-02 21:57:58 +0000 @@ -83,6 +83,8 @@ AC_CONFIG_HEADERS(src/config.h:src/config.in) AC_CONFIG_SRCDIR(src/lisp.h) AC_CONFIG_AUX_DIR(build-aux) +dnl automake 1.13 and later understand this, making -I m4 unnecessary. +AC_CONFIG_MACRO_DIR(m4) xcsdkdir= AC_CHECK_PROGS(XCRUN, [xcrun]) ------------------------------------------------------------ revno: 117045 committer: Paul Eggert branch nick: trunk timestamp: Fri 2014-05-02 14:22:57 -0700 message: * vhdl-mode.texi: Add "@documentencoding UTF-8", since this is a toplevel .texi file. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-04-22 21:32:51 +0000 +++ doc/misc/ChangeLog 2014-05-02 21:22:57 +0000 @@ -1,3 +1,8 @@ +2014-05-02 Paul Eggert + + * vhdl-mode.texi: Add "@documentencoding UTF-8", + since this is a toplevel .texi file. + 2014-04-22 Bastien Guerry * org.texi (Installation): Be more clear on why installing Org === modified file 'doc/misc/vhdl-mode.texi' --- doc/misc/vhdl-mode.texi 2014-03-27 18:20:08 +0000 +++ doc/misc/vhdl-mode.texi 2014-05-02 21:22:57 +0000 @@ -2,6 +2,7 @@ @setfilename ../../info/vhdl-mode @settitle VHDL Mode, an Emacs mode for editing VHDL code +@documentencoding UTF-8 @c Adapted from the VHDL Mode texinfo manual version 2 by Rodney J. Whitby. @c Adapted from the CC Mode texinfo manual by Barry A. Warsaw. @@ -57,8 +58,8 @@ @end ifnottex @menu -* Introduction:: -* Getting Connected:: +* Introduction:: +* Getting Connected:: * New Indentation Engine:: * Customizing Indentation:: * Syntactic Symbols:: @@ -66,9 +67,9 @@ * Getting the latest VHDL Mode release:: * Sample .emacs File:: * Limitations and Known Bugs:: -* Mailing Lists and Submitting Bug Reports:: +* Mailing Lists and Submitting Bug Reports:: * GNU Free Documentation License:: The license for this documentation. -* Concept Index:: +* Concept Index:: * Command Index:: Command Index * Key Index:: Key Index * Variable Index:: Variable Index ------------------------------------------------------------ revno: 117044 committer: Glenn Morris branch nick: trunk timestamp: Fri 2014-05-02 13:49:17 -0400 message: .bzrignore: Tighten up a.out pattern diff: === modified file '.bzrignore' --- .bzrignore 2014-04-21 09:38:44 +0000 +++ .bzrignore 2014-05-02 17:49:17 +0000 @@ -232,4 +232,4 @@ admin/charsets/cp51932.el admin/charsets/eucjp-ms.el admin/charsets/jisx2131-filter -a.out +test/automated/flymake/warnpred/a.out ------------------------------------------------------------ revno: 117043 committer: Glenn Morris branch nick: trunk timestamp: Fri 2014-05-02 13:40:09 -0400 message: autogen.sh: minor tweaks * autogen.sh (get_version): Handle no leading whitespace. (check_version, main): Handle program names with hyphens. diff: === modified file 'ChangeLog' --- ChangeLog 2014-04-30 19:54:52 +0000 +++ ChangeLog 2014-05-02 17:40:09 +0000 @@ -1,3 +1,8 @@ +2014-05-02 Glenn Morris + + * autogen.sh (get_version): Handle no leading whitespace. + (check_version, main): Handle program names with hyphens. + 2014-04-30 Glenn Morris * configure.ac: Treat MirBSD as OpenBSD. (Bug#17339) === modified file 'autogen.sh' --- autogen.sh 2014-04-14 05:35:45 +0000 +++ autogen.sh 2014-05-02 17:40:09 +0000 @@ -50,7 +50,7 @@ get_version () { ## Remove eg "./autogen.sh: line 50: autoconf: command not found". - $1 --version 2>&1 | sed -e '/not found/d' -n -e '1 s/.* \([1-9][0-9\.]*\).*/\1/p' + $1 --version 2>&1 | sed -e '/not found/d' -e 's/.* //' -n -e '1 s/\([0-9][0-9\.]*\).*/\1/p' } ## $1 = version string, eg "2.59" @@ -76,7 +76,7 @@ check_version () { ## Respect eg $AUTOMAKE if it is set, like autoreconf does. - uprog=`echo $1 | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + uprog=`echo $1 | sed -e 's/-/_/g' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` eval uprog=\$${uprog} @@ -114,7 +114,9 @@ for prog in $progs; do - eval min=\$${prog}_min + sprog=`echo "$prog" | sed 's/-/_/g'` + + eval min=\$${sprog}_min echo "Checking for $prog (need at least version $min)..." @@ -133,7 +135,7 @@ if [ $retval -ne 0 ]; then missing="$missing $prog" - eval ${prog}_why=\""$stat"\" + eval ${sprog}_why=\""$stat"\" fi done @@ -147,7 +149,9 @@ EOF for prog in $progs; do - eval min=\$${prog}_min + sprog=`echo "$prog" | sed 's/-/_/g'` + + eval min=\$${sprog}_min echo "$prog (minimum version $min)" done @@ -159,7 +163,9 @@ EOF for prog in $missing; do - eval why=\$${prog}_why + sprog=`echo "$prog" | sed 's/-/_/g'` + + eval why=\$${sprog}_why echo "$prog ($why)" done ------------------------------------------------------------ revno: 117042 committer: Katsumi Yamaoka branch nick: trunk timestamp: Fri 2014-05-02 09:49:11 +0000 message: Gnus: Make gnus-mime-inline-part and gnus-mm-display-part work similarly (The last commit message was mistaken, sorry.) diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2014-05-02 09:44:34 +0000 +++ lisp/gnus/ChangeLog 2014-05-02 09:49:11 +0000 @@ -2,7 +2,7 @@ * gnus-art.el (gnus-mime-inline-part): Redisplay a button so as to show the displaying state of a part. - (gnus-mime-inline-part): Don't insert a newline in the beginning of + (gnus-mm-display-part): Don't insert a newline in the beginning of a part like gnus-mime-inline-part doesn't; work for XEmacs. * mm-decode.el (mm-display-part): Don't insert a newline in the top. ------------------------------------------------------------ revno: 117041 committer: Katsumi Yamaoka branch nick: trunk timestamp: Fri 2014-05-02 09:44:34 +0000 message: Gnus: Make gnus-mime-inline-part and gnus-mime-inline-part work similarly * gnus-art.el (gnus-mime-inline-part): Redisplay a button so as to show the displaying state of a part. (gnus-mime-inline-part): Don't insert a newline in the beginning of a part like gnus-mime-inline-part doesn't; work for XEmacs. * mm-decode.el (mm-display-part): Don't insert a newline in the top. (mm-shr): Make undisplayer unbreakable. * mm-view.el (mm-inline-image-emacs, mm-inline-image-xemacs): Don't insert excessive newline. (mm-inline-text-html-render-with-w3m, mm-inline-text) (mm-insert-inline): Make undisplayer unbreakable. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2014-05-01 07:59:33 +0000 +++ lisp/gnus/ChangeLog 2014-05-02 09:44:34 +0000 @@ -1,3 +1,18 @@ +2014-05-02 Katsumi Yamaoka + + * gnus-art.el (gnus-mime-inline-part): Redisplay a button so as to show + the displaying state of a part. + (gnus-mime-inline-part): Don't insert a newline in the beginning of + a part like gnus-mime-inline-part doesn't; work for XEmacs. + + * mm-decode.el (mm-display-part): Don't insert a newline in the top. + (mm-shr): Make undisplayer unbreakable. + + * mm-view.el (mm-inline-image-emacs, mm-inline-image-xemacs): Don't + insert excessive newline. + (mm-inline-text-html-render-with-w3m, mm-inline-text) + (mm-insert-inline): Make undisplayer unbreakable. + 2014-05-01 Katsumi Yamaoka * gnus-art.el (gnus-mm-display-part): @@ -6,7 +21,7 @@ 2014-04-30 Katsumi Yamaoka * gnus-art.el (gnus-mm-display-part): Don't move point while toggling - a part; redisplay a button (enbugged in 2014-02-05). + a part; redisplay a button (enbugged in 2014-03-23). 2014-04-27 Teodor Zlatanov === modified file 'lisp/gnus/gnus-art.el' --- lisp/gnus/gnus-art.el 2014-05-01 07:59:33 +0000 +++ lisp/gnus/gnus-art.el 2014-05-02 09:44:34 +0000 @@ -5300,12 +5300,25 @@ Compressed files like .gz and .bz2 are decompressed." (interactive (list nil current-prefix-arg)) (gnus-article-check-buffer) - (unless handle - (setq handle (get-text-property (point) 'gnus-data))) - (when handle - (let ((b (point)) - (inhibit-read-only t) - contents charset coding-system) + (let* ((inhibit-read-only t) + (b (point)) + (btn ;; position where the MIME button exists + (if handle + (if (eq handle (get-text-property b 'gnus-data)) + b + (article-goto-body) + (or (text-property-any (point) (point-max) 'gnus-data handle) + (text-property-any (point-min) (point) 'gnus-data handle))) + (setq handle (get-text-property b 'gnus-data)) + b)) + contents charset coding-system) + (when handle + (when (= b (prog1 + btn + (setq btn (previous-single-property-change + (next-single-property-change btn 'gnus-data) + 'gnus-data)))) + (setq b btn)) (if (and (not arg) (mm-handle-undisplayer handle)) (mm-remove-part handle) (mm-with-unibyte-buffer @@ -5332,8 +5345,35 @@ ((mm-handle-undisplayer handle) (mm-remove-part handle))) (forward-line 1) - (mm-display-inline handle) - (goto-char b))))) + (mm-display-inline handle)) + ;; Toggle the button appearance between `[button]...' and `[button]'. + (goto-char btn) + (gnus-insert-mime-button handle (get-text-property btn 'gnus-part) + (list (mm-handle-displayed-p handle))) + (if (featurep 'emacs) + (delete-region + (point) + (text-property-any (point) (point-max) 'gnus-data nil)) + (let* ((end (text-property-any (point) (point-max) 'gnus-data nil)) + (annots (annotations-at end))) + (delete-region (point) + ;; FIXME: why isn't this simply `end'? + (if annots (1+ end) end)) + (dolist (annot annots) + (set-extent-endpoints annot (point) (point))))) + (unless (search-backward "\n\n" nil t) + ;; We're in the article header. + (delete-char -1) + (dolist (ovl (gnus-overlays-in btn (point))) + (gnus-overlay-put ovl 'gnus-button-attachment-extra t) + (gnus-overlay-put ovl 'face nil)) + (save-restriction + (message-narrow-to-field) + (let ((gnus-treatment-function-alist + '((gnus-treat-highlight-headers + gnus-article-highlight-headers)))) + (gnus-treat-article 'head)))) + (goto-char b)))) (defun gnus-mime-set-charset-parameters (handle charset) "Set CHARSET to parameters in HANDLE. @@ -5650,6 +5690,9 @@ (when win (select-window win) (goto-char point))) + (setq point (previous-single-property-change + (next-single-property-change point 'gnus-data) + 'gnus-data)) (forward-line) (if (mm-handle-displayed-p handle) ;; This will remove the part. @@ -5673,27 +5716,29 @@ (mm-handle-media-type handle)))))) (goto-char point) ;; Toggle the button appearance between `[button]...' and `[button]'. - (let ((end (next-single-property-change point 'gnus-data)) - start) - (delete-region - (setq start (previous-single-property-change end 'gnus-data)) - end) - (gnus-insert-mime-button - handle id (list (mm-handle-displayed-p handle))) - (setq end (point)) - (if (search-backward "\n\n" nil t) - (goto-char end) - ;; We're in the article header. - (delete-char -1) - (dolist (ovl (gnus-overlays-in start (1- end))) - (gnus-overlay-put ovl 'gnus-button-attachment-extra t) - (gnus-overlay-put ovl 'face nil)) - (save-restriction - (message-narrow-to-field) - (let ((gnus-treatment-function-alist - '((gnus-treat-highlight-headers - gnus-article-highlight-headers)))) - (gnus-treat-article 'head))))) + (gnus-insert-mime-button handle id (list (mm-handle-displayed-p handle))) + (if (featurep 'emacs) + (delete-region + (point) (text-property-any (point) (point-max) 'gnus-data nil)) + (let* ((end (text-property-any (point) (point-max) 'gnus-data nil)) + (annots (annotations-at end))) + (delete-region (point) + ;; FIXME: why isn't this simply `end'? + (if annots (1+ end) end)) + (dolist (annot annots) + (set-extent-endpoints annot (point) (point))))) + (unless (search-backward "\n\n" nil t) + ;; We're in the article header. + (delete-char -1) + (dolist (ovl (gnus-overlays-in point (point))) + (gnus-overlay-put ovl 'gnus-button-attachment-extra t) + (gnus-overlay-put ovl 'face nil)) + (save-restriction + (message-narrow-to-field) + (let ((gnus-treatment-function-alist + '((gnus-treat-highlight-headers + gnus-article-highlight-headers)))) + (gnus-treat-article 'head)))) (goto-char point) (if (window-live-p window) (select-window window))) === modified file 'lisp/gnus/mm-decode.el' --- lisp/gnus/mm-decode.el 2014-03-23 23:13:36 +0000 +++ lisp/gnus/mm-decode.el 2014-05-02 09:44:34 +0000 @@ -821,7 +821,6 @@ 'inline) ((and (mm-inlinable-p ehandle) (mm-inlined-p ehandle)) - (forward-line 1) (mm-display-inline handle) 'inline) ((or method @@ -1868,7 +1867,7 @@ handle `(lambda () (let ((inhibit-read-only t)) - (delete-region ,(point-min-marker) + (delete-region ,(copy-marker (point-min) t) ,(point-max-marker)))))))) (defvar shr-map) === modified file 'lisp/gnus/mm-view.el' --- lisp/gnus/mm-view.el 2014-03-23 23:13:36 +0000 +++ lisp/gnus/mm-view.el 2014-05-02 09:44:34 +0000 @@ -96,19 +96,19 @@ (- (nth 3 edges) (nth 1 edges))))))) image)) b) - (insert "\n\n") + (insert "\n") (mm-handle-set-undisplayer handle `(lambda () (let ((b ,b) (inhibit-read-only t)) (remove-images b b) - (delete-region b (+ b 2))))))) + (delete-region b (1+ b))))))) (defun mm-inline-image-xemacs (handle) (when (featurep 'xemacs) - (insert "\n\n") - (forward-char -2) + (insert "\n") + (forward-char -1) (let ((annot (make-annotation (mm-get-image handle) nil 'text)) (inhibit-read-only t)) (mm-handle-set-undisplayer @@ -117,7 +117,7 @@ (let ((b ,(point-marker)) (inhibit-read-only t)) (delete-annotation ,annot) - (delete-region (- b 2) b)))) + (delete-region (1- b) b)))) (set-extent-property annot 'mm t) (set-extent-property annot 'duplicable t)))) @@ -217,7 +217,7 @@ handle `(lambda () (let ((inhibit-read-only t)) - (delete-region ,(point-min-marker) + (delete-region ,(copy-marker (point-min) t) ,(point-max-marker))))))))) (defvar mm-w3m-standalone-supports-m17n-p (if (featurep 'mule) 'undecided) @@ -391,7 +391,7 @@ handle `(lambda () (let ((inhibit-read-only t)) - (delete-region ,(point-min-marker) + (delete-region ,(copy-marker (point-min) t) ,(point-max-marker)))))))) (defun mm-insert-inline (handle text) @@ -404,7 +404,7 @@ handle `(lambda () (let ((inhibit-read-only t)) - (delete-region ,(copy-marker b) + (delete-region ,(copy-marker b t) ,(copy-marker (point)))))))) (defun mm-inline-audio (handle) ------------------------------------------------------------ revno: 117040 fixes bug: http://debbugs.gnu.org/17325 committer: Barry O'Reilly branch nick: trunk timestamp: Thu 2014-05-01 19:25:28 -0400 message: Change algorithm used to adjust positions for undo in region * simple.el (undo-make-selective-list): New algorithm fixes incorrectness of position adjustments when undoing in region. (Bug#17235) (undo-elt-crosses-region): Make obsolete. (undo-adjust-elt, undo-adjust-beg-end, undo-adjust-pos): New functions to adjust positions using undo-deltas. * automated/undo-tests.el (undo-test-region-deletion): New test to demonstrate bug#17235. (undo-test-region-example): New test to verify example given in comments for undo-make-selective-list. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-05-01 16:14:03 +0000 +++ lisp/ChangeLog 2014-05-01 23:25:28 +0000 @@ -1,3 +1,10 @@ +2014-05-01 Barry O'Reilly + + * automated/undo-tests.el (undo-test-region-deletion): New test to + demonstrate bug#17235. + (undo-test-region-example): New test to verify example given in + comments for undo-make-selective-list. + 2014-05-01 Stefan Monnier * emacs-lisp/lisp-mode.el (lisp--match-hidden-arg): Only highlight past === modified file 'lisp/simple.el' --- lisp/simple.el 2014-04-28 04:40:41 +0000 +++ lisp/simple.el 2014-05-01 23:25:28 +0000 @@ -2365,91 +2365,112 @@ (undo-make-selective-list (min beg end) (max beg end)) buffer-undo-list))) +;; The positions given in elements of the undo list are the positions +;; as of the time that element was recorded to undo history. In +;; general, subsequent buffer edits render those positions invalid in +;; the current buffer, unless adjusted according to the intervening +;; undo elements. +;; +;; Undo in region is a use case that requires adjustments to undo +;; elements. It must adjust positions of elements in the region based +;; on newer elements not in the region so as they may be correctly +;; applied in the current buffer. undo-make-selective-list +;; accomplishes this with its undo-deltas list of adjustments. An +;; example undo history from oldest to newest: +;; +;; buf pos: +;; 123456789 buffer-undo-list undo-deltas +;; --------- ---------------- ----------- +;; aaa (1 . 4) (1 . -3) +;; aaba (3 . 4) N/A (in region) +;; ccaaba (1 . 3) (1 . -2) +;; ccaabaddd (7 . 10) (7 . -3) +;; ccaabdd ("ad" . 6) (6 . 2) +;; ccaabaddd (6 . 8) (6 . -2) +;; | |<-- region: "caab", from 2 to 6 +;; +;; When the user starts a run of undos in region, +;; undo-make-selective-list is called to create the full list of in +;; region elements. Each element is adjusted forward chronologically +;; through undo-deltas to determine if it is in the region. +;; +;; In the above example, the insertion of "b" is (3 . 4) in the +;; buffer-undo-list. The undo-delta (1 . -2) causes (3 . 4) to become +;; (5 . 6). The next three undo-deltas cause no adjustment, so (5 +;; . 6) is assessed as in the region and placed in the selective list. +;; Notably, the end of region itself adjusts from "2 to 6" to "2 to 5" +;; due to the selected element. The "b" insertion is the only element +;; fully in the region, so in this example undo-make-selective-list +;; returns (nil (5 . 6)). +;; +;; The adjustment of the (7 . 10) insertion of "ddd" shows an edge +;; case. It is adjusted through the undo-deltas: ((6 . 2) (6 . -2)). +;; Normally an undo-delta of (6 . 2) would cause positions after 6 to +;; adjust by 2. However, they shouldn't adjust to less than 6, so (7 +;; . 10) adjusts to (6 . 8) due to the first undo delta. +;; +;; More interesting is how to adjust the "ddd" insertion due to the +;; next undo-delta: (6 . -2), corresponding to reinsertion of "ad". +;; If the reinsertion was a manual retyping of "ad", then the total +;; adjustment should be (7 . 10) -> (6 . 8) -> (8 . 10). However, if +;; the reinsertion was due to undo, one might expect the first "d" +;; character would again be a part of the "ddd" text, meaning its +;; total adjustment would be (7 . 10) -> (6 . 8) -> (7 . 10). +;; +;; undo-make-selective-list assumes in this situation that "ad" was a +;; new edit, even if it was inserted because of an undo. +;; Consequently, if the user undos in region "8 to 10" of the +;; "ccaabaddd" buffer, they could be surprised that it becomes +;; "ccaabad", as though the first "d" became detached from the +;; original "ddd" insertion. This quirk is a FIXME. + (defun undo-make-selective-list (start end) "Return a list of undo elements for the region START to END. -The elements come from `buffer-undo-list', but we keep only -the elements inside this region, and discard those outside this region. -If we find an element that crosses an edge of this region, -we stop and ignore all further elements." - (let ((undo-list-copy (undo-copy-list buffer-undo-list)) - (undo-list (list nil)) - some-rejected - undo-elt temp-undo-list delta) - (while undo-list-copy - (setq undo-elt (car undo-list-copy)) - (let ((keep-this - (cond ((and (consp undo-elt) (eq (car undo-elt) t)) - ;; This is a "was unmodified" element. - ;; Keep it if we have kept everything thus far. - (not some-rejected)) - ;; Skip over marker adjustments, instead relying on - ;; finding them after (TEXT . POS) elements - ((markerp (car-safe undo-elt)) - nil) - (t - (undo-elt-in-region undo-elt start end))))) - (if keep-this - (progn - (setq end (+ end (cdr (undo-delta undo-elt)))) - ;; Don't put two nils together in the list - (when (not (and (eq (car undo-list) nil) - (eq undo-elt nil))) - (setq undo-list (cons undo-elt undo-list)) - ;; If (TEXT . POS), "keep" its subsequent (MARKER - ;; . ADJUSTMENT) whose markers haven't moved. - (when (and (stringp (car-safe undo-elt)) - (integerp (cdr-safe undo-elt))) - (let ((list-i (cdr undo-list-copy))) +The elements come from `buffer-undo-list', but we keep only the +elements inside this region, and discard those outside this +region. The elements' positions are adjusted so as the returned +list can be applied to the current buffer." + (let ((ulist buffer-undo-list) + ;; A list of position adjusted undo elements in the region. + (selective-list (list nil)) + ;; A list of undo-deltas for out of region undo elements. + undo-deltas + undo-elt) + (while ulist + (setq undo-elt (car ulist)) + (cond + ((null undo-elt) + ;; Don't put two nils together in the list + (when (car selective-list) + (push nil selective-list))) + ((and (consp undo-elt) (eq (car undo-elt) t)) + ;; This is a "was unmodified" element. Keep it + ;; if we have kept everything thus far. + (when (not undo-deltas) + (push undo-elt selective-list))) + ;; Skip over marker adjustments, instead relying + ;; on finding them after (TEXT . POS) elements + ((markerp (car-safe undo-elt)) + nil) + (t + (let ((adjusted-undo-elt (undo-adjust-elt undo-elt + undo-deltas))) + (if (undo-elt-in-region adjusted-undo-elt start end) + (progn + (setq end (+ end (cdr (undo-delta adjusted-undo-elt)))) + (push adjusted-undo-elt selective-list) + ;; Keep (MARKER . ADJUSTMENT) if their (TEXT . POS) was + ;; kept. primitive-undo may discard them later. + (when (and (stringp (car-safe adjusted-undo-elt)) + (integerp (cdr-safe adjusted-undo-elt))) + (let ((list-i (cdr ulist))) (while (markerp (car-safe (car list-i))) - (let* ((adj-elt (pop list-i)) - (m (car adj-elt))) - (and (eq (marker-buffer m) (current-buffer)) - (= (cdr undo-elt) m) - (push adj-elt undo-list)))))))) - (if (undo-elt-crosses-region undo-elt start end) - (setq undo-list-copy nil) - (setq some-rejected t) - (setq temp-undo-list (cdr undo-list-copy)) - (setq delta (undo-delta undo-elt)) - - (when (/= (cdr delta) 0) - (let ((position (car delta)) - (offset (cdr delta))) - - ;; Loop down the earlier events adjusting their buffer - ;; positions to reflect the fact that a change to the buffer - ;; isn't being undone. We only need to process those element - ;; types which undo-elt-in-region will return as being in - ;; the region since only those types can ever get into the - ;; output - - (while temp-undo-list - (setq undo-elt (car temp-undo-list)) - (cond ((integerp undo-elt) - (if (>= undo-elt position) - (setcar temp-undo-list (- undo-elt offset)))) - ((atom undo-elt) nil) - ((stringp (car undo-elt)) - ;; (TEXT . POSITION) - (let ((text-pos (abs (cdr undo-elt))) - (point-at-end (< (cdr undo-elt) 0 ))) - (if (>= text-pos position) - (setcdr undo-elt (* (if point-at-end -1 1) - (- text-pos offset)))))) - ((integerp (car undo-elt)) - ;; (BEGIN . END) - (when (>= (car undo-elt) position) - (setcar undo-elt (- (car undo-elt) offset)) - (setcdr undo-elt (- (cdr undo-elt) offset)))) - ((null (car undo-elt)) - ;; (nil PROPERTY VALUE BEG . END) - (let ((tail (nthcdr 3 undo-elt))) - (when (>= (car tail) position) - (setcar tail (- (car tail) offset)) - (setcdr tail (- (cdr tail) offset)))))) - (setq temp-undo-list (cdr temp-undo-list)))))))) - (setq undo-list-copy (cdr undo-list-copy))) - (nreverse undo-list))) + (push (pop list-i) selective-list))))) + (let ((delta (undo-delta undo-elt))) + (when (/= 0 (cdr delta)) + (push delta undo-deltas))))))) + (pop ulist)) + (nreverse selective-list))) (defun undo-elt-in-region (undo-elt start end) "Determine whether UNDO-ELT falls inside the region START ... END. @@ -2497,6 +2518,73 @@ ;; (BEGIN . END) (and (< (car undo-elt) end) (> (cdr undo-elt) start))))) +(make-obsolete 'undo-elt-crosses-region nil "24.5") + +(defun undo-adjust-elt (elt deltas) + "Return adjustment of undo element ELT by the undo DELTAS +list." + (pcase elt + ;; POSITION + ((pred integerp) + (undo-adjust-pos elt deltas)) + ;; (BEG . END) + (`(,(and beg (pred integerp)) . ,(and end (pred integerp))) + (undo-adjust-beg-end beg end deltas)) + ;; (TEXT . POSITION) + (`(,(and text (pred stringp)) . ,(and pos (pred integerp))) + (cons text (* (if (< pos 0) -1 1) + (undo-adjust-pos (abs pos) deltas)))) + ;; (nil PROPERTY VALUE BEG . END) + (`(nil . ,(or `(,prop ,val ,beg . ,end) pcase--dontcare)) + `(nil ,prop ,val . ,(undo-adjust-beg-end beg end deltas))) + ;; (apply DELTA START END FUN . ARGS) + ;; FIXME + ;; All others return same elt + (_ elt))) + +;; (BEG . END) can adjust to the same positions, commonly when an +;; insertion was undone and they are out of region, for example: +;; +;; buf pos: +;; 123456789 buffer-undo-list undo-deltas +;; --------- ---------------- ----------- +;; [...] +;; abbaa (2 . 4) (2 . -2) +;; aaa ("bb" . 2) (2 . 2) +;; [...] +;; +;; "bb" insertion (2 . 4) adjusts to (2 . 2) because of the subsequent +;; undo. Further adjustments to such an element should be the same as +;; for (TEXT . POSITION) elements. The options are: +;; +;; 1: POSITION adjusts using <= (use-< nil), resulting in behavior +;; analogous to marker insertion-type t. +;; +;; 2: POSITION adjusts using <, resulting in behavior analogous to +;; marker insertion-type nil. +;; +;; There was no strong reason to prefer one or the other, except that +;; the first is more consistent with prior undo in region behavior. +(defun undo-adjust-beg-end (beg end deltas) + "Return cons of adjustments to BEG and END by the undo DELTAS +list." + (let ((adj-beg (undo-adjust-pos beg deltas))) + ;; Note: option 2 above would be like (cons (min ...) adj-end) + (cons adj-beg + (max adj-beg (undo-adjust-pos end deltas t))))) + +(defun undo-adjust-pos (pos deltas &optional use-<) + "Return adjustment of POS by the undo DELTAS list, comparing +with < or <= based on USE-<." + (dolist (d deltas pos) + (when (if use-< + (< (car d) pos) + (<= (car d) pos)) + (setq pos + ;; Don't allow pos to become less than the undo-delta + ;; position. This edge case is described in the overview + ;; comments. + (max (car d) (- pos (cdr d))))))) ;; Return the first affected buffer position and the delta for an undo element ;; delta is defined as the change in subsequent buffer positions if we *did* === modified file 'test/ChangeLog' --- test/ChangeLog 2014-04-25 16:11:07 +0000 +++ test/ChangeLog 2014-05-01 23:25:28 +0000 @@ -1,3 +1,12 @@ +2014-05-01 Barry O'Reilly + + * simple.el (undo-make-selective-list): New algorithm fixes + incorrectness of position adjustments when undoing in region. + (Bug#17235) + (undo-elt-crosses-region): Make obsolete. + (undo-adjust-elt, undo-adjust-beg-end, undo-adjust-pos): New + functions to adjust positions using undo-deltas. + 2014-04-25 Michael Albinus * automated/tramp-tests.el (top): === modified file 'test/automated/undo-tests.el' --- test/automated/undo-tests.el 2014-03-25 02:47:39 +0000 +++ test/automated/undo-tests.el 2014-05-01 23:25:28 +0000 @@ -226,7 +226,7 @@ (should-not (buffer-modified-p)))) (delete-file tempfile)))) -(ert-deftest undo-test-in-region-not-most-recent () +(ert-deftest undo-test-region-not-most-recent () "Test undo in region of an edit not the most recent." (with-temp-buffer (buffer-enable-undo) @@ -247,7 +247,78 @@ (should (string= (buffer-string) "11131")))) -(ert-deftest undo-test-in-region-eob () +(ert-deftest undo-test-region-deletion () + "Test undoing a deletion to demonstrate bug 17235." + (with-temp-buffer + (buffer-enable-undo) + (transient-mark-mode 1) + (insert "12345") + (search-backward "4") + (undo-boundary) + (delete-forward-char 1) + (search-backward "1") + (undo-boundary) + (insert "xxxx") + (undo-boundary) + (insert "yy") + (search-forward "35") + (undo-boundary) + ;; Select "35" + (push-mark (point) t t) + (setq mark-active t) + (forward-char -2) + (undo) ; Expect "4" to come back + (should (string= (buffer-string) + "xxxxyy12345")))) + +(ert-deftest undo-test-region-example () + "The same example test case described in comments for +undo-make-selective-list." + ;; buf pos: + ;; 123456789 buffer-undo-list undo-deltas + ;; --------- ---------------- ----------- + ;; aaa (1 . 4) (1 . -3) + ;; aaba (3 . 4) N/A (in region) + ;; ccaaba (1 . 3) (1 . -2) + ;; ccaabaddd (7 . 10) (7 . -3) + ;; ccaabdd ("ad" . 6) (6 . 2) + ;; ccaabaddd (6 . 8) (6 . -2) + ;; | |<-- region: "caab", from 2 to 6 + (with-temp-buffer + (buffer-enable-undo) + (transient-mark-mode 1) + (insert "aaa") + (goto-char 3) + (undo-boundary) + (insert "b") + (goto-char 1) + (undo-boundary) + (insert "cc") + (goto-char 7) + (undo-boundary) + (insert "ddd") + (search-backward "ad") + (undo-boundary) + (delete-forward-char 2) + (undo-boundary) + ;; Select "dd" + (push-mark (point) t t) + (setq mark-active t) + (goto-char (point-max)) + (undo) + (undo-boundary) + (should (string= (buffer-string) + "ccaabaddd")) + ;; Select "caab" + (push-mark 2 t t) + (setq mark-active t) + (goto-char 6) + (undo) + (undo-boundary) + (should (string= (buffer-string) + "ccaaaddd")))) + +(ert-deftest undo-test-region-eob () "Test undo in region of a deletion at EOB, demonstrating bug 16411." (with-temp-buffer (buffer-enable-undo)