aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2007-06-12 21:03:32 +0000
committerStefan Monnier2007-06-12 21:03:32 +0000
commitb8104a2bf5bee4a07cd6f3105a980f9f3324af8f (patch)
treee5f2669269d04947a6e11943533ab1c05bfd7f31 /lisp
parent0794ad3ba336f615454e7a624cff77212fc67a2d (diff)
downloademacs-b8104a2bf5bee4a07cd6f3105a980f9f3324af8f.tar.gz
emacs-b8104a2bf5bee4a07cd6f3105a980f9f3324af8f.zip
(byte-compile-current-group): New var.
(byte-compile-file): Bind it. (byte-compile-nogroup-warn): Use it to avoid spurious warnings when the group argument is provided implicitly. (byte-compile-format-warn, byte-compile-from-buffer) (byte-compile-insert-header): Don't hardcode point-min==1. (byte-compile-file-form-require): Remove unused var old-load-list. (byte-compile-eval): Remove unused vars old-autoloads and hist-nil-new.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/emacs-lisp/bytecomp.el62
2 files changed, 46 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4b25be5b550..728dd0f8135 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12007-06-12 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/bytecomp.el (byte-compile-current-group): New var.
4 (byte-compile-file): Bind it.
5 (byte-compile-nogroup-warn): Use it to avoid spurious warnings when the
6 group argument is provided implicitly.
7 (byte-compile-format-warn, byte-compile-from-buffer)
8 (byte-compile-insert-header): Don't hardcode point-min==1.
9 (byte-compile-file-form-require): Remove unused var old-load-list.
10 (byte-compile-eval): Remove unused vars old-autoloads and hist-nil-new.
11
12007-06-12 Michael Kifer <kifer@cs.stonybrook.edu> 122007-06-12 Michael Kifer <kifer@cs.stonybrook.edu>
2 13
3 * emulation/viper-cmd.el (viper-prefix-arg-com, viper-prefix-arg-value): 14 * emulation/viper-cmd.el (viper-prefix-arg-com, viper-prefix-arg-value):
@@ -32,7 +43,7 @@
32 message options 43 message options
33 44
34 * ediff-ptch.el (ediff-context-diff-label-regexp): Better regexp. 45 * ediff-ptch.el (ediff-context-diff-label-regexp): Better regexp.
35 (ediff-fixup-patch-map): Improved heuristic. 46 (ediff-fixup-patch-map): Improve heuristic.
36 47
372007-06-12 Stefan Monnier <monnier@iro.umontreal.ca> 482007-06-12 Stefan Monnier <monnier@iro.umontreal.ca>
38 49
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 619b7533ca7..6a9381d787e 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -853,13 +853,11 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
853 (when (and (consp s) (eq t (car s))) 853 (when (and (consp s) (eq t (car s)))
854 (push (cdr s) old-autoloads))))))) 854 (push (cdr s) old-autoloads)))))))
855 (when (memq 'cl-functions byte-compile-warnings) 855 (when (memq 'cl-functions byte-compile-warnings)
856 (let ((hist-new load-history) 856 (let ((hist-new load-history))
857 (hist-nil-new current-load-list))
858 ;; Go through load-history, look for newly loaded files 857 ;; Go through load-history, look for newly loaded files
859 ;; and mark all the functions defined therein. 858 ;; and mark all the functions defined therein.
860 (while (and hist-new (not (eq hist-new hist-orig))) 859 (while (and hist-new (not (eq hist-new hist-orig)))
861 (let ((xs (pop hist-new)) 860 (let ((xs (pop hist-new)))
862 old-autoloads)
863 ;; Make sure the file was not already loaded before. 861 ;; Make sure the file was not already loaded before.
864 (when (and (equal (car xs) "cl") (not (assoc (car xs) hist-orig))) 862 (when (and (equal (car xs) "cl") (not (assoc (car xs) hist-orig)))
865 (byte-compile-find-cl-functions))))))))) 863 (byte-compile-find-cl-functions)))))))))
@@ -881,6 +879,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
881(defvar byte-compile-current-form nil) 879(defvar byte-compile-current-form nil)
882(defvar byte-compile-dest-file nil) 880(defvar byte-compile-dest-file nil)
883(defvar byte-compile-current-file nil) 881(defvar byte-compile-current-file nil)
882(defvar byte-compile-current-group nil)
884(defvar byte-compile-current-buffer nil) 883(defvar byte-compile-current-buffer nil)
885 884
886;; Log something that isn't a warning. 885;; Log something that isn't a warning.
@@ -1265,7 +1264,7 @@ extra args."
1265 (get (car form) 'byte-compile-format-like)) 1264 (get (car form) 'byte-compile-format-like))
1266 (let ((nfields (with-temp-buffer 1265 (let ((nfields (with-temp-buffer
1267 (insert (nth 1 form)) 1266 (insert (nth 1 form))
1268 (goto-char 1) 1267 (goto-char (point-min))
1269 (let ((n 0)) 1268 (let ((n 0))
1270 (while (re-search-forward "%." nil t) 1269 (while (re-search-forward "%." nil t)
1271 (unless (eq ?% (char-after (1+ (match-beginning 0)))) 1270 (unless (eq ?% (char-after (1+ (match-beginning 0))))
@@ -1282,20 +1281,29 @@ extra args."
1282 1281
1283;; Warn if a custom definition fails to specify :group. 1282;; Warn if a custom definition fails to specify :group.
1284(defun byte-compile-nogroup-warn (form) 1283(defun byte-compile-nogroup-warn (form)
1285 (let ((keyword-args (cdr (cdr (cdr (cdr form))))) 1284 (if (and (memq (car form) '(custom-declare-face custom-declare-variable))
1286 (name (cadr form))) 1285 byte-compile-current-group)
1287 (or (not (eq (car-safe name) 'quote)) 1286 ;; The group will be provided implicitly.
1288 (and (eq (car form) 'custom-declare-group) 1287 nil
1289 (equal name ''emacs)) 1288 (let ((keyword-args (cdr (cdr (cdr (cdr form)))))
1290 (plist-get keyword-args :group) 1289 (name (cadr form)))
1291 (not (and (consp name) (eq (car name) 'quote))) 1290 (or (not (eq (car-safe name) 'quote))
1292 (byte-compile-warn 1291 (and (eq (car form) 'custom-declare-group)
1293 "%s for `%s' fails to specify containing group" 1292 (equal name ''emacs))
1294 (cdr (assq (car form) 1293 (plist-get keyword-args :group)
1295 '((custom-declare-group . defgroup) 1294 (not (and (consp name) (eq (car name) 'quote)))
1296 (custom-declare-face . defface) 1295 (byte-compile-warn
1297 (custom-declare-variable . defcustom)))) 1296 "%s for `%s' fails to specify containing group"
1298 (cadr name))))) 1297 (cdr (assq (car form)
1298 '((custom-declare-group . defgroup)
1299 (custom-declare-face . defface)
1300 (custom-declare-variable . defcustom))))
1301 (cadr name)))
1302 ;; Update the current group, if needed.
1303 (if (and byte-compile-current-file ;Only when byte-compiling a whole file.
1304 (eq (car form) 'custom-declare-group)
1305 (eq (car-safe name) 'quote))
1306 (setq byte-compile-current-group (cadr name))))))
1299 1307
1300;; Warn if the function or macro is being redefined with a different 1308;; Warn if the function or macro is being redefined with a different
1301;; number of arguments. 1309;; number of arguments.
@@ -1657,6 +1665,7 @@ The value is non-nil if there were no errors, nil if errors."
1657 ;; Force logging of the file name for each file compiled. 1665 ;; Force logging of the file name for each file compiled.
1658 (setq byte-compile-last-logged-file nil) 1666 (setq byte-compile-last-logged-file nil)
1659 (let ((byte-compile-current-file filename) 1667 (let ((byte-compile-current-file filename)
1668 (byte-compile-current-group nil)
1660 (set-auto-coding-for-load t) 1669 (set-auto-coding-for-load t)
1661 target-file input-buffer output-buffer 1670 target-file input-buffer output-buffer
1662 byte-compile-dest-file) 1671 byte-compile-dest-file)
@@ -1834,9 +1843,8 @@ With argument, insert value in current buffer after the form."
1834 ;; byte-compile-warnings)) 1843 ;; byte-compile-warnings))
1835 ) 1844 )
1836 (byte-compile-close-variables 1845 (byte-compile-close-variables
1837 (save-excursion 1846 (with-current-buffer
1838 (setq outbuffer 1847 (setq outbuffer (get-buffer-create " *Compiler Output*"))
1839 (set-buffer (get-buffer-create " *Compiler Output*")))
1840 (set-buffer-multibyte t) 1848 (set-buffer-multibyte t)
1841 (erase-buffer) 1849 (erase-buffer)
1842 ;; (emacs-lisp-mode) 1850 ;; (emacs-lisp-mode)
@@ -1850,9 +1858,8 @@ With argument, insert value in current buffer after the form."
1850 (setq overwrite-mode 'overwrite-mode-binary)) 1858 (setq overwrite-mode 'overwrite-mode-binary))
1851 (displaying-byte-compile-warnings 1859 (displaying-byte-compile-warnings
1852 (and filename (byte-compile-insert-header filename inbuffer outbuffer)) 1860 (and filename (byte-compile-insert-header filename inbuffer outbuffer))
1853 (save-excursion 1861 (with-current-buffer inbuffer
1854 (set-buffer inbuffer) 1862 (goto-char (point-min))
1855 (goto-char 1)
1856 1863
1857 ;; Compile the forms from the input buffer. 1864 ;; Compile the forms from the input buffer.
1858 (while (progn 1865 (while (progn
@@ -1920,7 +1927,7 @@ With argument, insert value in current buffer after the form."
1920 (let ((dynamic-docstrings byte-compile-dynamic-docstrings) 1927 (let ((dynamic-docstrings byte-compile-dynamic-docstrings)
1921 (dynamic byte-compile-dynamic)) 1928 (dynamic byte-compile-dynamic))
1922 (set-buffer outbuffer) 1929 (set-buffer outbuffer)
1923 (goto-char 1) 1930 (goto-char (point-min))
1924 ;; The magic number of .elc files is ";ELC", or 0x3B454C43. After 1931 ;; The magic number of .elc files is ";ELC", or 0x3B454C43. After
1925 ;; that is the file-format version number (18, 19 or 20) as a 1932 ;; that is the file-format version number (18, 19 or 20) as a
1926 ;; byte, followed by some nulls. The primary motivation for doing 1933 ;; byte, followed by some nulls. The primary motivation for doing
@@ -2241,8 +2248,7 @@ list that represents a doc string reference.
2241 2248
2242(put 'require 'byte-hunk-handler 'byte-compile-file-form-require) 2249(put 'require 'byte-hunk-handler 'byte-compile-file-form-require)
2243(defun byte-compile-file-form-require (form) 2250(defun byte-compile-file-form-require (form)
2244 (let ((old-load-list current-load-list) 2251 (let ((args (mapcar 'eval (cdr form))))
2245 (args (mapcar 'eval (cdr form))))
2246 (apply 'require args) 2252 (apply 'require args)
2247 ;; Detect (require 'cl) in a way that works even if cl is already loaded. 2253 ;; Detect (require 'cl) in a way that works even if cl is already loaded.
2248 (if (member (car args) '("cl" cl)) 2254 (if (member (car args) '("cl" cl))