From 2394ef283c781297f3a1da79c8c8c92ca9d1b5e5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 24 Jun 2014 19:58:06 +0300 Subject: admin/notes/unicode: Some notes about what to do when a new Unicode version is imported. --- admin/ChangeLog | 5 +++++ admin/notes/unicode | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/admin/ChangeLog b/admin/ChangeLog index 1fb3a6efd1a..1abbf36e9dc 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2014-06-24 Eli Zaretskii + + * notes/unicode: Some notes about what to do when a new Unicode + version is imported. + 2014-06-24 Glenn Morris * unidata/BidiMirroring.txt: Update to 7.0.0 (only comment changes). diff --git a/admin/notes/unicode b/admin/notes/unicode index 654580639f7..cff619fd8b8 100644 --- a/admin/notes/unicode +++ b/admin/notes/unicode @@ -3,6 +3,39 @@ Copyright (C) 2002-2014 Free Software Foundation, Inc. See the end of the file for license conditions. +Importing a new Unicode Standard version into Emacs +------------------------------------------------------------- + +Emacs uses the following files from the Unicode Character Database +(a.k.a. "UCD): + + . UnicodeData.txt + . BidiMirroring.txt + . IVD_Sequences.txt + +First, these files need to be copied into admin/unidata/, and then +Emacs should be rebuilt for them to take effect. Rebuilding Emacs +updates several derived files elsewhere in the Emacs source tree, +mainly in lisp/international/. + +When Emacs is rebuilt for the first time after importing the new +files, pay attention to any warning or error messages. In particular, +admin/unidata/unidata-gen.el will complain if UnicodeData.txt defines +new bidirectional attributes of characters, because unidata-gen.el, +bidi.c and dispextern.h need to be updated in that case; failure to do +so will cause aborts in redisplay. + +Next, review the changes in UnicodeData.txt vs the previous version +used by Emacs. Any changes, be it introduction of new scripts or +addition of codepoints to existing scripts, need corresponding changes +in the data used for filling char-script-table, see characters.el +around line 1300. Other databases and settings in characters.el, such +as the data for char-width-table, might also need changes. + +Any new scripts added by UnicodeData.txt will also need updates to +script-representative-chars defined in fontset.el. Other databases in +fontset.el might also need to be updated as needed. + Problems, fixmes and other unicode-related issues ------------------------------------------------------------- -- cgit v1.2.1 From 370ceb22102e02a25516e43a61da0c9a9d6e1579 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 24 Jun 2014 16:16:10 -0400 Subject: Fix some indentation problem with \; and pipes. * lisp/progmodes/sh-script.el (sh-mode-syntax-table): Set syntax of ;|&. (sh-smie--default-forward-token, sh-smie--default-backward-token): New functions. (sh-smie-sh-forward-token, sh-smie-sh-backward-token) (sh-smie-rc-forward-token, sh-smie-rc-backward-token): Use them. (sh-smie-sh-rules): Fix indentation of a pipe at BOL. Fixes: debbugs:17842 --- lisp/ChangeLog | 10 ++++++ lisp/progmodes/sh-script.el | 76 +++++++++++++++++++++++++++++++++++---------- test/indent/shell.sh | 7 +++++ 3 files changed, 76 insertions(+), 17 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 379e5ed4d30..da8d49ae0a9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2014-06-24 Stefan Monnier + + Fix some indentation problem with \; and pipes (bug#17842). + * progmodes/sh-script.el (sh-mode-syntax-table): Set syntax of ;|&. + (sh-smie--default-forward-token, sh-smie--default-backward-token): + New functions. + (sh-smie-sh-forward-token, sh-smie-sh-backward-token) + (sh-smie-rc-forward-token, sh-smie-rc-backward-token): Use them. + (sh-smie-sh-rules): Fix indentation of a pipe at BOL. + 2014-06-24 Eli Zaretskii * international/fontset.el (script-representative-chars): diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 4db462594dc..1601b6c81ae 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -466,6 +466,9 @@ the car and cdr are the same symbol.") ?~ "_" ?, "_" ?= "." + ?\; "." + ?| "." + ?& "." ?< "." ?> ".") "The syntax table to use for Shell-Script mode. @@ -1837,6 +1840,40 @@ Does not preserve point." ((equal tok "in") (sh-smie--sh-keyword-in-p)) (t (sh-smie--keyword-p)))) +(defun sh-smie--default-forward-token () + (forward-comment (point-max)) + (buffer-substring-no-properties + (point) + (progn (if (zerop (skip-syntax-forward ".")) + (while (progn (skip-syntax-forward "w_'") + (looking-at "\\\\")) + (forward-char 2))) + (point)))) + +(defun sh-smie--default-backward-token () + (forward-comment (- (point))) + (let ((pos (point)) + (n (skip-syntax-backward "."))) + (if (or (zerop n) + (and (eq n -1) + (let ((p (point))) + (if (eq -1 (% (skip-syntax-backward "\\") 2)) + t + (goto-char p) + nil)))) + (while + (progn (skip-syntax-backward "w_'") + (or (not (zerop (skip-syntax-backward "\\"))) + (when (eq ?\\ (char-before (1- (point)))) + (let ((p (point))) + (forward-char -1) + (if (eq -1 (% (skip-syntax-backward "\\") 2)) + t + (goto-char p) + nil)))))) + (goto-char (- (point) (% (skip-syntax-backward "\\") 2)))) + (buffer-substring-no-properties (point) pos))) + (defun sh-smie-sh-forward-token () (if (and (looking-at "[ \t]*\\(?:#\\|\\(\\s|\\)\\|$\\)") (save-excursion @@ -1865,7 +1902,7 @@ Does not preserve point." tok)) (t (let* ((pos (point)) - (tok (smie-default-forward-token))) + (tok (sh-smie--default-forward-token))) (cond ((equal tok ")") "case-)") ((equal tok "(") "case-(") @@ -1909,7 +1946,7 @@ Does not preserve point." (goto-char (match-beginning 1)) (match-string-no-properties 1)) (t - (let ((tok (smie-default-backward-token))) + (let ((tok (sh-smie--default-backward-token))) (cond ((equal tok ")") "case-)") ((equal tok "(") "case-(") @@ -1939,18 +1976,18 @@ May return nil if the line should not be treated as continued." (`(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt) (sh-var-value 'sh-indent-for-case-label))) ((and `(:before . ,_) - (guard (when sh-indent-after-continuation - (save-excursion - (ignore-errors - (skip-chars-backward " \t") - (sh-smie--looking-back-at-continuation-p)))))) - ;; After a line-continuation, make sure the rest is indented. - (let* ((sh-indent-after-continuation nil) - (indent (smie-indent-calculate)) - (initial (sh-smie--continuation-start-indent))) - (when (and (numberp indent) (numberp initial) - (<= indent initial)) - `(column . ,(+ initial sh-indentation))))) + ;; After a line-continuation, make sure the rest is indented. + (guard sh-indent-after-continuation) + (guard (save-excursion + (ignore-errors + (skip-chars-backward " \t") + (sh-smie--looking-back-at-continuation-p)))) + (let initial (sh-smie--continuation-start-indent)) + (guard (let* ((sh-indent-after-continuation nil) + (indent (smie-indent-calculate))) + (and (numberp indent) (numberp initial) + (<= indent initial))))) + `(column . ,(+ initial sh-indentation))) (`(:before . ,(or `"(" `"{" `"[")) (when (smie-rule-hanging-p) (if (not (smie-rule-prev-p "&&" "||" "|")) @@ -1974,7 +2011,12 @@ May return nil if the line should not be treated as continued." (smie-rule-bolp)))) (current-column) (smie-indent-calculate))))) - (`(:after . ,(or `"|" `"&&" `"||")) (if (smie-rule-parent-p token) nil 4)) + (`(:before . ,(or `"|" `"&&" `"||")) + (unless (smie-rule-parent-p token) + (smie-backward-sexp token) + `(column . ,(+ (funcall smie-rules-function :elem 'basic) + (smie-indent-virtual))))) + ;; Attempt at backward compatibility with the old config variables. (`(:before . "fi") (sh-var-value 'sh-indent-for-fi)) (`(:before . "done") (sh-var-value 'sh-indent-for-done)) @@ -2095,7 +2137,7 @@ Point should be before the newline." ;; tok)) (t (let* ((pos (point)) - (tok (smie-default-forward-token))) + (tok (sh-smie--default-forward-token))) (cond ;; ((equal tok ")") "case-)") ((and tok (string-match "\\`[a-z]" tok) @@ -2136,7 +2178,7 @@ Point should be before the newline." ;; (goto-char (match-beginning 1)) ;; (match-string-no-properties 1)) (t - (let ((tok (smie-default-backward-token))) + (let ((tok (sh-smie--default-backward-token))) (cond ;; ((equal tok ")") "case-)") ((and tok (string-match "\\`[a-z]" tok) diff --git a/test/indent/shell.sh b/test/indent/shell.sh index 8e831bb8f11..4a30739e2d9 100755 --- a/test/indent/shell.sh +++ b/test/indent/shell.sh @@ -41,6 +41,13 @@ for foo in bar; do # bug#17721 } done +filter_3 () # bug#17842 +{ + tr -d '"`' | tr ' ' ' ' | \ + awk -F\; -f filter.awk | \ + grep -v "^," | sort -t, -k2,2 +} + echo -n $(( 5 << 2 )) # This should not be treated as a heredoc (bug#12770). 2 -- cgit v1.2.1 From a4d8b73e1cb0f9c59a4f93170248dd85c5ee680c Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 25 Jun 2014 02:23:41 +0300 Subject: * lisp/desktop.el (desktop-auto-save-enable) (desktop-auto-save-disable): New functions. (desktop-save-mode, desktop-auto-save-timeout): Use them. (desktop-read): Disable the autosave before loading the desktop, and enable afterwards. Fixes: debbugs:17351 --- lisp/ChangeLog | 8 ++++++++ lisp/desktop.el | 26 ++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index da8d49ae0a9..5981c50af77 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-06-24 Juri Linkov + + * desktop.el (desktop-auto-save-enable) + (desktop-auto-save-disable): New functions. + (desktop-save-mode, desktop-auto-save-timeout): Use them. + (desktop-read): Disable the autosave before loading the desktop, + and enable afterwards. (Bug#17351) + 2014-06-24 Stefan Monnier Fix some indentation problem with \; and pipes (bug#17842). diff --git a/lisp/desktop.el b/lisp/desktop.el index d420a6416a9..26d288bf9cd 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -174,11 +174,8 @@ For further details, see info node `(emacs)Saving Emacs Sessions'." :global t :group 'desktop (if desktop-save-mode - (when (and (integerp desktop-auto-save-timeout) - (> desktop-auto-save-timeout 0)) - (add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer)) - (remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) - (desktop-auto-save-cancel-timer))) + (desktop-auto-save-enable) + (desktop-auto-save-disable))) (defun desktop-save-mode-off () "Disable `desktop-save-mode'. Provided for use in hooks." @@ -219,9 +216,8 @@ Zero or nil means disable auto-saving due to idleness." (set-default symbol value) (ignore-errors (if (and (integerp value) (> value 0)) - (add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) - (remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) - (desktop-auto-save-cancel-timer)))) + (desktop-auto-save-enable value) + (desktop-auto-save-disable)))) :group 'desktop :version "24.4") @@ -1132,6 +1128,10 @@ Using it may cause conflicts. Use it anyway? " owner))))) (unless desktop-dirname (message "Desktop file in use; not loaded."))) (desktop-lazy-abort) + ;; Temporarily disable the autosave that will leave it + ;; disabled when loading the desktop fails with errors, + ;; thus not overwriting the desktop with broken contents. + (desktop-auto-save-disable) ;; Evaluate desktop buffer and remember when it was modified. (load (desktop-full-file-name) t t t) (setq desktop-file-modtime (nth 5 (file-attributes (desktop-full-file-name)))) @@ -1184,6 +1184,7 @@ Using it may cause conflicts. Use it anyway? " owner))))) (set-window-prev-buffers window nil) (set-window-next-buffers window nil)))) (setq desktop-saved-frameset nil) + (desktop-auto-save-enable) t)) ;; No desktop file found. (desktop-clear) @@ -1230,6 +1231,15 @@ directory DIRNAME." ;; Auto-Saving. (defvar desktop-auto-save-timer nil) +(defun desktop-auto-save-enable (&optional timeout) + (when (and (integerp (or timeout desktop-auto-save-timeout)) + (> (or timeout desktop-auto-save-timeout) 0)) + (add-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer))) + +(defun desktop-auto-save-disable () + (remove-hook 'window-configuration-change-hook 'desktop-auto-save-set-timer) + (desktop-auto-save-cancel-timer)) + (defun desktop-auto-save () "Save the desktop periodically. Called by the timer created in `desktop-auto-save-set-timer'." -- cgit v1.2.1 From 50f290812618d79c29a5c540bb65ee6e52dc548d Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 24 Jun 2014 20:48:10 -0400 Subject: * lisp/help-fns.el (describe-function-1): Check file-name is a string before calling help-fns--autoloaded-p. Fixes: debbugs:17564 --- lisp/ChangeLog | 5 +++++ lisp/help-fns.el | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5981c50af77..f0fecd95e9f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-25 Stefan Monnier + + * help-fns.el (describe-function-1): Check file-name is a string before + calling help-fns--autoloaded-p (bug#17564). + 2014-06-24 Juri Linkov * desktop.el (desktop-auto-save-enable) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 5b0739ed9ae..46b73701835 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -460,7 +460,7 @@ FILE is the file where FUNCTION was probably defined." (beg (if (and (or (byte-code-function-p def) (keymapp def) (memq (car-safe def) '(macro lambda closure))) - file-name + (stringp file-name) (help-fns--autoloaded-p function file-name)) (if (commandp def) "an interactive autoloaded " -- cgit v1.2.1 From a5128e3ded506a54619177d9a7c95d58463baace Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Wed, 25 Jun 2014 14:06:00 +0200 Subject: * calendar/todo-mode.el: Fix two bugs. (todo-insert-item--basic): If user cancels item insertion to another category before setting priority, show original category whether it is in the same or a different file. (todo-set-item-priority): After selecting category, instead of moving point to top, which extends an active region, restore it. --- lisp/ChangeLog | 9 +++++++++ lisp/calendar/todo-mode.el | 19 +++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f0fecd95e9f..d5583eef10e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2014-06-25 Stephen Berman + + * calendar/todo-mode.el: Fix two bugs. + (todo-insert-item--basic): If user cancels item insertion to + another category before setting priority, show original category + whether it is in the same or a different file. + (todo-set-item-priority): After selecting category, instead of + moving point to top, which extends an active region, restore it. + 2014-06-25 Stefan Monnier * help-fns.el (describe-function-1): Check file-name is a string before diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index ab2ab3e4cb8..1a54cc2c67b 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -1962,13 +1962,12 @@ their associated keys and their effects." ;; If user cancels before setting priority, restore ;; display. (unless item-added - (if ocat - (progn - (unless (equal cat ocat) - (todo-category-number ocat) - (todo-category-select)) - (and done-only (todo-toggle-view-done-only))) - (set-window-buffer (selected-window) (set-buffer obuf))) + (set-window-buffer (selected-window) (set-buffer obuf)) + (when ocat + (unless (equal cat ocat) + (todo-category-number ocat) + (todo-category-select)) + (and done-only (todo-toggle-view-done-only))) (goto-char opoint)) ;; If the todo items section is not visible when the ;; insertion command is called (either because only done @@ -2553,9 +2552,9 @@ meaning to raise or lower the item's priority by one." (goto-char (point-min)) (setq done (re-search-forward todo-done-string-start nil t)))) (let ((todo-show-with-done done)) - (todo-category-select) - ;; Keep top of category in view while setting priority. - (goto-char (point-min))))) + ;; Keep current item or top of moved to category in view + ;; while setting priority. + (save-excursion (todo-category-select))))) ;; Prompt for priority only when the category has at least one ;; todo item. (when (> maxnum 1) -- cgit v1.2.1 From 0a27804c807128d25509b59c82806b7fd9ad6bba Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 25 Jun 2014 13:20:08 -0400 Subject: * lisp/emacs-lisp/package.el (package-list-unsigned): New var. (package-desc-status): Obey it. Fixes: debbugs:17625 --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/package.el | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d5583eef10e..7a46cf11a15 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-25 Stefan Monnier + + * emacs-lisp/package.el (package-list-unsigned): New var (bug#17625). + (package-desc-status): Obey it. + 2014-06-25 Stephen Berman * calendar/todo-mode.el: Fix two bugs. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6985a2b58cc..6efe6c7135a 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -823,6 +823,8 @@ GnuPG keyring is located under \"gnupg\" in `package-user-dir'." sig)) (epg-context-result-for context 'verify))))) (if (null good-signatures) + ;; FIXME: Only signal an error if the signature is invalid, not if we + ;; simply lack the key needed to check the sig! (error "Failed to verify signature %s: %S" sig-file (mapcar #'epg-signature-to-string @@ -1651,6 +1653,9 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC." (defvar package-list-unversioned nil "If non-nil include packages that don't have a version in `list-package'.") +(defvar package-list-unsigned nil + "If non-nil, mention in the list which packages were installed w/o signature.") + (defun package-desc-status (pkg-desc) (let* ((name (package-desc-name pkg-desc)) (dir (package-desc-dir pkg-desc)) @@ -1671,9 +1676,8 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC." (dir ;One of the installed packages. (cond ((not (file-exists-p (package-desc-dir pkg-desc))) "deleted") - ((eq pkg-desc (cadr (assq name package-alist))) (if signed - "installed" - "unsigned")) + ((eq pkg-desc (cadr (assq name package-alist))) + (if (or (not package-list-unsigned) signed) "installed" "unsigned")) (t "obsolete"))) (t (let* ((ins (cadr (assq name package-alist))) @@ -1683,9 +1687,9 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC." (if (memq name package-menu--new-package-list) "new" "available")) ((version-list-< version ins-v) "obsolete") - ((version-list-= version ins-v) (if signed - "installed" - "unsigned")))))))) + ((version-list-= version ins-v) + (if (or (not package-list-unsigned) signed) + "installed" "unsigned")))))))) (defun package-menu--refresh (&optional packages keywords) "Re-populate the `tabulated-list-entries'. -- cgit v1.2.1 From e147461d406b00eb9b0281d35cf512e7a69f6601 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 25 Jun 2014 15:18:49 -0400 Subject: * src/puresize.h (BASE_PURESIZE): Bump by another 1K. Fixes: debbugs:17846 --- src/ChangeLog | 4 ++++ src/puresize.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index cd82e91c2dd..d5da7f7aa5b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-06-25 Glenn Morris + + * puresize.h (BASE_PURESIZE): Bump by another 1K. (Bug#17846) + 2014-06-21 Eli Zaretskii * indent.c (Fvertical_motion): Doc fix. diff --git a/src/puresize.h b/src/puresize.h index 1371fb3cea2..43a4d8c5c6a 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -40,7 +40,7 @@ along with GNU Emacs. If not, see . */ #endif #ifndef BASE_PURESIZE -#define BASE_PURESIZE (1701000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) +#define BASE_PURESIZE (1702000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) #endif /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ -- cgit v1.2.1 From b106c611ecab4c74b13344ecbb16107b6f43d232 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 25 Jun 2014 16:26:01 -0400 Subject: * src/puresize.h (BASE_PURESIZE): Add 1%, for safety. --- src/puresize.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/puresize.h b/src/puresize.h index 43a4d8c5c6a..ad591c75672 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -40,7 +40,7 @@ along with GNU Emacs. If not, see . */ #endif #ifndef BASE_PURESIZE -#define BASE_PURESIZE (1702000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) +#define BASE_PURESIZE (1720000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) #endif /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ -- cgit v1.2.1 From 79577a9f9bb8f0adb407b42c59e758aa1b65ea27 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 25 Jun 2014 16:48:41 -0400 Subject: ChangeLog fix --- src/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index d5da7f7aa5b..3e3c0cba183 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,6 @@ 2014-06-25 Glenn Morris - * puresize.h (BASE_PURESIZE): Bump by another 1K. (Bug#17846) + * puresize.h (BASE_PURESIZE): Increase a bit. (Bug#17846) 2014-06-21 Eli Zaretskii -- cgit v1.2.1 From 30a42a5bedfbfaab72da862826f43291fe771ce8 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 25 Jun 2014 17:59:28 -0400 Subject: * test/automated/package-test.el (package-test-update-listing) (package-test-update-archives, package-test-describe-package): Adjust tests according to new package-list-unsigned. --- test/ChangeLog | 6 ++++++ test/automated/package-test.el | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index f86084739af..3bd41a22964 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2014-06-25 Stefan Monnier + + * automated/package-test.el (package-test-update-listing) + (package-test-update-archives, package-test-describe-package): + Adjust tests according to new package-list-unsigned. + 2014-06-21 Fabián Ezequiel Gallina * automated/python-tests.el (python-util-strip-string-1): New test. diff --git a/test/automated/package-test.el b/test/automated/package-test.el index ee1920b5ef4..65e13438ea1 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el @@ -264,7 +264,7 @@ Must called from within a `tar-mode' buffer." (should (package-installed-p 'simple-single)) (switch-to-buffer "*Packages*") (goto-char (point-min)) - (should (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+unsigned" nil t)) + (should (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+installed" nil t)) (goto-char (point-min)) (should-not (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+\\(available\\|new\\)" nil t)) (kill-buffer buf)))) @@ -286,7 +286,7 @@ Must called from within a `tar-mode' buffer." ;; New version should be available and old version should be installed (goto-char (point-min)) (should (re-search-forward "^\\s-+simple-single\\s-+1.4\\s-+new" nil t)) - (should (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+unsigned" nil t)) + (should (re-search-forward "^\\s-+simple-single\\s-+1.3\\s-+installed" nil t)) (goto-char (point-min)) (should (re-search-forward "^\\s-+new-pkg\\s-+1.0\\s-+\\(available\\|new\\)" nil t)) @@ -317,7 +317,7 @@ Must called from within a `tar-mode' buffer." (with-fake-help-buffer (describe-package 'simple-single) (goto-char (point-min)) - (should (search-forward "simple-single is an unsigned package." nil t)) + (should (search-forward "simple-single is an installed package." nil t)) (should (search-forward (format "Status: Installed in `%s/' (unsigned)." (expand-file-name "simple-single-1.3" package-user-dir)) -- cgit v1.2.1 From 83d208a5dd293caae48beb9d36dd45529375631a Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 26 Jun 2014 07:53:37 +0800 Subject: Fix a few packages to work with nil tab-stop-list * indent.el (indent-accumulate-tab-stops): New function. * textmodes/picture.el (picture-set-tab-stops): * ruler-mode.el (ruler-mode-mouse-add-tab-stop) (ruler-mode-ruler): Fix to work with nil tab-stop-list. * progmodes/asm-mode.el (asm-calculate-indentation): Use indent-next-tab-stop. --- lisp/ChangeLog | 11 +++++++++++ lisp/indent.el | 7 +++++++ lisp/progmodes/asm-mode.el | 2 +- lisp/ruler-mode.el | 7 ++++--- lisp/textmodes/picture.el | 3 ++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7a46cf11a15..386e0660c5f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2014-06-25 Leo Liu + + * textmodes/picture.el (picture-set-tab-stops): + * ruler-mode.el (ruler-mode-mouse-add-tab-stop) + (ruler-mode-ruler): Fix to work with nil tab-stop-list. + + * progmodes/asm-mode.el (asm-calculate-indentation): Use + indent-next-tab-stop. + + * indent.el (indent-accumulate-tab-stops): New function. + 2014-06-25 Stefan Monnier * emacs-lisp/package.el (package-list-unsigned): New var (bug#17625). diff --git a/lisp/indent.el b/lisp/indent.el index 7df927ff808..20820701b3b 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -677,6 +677,13 @@ If PREV is non-nil, return the previous one instead." (if (<= column last) -1 (/ (- column last 1) step)) (1+ (/ (- column last) step))))))))) +(defun indent-accumulate-tab-stops (limit) + "Get a list of tab stops before LIMIT (inclusive)." + (let ((tab 0) (tab-stops)) + (while (<= (setq tab (indent-next-tab-stop tab)) limit) + (push tab tab-stops)) + (nreverse tab-stops))) + (defun tab-to-tab-stop () "Insert spaces or tabs to next defined tab-stop column. The variable `tab-stop-list' is a list of columns at which there are tab stops. diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el index ab7612082d5..3532b4a03f1 100644 --- a/lisp/progmodes/asm-mode.el +++ b/lisp/progmodes/asm-mode.el @@ -172,7 +172,7 @@ Special commands: ;; Simple `;' comments go to the comment-column. (and (looking-at "\\s<\\(\\S<\\|\\'\\)") comment-column) ;; The rest goes at the first tab stop. - (or (car tab-stop-list) tab-width))) + (or (indent-next-tab-stop 0)))) (defun asm-colon () "Insert a colon; if it follows a label, delete the label's indentation." diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el index 9e32a2f5c64..bcd9c5463a1 100644 --- a/lisp/ruler-mode.el +++ b/lisp/ruler-mode.el @@ -477,8 +477,9 @@ START-EVENT is the mouse click event." (not (member ts tab-stop-list)) (progn (message "Tab stop set to %d" ts) - (setq tab-stop-list (sort (cons ts tab-stop-list) - #'<))))))))) + (when (null tab-stop-list) + (setq tab-stop-list (indent-accumulate-tab-stops (1- ts)))) + (setq tab-stop-list (sort (cons ts tab-stop-list) #'<))))))))) (defun ruler-mode-mouse-del-tab-stop (start-event) "Delete tab stop at the graduation where the mouse pointer is on. @@ -754,7 +755,7 @@ Optional argument PROPS specifies other text properties to apply." i (1+ i) 'help-echo ruler-mode-fill-column-help-echo ruler)) ;; Show the `tab-stop-list' markers. - ((and ruler-mode-show-tab-stops (member j tab-stop-list)) + ((and ruler-mode-show-tab-stops (= j (indent-next-tab-stop (1- j)))) (aset ruler i ruler-mode-tab-stop-char) (put-text-property i (1+ i) 'face 'ruler-mode-tab-stop diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index b11b773dee1..94d02bebb6a 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -418,7 +418,8 @@ stops computed are displayed in the minibuffer with `:' at each stop." (save-excursion (let (tabs) (if arg - (setq tabs (default-value 'tab-stop-list)) + (setq tabs (or (default-value 'tab-stop-list) + (indent-accumulate-tab-stops (window-width)))) (let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]"))) (beginning-of-line) (let ((bol (point))) -- cgit v1.2.1 From 92f1664d5e0e9f99093cde778ac18756cdc72bcf Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 25 Jun 2014 20:34:54 -0400 Subject: ChangeLog fixes. Not sure how M-x authors missed these so far... --- lisp/ChangeLog | 14 ++++++++------ lisp/ChangeLog.16 | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 386e0660c5f..1c0f4b03a99 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -10686,7 +10686,7 @@ 2013-07-07 Michael Kifer - * ediff.el (ediff-version): Version update. + * vc/ediff.el (ediff-version): Version update. (ediff-files-command, ediff3-files-command, ediff-merge-command) (ediff-merge-with-ancestor-command, ediff-directories-command) (ediff-directories3-command, ediff-merge-directories-command) @@ -10694,19 +10694,21 @@ All are command-line interfaces to ediff: to facilitate calling Emacs with the appropriate ediff functions invoked. - * viper-cmd.el (viper-del-forward-char-in-insert): New function. + * emulation/viper-cmd.el (viper-del-forward-char-in-insert): + New function. (viper-save-kill-buffer): Check if buffer is modified. - * viper.el (viper-version): Version update. + * emulation/viper.el (viper-version): Version update. (viper-emacs-state-mode-list): Add egg-status-buffer-mode. 2013-07-07 Stefan Monnier * faces.el (tty-run-terminal-initialization): Run new tty-setup-hook. - * viper-cmd.el (viper-envelop-ESC-key): Remove function. + * emulation/viper-cmd.el (viper-envelop-ESC-key): Remove function. (viper-intercept-ESC-key): Simplify. - * viper-keym.el (viper-ESC-key): Make it a constant, don't use kbd. - * viper.el (viper--tty-ESC-filter, viper--lookup-key) + * emulation/viper-keym.el (viper-ESC-key): Make it a constant, + don't use kbd. + * emulation/viper.el (viper--tty-ESC-filter, viper--lookup-key) (viper-catch-tty-ESC, viper-uncatch-tty-ESC) (viper-setup-ESC-to-escape): New functions. (viper-go-away, viper-set-hooks): Call viper-setup-ESC-to-escape. diff --git a/lisp/ChangeLog.16 b/lisp/ChangeLog.16 index 534f91f61ce..2e8c6df24a6 100644 --- a/lisp/ChangeLog.16 +++ b/lisp/ChangeLog.16 @@ -8501,7 +8501,7 @@ 2012-07-25 Jay Belanger - * calc-alg.el (math-simplify-divide): Don't cross multiply + * calc/calc-alg.el (math-simplify-divide): Don't cross multiply in an equation when the lhs is a variable. 2012-07-24 Julien Danjou -- cgit v1.2.1 From d2301b5d805d603547b36d96e3a09e6d8124a6d7 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 25 Jun 2014 20:36:58 -0400 Subject: authors.el: Add some renamed/moved files * lisp/emacs-lisp/authors.el (authors-valid-file-names) (authors-renamed-files-alist): Additions. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/authors.el | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1c0f4b03a99..5a716312f0e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-26 Glenn Morris + + * emacs-lisp/authors.el (authors-valid-file-names) + (authors-renamed-files-alist): Additions. + 2014-06-25 Leo Liu * textmodes/picture.el (picture-set-tab-stops): diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el index dfc60512c61..3a552c6c1ef 100644 --- a/lisp/emacs-lisp/authors.el +++ b/lisp/emacs-lisp/authors.el @@ -622,11 +622,12 @@ Changes to files in this list are not listed.") "temacs.opt" "descrip.mms" "compile.com" "link.com" "compact.el" "fadr.el" "calc/calc-maint.el" + "emacs-lisp/cl-specs.el" "emacs-lisp/eieio-comp.el" "erc-hecomplete.el" "eshell/esh-maint.el" "language/persian.el" - "meese.el" "iswitchb.el" + "ledit.el" "meese.el" "iswitchb.el" "longlines.el" "mh-exec.el" "mh-init.el" "mh-customize.el" "net/zone-mode.el" "xesam.el" "term/mac-win.el" "sup-mouse.el" @@ -647,6 +648,7 @@ Changes to files in this list are not listed.") "dns-mode.el" "run-at-time.el" "gnus-encrypt.el" "sha1-el.el" "gnus-gl.el" "gnus.sum.el" "proto-stream.el" "color.el" "color-lab.el" "eww.el" "shr-color.el" "shr.el" "earcon.el" "gnus-audio.el" "encrypt.el" + "format-spec.el" "gnus-move.el" ;; doc "getopt.c" "texindex.c" "news.texi" "vc.texi" "vc2-xtra.texi" "back.texi" "vol1.texi" "vol2.texi" "elisp-covers.texi" "two.el" @@ -752,7 +754,11 @@ in the repository.") ("progmodes/octave-inf.el" . "octave.el") ("progmodes/octave-mod.el" . "octave.el") ;; Obsolete. + ("emacs-lisp/assoc.el" . "assoc.el") + ("emacs-lisp/cust-print.el" . "cust-print.el") + ("mail/mailpost.el" . "mailpost.el") ("play/bruce.el" . "bruce.el") + ("play/yow.el" . "yow.el") ("patcomp.el" . "patcomp.el") ;; From lisp to etc/forms. ("forms-d2.el" . "forms-d2.el") @@ -771,6 +777,7 @@ in the repository.") ("build-install" . "build-ins.in") ("build-install.in" . "build-ins.in") ("unidata/Makefile" . "unidata/Makefile.in") + ("mac/uvs.el" . "unidata/uvs.el") ;; Moved from top to etc/ ("CONTRIBUTE" . "CONTRIBUTE") ("FTP" . "FTP") -- cgit v1.2.1 From 1d8bea62832ea227d154995d2d52bd2093d4d722 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 26 Jun 2014 12:00:56 +0800 Subject: * lisp/url/url-handlers.el (url-http-parse-response): Remove unused autoload. (url-insert-file-contents): Condition on url-http-response-status for the HTTP/S specific part. * lisp/url/url-http.el (url-http-end-of-headers): Remove duplicate defvar. Fixes: debbugs:17549 --- lisp/url/ChangeLog | 8 ++++++++ lisp/url/url-handlers.el | 16 ++++++++++------ lisp/url/url-http.el | 1 - 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 408f659681f..4880bfea30b 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,11 @@ +2014-06-26 Leo Liu + + * url-http.el (url-http-end-of-headers): Remove duplicate defvar. + + * url-handlers.el (url-http-parse-response): Remove unused autoload. + (url-insert-file-contents): Condition on url-http-response-status + for the HTTP/S specific part. (Bug#17549) + 2014-05-09 Michael Albinus * url-handlers.el (url-file-handler-load-in-progress): New defvar. diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index b0f01123bbb..5a274c12e31 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -33,7 +33,6 @@ (autoload 'url-expand-file-name "url-expand" "Convert url to a fully specified url, and canonicalize it.") (autoload 'mm-dissect-buffer "mm-decode" "Dissect the current buffer and return a list of MIME handles.") (autoload 'url-scheme-get-property "url-methods" "Get property of a URL SCHEME.") -(autoload 'url-http-parse-response "url-http" "Parse just the response code.") ;; Always used after mm-dissect-buffer and defined in the same file. (declare-function mm-save-part-to-file "mm-decode" (handle file)) @@ -298,17 +297,21 @@ They count bytes from the beginning of the body." (insert data)) (list (length data) charset))) +(defconst url-http-codes) + ;;;###autoload (defun url-insert-file-contents (url &optional visit beg end replace) (let ((buffer (url-retrieve-synchronously url))) (unless buffer (signal 'file-error (list url "No Data"))) (with-current-buffer buffer - (let ((response (url-http-parse-response))) - (if (and (>= response 200) (< response 300)) - (goto-char (point-min)) - (let ((desc (buffer-substring-no-properties (1+ (point)) - (line-end-position)))) + ;; XXX: This is HTTP/S specific and should be moved to url-http + ;; instead. See http://debbugs.gnu.org/17549. + (when (bound-and-true-p url-http-response-status) + (unless (and (>= url-http-response-status 200) + (< url-http-response-status 300)) + (let ((desc (nth 2 (assq url-http-response-status url-http-codes)))) (kill-buffer buffer) + ;; Signal file-error per http://debbugs.gnu.org/16733. (signal 'file-error (list url desc)))))) (if visit (setq buffer-file-name url)) (save-excursion @@ -323,6 +326,7 @@ They count bytes from the beginning of the body." ;; usual heuristic/rules that we apply to files. (decode-coding-inserted-region start (point) url visit beg end replace)) (list url (car size-and-charset)))))) + (put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents) (defun url-file-name-completion (url directory &optional predicate) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index ac2e1403d03..dcb86689ca9 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -47,7 +47,6 @@ (defvar url-http-response-version) (defvar url-http-target-url) (defvar url-http-transfer-encoding) -(defvar url-http-end-of-headers) (defvar url-show-status) (require 'url-gw) -- cgit v1.2.1 From cb6ce5eee811b547506cf37bb9da78ff908a82ff Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 26 Jun 2014 12:27:18 +0800 Subject: Fix last change --- lisp/url/url-handlers.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index 5a274c12e31..0572e6eec8b 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el @@ -297,7 +297,7 @@ They count bytes from the beginning of the body." (insert data)) (list (length data) charset))) -(defconst url-http-codes) +(defvar url-http-codes) ;;;###autoload (defun url-insert-file-contents (url &optional visit beg end replace) -- cgit v1.2.1 From c269730462ab74967ed2cde73da7c74545a2118c Mon Sep 17 00:00:00 2001 From: Luke Lee Date: Thu, 26 Jun 2014 13:47:33 +0800 Subject: HideIfDef mode bug fixes and enhancements. This is #2 of 3 patches based on the completed work posted on http://www.emacswiki.org/emacs/HideIfDef. - Supporting argumented macro expansion. - Stringification, tokenization and concatenation of strings and tokens. - Add functions to find defines and parse argumented macros into a macro tree containing macro name, formal parameters and macro body. - On macro evaluation, macros will be applied with actual parameters and then got expanded recursively. - Merge main trunk changes * lisp/progmodes/hideif.el (hif-string-to-number): Merge changes from main trunk. (hif-simple-token-only, hif-tokenize): Commentted in detail mainly for performance enhancements. (hif-parse-if-exp): Rename to `hif-parse-exp'. Enhanced for macro expansion. (hif-factor, hif-string-concatenation, intern-safe): Support string concatenation and argumented macro expansion. (hif-if-valid-identifier-p, hif-define-operator, hif-flatten) (hif-expand-token-list, hif-get-argument-list, hif-define-macro) (hif-delimit, hif-macro-supply-arguments, hif-invoke, hif-canonicalize) (hif-canonicalize-tokens, hif-looking-at-elif, hif-place-macro-invocation) (hif-parse-macro-arglist): Mostly new functions for supporting argumented macro expansion. (hif-string-concatenation, hif-stringify, hif-token-concat) (hif-token-stringification, hif-token-concatenation): Stringify and concatentation. (hif-find-next-relevant): Fix comments (hif-ifdef-to-endif, hif-looking-at-elif, hif-hide-line): Bug fix for some cases involving #elif. (hif-find-define, hif-add-new-defines): New functions for automatically scanning of defined symbols. (hide-ifdef-guts): Fix for auto defined symbol scanning. (hide-ifdef-undef): Fix behavior to match CPP. --- lisp/progmodes/hideif.el | 623 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 577 insertions(+), 46 deletions(-) diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index 39ad676f593..b0ca4f0cdd0 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -36,6 +36,8 @@ ;; ;; Hide-ifdef suppresses the display of code that the preprocessor wouldn't ;; pass through. Support complete C/C++ expression and precedence. +;; It will automatically scans for new #define symbols and macros on the way +;; parsing. ;; ;; The hidden code is marked by ellipses (...). Be ;; cautious when editing near ellipses, since the hidden text is @@ -97,11 +99,12 @@ ;; Extensively modified by Daniel LaLiberte (while at Gould). ;; ;; Extensively modified by Luke Lee in 2013 to support complete C expression -;; evaluation. +;; evaluation and argumented macro expansion. ;;; Code: (require 'cc-mode) +(require 'cl-lib) (defgroup hide-ifdef nil "Hide selected code within `ifdef'." @@ -133,6 +136,9 @@ :group 'hide-ifdef :version "23.1") +(defcustom hide-ifdef-exclude-define-regexp nil + "Ignore #define names if those names match this exclusion pattern." + :type 'string) (defvar hide-ifdef-mode-submap ;; Set up the submap that goes after the prefix key. @@ -356,12 +362,32 @@ that form should be displayed.") ;;; The code that understands what ifs and ifdef in files look like. (defconst hif-cpp-prefix "\\(^\\|\r\\)[ \t]*#[ \t]*") +(defconst hif-ifxdef-regexp (concat hif-cpp-prefix "if\\(n\\)?def")) (defconst hif-ifndef-regexp (concat hif-cpp-prefix "ifndef")) (defconst hif-ifx-regexp (concat hif-cpp-prefix "if\\(n?def\\)?[ \t]+")) +(defconst hif-elif-regexp (concat hif-cpp-prefix "elif")) (defconst hif-else-regexp (concat hif-cpp-prefix "else")) (defconst hif-endif-regexp (concat hif-cpp-prefix "endif")) (defconst hif-ifx-else-endif-regexp - (concat hif-ifx-regexp "\\|" hif-else-regexp "\\|" hif-endif-regexp)) + (concat hif-ifx-regexp "\\|" hif-elif-regexp "\\|" hif-else-regexp "\\|" + hif-endif-regexp)) +(defconst hif-macro-expr-prefix-regexp + (concat hif-cpp-prefix "\\(if\\(n?def\\)?\\|elif\\|define\\)[ \t]+")) + +(defconst hif-white-regexp "[ \t]*") +(defconst hif-define-regexp + (concat hif-cpp-prefix "\\(define\\|undef\\)")) +(defconst hif-id-regexp + (concat "[[:alpha:]_][[:alnum:]_]*")) +(defconst hif-macroref-regexp + (concat hif-white-regexp "\\(" hif-id-regexp "\\)" hif-white-regexp + "\\(" + "(" hif-white-regexp + "\\(" hif-id-regexp "\\)?" hif-white-regexp + "\\(" "," hif-white-regexp hif-id-regexp hif-white-regexp "\\)*" + "\\(\\.\\.\\.\\)?" hif-white-regexp + ")" + "\\)?" )) ;; Used to store the current token and the whole token list during parsing. ;; Only bound dynamically. @@ -397,7 +423,12 @@ that form should be displayed.") ("/" . hif-divide) ("%" . hif-modulo) ("?" . hif-conditional) - (":" . hif-colon))) + (":" . hif-colon) + ("," . hif-comma) + ("#" . hif-stringify) + ("..." . hif-etc))) + +(defconst hif-valid-token-list (mapcar 'cdr hif-token-alist)) (defconst hif-token-regexp (concat (regexp-opt (mapcar 'car hif-token-alist)) @@ -407,10 +438,29 @@ that form should be displayed.") (defconst hif-string-literal-regexp "\\(\"\\(?:[^\"\\]\\|\\\\.\\)*\"\\)") +(defun hif-string-to-number (string &optional base) + "Like `string-to-number', but it understands non-decimal floats." + (if (or (not base) (= base 10)) + (string-to-number string base) + (let* ((parts (split-string string "\\." t "[ \t]+")) + (frac (cadr parts)) + (fraclen (length frac)) + (quot (expt (if (zerop fraclen) + base + (* base 1.0)) fraclen))) + (/ (string-to-number (concat (car parts) frac) base) quot)))) + +;; The dynamic binding variable `hif-simple-token-only' is shared only by +;; `hif-tokenize' and `hif-find-define'. The purpose is to prevent `hif-tokenize' +;; from returning one more value to indicate a simple token is scanned. This help +;; speeding up macro evaluation on those very simple cases like integers or +;; literals. +;; Check the long comments before `hif-find-define' for more details. [lukelee] (defun hif-tokenize (start end) "Separate string between START and END into a list of tokens." (let ((token-list nil)) + (setq hif-simple-token-only t) (with-syntax-table hide-ifdef-syntax-table (save-excursion (goto-char start) @@ -423,8 +473,10 @@ that form should be displayed.") ((looking-at hif-string-literal-regexp) (push (substring-no-properties (match-string 1)) token-list) (goto-char (match-end 0))) + ((looking-at hif-token-regexp) - (let ((token (buffer-substring (point) (match-end 0)))) + (let ((token (buffer-substring-no-properties + (point) (match-end 0)))) (goto-char (match-end 0)) ;; (message "token: %s" token) (sit-for 1) (push @@ -432,22 +484,22 @@ that form should be displayed.") (if (string-equal token "defined") 'hif-defined) ;; TODO: ;; 1. postfix 'l', 'll', 'ul' and 'ull' - ;; 2. floating number formats - ;; 3. hexadecimal/octal floats - ;; 4. 098 is interpreted as octal conversion error - ;; FIXME: string-to-number does not convert hex floats + ;; 2. floating number formats (like 1.23e4) + ;; 3. 098 is interpreted as octal conversion error (if (string-match "0x\\([0-9a-fA-F]+\\.?[0-9a-fA-F]*\\)" token) - (string-to-number (match-string 1 token) 16)) ;; hex - ;; FIXME: string-to-number does not convert octal floats + (hif-string-to-number (match-string 1 token) 16)) ;; hex (if (string-match "\\`0[0-9]+\\(\\.[0-9]+\\)?\\'" token) - (string-to-number token 8)) ;; octal + (hif-string-to-number token 8)) ;; octal (if (string-match "\\`[1-9][0-9]*\\(\\.[0-9]+\\)?\\'" token) (string-to-number token)) ;; decimal - (intern token)) + (prog1 (intern token) + (setq hif-simple-token-only nil))) token-list))) + (t (error "Bad #if expression: %s" (buffer-string))))))) + (nreverse token-list))) ;;------------------------------------------------------------------------ @@ -482,9 +534,115 @@ that form should be displayed.") "Pop the next token from token-list into the let variable `hif-token'." (setq hif-token (pop hif-token-list))) -(defun hif-parse-if-exp (token-list) - "Parse the TOKEN-LIST. Return translated list in prefix form." - (let ((hif-token-list token-list)) +(defsubst hif-if-valid-identifier-p (id) + (not (or (numberp id) + (stringp id)))) + +(defun hif-define-operator (tokens) + "`Upgrade' hif-define xxx to '(hif-define xxx)' so that it won't be +subsitituted" + (let ((result nil) + (tok nil)) + (while (setq tok (pop tokens)) + (push + (if (eq tok 'hif-defined) + (progn + (setq tok (cadr tokens)) + (if (eq (car tokens) 'hif-lparen) + (if (and (hif-if-valid-identifier-p tok) + (eq (caddr tokens) 'hif-rparen)) + (setq tokens (cdddr tokens)) + (error "#define followed by non-identifier: %S" tok)) + (setq tok (car tokens) + tokens (cdr tokens)) + (unless (hif-if-valid-identifier-p tok) + (error "#define followed by non-identifier: %S" tok))) + (list 'hif-defined 'hif-lparen tok 'hif-rparen)) + tok) + result)) + (nreverse result))) + +(defun hif-flatten (l) + "Flatten a tree" + (apply #'nconc + (mapcar (lambda (x) (if (listp x) + (hif-flatten x) + (list x))) l))) + +(defun hif-expand-token-list (tokens &optional macroname expand_list) + "Perform expansion till everything expanded. No self-reference expansion. + EXPAND_LIST is the list of macro names currently being expanded." + (catch 'self-referencing + (let ((expanded nil) + (remains (hif-define-operator + (hif-token-concatenation + (hif-token-stringification tokens)))) + tok rep) + (if macroname + (setq expand_list (cons macroname expand_list))) + ;; Expanding all tokens till list exhausted + (while (setq tok (pop remains)) + (if (memq tok expand_list) + ;; For self-referencing tokens, don't expand it + (throw 'self-referencing tokens)) + (push + (cond + ((or (memq tok hif-valid-token-list) + (numberp tok) + (stringp tok)) + tok) + + ((setq rep (hif-lookup tok)) + (if (and (listp rep) + (eq (car rep) 'hif-define-macro)) ;; a defined macro + ;; Recursively expand it + (if (cadr rep) ;; Argument list is not nil + (if (not (eq (car remains) 'hif-lparen)) + ;; No argument, no invocation + tok + ;; Argumented macro, get arguments and invoke it. + ;; Dynamically bind hif-token-list and hif-token + ;; for hif-macro-supply-arguments + (let* ((hif-token-list (cdr remains)) + (hif-token nil) + (parmlist (mapcar 'hif-expand-token-list + (hif-get-argument-list + tok))) + (result + (hif-expand-token-list + (hif-macro-supply-arguments tok parmlist) + tok expand_list))) + (setq remains (cons hif-token hif-token-list)) + result)) + ;; Argument list is nil, direct expansion + (setq rep (hif-expand-token-list + (caddr rep) ;; Macro's token list + tok expand_list)) + ;; Replace all remaining references immediately + (setq remains (substitute tok rep remains)) + rep) + ;; Lookup tok returns an atom + rep)) + + ;;[2013-10-22 16:06:12 +0800] Must keep the token, removing + ;; this token might results in an incomplete expression that + ;; cannot be parsed further. + ;;((= 1 (hif-defined tok)) ;; defined (hif-defined tok)=1, + ;; ;;but empty (hif-lookup tok)=nil, thus remove this token + ;; (setq remains (delete tok remains)) + ;; nil) + + (t ;; Usual IDs + tok)) + + expanded)) + + (hif-flatten (nreverse expanded))))) + +(defun hif-parse-exp (token-list &optional macroname) + "Parse the TOKEN-LIST. Return translated list in prefix form. MACRONAME +is applied when invoking macros to prevent self-referencing macros." + (let ((hif-token-list (hif-expand-token-list token-list macroname))) (hif-nexttoken) (prog1 (and hif-token @@ -574,7 +732,8 @@ that form should be displayed.") "Parse a comp-expr : logshift | comp-expr `<'|`>'|`>='|`<=' logshift." (let ((result (hif-logshift-expr)) (comp-token nil)) - (while (memq hif-token '(hif-greater hif-less hif-greater-equal hif-less-equal)) + (while (memq hif-token '(hif-greater hif-less hif-greater-equal + hif-less-equal)) (setq comp-token hif-token) (hif-nexttoken) (setq result (list comp-token result (hif-logshift-expr)))) @@ -613,7 +772,8 @@ that form should be displayed.") result)) (defun hif-factor () - "Parse a factor: '!' factor | '~' factor | '(' expr ')' | 'defined(' id ')' | 'id(parmlist)' | strings | id." + "Parse a factor: '!' factor | '~' factor | '(' expr ')' | +'defined(' id ')' | 'id(parmlist)' | strings | id." (cond ((eq hif-token 'hif-not) (hif-nexttoken) @@ -646,6 +806,8 @@ that form should be displayed.") ((numberp hif-token) (prog1 hif-token (hif-nexttoken))) + ((stringp hif-token) + (hif-string-concatenation)) ;; Unary plus/minus. ((memq hif-token '(hif-minus hif-plus)) @@ -653,10 +815,91 @@ that form should be displayed.") (t ; identifier (let ((ident hif-token)) - (if (memq ident '(or and)) - (error "Error: missing identifier")) (hif-nexttoken) - `(hif-lookup (quote ,ident)))))) + (if (eq hif-token 'hif-lparen) + (hif-place-macro-invocation ident) + `(hif-lookup (quote ,ident))))))) + +(defun hif-get-argument-list (ident) + (let ((nest 0) + (parmlist nil) ;; A "token" list of parameters, will later be parsed + (parm nil)) + + (while (or (not (eq (hif-nexttoken) 'hif-rparen)) + (/= nest 0)) + (if (eq (car (last parm)) 'hif-comma) + (setq parm nil)) + (cond + ((eq hif-token 'hif-lparen) + (setq nest (1+ nest))) + ((eq hif-token 'hif-rparen) + (setq nest (1- nest))) + ((and (eq hif-token 'hif-comma) + (= nest 0)) + (push (nreverse parm) parmlist) + (setq parm nil))) + (push hif-token parm)) + + (push (nreverse parm) parmlist) ;; Okay even if parm is nil + (hif-nexttoken) ;; Drop the hif-rparen, get next token + (nreverse parmlist))) + +(defun hif-place-macro-invocation (ident) + (let ((parmlist (hif-get-argument-list ident))) + `(hif-invoke (quote ,ident) (quote ,parmlist)))) + +(defun hif-string-concatenation () + "Parse concatenated strings: string | strings string" + (let ((result (substring-no-properties hif-token))) + (while (stringp (hif-nexttoken)) + (setq result (concat + (substring result 0 -1) ; remove trailing '"' + (substring hif-token 1)))) ; remove leading '"' + result)) + +(defun hif-define-macro (parmlist token-body) + "A marker for defined macro with arguments, cannot be evaluated alone with +no parameters inputed." + ;;TODO: input arguments at run time, use minibuffer to query all arguments + (error + "Argumented macro cannot be evaluated without passing any parameter.")) + +(defun hif-stringify (a) + "Stringify a number, string or symbol." + (cond + ((numberp a) + (number-to-string a)) + ((atom a) + (symbol-name a)) + ((stringp a) + (concat "\"" a "\"")) + (t + (error "Invalid token to stringify")))) + +(defun intern-safe (str) + (if (stringp str) + (intern str))) + +(defun hif-token-concat (a b) + "Concatenate two tokens into a longer token, currently support only simple +token concatenation. Also support weird (but valid) token concatenation like +'>' ## '>' becomes '>>'. Here we take care only those that can be evaluated +during preprocessing time and ignore all those that can only be evaluated at +C(++) runtime (like '++', '--' and '+='...)." + (if (or (memq a hif-valid-token-list) + (memq b hif-valid-token-list)) + (let* ((ra (car (rassq a hif-token-alist))) + (rb (car (rassq b hif-token-alist))) + (result (and ra rb + (cdr (assoc (concat ra rb) hif-token-alist))))) + (or result + ;;(error "Invalid token to concatenate") + (error "Concatenating \"%s\" and \"%s\" does not give a valid \ +preprocessing token." + (or ra (symbol-name a)) + (or rb (symbol-name b))))) + (intern-safe (concat (hif-stringify a) + (hif-stringify b))))) (defun hif-mathify (val) "Treat VAL as a number: if it's t or nil, use 1 or 0." @@ -719,23 +962,157 @@ that form should be displayed.") (setq result (funcall hide-ifdef-evaluator e)))) result)) +(defun hif-token-stringification (l) + "Scan token list for 'hif-stringify' ('#') token and stringify the next +token." + (let (result) + (while l + (push (if (eq (car l) 'hif-stringify) + (prog1 + (if (cadr l) + (hif-stringify (cadr l)) + (error "No token to stringify")) + (setq l (cdr l))) + (car l)) + result) + (setq l (cdr l))) + (nreverse result))) + +(defun hif-token-concatenation (l) + "Scan token list for 'hif-token-concat' ('##') token and concatenate two +tokens." + (let ((prev nil) + result) + (while l + (while (eq (car l) 'hif-token-concat) + (unless prev + (error "No token before ## to concatenate")) + (unless (cdr l) + (error "No token after ## to concatenate")) + (setq prev (hif-token-concat prev (cadr l))) + (setq l (cddr l))) + (if prev + (setq result (append result (list prev)))) + (setq prev (car l) + l (cdr l))) + (if prev + (append result (list prev)) + result))) + +(defun hif-delimit (lis atom) + (nconc (mapcan (lambda (l) (list l atom)) + (butlast lis)) + (last lis))) + +;; Perform token replacement: +(defun hif-macro-supply-arguments (macro-name actual-parms) + "Expand a macro call, replace ACTUAL-PARMS in the macro body." + (let* ((SA (assoc macro-name hide-ifdef-env)) + (macro (and SA + (cdr SA) + (eq (cadr SA) 'hif-define-macro) + (cddr SA))) + (formal-parms (and macro (car macro))) + (macro-body (and macro (cadr macro))) + (hide-ifdef-local-env nil) ; dynamic binding local table + actual-count + formal-count + actual + formal + etc) + + (when (and actual-parms formal-parms macro-body) + ;; For each actual parameter, evaluate each one and associate it + ;; with the associated actual parameter, put it into local table and finally + ;; evaluate the macro body. + (if (setq etc (eq (car formal-parms) 'hif-etc)) + ;; Take care of 'hif-etc first. Prefix 'hif-comma back if needed. + (setq formal-parms (cdr formal-parms))) + (setq formal-count (length formal-parms) + actual-count (length actual-parms)) + + (if (> formal-count actual-count) + (error "Too few parmameter for macro %S" macro-name) + (if (< formal-count actual-count) + (or etc + (error "Too many parameters for macro %S" macro-name)))) + + ;; Perform token replacement on the macro-body on the parameters + (while (setq formal (pop formal-parms)) + ;; Prevent repetitive substitutation, thus cannot use 'subst' + ;; for example: + ;; #define mac(a,b) (a+b) + ;; #define testmac mac(b,y) + ;; testmac should expand to (b+y): replace of argument a and b + ;; occurs simultaneously, not sequentially. If sequentially, + ;; according to the argument order, it will become: + ;; 1. formal parm #1 'a' replaced by actual parm 'b', thus (a+b) + ;; becomes (b+b) + ;; 2. formal parm #2 'b' replaced by actual parm 'y', thus (b+b) + ;; becomes (y+y). + (setq macro-body + ;; Unlike 'subst', 'substitute' replace only the top level + ;; instead of the whole tree; more importantly, it's not + ;; destructive. + (substitute (if (and etc (null formal-parms)) + (hif-delimit actual-parms 'hif-comma) + (car actual-parms)) + formal macro-body)) + (setq actual-parms (cdr actual-parms))) + + ;; Replacement completed, flatten the whole token list + (setq macro-body (hif-flatten macro-body)) + + ;; Stringification and token concatenation happens here + (hif-token-concatenation (hif-token-stringification macro-body))))) + +(defun hif-invoke (macro-name actual-parms) + "Invoke a macro by first expanding it, then reparse the macro-body, +finally invoke the macro." + ;; Reparse the macro body and evaluate it + (funcall hide-ifdef-evaluator + (hif-parse-exp + (hif-macro-supply-arguments macro-name actual-parms) + macro-name))) ;;;----------- end of parser ----------------------- -(defun hif-canonicalize () - "When at beginning of #ifX, return a Lisp expression for its condition." +(defun hif-canonicalize-tokens (regexp) ;; for debugging + "Return the expanded result of the scanned tokens." (save-excursion - (let ((negate (looking-at hif-ifndef-regexp))) - (re-search-forward hif-ifx-regexp) - (let* ((tokens (hif-tokenize (point) - (progn (hif-end-of-line) (point)))) - (expr (hif-parse-if-exp tokens))) - ;; (message "hif-canonicalized: %s" expr) - (if negate - (list 'hif-not expr) - expr))))) - + (re-search-forward regexp) + (let* ((curr-regexp (match-string 0)) + (defined (string-match hif-ifxdef-regexp curr-regexp)) + (negate (and defined + (string= (match-string 2 curr-regexp) "n"))) + (hif-simple-token-only nil) ;; Dynamic binding var for `hif-tokenize' + (tokens (hif-tokenize (point) + (progn (hif-end-of-line) (point))))) + (if defined + (setq tokens (list 'hif-defined tokens))) + (if negate + (setq tokens (list 'hif-not tokens))) + tokens))) + +(defun hif-canonicalize (regexp) + "When at beginning of `regexp' (i.e. #ifX), return a Lisp expression for +its condition." + (let ((case-fold-search nil)) + (save-excursion + (re-search-forward regexp) + (let* ((curr-regexp (match-string 0)) + (defined (string-match hif-ifxdef-regexp curr-regexp)) + (negate (and defined + (string= (match-string 2 curr-regexp) "n"))) + (hif-simple-token-only nil) ;; Dynamic binding for `hif-tokenize' + (tokens (hif-tokenize (point) + (progn (hif-end-of-line) (point))))) + (if defined + (setq tokens (list 'hif-defined tokens))) + (if negate + (setq tokens (list 'hif-not tokens))) + (hif-parse-exp tokens))))) (defun hif-find-any-ifX () "Move to next #if..., or #ifndef, at point or after." @@ -746,10 +1123,10 @@ that form should be displayed.") (defun hif-find-next-relevant () - "Move to next #if..., #else, or #endif, after the current line." + "Move to next #if..., #elif..., #else, or #endif, after the current line." ;; (message "hif-find-next-relevant at %d" (point)) (end-of-line) - ;; avoid infinite recursion by only going to beginning of line if match found + ;; Avoid infinite recursion by only going to line-beginning if match found (if (re-search-forward hif-ifx-else-endif-regexp (point-max) t) (beginning-of-line))) @@ -757,7 +1134,7 @@ that form should be displayed.") "Move to previous #if..., #else, or #endif, before the current line." ;; (message "hif-find-previous-relevant at %d" (point)) (beginning-of-line) - ;; avoid infinite recursion by only going to beginning of line if match found + ;; Avoid infinite recursion by only going to line-beginning if match found (if (re-search-backward hif-ifx-else-endif-regexp (point-min) t) (beginning-of-line))) @@ -769,15 +1146,19 @@ that form should be displayed.") (defun hif-looking-at-else () (looking-at hif-else-regexp)) +(defun hif-looking-at-elif () + (looking-at hif-elif-regexp)) (defun hif-ifdef-to-endif () - "If positioned at #ifX or #else form, skip to corresponding #endif." + "If positioned at #ifX, #elif, or #else form, skip to corresponding #endif." ;; (message "hif-ifdef-to-endif at %d" (point)) (sit-for 1) (hif-find-next-relevant) (cond ((hif-looking-at-ifX) (hif-ifdef-to-endif) ; find endif of nested if (hif-ifdef-to-endif)) ; find outer endif or else + ((hif-looking-at-elif) + (hif-ifdef-to-endif)) ((hif-looking-at-else) (hif-ifdef-to-endif)) ; find endif following else ((hif-looking-at-endif) @@ -950,7 +1331,7 @@ Point is left unchanged." ;;; A bit slimy. (defun hif-hide-line (point) - "Hide the line containing point. Does nothing if `hide-ifdef-lines' is nil." + "Hide the line containing point. Does nothing if `hide-ifdef-lines' is nil." (when hide-ifdef-lines (save-excursion (goto-char point) @@ -994,7 +1375,7 @@ Point is left unchanged." "Called at #ifX expression, this hides those parts that should be hidden. It uses the judgment of `hide-ifdef-evaluator'." ;; (message "hif-possibly-hide") (sit-for 1) - (let ((test (hif-canonicalize)) + (let ((test (hif-canonicalize hif-ifx-regexp)) (range (hif-find-range))) ;; (message "test = %s" test) (sit-for 1) @@ -1022,16 +1403,145 @@ It uses the judgment of `hide-ifdef-evaluator'." (goto-char (hif-range-end range)) (end-of-line))) +(defun hif-parse-macro-arglist (str) + "Parse argument list formatted as '( arg1 [ , argn] [...] )', including +the '...'. Return a list of the arguments, if '...' exists the first arg +will be hif-etc." + (let* ((hif-simple-token-only nil) ;; Dynamic binding var for `hif-tokenize' + (tokenlist + (cdr (hif-tokenize + (- (point) (length str)) (point)))) ; remove hif-lparen + etc result token) + (while (not (eq (setq token (pop tokenlist)) 'hif-rparen)) + (cond + ((eq token 'hif-etc) + (setq etc t)) + ((eq token 'hif-comma) + t) + (t + (push token result)))) + (if etc + (cons 'hif-etc (nreverse result)) + (nreverse result)))) + +;; The original version of hideif evaluates the macro early and store the +;; final values for the defined macro into the symbol database (aka +;; `hide-ifdef-env'). The evaluation process is "strings -> tokens -> parsed +;; tree -> [value]". (The square bracket refers to what's stored in in our +;; `hide-ifdef-env'.) +;; +;; This forbids the evaluation of an argumented macro since the parameters +;; are applied at run time. In order to support argumented macro I then +;; postponed the evaluation process one stage and store the "parsed tree" +;; into symbol database. The evaluation process was then "strings -> tokens +;; -> [parsed tree] -> value". Hideif therefore run slower since it need to +;; evaluate the parsed tree everytime when trying to expand the symbol. These +;; temporarily code changes are obsolete and not in Emacs source repository. +;; +;; Furthermore, CPP did allow partial expression to be defined in several +;; macros and later got concatenated into a complete expression and then +;; evaluate it. In order to match this behavior I had to postpone one stage +;; further, otherwise those partial expression will be fail on parsing and +;; we'll miss all macros that reference it. The evaluation process thus +;; became "strings -> [tokens] -> parsed tree -> value." This degraded the +;; performance since we need to parse tokens and evaluate them everytime +;; when that symbol is referenced. +;; +;; In real cases I found a lot portion of macros are "simple macros" that +;; expand to literals like integers or other symbols. In order to enhance +;; the performance I use this `hif-simple-token-only' to notify my code and +;; save the final [value] into symbol database. [lukelee] +(defun hif-find-define (&optional min max) + "Parse texts and retrieve all defines within the region MIN and MAX." + (interactive) + (and min (goto-char min)) + (and (re-search-forward hif-define-regexp max t) + (or + (let* ((defining (string= "define" (match-string 2))) + (name (and (re-search-forward hif-macroref-regexp max t) + (match-string 1))) + (parsed nil) + (parmlist (and (match-string 3) ;; First arg id found + (hif-parse-macro-arglist (match-string 2))))) + (if defining + ;; Ignore name (still need to return 't), or define the name + (or (and hide-ifdef-exclude-define-regexp + (string-match hide-ifdef-exclude-define-regexp + name)) + + (let* ((start (point)) + (end (progn (hif-end-of-line) (point))) + (hif-simple-token-only nil) ;; Dynamic binding + (tokens + (and name + ;; `hif-simple-token-only' is set/clear + ;; only in this block + (condition-case nil + ;; Prevent C statements like + ;; 'do { ... } while (0)' + (hif-tokenize start end) + (error + ;; We can't just return nil here since + ;; this will stop hideif from searching + ;; for more #defines. + (setq hif-simple-token-only t) + (buffer-substring-no-properties + start end))))) + ;; For simple tokens we save only the parsed result; + ;; otherwise we save the tokens and parse it after + ;; parameter replacement + (expr (and tokens + ;; `hif-simple-token-only' is checked only + ;; here. + (or (and hif-simple-token-only + (listp tokens) + (= (length tokens) 1) + (hif-parse-exp tokens)) + `(hif-define-macro ,parmlist + ,tokens)))) + (SA (and name + (assoc (intern name) hide-ifdef-env)))) + (and name + (if SA + (or (setcdr SA expr) t) + ;; Lazy evaluation, eval only if hif-lookup find it. + ;; Define it anyway, even if nil it's still in list + ;; and therefore considerred defined + (push (cons (intern name) expr) hide-ifdef-env))))) + ;; #undef + (and name + (hif-undefine-symbol (intern name)))))) + t)) + + +(defun hif-add-new-defines (&optional min max) + "Scan and add all #define macros between MIN and MAX" + (interactive) + (save-excursion + (save-restriction + ;; (mark-region min max) ;; for debugging + (while (hif-find-define min max) + (setf min (point))) + (if max (goto-char max) + (goto-char (point-max)))))) (defun hide-ifdef-guts () "Does most of the work of `hide-ifdefs'. It does not do the work that's pointless to redo on a recursive entry." ;; (message "hide-ifdef-guts") (save-excursion + (let ((case-fold-search nil) + min max) (goto-char (point-min)) - (while (hif-find-any-ifX) - (hif-possibly-hide)))) + (setf min (point)) + (loop do + (setf max (hif-find-any-ifX)) + (hif-add-new-defines min max) + (if max + (hif-possibly-hide)) + (setf min (point)) + while max)))) ;;===%%SF%% hide-ifdef-hiding (End) === @@ -1045,7 +1555,8 @@ It does not do the work that's pointless to redo on a recursive entry." (message "Hide-Read-Only %s" (if hide-ifdef-read-only "ON" "OFF")) (if hide-ifdef-hiding - (setq buffer-read-only (or hide-ifdef-read-only hif-outside-read-only))) + (setq buffer-read-only (or hide-ifdef-read-only + hif-outside-read-only))) (force-mode-line-update)) (defun hide-ifdef-toggle-outside-read-only () @@ -1081,12 +1592,32 @@ It does not do the work that's pointless to redo on a recursive entry." (hif-set-var var 1) (if hide-ifdef-hiding (hide-ifdefs))) -(defun hide-ifdef-undef (var) - "Undefine a VAR so that #ifdef VAR would not be included." - (interactive "SUndefine what? ") - (hif-set-var var nil) - (if hide-ifdef-hiding (hide-ifdefs))) +(defun hif-undefine-symbol (var) + (setq hide-ifdef-env + (delete (assoc var hide-ifdef-env) hide-ifdef-env))) +;;(defun hide-ifdef-undef (var) +;; "Undefine a VAR so that #ifdef VAR would not be included." +;; (interactive "SUndefine what? ") +;; ;;(hif-set-var var nil);;Luke fixed: set it nil is still considered +;; ;;defined so #ifdef VAR is still true. +;; (hif-undefine-symbol var) +;; (if hide-ifdef-hiding (hide-ifdefs))) + +(defun hide-ifdef-undef (start end) + "Undefine a VAR so that #ifdef VAR would not be included." + (interactive "r") + (let* ((symstr + (or (and mark-active + (buffer-substring-no-properties start end)) + (read-string "Undefine what? " (current-word)))) + (sym (and symstr + (intern symstr)))) + (if (zerop (hif-defined sym)) + (message "`%s' not defined, no need to undefine it" symstr) + (hif-undefine-symbol sym) + (if hide-ifdef-hiding (hide-ifdefs)) + (message "`%S' undefined" sym)))) (defun hide-ifdefs (&optional nomsg) "Hide the contents of some #ifdefs. -- cgit v1.2.1 From 9fc9c8c639226ec263df1f40a5801909dc52f590 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 25 Jun 2014 23:43:39 -0700 Subject: Remove some function declarations, no longer needed or correct * lisp/emacs-lisp/cl-macs.el (help-add-fundoc-usage): * lisp/gnus/mm-util.el (help-function-arglist): Remove outdated declarations. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/cl-macs.el | 2 -- lisp/gnus/ChangeLog | 4 ++++ lisp/gnus/mm-util.el | 2 -- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5a716312f0e..34d057c10f1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-06-26 Glenn Morris + * emacs-lisp/cl-macs.el (help-add-fundoc-usage): + Remove outdated declaration. + * emacs-lisp/authors.el (authors-valid-file-names) (authors-renamed-files-alist): Additions. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 5640b1796c7..e45efa328ee 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -376,8 +376,6 @@ its argument list allows full Common Lisp conventions." (if (car res) `(progn ,(car res) ,form) form)) `(function ,func))) -(declare-function help-add-fundoc-usage "help-fns" (docstring arglist)) - (defun cl--make-usage-var (x) "X can be a var or a (destructuring) lambda-list." (cond diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 4ad3a6de63e..993bbbb2475 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2014-06-26 Glenn Morris + + * mm-util.el (help-function-arglist): Remove outdated declaration. + 2014-06-22 Andreas Schwab * html2text.el (html2text-get-attr): Rewrite to handle spaces in quoted diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index 38ee8a563e5..6433ec96938 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el @@ -1378,8 +1378,6 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'." (write-region start end filename append visit lockname))) (autoload 'gmm-write-region "gmm-utils") -(declare-function help-function-arglist "help-fns" - (def &optional preserve-names)) ;; It is not a MIME function, but some MIME functions use it. (if (and (fboundp 'make-temp-file) -- cgit v1.2.1 From f387f870529694ada0335219143f6014171ec096 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 25 Jun 2014 23:48:25 -0700 Subject: Bump version to 24.3.92 --- README | 2 +- configure.ac | 2 +- doc/emacs/emacsver.texi | 2 +- doc/man/emacs.1 | 2 +- msdos/sed2v2.inp | 2 +- nt/config.nt | 2 +- nt/emacs.rc | 8 ++++---- nt/emacsclient.rc | 8 ++++---- nt/makefile.w32-in | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README b/README index e030eb82be6..2a166ef728a 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ Copyright (C) 2001-2014 Free Software Foundation, Inc. See the end of the file for license conditions. -This directory tree holds version 24.3.91 of GNU Emacs, the extensible, +This directory tree holds version 24.3.92 of GNU Emacs, the extensible, customizable, self-documenting real-time display editor. The file INSTALL in this directory says how to build and install GNU diff --git a/configure.ac b/configure.ac index 3d840a1b484..8e74f799ec9 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ dnl You should have received a copy of the GNU General Public License dnl along with GNU Emacs. If not, see . AC_PREREQ(2.65) -AC_INIT(emacs, 24.3.91) +AC_INIT(emacs, 24.3.92) dnl We get MINGW64 with MSYS2 if test "x$MSYSTEM" = "xMINGW32" -o "x$MSYSTEM" = "xMINGW64" diff --git a/doc/emacs/emacsver.texi b/doc/emacs/emacsver.texi index cba7c1eb168..700cb266ffa 100644 --- a/doc/emacs/emacsver.texi +++ b/doc/emacs/emacsver.texi @@ -1,4 +1,4 @@ @c It would be nicer to generate this using configure and @version@. @c However, that would mean emacsver.texi would always be newer @c then the info files in release tarfiles. -@set EMACSVER 24.3.91 +@set EMACSVER 24.3.92 diff --git a/doc/man/emacs.1 b/doc/man/emacs.1 index 12dc0707ed0..30fe5bfd3e9 100644 --- a/doc/man/emacs.1 +++ b/doc/man/emacs.1 @@ -1,5 +1,5 @@ .\" See section COPYING for copyright and redistribution information. -.TH EMACS 1 "2007 April 13" "GNU Emacs 24.3.91" +.TH EMACS 1 "2007 April 13" "GNU Emacs 24.3.92" . . .SH NAME diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index 2ee3b138f19..0ba3ead17a7 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -70,7 +70,7 @@ /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/ /^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION ""/ /^#undef PENDING_OUTPUT_COUNT/s/^.*$/#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base)/ -/^#undef VERSION/s/^.*$/#define VERSION "24.3.91"/ +/^#undef VERSION/s/^.*$/#define VERSION "24.3.92"/ /^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/ /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/ /^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/ diff --git a/nt/config.nt b/nt/config.nt index 8b20348c956..a04ee7c306a 100644 --- a/nt/config.nt +++ b/nt/config.nt @@ -1576,7 +1576,7 @@ along with GNU Emacs. If not, see . */ #undef USG_SUBTTY_WORKS /* Version number of package */ -#define VERSION "24.3.91" +#define VERSION "24.3.92" /* Define to 1 if unsetenv returns void instead of int. */ #undef VOID_UNSETENV diff --git a/nt/emacs.rc b/nt/emacs.rc index 68001be40ed..96bc59ad8e4 100644 --- a/nt/emacs.rc +++ b/nt/emacs.rc @@ -11,8 +11,8 @@ Emacs ICON icons/emacs.ico #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 24,3,91,0 - PRODUCTVERSION 24,3,91,0 + FILEVERSION 24,3,92,0 + PRODUCTVERSION 24,3,92,0 FILEFLAGSMASK 0x3FL #ifdef EMACSDEBUG FILEFLAGS 0x1L @@ -29,12 +29,12 @@ BEGIN BEGIN VALUE "CompanyName", "Free Software Foundation\0" VALUE "FileDescription", "GNU Emacs: The extensible self-documenting text editor\0" - VALUE "FileVersion", "24, 3, 91, 0\0" + VALUE "FileVersion", "24, 3, 92, 0\0" VALUE "InternalName", "Emacs\0" VALUE "LegalCopyright", "Copyright (C) 2001-2014\0" VALUE "OriginalFilename", "emacs.exe" VALUE "ProductName", "Emacs\0" - VALUE "ProductVersion", "24, 3, 91, 0\0" + VALUE "ProductVersion", "24, 3, 92, 0\0" VALUE "OLESelfRegister", "\0" END END diff --git a/nt/emacsclient.rc b/nt/emacsclient.rc index 4d59cda84c7..d7c56e1f2a5 100644 --- a/nt/emacsclient.rc +++ b/nt/emacsclient.rc @@ -5,8 +5,8 @@ Emacs ICON icons\emacs.ico #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION 24,3,91,0 - PRODUCTVERSION 24,3,91,0 + FILEVERSION 24,3,92,0 + PRODUCTVERSION 24,3,92,0 FILEFLAGSMASK 0x3FL #ifdef EMACSDEBUG FILEFLAGS 0x1L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "Free Software Foundation\0" VALUE "FileDescription", "GNU EmacsClient: Client for the extensible self-documenting text editor\0" - VALUE "FileVersion", "24, 3, 91, 0\0" + VALUE "FileVersion", "24, 3, 92, 0\0" VALUE "InternalName", "EmacsClient\0" VALUE "LegalCopyright", "Copyright (C) 2001-2014\0" VALUE "OriginalFilename", "emacsclientw.exe" VALUE "ProductName", "EmacsClient\0" - VALUE "ProductVersion", "24, 3, 91, 0\0" + VALUE "ProductVersion", "24, 3, 92, 0\0" VALUE "OLESelfRegister", "\0" END END diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in index 786bf2c8578..fba62a4f1c9 100644 --- a/nt/makefile.w32-in +++ b/nt/makefile.w32-in @@ -22,7 +22,7 @@ # FIXME: This file uses DOS EOLs. Convert to Unix after 22.1 is out # (and remove or replace this comment). -VERSION = 24.3.91 +VERSION = 24.3.92 TMP_DIST_DIR = emacs-$(VERSION) -- cgit v1.2.1 From 436550da1bf8d2cdd92a60f6ce84f131a8045062 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 25 Jun 2014 23:51:30 -0700 Subject: Regenerate etc/AUTHORS --- etc/AUTHORS | 63 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/etc/AUTHORS b/etc/AUTHORS index 73622ae7f01..0ef64f5f343 100644 --- a/etc/AUTHORS +++ b/etc/AUTHORS @@ -1160,9 +1160,9 @@ Eli Tziperman: wrote rmail-spam-filter.el Eli Zaretskii: wrote [bidirectional display in xdisp.c] [tty menus in term.c] bidi.c rxvt.el tty-colors.el and changed xdisp.c msdos.c w32.c w32fns.c files.el fileio.c simple.el - w32proc.c display.texi sed1v2.inp src/makefile.w32-in config.bat - msdos.h emacs.c process.c term.c src/Makefile.in dispextern.h dispnew.c - mainmake.v2 rmail.el and 793 other files + display.texi w32proc.c sed1v2.inp src/makefile.w32-in config.bat + msdos.h emacs.c term.c process.c dispnew.c src/Makefile.in dispextern.h + mainmake.v2 rmail.el and 795 other files Elias Oltmanns: changed tls.el gnus-agent.el gnus-cite.el gnus-int.el gnus-srvr.el gnus.el @@ -1504,9 +1504,9 @@ Giuseppe Scrivano: changed browse-url.el buffer.c configure.ac sysdep.c Glenn Morris: wrote automated/f90.el automated/vc-bzr.el check-declare.el and changed configure.ac src/Makefile.in Makefile.in calendar.el diary-lib.el files.el lisp/Makefile.in rmail.el progmodes/f90.el - bytecomp.el simple.el emacs.texi make-dist ack.texi misc/Makefile.in - cal-menu.el appt.el cal-hebrew.el calendar.texi holidays.el - display.texi and 1532 other files + bytecomp.el emacs.texi simple.el make-dist ack.texi misc/Makefile.in + cal-menu.el appt.el cal-hebrew.el display.texi startup.el calendar.texi + and 1534 other files Glynn Clements: wrote gamegrid.el snake.el tetris.el @@ -2191,9 +2191,9 @@ Jure Cuhalev: changed ispell.el Juri Linkov: wrote files-x.el misearch.el occur-tests.el and changed isearch.el info.el replace.el simple.el dired-aux.el progmodes/grep.el dired.el progmodes/compile.el startup.el faces.el - files.el menu-bar.el display.texi descr-text.el bindings.el - image-mode.el cus-edit.el desktop.el ispell.el man.el comint.el - and 353 other files + files.el menu-bar.el display.texi descr-text.el bindings.el desktop.el + image-mode.el cus-edit.el ispell.el man.el comint.el + and 355 other files Justin Bogner: changed fortune.el @@ -2315,8 +2315,8 @@ Kelly Dean: changed simple.el fileio.c help-macro.el Ken Brown: changed configure.ac gmalloc.c sheap.c cygwin.h browse-url.el emacs.c emacs.rc dispextern.h frame.c src/Makefile.in unexcw.c - vm-limit.c xgselect.c CPP-DEFINES alloc.c callproc.c conf_post.h - config.nt dired.c fileio.c gdb-mi.el and 12 other files + vm-limit.c w32term.c xgselect.c CPP-DEFINES alloc.c callproc.c + conf_post.h config.nt dired.c fileio.c and 12 other files Ken Brush: changed emacsclient.c @@ -2525,11 +2525,11 @@ and changed nxml-mode.el tutorial.el window.el ada-xref.el buff-menu.el Lennart Staflin: changed dired.el diary-ins.el diary-lib.el tq.el xdisp.c Leo Liu: wrote pcmpl-x.el -and changed octave.el ido.el rcirc.el subr.el files.el flymake.el - simple.el smie.el abbrev.el eldoc.el progmodes/python.el +and changed octave.el ido.el rcirc.el subr.el files.el simple.el + flymake.el smie.el abbrev.el eldoc.el progmodes/python.el progmodes/compile.el register.el rng-valid.el bindings.el comint.el - diff-mode.el dired-x.el font-lock.el kmacro.el minibuf.c - and 121 other files + diff-mode.el dired-x.el font-lock.el indent.el kmacro.el + and 129 other files Leo P. White: changed eieio-custom.el @@ -2740,8 +2740,8 @@ Martin Pohlack: changed iimage.el pc-select.el Martin Rudalics: changed window.el window.c windows.texi frame.c xdisp.c help.el w32term.c xterm.c buffer.c w32fns.c cus-start.el dired.el - window.h frame.el files.el subr.el xfns.c buffers.texi cus-edit.el - display.texi dispnew.c and 165 other files + window.h frame.el files.el mouse.el subr.el xfns.c buffers.texi + cus-edit.el display.texi and 165 other files Martin Stjernholm: wrote cc-bytecomp.el and co-wrote cc-align.el cc-cmds.el cc-compat.el cc-defs.el cc-engine.el @@ -2850,7 +2850,7 @@ and changed tramp.texi dbusbind.c trampver.texi trampver.el ange-ftp.el dbus.texi tramp-adb.el tramp-fish.el files.el autorevert.el files.texi tramp-imap.el notifications.el tramp-vc.el configure.ac lisp/Makefile.in tramp-uu.el em-unix.el keyboard.c simple.el - tramp-util.el and 100 other files + tramp-util.el and 101 other files Michael Ben-Gershon: changed acorn.h configure.ac riscix1-1.h riscix1-2.h unexec.c @@ -3120,8 +3120,8 @@ and changed org-list.el org.el ox-html.el org-footnote.el org.texi ob-asymptote.el org-macs.el org-pcomplete.el org-clock.el org-table.el and 22 other files -Nicolas Richard: changed simple.el align.el battery.el ispell.el - minibuffer.el ob.el org.el package.el +Nicolas Richard: changed simple.el align.el battery.el eieio-opt.el + ispell.el minibuffer.el ob.el org.el package.el Niels Giesen: changed icalendar.el org-agenda.el org-clock.el org-docbook.el org-table.el ox-icalendar.el ox-latex.el @@ -3231,7 +3231,7 @@ and co-wrote cal-dst.el and changed lisp.h configure.ac alloc.c process.c fileio.c sysdep.c xdisp.c image.c editfns.c keyboard.c emacs.c data.c lread.c callproc.c xterm.c fns.c eval.c Makefile.in dispextern.h dispnew.c gnulib.mk - and 1009 other files + and 1015 other files Paul Fisher: changed fns.c @@ -3862,8 +3862,8 @@ Stefan Monnier: wrote bibtex-style.el bzrmerge.el cl.el and co-wrote font-lock.el and changed subr.el simple.el lisp.h keyboard.c files.el vc.el bytecomp.el xdisp.c alloc.c eval.c cl-macs.el progmodes/compile.el - keymap.c pcvs.el newcomment.el tex-mode.el sh-script.el buffer.c - vc-hooks.el window.c lread.c and 1204 other files + keymap.c pcvs.el sh-script.el newcomment.el tex-mode.el buffer.c + vc-hooks.el window.c lread.c and 1206 other files Stefan Reichör: changed gnus-agent.el @@ -3887,10 +3887,10 @@ Stephan Stahl: changed which-func.el buff-menu.el buffer.c dired-x.texi Stephen A. Wood: changed fortran.el Stephen Berman: co-wrote todo-mode.el -and changed diary-lib.el info.el minibuffer.el otodo-mode.el - todo-mode.texi allout.el dframe.el dir dired-aux.el dired.el files.el - find-dired.el frame.c gamegrid.el gnus-group.el gomoku.el gtkutil.c - misc/Makefile.in newcomment.el page.el proced.el and 6 other files +and changed diary-lib.el minibuffer.el todo-mode.texi info.el + otodo-mode.el allout.el dframe.el dir dired-aux.el dired.el elpa + files.el find-dired.el frame.c gamegrid.el gnus-group.el gomoku.el + gtkutil.c misc/Makefile.in newcomment.el page.el and 7 other files Stephen C. Gilardi: changed configure.ac @@ -4427,10 +4427,11 @@ Yagi Tatsuya: changed gnus-art.el gnus-start.el Yair F: changed hebrew.el -Yamamoto Mitsuharu: changed macterm.c macfns.c mac-win.el mac.c macterm.h - macmenu.c macgui.h image.c xdisp.c xterm.c macselect.c keyboard.c - w32term.c src/Makefile.in unexmacosx.c emacs.c darwin.h dispnew.c - configure.ac dispextern.h alloc.c and 89 other files +Yamamoto Mitsuharu: wrote uvs.el +and changed macterm.c macfns.c mac-win.el mac.c macterm.h macmenu.c + macgui.h image.c xdisp.c xterm.c macselect.c keyboard.c w32term.c + src/Makefile.in unexmacosx.c emacs.c darwin.h dispnew.c configure.ac + dispextern.h alloc.c and 90 other files Yann Dirson: changed imenu.el -- cgit v1.2.1