From d8947b79fcc51b605fc25acc3ba5f0bd01188726 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Tue, 13 Nov 2007 16:10:14 +0000 Subject: * emacs-lisp/byte-opt.el (byte-compile-trueconstp): Handle more constant forms. (byte-compile-nilconstp): New function. (byte-optimize-cond): Kill subsequent branches when a branch is know to be taken or not taken. (byte-optimize-if): Use byte-compile-nilconstp instead of hand coding. --- lisp/emacs-lisp/byte-opt.el | 49 +++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 4097ada0bda..a9bdc3df41d 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -185,6 +185,7 @@ ;;; Code: (require 'bytecomp) +(eval-when-compile (require 'cl)) (defun byte-compile-log-lap-1 (format &rest args) (if (aref byte-code-vector 0) @@ -626,12 +627,24 @@ ;; It is now safe to optimize code such that it introduces new bindings. ;; I'd like this to be a defsubst, but let's not be self-referential... -(defmacro byte-compile-trueconstp (form) - ;; Returns non-nil if FORM is a non-nil constant. - `(cond ((consp ,form) (eq (car ,form) 'quote)) - ((not (symbolp ,form))) - ((eq ,form t)) - ((keywordp ,form)))) +(defsubst byte-compile-trueconstp (form) + "Return non-nil if FORM always evaluates to a non-nil value." + (cond ((consp form) + (case (car form) + (quote (cadr form)) + (progn (byte-compile-trueconstp (car (last (cdr form))))))) + ((not (symbolp form))) + ((eq form t)) + ((keywordp form)))) + +(defsubst byte-compile-nilconstp (form) + "Return non-nil if FORM always evaluates to a nil value." + (cond ((consp form) + (case (car form) + (quote (null (cadr form))) + (progn (byte-compile-nilconstp (car (last (cdr form))))))) + ((not (symbolp form)) nil) + ((null form)))) ;; If the function is being called with constant numeric args, ;; evaluate as much as possible at compile-time. This optimizer @@ -990,17 +1003,17 @@ (setq rest form) (while (setq rest (cdr rest)) (cond ((byte-compile-trueconstp (car-safe (car rest))) - (cond ((eq rest (cdr form)) - (setq form - (if (cdr (car rest)) - (if (cdr (cdr (car rest))) - (cons 'progn (cdr (car rest))) - (nth 1 (car rest))) - (car (car rest))))) + ;; This branch will always be taken: kill the subsequent ones. + (cond ((eq rest (cdr form)) ;First branch of `cond'. + (setq form `(progn ,@(car rest)))) ((cdr rest) (setq form (copy-sequence form)) (setcdr (memq (car rest) form) nil))) - (setq rest nil))))) + (setq rest nil)) + ((and (consp (car rest)) + (byte-compile-nilconstp (caar rest))) + ;; This branch will never be taken: kill its body. + (setcdr (car rest) nil))))) ;; ;; Turn (cond (( )) ... ) into (or (cond ... )) (if (eq 'cond (car-safe form)) @@ -1031,11 +1044,9 @@ (byte-optimize-if `(if ,(car (last clause)) ,@(nthcdr 2 form))))))) ((byte-compile-trueconstp clause) - (nth 2 form)) - ((null clause) - (if (nthcdr 4 form) - (cons 'progn (nthcdr 3 form)) - (nth 3 form))) + `(progn ,clause ,(nth 2 form))) + ((byte-compile-nilconstp clause) + `(progn ,clause ,@(nthcdr 3 form))) ((nth 2 form) (if (equal '(nil) (nthcdr 3 form)) (list 'if clause (nth 2 form)) -- cgit v1.2.3 From f31d0424eaa81455fb3bd32216061094e57b61cd Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 14 Nov 2007 11:18:54 +0000 Subject: Comment change. --- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/byte-opt.el | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3c72815aced..5c915b695f9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2007-11-14 Juanma Barranquero + + * isearch-multi.el (isearch-buffers-next-buffer-function): Doc fix. + 2007-11-14 Nick Roberts * progmodes/gdb-ui.el (gdb-parent-bptno-enabled): New variable. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index a9bdc3df41d..f56e2544272 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -626,7 +626,6 @@ ;; ;; It is now safe to optimize code such that it introduces new bindings. -;; I'd like this to be a defsubst, but let's not be self-referential... (defsubst byte-compile-trueconstp (form) "Return non-nil if FORM always evaluates to a non-nil value." (cond ((consp form) -- cgit v1.2.3 From 82bb5643229173955379d4b51cd25fee547046df Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 17 Nov 2007 02:49:49 +0000 Subject: (backquote): Improve argument/docstring consistency. --- lisp/emacs-lisp/backquote.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el index a2a929d9601..4940e2fd8c6 100644 --- a/lisp/emacs-lisp/backquote.el +++ b/lisp/emacs-lisp/backquote.el @@ -92,7 +92,7 @@ For example (backquote-list* 'a 'b 'c) => (a b . c)" "Symbol used to represent a splice inside a backquote.") ;;;###autoload -(defmacro backquote (arg) +(defmacro backquote (structure) "Argument STRUCTURE describes a template to build. The whole structure acts as if it were quoted except for certain @@ -106,7 +106,7 @@ b => (ba bb bc) ; assume b has this value `(a ,@b c) => (a ba bb bc c) ; splice in the value of b Vectors work just like lists. Nested backquotes are permitted." - (cdr (backquote-process arg))) + (cdr (backquote-process structure))) ;; GNU Emacs has no reader macros -- cgit v1.2.3 From efb67a5e8dea3b4bb9af250757a9e97db5c5a9a0 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sat, 17 Nov 2007 02:51:49 +0000 Subject: (ring-size, ring-p, ring-insert, ring-length, ring-empty-p): Use c[ad]dr. (ring-plus1): Use `1+'. (ring-minus1): Use `zerop'. (ring-remove): Use c[ad]dr. Use `when'. (ring-copy): Use c[ad]dr. Use `let', not `let*'. (ring-ref): Use `let', not `let*'. (ring-insert-at-beginning): Use c[ad]dr. Doc fix. (ring-insert+extend): Use c[ad]dr. Fix typo in docstring. (ring-member): Simplify. Doc fix. (ring-convert-sequence-to-ring): Simplify. --- lisp/ChangeLog | 23 +++++++++++++-- lisp/emacs-lisp/ring.el | 76 ++++++++++++++++++++++++------------------------- 2 files changed, 57 insertions(+), 42 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d0fb5ef28da..b1a571ef96b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,20 @@ +2007-11-17 Juanma Barranquero + + * emacs-lisp/backquote.el (backquote): + Improve argument/docstring consistency. + + * emacs-lisp/ring.el (ring-size, ring-p, ring-insert) + (ring-length, ring-empty-p): Use c[ad]dr. + (ring-plus1): Use `1+'. + (ring-minus1): Use `zerop'. + (ring-remove): Use c[ad]dr. Use `when'. + (ring-copy): Use c[ad]dr. Use `let', not `let*'. + (ring-ref): Use `let', not `let*'. + (ring-insert-at-beginning): Use c[ad]dr. Doc fix. + (ring-insert+extend): Use c[ad]dr. Fix typo in docstring. + (ring-member): Simplify. Doc fix. + (ring-convert-sequence-to-ring): Simplify. + 2007-11-17 Juri Linkov * dired-aux.el (dired-create-directory): Allow creating @@ -36,12 +53,12 @@ * emulation/pc-select.el (pc-select-shifted-mark): New var. (ensure-mark): Set it. (maybe-deactivate-mark): New fun. - Use it everywhere instead of (setq mark-active nil) + Use it everywhere instead of (setq mark-active nil). 2007-11-16 Dan Nicolaescu - * textmodes/reftex-dcr.el (reftex-start-itimer-once): Add check - for XEmacs. + * textmodes/reftex-dcr.el (reftex-start-itimer-once): + Add check for XEmacs. * calc/calc-menu.el (calc-mode-map): Pacify byte compiler. diff --git a/lisp/emacs-lisp/ring.el b/lisp/emacs-lisp/ring.el index 93cf434292a..d9ce48e23a6 100644 --- a/lisp/emacs-lisp/ring.el +++ b/lisp/emacs-lisp/ring.el @@ -51,8 +51,8 @@ (defun ring-p (x) "Return t if X is a ring; nil otherwise." (and (consp x) (integerp (car x)) - (consp (cdr x)) (integerp (car (cdr x))) - (vectorp (cdr (cdr x))))) + (consp (cdr x)) (integerp (cadr x)) + (vectorp (cddr x)))) ;;;###autoload (defun make-ring (size) @@ -60,11 +60,11 @@ (cons 0 (cons 0 (make-vector size nil)))) (defun ring-insert-at-beginning (ring item) - "Add to RING the item ITEM. Add it at the front, as the oldest item." - (let* ((vec (cdr (cdr ring))) + "Add to RING the item ITEM, at the front, as the oldest item." + (let* ((vec (cddr ring)) (veclen (length vec)) (hd (car ring)) - (ln (car (cdr ring)))) + (ln (cadr ring))) (setq ln (min veclen (1+ ln)) hd (ring-minus1 hd veclen)) (aset vec hd item) @@ -73,16 +73,16 @@ (defun ring-plus1 (index veclen) "Return INDEX+1, with wraparound." - (let ((new-index (+ index 1))) + (let ((new-index (1+ index))) (if (= new-index veclen) 0 new-index))) (defun ring-minus1 (index veclen) "Return INDEX-1, with wraparound." - (- (if (= 0 index) veclen index) 1)) + (- (if (zerop index) veclen index) 1)) (defun ring-length (ring) "Return the number of elements in the RING." - (car (cdr ring))) + (cadr ring)) (defun ring-index (index head ringlen veclen) "Convert nominal ring index INDEX to an internal index. @@ -95,26 +95,26 @@ VECLEN is the size of the vector in the ring." (defun ring-empty-p (ring) "Return t if RING is empty; nil otherwise." - (zerop (car (cdr ring)))) + (zerop (cadr ring))) (defun ring-size (ring) "Return the size of RING, the maximum number of elements it can contain." - (length (cdr (cdr ring)))) + (length (cddr ring))) (defun ring-copy (ring) "Return a copy of RING." - (let* ((vec (cdr (cdr ring))) - (hd (car ring)) - (ln (car (cdr ring)))) + (let ((vec (cddr ring)) + (hd (car ring)) + (ln (cadr ring))) (cons hd (cons ln (copy-sequence vec))))) (defun ring-insert (ring item) "Insert onto ring RING the item ITEM, as the newest (last) item. If the ring is full, dump the oldest item to make room." - (let* ((vec (cdr (cdr ring))) + (let* ((vec (cddr ring)) (veclen (length vec)) (hd (car ring)) - (ln (car (cdr ring)))) + (ln (cadr ring))) (prog1 (aset vec (mod (+ hd ln) veclen) item) (if (= ln veclen) @@ -128,13 +128,13 @@ numeric, remove the element indexed." (if (ring-empty-p ring) (error "Ring empty") (let* ((hd (car ring)) - (ln (car (cdr ring))) - (vec (cdr (cdr ring))) + (ln (cadr ring)) + (vec (cddr ring)) (veclen (length vec)) (tl (mod (1- (+ hd ln)) veclen)) oldelt) - (if (null index) - (setq index (1- ln))) + (when (null index) + (setq index (1- ln))) (setq index (ring-index index hd ln veclen)) (setq oldelt (aref vec index)) (while (/= index tl) @@ -152,7 +152,9 @@ INDEX need not be <= the ring length; the appropriate modulo operation will be performed." (if (ring-empty-p ring) (error "Accessing an empty ring") - (let* ((hd (car ring)) (ln (car (cdr ring))) (vec (cdr (cdr ring)))) + (let ((hd (car ring)) + (ln (cadr ring)) + (vec (cddr ring))) (aref vec (ring-index index hd ln (length vec)))))) (defun ring-elements (ring) @@ -165,15 +167,12 @@ will be performed." (push (aref vect (mod (+ start var) size)) lst)))) (defun ring-member (ring item) - "Return index of ITEM if on RING, else nil. Comparison via `equal'. -The index is 0-based." - (let ((ind 0) - (len (1- (ring-length ring))) - (memberp nil)) - (while (and (<= ind len) - (not (setq memberp (equal item (ring-ref ring ind))))) - (setq ind (1+ ind))) - (and memberp ind))) + "Return index of ITEM if on RING, else nil. +Comparison is done via `equal'. The index is 0-based." + (catch 'found + (dotimes (ind (ring-length ring) nil) + (when (equal item (ring-ref ring ind)) + (throw 'found ind))))) (defun ring-next (ring item) "Return the next item in the RING, after ITEM. @@ -190,12 +189,12 @@ Raise error if ITEM is not in the RING." (ring-ref ring (ring-minus1 curr-index (ring-length ring))))) (defun ring-insert+extend (ring item &optional grow-p) - "Like ring-insert, but if GROW-P is non-nil, then enlarge ring. + "Like `ring-insert', but if GROW-P is non-nil, then enlarge ring. Insert onto ring RING the item ITEM, as the newest (last) item. If the ring is full, behavior depends on GROW-P: If GROW-P is non-nil, enlarge the ring to accommodate the new item. If GROW-P is nil, dump the oldest item to make room for the new." - (let* ((vec (cdr (cdr ring))) + (let* ((vec (cddr ring)) (veclen (length vec)) (hd (car ring)) (ringlen (ring-length ring))) @@ -218,7 +217,8 @@ If the RING is full, behavior depends on GROW-P: If GROW-P is non-nil, enlarge the ring to accommodate the new ITEM. If GROW-P is nil, dump the oldest item to make room for the new." (let (ind) - (while (setq ind (ring-member ring item)) (ring-remove ring ind))) + (while (setq ind (ring-member ring item)) + (ring-remove ring ind))) (ring-insert+extend ring item grow-p)) (defun ring-convert-sequence-to-ring (seq) @@ -227,13 +227,11 @@ If SEQ is already a ring, return it." (if (ring-p seq) seq (let* ((size (length seq)) - (ring (make-ring size)) - (count 0)) - (while (< count size) - (if (or (ring-empty-p ring) - (not (equal (ring-ref ring 0) (elt seq count)))) - (ring-insert-at-beginning ring (elt seq count))) - (setq count (1+ count))) + (ring (make-ring size))) + (dotimes (count size) + (when (or (ring-empty-p ring) + (not (equal (ring-ref ring 0) (elt seq count)))) + (ring-insert-at-beginning ring (elt seq count)))) ring))) ;;; provide ourself: -- cgit v1.2.3 From 43ab13de0b74f3d9f27797d8cad877b0ab478499 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 17 Nov 2007 03:43:54 +0000 Subject: (authors-process-lines): Remove. (authors): Use process-lines rather than authors-process-lines. --- lisp/emacs-lisp/authors.el | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/authors.el b/lisp/emacs-lisp/authors.el index 50d2f41f7ae..486a02d2c6b 100644 --- a/lisp/emacs-lisp/authors.el +++ b/lisp/emacs-lisp/authors.el @@ -418,24 +418,6 @@ author and what he did in hash table TABLE. See the description of (nconc entry (list (cons action 1)))))))) -(defun authors-process-lines (program &rest args) - "Execute PROGRAM with ARGS, returning its output as a list of lines. -Signal an error if the program returns with a non-zero exit status." - (with-temp-buffer - (let ((status (apply 'call-process program nil (current-buffer) nil args))) - (unless (eq status 0) - (error "%s exited with status %s" program status)) - (goto-char (point-min)) - (let (lines) - (while (not (eobp)) - (setq lines (cons (buffer-substring-no-properties - (line-beginning-position) - (line-end-position)) - lines)) - (forward-line 1)) - (nreverse lines))))) - - (defun authors-canonical-author-name (author) "Return a canonicalized form of AUTHOR, an author name. If AUTHOR has an alias, use that. Remove email addresses. Capitalize @@ -605,7 +587,7 @@ Result is a buffer *Authors* containing authorship information, and a buffer *Authors Errors* containing references to unknown files." (interactive "DEmacs source directory: ") (setq root (expand-file-name root)) - (let ((logs (authors-process-lines "find" root "-name" "ChangeLog*")) + (let ((logs (process-lines "find" root "-name" "ChangeLog*")) (table (make-hash-table :test 'equal)) (buffer-name "*Authors*") authors-checked-files-alist @@ -617,7 +599,7 @@ buffer *Authors Errors* containing references to unknown files." (when (string-match "ChangeLog\\(.[0-9]+\\)?$" log) (message "Scanning %s..." log) (authors-scan-change-log log table))) - (let ((els (authors-process-lines "find" root "-name" "*.el"))) + (let ((els (process-lines "find" root "-name" "*.el"))) (dolist (file els) (message "Scanning %s..." file) (authors-scan-el file table))) -- cgit v1.2.3 From aefbd1608c5aca54cc04306792f7d10915fb8006 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 17 Nov 2007 03:45:17 +0000 Subject: (declare-function): New macro. --- lisp/emacs-lisp/byte-run.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 267173c1713..b0525cbc7c6 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -103,6 +103,25 @@ The return value of this function is not used." (eval-and-compile (put ',name 'byte-optimizer 'byte-compile-inline-expand)))) +(defmacro declare-function (fn file &optional arglist) + "Tell the byte-compiler that function FN is defined, in FILE. +Optional ARGLIST is the argument list used by the function. The +FILE argument is not used by the byte-compiler, but by the +`check-declare' package, which checks that FILE contains a +definition for FN. FILE should be either absolute, or relative +to the location of the file containing the declaration. ARGLIST +is used by both the byte-compiler and `check-declare' to check +for consistency. + +Note that for the purposes of `check-declare', this statement +must be the first non-whitespace on a line, and everything up to +the end of FILE must be all on the same line. For example: + +\(declare-function c-end-of-defun \"progmodes/cc-cmds.el\" + \(&optional arg))" + ;; Does nothing - byte-compile-declare-function does the work. + ) + (defun make-obsolete (obsolete-name current-name &optional when) "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. The warning will say that CURRENT-NAME should be used instead. -- cgit v1.2.3 From d97362d77951e32486aff2ed7005f8b9b047555c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 17 Nov 2007 03:46:23 +0000 Subject: (byte-compile-declare-function): New function, byte-hunk-handler for declare-function. (byte-compile-callargs-warn): Handle declared functions. --- lisp/emacs-lisp/bytecomp.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 0248bb20f06..313df65f0c1 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1258,7 +1258,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (byte-compile-fdefinition (car form) t))) (sig (if (and def (not (eq def t))) (byte-compile-arglist-signature - (if (eq 'lambda (car-safe def)) + (if (memq (car-safe def) '(declared lambda)) (nth 1 def) (if (byte-code-function-p def) (aref def 0) @@ -2817,6 +2817,16 @@ If FORM is a lambda or a macro, byte-compile it as a function." (cdr body)) (body (list body)))) + +(put 'declare-function 'byte-hunk-handler 'byte-compile-declare-function) +(defun byte-compile-declare-function (form) + (push (cons (nth 1 form) + (if (< (length form) 4) ; arglist not specified + t + (list 'declared (nth 3 form)))) + byte-compile-function-environment) + nil) + ;; This is the recursive entry point for compiling each subform of an ;; expression. -- cgit v1.2.3 From 87b8db2bf304147a6ef8d50dda3b13a0397fa581 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 17 Nov 2007 03:47:59 +0000 Subject: New file. --- lisp/emacs-lisp/check-declare.el | 195 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 lisp/emacs-lisp/check-declare.el (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el new file mode 100644 index 00000000000..e0d9601f4b4 --- /dev/null +++ b/lisp/emacs-lisp/check-declare.el @@ -0,0 +1,195 @@ +;;; check-declare.el --- Check declare-function statements + +;; Copyright (C) 2007 Free Software Foundation, Inc. + +;; Author: Glenn Morris +;; Keywords: lisp, tools, maint + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; The byte-compiler often warns about undefined functions that you +;; know will actually be defined when it matters. The `declare-function' +;; statement allows you to suppress these warnings. This package +;; checks that all such statements in a file or directory are accurate. +;; The entry points are `check-declare-file' and `check-declare-directory'. + +;;; Code: + +(defconst check-declare-warning-buffer "*Check Declarations Warnings*" + "Name of buffer used to display any `check-declare' warnings.") + +(defun check-declare-scan (file) + "Scan FILE for `declare-function' calls. +Return a list with elements of the form (FNFILE FN ARGLIST), where +ARGLIST may be absent. This claims that FNFILE defines FN, with ARGLIST." + (let ((m (format "Scanning %s..." file)) + alist fnfile fn) + (message "%s" m) + (with-temp-buffer + (insert-file-contents file) + (while (re-search-forward + "^[ \t]*(declare-function[ \t]+\\(\\S-+\\)[ \t]+\ +\"\\(\\S-+\\)\"" nil t) + (setq fn (match-string 1) + fnfile (match-string 2)) + (or (file-name-absolute-p fnfile) + (setq fnfile (expand-file-name fnfile (file-name-directory file)))) + (setq alist (cons + (list fnfile fn + (progn + (skip-chars-forward " \t\n") + ;; Use `t' to distinguish no arglist + ;; specified from an empty one. + (if (looking-at "\\((\\|nil\\)") + (read (current-buffer)) + t))) + alist)))) + (message "%sdone" m) + alist)) + +(autoload 'byte-compile-arglist-signature "bytecomp") + +(defun check-declare-verify (fnfile fnlist) + "Check that FNFILE contains function definitions matching FNLIST. +Each element of FNLIST has the form (FILE FN ARGLIST), where +ARGLIST is optional. This means FILE claimed FN was defined in +FNFILE with the specified ARGLIST. Returns nil if all claims are +found to be true, otherwise a list of errors with elements of the form +\(FILE FN TYPE), where TYPE is a string giving details of the error." + (let ((m (format "Checking %s..." fnfile)) + re fn sig siglist arglist type errlist) + (message "%s" m) + (if (file-exists-p fnfile) + (with-temp-buffer + (insert-file-contents fnfile) + (setq re (format "^[ \t]*(defun[ \t]+%s\\>" + (regexp-opt (mapcar 'cadr fnlist) t))) + (while (re-search-forward re nil t) + (skip-chars-forward " \t\n") + (setq fn (match-string 1) + sig (if (looking-at "\\((\\|nil\\)") + (byte-compile-arglist-signature + (read (current-buffer)))) + ;; alist of functions and arglist signatures. + siglist (cons (cons fn sig) siglist))))) + (dolist (e fnlist) + (setq arglist (nth 2 e) + type + (if re ; re non-nil means found a file + (if (setq sig (assoc (cadr e) siglist)) + ;; Recall we use t to mean no arglist specified, + ;; to distinguish from an empty arglist. + (unless (eq arglist t) + (unless (equal (byte-compile-arglist-signature arglist) + (cdr sig)) + "arglist mismatch")) + "function not found") + "file not found")) + (when type + (setq errlist (cons (list (car e) (cadr e) type) errlist)))) + (message "%s%s" m (if errlist "problems found" "OK")) + errlist)) + +(defun check-declare-sort (alist) + "Sort a list with elements FILE (FNFILE ...). +Returned list has elements FNFILE (FILE ...)." + (let (file fnfile rest sort a) + (dolist (e alist) + (setq file (car e)) + (dolist (f (cdr e)) + (setq fnfile (car f) + rest (cdr f)) + (if (setq a (assoc fnfile sort)) + (setcdr a (append (cdr a) (list (cons file rest)))) + (setq sort (cons (list fnfile (cons file rest)) sort))))) + sort)) + +(defun check-declare-warn (file fn fnfile type) + "Warn that FILE made a false claim about FN in FNFILE. +TYPE is a string giving the nature of the error. Warning is displayed in +`check-declare-warning-buffer'." + (display-warning 'check-declare + (format "%s said `%s' was defined in %s: %s" + (file-name-nondirectory file) fn + (file-name-nondirectory fnfile) + type) + nil check-declare-warning-buffer)) + +(defun check-declare-files (&rest files) + "Check veracity of all `declare-function' statements in FILES. +Return a list of any errors found." + (let (alist err errlist) + (dolist (file files) + (setq alist (cons (cons file (check-declare-scan file)) alist))) + ;; Sort so that things are ordered by the files supposed to + ;; contain the defuns. + (dolist (e (check-declare-sort alist)) + (if (setq err (check-declare-verify (car e) (cdr e))) + (setq errlist (cons (cons (car e) err) errlist)))) + (if (get-buffer check-declare-warning-buffer) + (kill-buffer check-declare-warning-buffer)) + ;; Sort back again so that errors are ordered by the files + ;; containing the declare-function statements. + (dolist (e (check-declare-sort errlist)) + (dolist (f (cdr e)) + (check-declare-warn (car e) (cadr f) (car f) (nth 2 f)))) + errlist)) + +;;;###autoload +(defun check-declare-file (file) + "Check veracity of all `declare-function' statements in FILE. +See `check-declare-directory' for more information." + (interactive "fFile to check: ") + (or (file-exists-p file) + (error "File `%s' not found" file)) + (let ((m (format "Checking %s..." file)) + errlist) + (message "%s" m) + (setq errlist (check-declare-files file)) + (message "%s%s" m (if errlist "problems found" "OK")) + errlist)) + +;;;###autoload +(defun check-declare-directory (root) + "Check veracity of all `declare-function' statements under directory ROOT. +Returns non-nil if any false statements are found. For this to +work correctly, the statements must adhere to the format +described in the documentation of `declare-function'." + (interactive "DDirectory to check: ") + (or (file-directory-p (setq root (expand-file-name root))) + (error "Directory `%s' not found" root)) + (let ((m "Checking `declare-function' statements...") + (m2 "Finding files with declarations...") + errlist files) + (message "%s" m) + (message "%s" m2) + (setq files (process-lines "find" root "-name" "*.el" + "-exec" "grep" "-l" + "^[ ]*(declare-function" "{}" ";")) + (message "%s%d found" m2 (length files)) + (when files + (setq errlist (apply 'check-declare-files files)) + (message "%s%s" m (if errlist "problems found" "OK")) + errlist))) + +(provide 'check-declare) + +;; arch-tag: a4d6cdc4-deb7-4502-b327-0e4ef3d82d96 +;;; check-declare.el ends here. -- cgit v1.2.3 From f3a4724d5c6597e5722761a83d313565256eb6c7 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 19 Nov 2007 00:09:20 +0000 Subject: (check-declare-verify): If fnfile does not exist, try adding `.el' extension. Also search for defsubsts. --- lisp/emacs-lisp/check-declare.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index e0d9601f4b4..0b78da165db 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -30,6 +30,10 @@ ;; checks that all such statements in a file or directory are accurate. ;; The entry points are `check-declare-file' and `check-declare-directory'. +;;; TODO: + +;; 1. Handle defstructs (eg uniquify-item-base in desktop.el). + ;;; Code: (defconst check-declare-warning-buffer "*Check Declarations Warnings*" @@ -76,14 +80,17 @@ found to be true, otherwise a list of errors with elements of the form (let ((m (format "Checking %s..." fnfile)) re fn sig siglist arglist type errlist) (message "%s" m) + (or (file-exists-p fnfile) + (setq fnfile (concat fnfile ".el"))) (if (file-exists-p fnfile) (with-temp-buffer (insert-file-contents fnfile) - (setq re (format "^[ \t]*(defun[ \t]+%s\\>" + ;; defsubst's don't _have_ to be known at compile time. + (setq re (format "^[ \t]*(def\\(un\\|subst\\)[ \t]+%s\\>" (regexp-opt (mapcar 'cadr fnlist) t))) (while (re-search-forward re nil t) (skip-chars-forward " \t\n") - (setq fn (match-string 1) + (setq fn (match-string 2) sig (if (looking-at "\\((\\|nil\\)") (byte-compile-arglist-signature (read (current-buffer)))) -- cgit v1.2.3 From db283402061f3207cf82784b3207c88d9c23bb00 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 19 Nov 2007 00:10:38 +0000 Subject: (compilation-forget-errors): Declare as function. --- lisp/ChangeLog | 11 +++++++++++ lisp/emacs-lisp/bytecomp.el | 3 +++ 2 files changed, 14 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8c1bcf780c4..4ae2d5c9b3e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2007-11-19 Glenn Morris + + * emacs-lisp/check-declare.el (check-declare-verify): If fnfile + does not exist, try adding `.el' extension. Also search for defsubsts. + + * cus-edit.el (recentf-expand-file-name): + * dired.el (dired-relist-entry): + * subr.el (w32-shell-dos-semantics): + * emacs-lisp/bytecomp.el (compilation-forget-errors): + Declare as functions. + 2007-11-18 Stefan Monnier * abbrev.el (kill-all-abbrevs, insert-abbrevs) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 313df65f0c1..b40eac3b9d1 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1053,6 +1053,9 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (defun byte-compile-warning-series (&rest ignore) nil) +;; (compile-mode) will cause this to be loaded. +(declare-function compilation-forget-errors "../progmodes/compile" nil) + ;; Log the start of a file in *Compile-Log*, and mark it as done. ;; Return the position of the start of the page in the log buffer. ;; But do nothing in batch mode. -- cgit v1.2.3 From 153ef845b8355e243c2adcf1ea52fb55636683d8 Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Tue, 20 Nov 2007 00:57:10 +0000 Subject: * progmodes/idlw-help.el: Require browse-url unconditionally, it is available by default. (idlwave-help-browse-url-available): Change default to t. * emulation/edt.el (defgroup, defcustom): Remove definition. (eval-when-compile): Remove. (c-mark-function): * textmodes/reftex-dcr.el (bibtex-beginning-of-entry): * textmodes/fill.el (comment-search-forward) (comment-string-strip): * progmodes/prolog.el (comint-mode, comint-send-string) (comint-send-region, comint-send-eof): * progmodes/dcl-mode.el (imenu-default-create-index-function): * emulation/viper-util.el (viper-forward-Word): * emulation/vi.el (c-mark-function): * emulation/edt-vt100.el (vt100-wide-mode): * emacs-lisp/timer.el (diary-entry-time): Declare as functions. * url-mailto.el (mail-send-and-exit): * url-http.el (url-dav-file-attributes): * url-file.el (ange-ftp-set-passwd, ange-ftp-copy-file-internal): Declare as functions. * url-privacy.el (url-device-type): Define unconditionally. --- lisp/ChangeLog | 20 ++++++++++++++++++++ lisp/emacs-lisp/timer.el | 3 +++ lisp/emulation/edt-vt100.el | 2 ++ lisp/emulation/edt.el | 34 +++++++++++++--------------------- lisp/emulation/vi.el | 2 ++ lisp/emulation/viper-util.el | 2 ++ lisp/progmodes/dcl-mode.el | 1 + lisp/progmodes/idlw-help.el | 7 ++----- lisp/progmodes/prolog.el | 5 +++++ lisp/textmodes/fill.el | 4 ++++ lisp/textmodes/reftex-dcr.el | 2 ++ lisp/url/ChangeLog | 9 +++++++++ lisp/url/url-file.el | 5 +++++ lisp/url/url-http.el | 2 ++ lisp/url/url-mailto.el | 2 ++ lisp/url/url-privacy.el | 7 ++++--- 16 files changed, 78 insertions(+), 29 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2aa2ba6575d..784c2d09da8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,23 @@ +2007-11-20 Dan Nicolaescu + + * progmodes/idlw-help.el: Require browse-url unconditionally, it + is available by default. + (idlwave-help-browse-url-available): Change default to t. + + * emulation/edt.el (defgroup, defcustom): Remove definition. + (eval-when-compile): Remove. + (c-mark-function): + * textmodes/reftex-dcr.el (bibtex-beginning-of-entry): + * textmodes/fill.el (comment-search-forward) + (comment-string-strip): + * progmodes/prolog.el (comint-mode, comint-send-string) + (comint-send-region, comint-send-eof): + * progmodes/dcl-mode.el (imenu-default-create-index-function): + * emulation/viper-util.el (viper-forward-Word): + * emulation/vi.el (c-mark-function): + * emulation/edt-vt100.el (vt100-wide-mode): + * emacs-lisp/timer.el (diary-entry-time): Declare as functions. + 2007-11-19 Michael Albinus * net/tramp.el (tramp-open-connection-setup-interactive-shell): diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 0fed5962fcb..023a4a3e4b7 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -356,6 +356,9 @@ This function is called, by name, directly by the C code." "Non-nil if EVENT is a timeout event." (and (listp event) (eq (car event) 'timer-event))) + +(declare-function diary-entry-time "../calendar/diary-lib" (s)) + ;;;###autoload (defun run-at-time (time repeat function &rest args) "Perform an action at time TIME. diff --git a/lisp/emulation/edt-vt100.el b/lisp/emulation/edt-vt100.el index 4e094a5f703..fbe56c2c341 100644 --- a/lisp/emulation/edt-vt100.el +++ b/lisp/emulation/edt-vt100.el @@ -39,6 +39,8 @@ ;; The following functions are called by the EDT screen width commands defined ;; in edt.el. +(declare-function vt100-wide-mode "../term/vt100" (&optional arg)) + (defun edt-set-term-width-80 () "Set terminal width to 80 columns." (vt100-wide-mode -1)) diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el index 4a68e258cb1..d61ef9725f3 100644 --- a/lisp/emulation/edt.el +++ b/lisp/emulation/edt.el @@ -166,28 +166,23 @@ ;;;; VARIABLES and CONSTANTS ;;;; -;; For backward compatibility to Emacs 19. -(or (fboundp 'defgroup) - (defmacro defgroup (&rest rest))) - (defgroup edt nil "Emacs emulating EDT." :prefix "edt-" :group 'emulations) ;; To silence the byte-compiler -(eval-when-compile - (defvar *EDT-keys*) - (defvar edt-default-global-map) - (defvar edt-last-copied-word) - (defvar edt-learn-macro-count) - (defvar edt-orig-page-delimiter) - (defvar edt-orig-transient-mark-mode) - (defvar edt-rect-start-point) - (defvar edt-user-global-map) - (defvar rect-start-point) - (defvar time-string) - (defvar zmacs-region-stays)) +(defvar *EDT-keys*) +(defvar edt-default-global-map) +(defvar edt-last-copied-word) +(defvar edt-learn-macro-count) +(defvar edt-orig-page-delimiter) +(defvar edt-orig-transient-mark-mode) +(defvar edt-rect-start-point) +(defvar edt-user-global-map) +(defvar rect-start-point) +(defvar time-string) +(defvar zmacs-region-stays) ;;; ;;; Version Information @@ -198,11 +193,6 @@ ;;; User Configurable Variables ;;; -;; For backward compatibility to Emacs 19. -(or (fboundp 'defcustom) - (defmacro defcustom (var value doc &rest ignore) - `(defvar ,var ,value ,doc))) - (defcustom edt-keep-current-page-delimiter nil "*Emacs MUST be restarted for a change in value to take effect! Non-nil leaves Emacs value of `page-delimiter' unchanged within EDT @@ -1628,6 +1618,8 @@ Argument NUM is the percentage into the buffer to move." (indent-region (point) (mark) nil) (fill-region (point) (mark)))) + +(declare-function c-mark-function "../progmodes/cc-cmds" ()) ;;; ;;; MARK SECTION WISELY ;;; diff --git a/lisp/emulation/vi.el b/lisp/emulation/vi.el index 81ad04b60d9..889f81e75c7 100644 --- a/lisp/emulation/vi.el +++ b/lisp/emulation/vi.el @@ -1375,6 +1375,8 @@ The following CHAR will be the name for the command or macro." (setq char (read-char)) (vi-ask-for-info char)))) +(declare-function c-mark-function "../progmodes/cc-cmds" ()) + (defun vi-mark-region (arg region) "Mark region appropriately. The next char REGION is d(efun),s(-exp),b(uffer), p(aragraph), P(age), f(unction in C/Pascal etc.), w(ord), e(nd of sentence), diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index c757eb63aef..6a21fa17e31 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el @@ -380,6 +380,8 @@ +(declare-function viper-forward-Word "viper-cmd" (arg)) + ;;; Support for :e, :r, :w file globbing ;; Glob the file spec. diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el index 6a3e9e82d6e..5df2c72b7e0 100644 --- a/lisp/progmodes/dcl-mode.el +++ b/lisp/progmodes/dcl-mode.el @@ -2201,6 +2201,7 @@ otherwise return nil." () (equal start (match-end 0)))))) +(declare-function imenu-default-create-index-function "../imenu" ()) ;;;------------------------------------------------------------------------- (defun dcl-imenu-create-index-function () diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el index 2269e179357..b599baa2893 100644 --- a/lisp/progmodes/idlw-help.el +++ b/lisp/progmodes/idlw-help.el @@ -42,13 +42,10 @@ ;;; Code: -(defvar idlwave-help-browse-url-available nil +(defvar idlwave-help-browse-url-available t "Whether browse-url is available") -(setq idlwave-help-browse-url-available - (condition-case nil - (require 'browse-url) - (error nil))) +(require 'browse-url) (defgroup idlwave-online-help nil "Online Help options for IDLWAVE mode." diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 3583f546754..190442bf26e 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -240,6 +240,11 @@ rigidly along with this one (not yet)." (defvar inferior-prolog-mode-syntax-table prolog-mode-syntax-table) (defvar inferior-prolog-mode-abbrev-table prolog-mode-abbrev-table) +(declare-function comint-mode "../comint") +(declare-function comint-send-string "../comint" (process string)) +(declare-function comint-send-region "../comint" (process start end)) +(declare-function comint-send-eof "../comint" ()) + (define-derived-mode inferior-prolog-mode comint-mode "Inferior Prolog" "Major mode for interacting with an inferior Prolog process. diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 6a0eb7a42cc..cd60cf3bf34 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -831,6 +831,10 @@ in the active region." (fill-region-as-paragraph beg end justify)))))) fill-pfx))) +(declare-function comment-search-forward "../newcomment" (limit &optional noerror)) +(declare-function comment-string-strip "../newcomment" (str beforep afterp)) + + (defun fill-comment-paragraph (&optional justify) "Fill current comment. If we're not in a comment, just return nil so that the caller diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el index e1ecc885f69..86ad54a73fa 100644 --- a/lisp/textmodes/reftex-dcr.el +++ b/lisp/textmodes/reftex-dcr.el @@ -359,6 +359,8 @@ will display info in the echo area." 'reftex-view-crossref-when-idle reftex-idle-time nil t)))) +(declare-function bibtex-beginning-of-entry "bibtex" ()) + (defun reftex-view-crossref-from-bibtex (&optional arg) "View location in a LaTeX document which cites the BibTeX entry at point. Since BibTeX files can be used by many LaTeX documents, this function diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 93552c15ea9..56df401cb53 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,12 @@ +2007-11-20 Dan Nicolaescu + + * url-mailto.el (mail-send-and-exit): + * url-http.el (url-dav-file-attributes): + * url-file.el (ange-ftp-set-passwd, ange-ftp-copy-file-internal): + Declare as functions. + + * url-privacy.el (url-device-type): Define unconditionally. + 2007-10-31 Juanma Barranquero * url-vars.el (url-vars-unload-hook): Remove function and variable. diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el index c361016856b..9faee051f46 100644 --- a/lisp/url/url-file.el +++ b/lisp/url/url-file.el @@ -86,6 +86,11 @@ to them." (error nil))) (apply func args)))) +(declare-function ange-ftp-set-passwd "../net/ange-ftp" (host user passwd)) +(declare-function ange-ftp-copy-file-internal "../net/ange-ftp" + (filename newname ok-if-already-exists + keep-date &optional msg cont nowait)) + (defun url-file-build-filename (url) (if (not (vectorp url)) (setq url (url-generic-parse-url url))) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index c5931c7d877..c8447dab859 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -1269,6 +1269,8 @@ CBARGS as the arguments." nil nil nil) ;whether gid would change ; inode ; device. (kill-buffer buffer))))) +(declare-function url-dav-file-attributes (url &optional id-format)) + ;;;###autoload (defun url-http-file-attributes (url &optional id-format) (if (url-dav-supported-p url) diff --git a/lisp/url/url-mailto.el b/lisp/url/url-mailto.el index 4b15d07245b..5004c62415c 100644 --- a/lisp/url/url-mailto.el +++ b/lisp/url/url-mailto.el @@ -60,6 +60,8 @@ (save-excursion (insert "\n")))))) +(declare-function mail-send-and-exit "../mail/sendmail") + ;;;###autoload (defun url-mailto (url) "Handle the mailto: URL syntax." diff --git a/lisp/url/url-privacy.el b/lisp/url/url-privacy.el index 6c29474752b..886e545ae7d 100644 --- a/lisp/url/url-privacy.el +++ b/lisp/url/url-privacy.el @@ -27,9 +27,10 @@ (eval-when-compile (require 'cl)) (require 'url-vars) -(if (fboundp 'device-type) - (defalias 'url-device-type 'device-type) - (defun url-device-type (&optional device) (or window-system 'tty))) +(defun url-device-type (&optional device) + (if (fboundp 'device-type) + (url-device-type device) + (or window-system 'tty))) ;;;###autoload (defun url-setup-privacy-info () -- cgit v1.2.3 From 82b3ac7a99c49b585e0fde395454f895da666998 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 20 Nov 2007 03:53:33 +0000 Subject: (check-declare-verify): Tweak regexp for end of function-name. Handle define-derived-mode. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/check-declare.el | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 784c2d09da8..300ae8b628b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2007-11-20 Glenn Morris + + * emacs-lisp/check-declare.el (check-declare-verify): Tweak regexp + for end of function-name. Handle define-derived-mode. + 2007-11-20 Dan Nicolaescu * progmodes/idlw-help.el: Require browse-url unconditionally, it diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 0b78da165db..c3e41086599 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -86,14 +86,18 @@ found to be true, otherwise a list of errors with elements of the form (with-temp-buffer (insert-file-contents fnfile) ;; defsubst's don't _have_ to be known at compile time. - (setq re (format "^[ \t]*(def\\(un\\|subst\\)[ \t]+%s\\>" + (setq re (format "^[ \t]*(\\(def\\(?:un\\|subst\\|\ +ine-derived-mode\\)\\)\[ \t]+%s\\([ \t;]+\\|$\\)" (regexp-opt (mapcar 'cadr fnlist) t))) (while (re-search-forward re nil t) (skip-chars-forward " \t\n") (setq fn (match-string 2) - sig (if (looking-at "\\((\\|nil\\)") - (byte-compile-arglist-signature - (read (current-buffer)))) + sig (if (string-equal "define-derived-mode" + (match-string 1)) + '(0 . 0) + (if (looking-at "\\((\\|nil\\)") + (byte-compile-arglist-signature + (read (current-buffer))))) ;; alist of functions and arglist signatures. siglist (cons (cons fn sig) siglist))))) (dolist (e fnlist) -- cgit v1.2.3 From 7a6e37202cf8c766d90ba1b06c829ae2810abdbd Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 20 Nov 2007 04:05:18 +0000 Subject: (declare-function): Define as a no-op, for compatibility with Emacs 23. --- lisp/emacs-lisp/byte-run.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 267173c1713..d38641e7e4a 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -103,6 +103,11 @@ The return value of this function is not used." (eval-and-compile (put ',name 'byte-optimizer 'byte-compile-inline-expand)))) +(defalias 'declare-function 'ignore + "In Emacs 22, does nothing. In 23, it will suppress byte-compiler warnings. +This definition is so that packages may take advantage of the +Emacs 23 feature and still remain compatible with Emacs 22.") + (defun make-obsolete (obsolete-name current-name &optional when) "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. The warning will say that CURRENT-NAME should be used instead. -- cgit v1.2.3 From 6d00e226c320eab31d8212b048cb67c442cb4c8f Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Tue, 20 Nov 2007 07:56:02 +0000 Subject: * progmodes/python.el (info-lookup-maybe-add-help): * progmodes/ps-mode.el (doc-view-minor-mode): * mail/emacsbug.el (Info-menu, Info-goto-node): * emulation/viper-keym.el (viper-ex) (viper-normalize-minor-mode-map-alist, viper-set-mode-vars-for): * emulation/viper-cmd.el (widget-type, widget-button-press) (viper-set-hooks): * emacs-lisp/tcover-unsafep.el (unsafep-function): * emacs-lisp/tcover-ses.el (ses-set-curcell, ses-update-cells) (ses-load, ses-vector-delete, ses-create-header-string) (ses-read-cell, ses-read-symbol, ses-command-hook, ses-jump): * emacs-lisp/gulp.el (mail-subject, mail-send): Declare as functions. * url-mailto.el (mail-send-and-exit): * url-http.el (url-dav-file-attributes): * url-file.el (ange-ftp-set-passwd, ange-ftp-copy-file-internal): (url-generate-unique-filename): Declare as functions. --- lisp/ChangeLog | 16 ++++++++++++++++ lisp/emacs-lisp/gulp.el | 3 +++ lisp/emacs-lisp/tcover-ses.el | 11 +++++++++++ lisp/emacs-lisp/tcover-unsafep.el | 1 + lisp/emulation/viper-cmd.el | 3 +++ lisp/emulation/viper-keym.el | 3 +++ lisp/mail/emacsbug.el | 3 +++ lisp/progmodes/ps-mode.el | 3 +++ lisp/progmodes/python.el | 2 ++ lisp/url/ChangeLog | 4 ++-- lisp/url/url-file.el | 1 + 11 files changed, 48 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b3c8eb1c32..2ee6983cb53 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,19 @@ +2007-11-20 Dan Nicolaescu + + * progmodes/python.el (info-lookup-maybe-add-help): + * progmodes/ps-mode.el (doc-view-minor-mode): + * mail/emacsbug.el (Info-menu, Info-goto-node): + * emulation/viper-keym.el (viper-ex) + (viper-normalize-minor-mode-map-alist, viper-set-mode-vars-for): + * emulation/viper-cmd.el (widget-type, widget-button-press) + (viper-set-hooks): + * emacs-lisp/tcover-unsafep.el (unsafep-function): + * emacs-lisp/tcover-ses.el (ses-set-curcell, ses-update-cells) + (ses-load, ses-vector-delete, ses-create-header-string) + (ses-read-cell, ses-read-symbol, ses-command-hook, ses-jump): + * emacs-lisp/gulp.el (mail-subject, mail-send): Declare as + functions. + 2007-11-20 Stefan Monnier * pcvs.el (cvs-revert-if-needed): Fix copy&paste typo. diff --git a/lisp/emacs-lisp/gulp.el b/lisp/emacs-lisp/gulp.el index 9e0795c8822..a75b52d99bd 100644 --- a/lisp/emacs-lisp/gulp.el +++ b/lisp/emacs-lisp/gulp.el @@ -78,6 +78,9 @@ Thanks.") :type 'string :group 'gulp) +(declare-function mail-subject "../mail/sendmail" ()) +(declare-function mail-send "../mail/sendmail" ()) + (defun gulp-send-requests (dir &optional time) "Send requests for updates to the authors of Lisp packages in directory DIR. For each maintainer, the message consists of `gulp-request-header', diff --git a/lisp/emacs-lisp/tcover-ses.el b/lisp/emacs-lisp/tcover-ses.el index 27ddeb25718..0a4bdce0412 100644 --- a/lisp/emacs-lisp/tcover-ses.el +++ b/lisp/emacs-lisp/tcover-ses.el @@ -26,6 +26,17 @@ (defvar ses-initial-global-parameters) (defvar ses-mode-map) +(declare-function ses-set-curcell "../ses") +(declare-function ses-update-cells "../ses") +(declare-function ses-load "../ses") +(declare-function ses-vector-delete "../ses") +(declare-function ses-create-header-string "../ses") +(declare-function ses-read-cell "../ses") +(declare-function ses-read-symbol "../ses") +(declare-function ses-command-hook "../ses") +(declare-function ses-jump "../ses") + + ;;;Here are some macros that exercise SES. Set `pause' to t if you want the ;;;macros to pause after each step. (let* ((pause nil) diff --git a/lisp/emacs-lisp/tcover-unsafep.el b/lisp/emacs-lisp/tcover-unsafep.el index b999ce63b8c..42c3ebef4e7 100644 --- a/lisp/emacs-lisp/tcover-unsafep.el +++ b/lisp/emacs-lisp/tcover-unsafep.el @@ -111,6 +111,7 @@ ) "A-list of (FORM . REASON)... that`unsafep' should decide are unsafe.") +(declare-function unsafep-function "unsafep" (fun)) ;;;######################################################################### (defun testcover-unsafep () diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 5e13edb9495..c90cecf8adc 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -3097,6 +3097,9 @@ On reaching beginning of line, stop and signal error." (setq this-command 'next-line) (if com (viper-execute-com 'viper-next-line val com)))) +(declare-function widget-type "../widget" (widget)) +(declare-function widget-button-press "../widget" (pos &optional event)) +(declare-function viper-set-hooks "viper" ()) (defun viper-next-line-at-bol (arg) "Next line at beginning of line. diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el index 0e502720f5e..ade63b1071c 100644 --- a/lisp/emulation/viper-keym.el +++ b/lisp/emulation/viper-keym.el @@ -48,6 +48,9 @@ (require 'viper-util) +(declare-function viper-ex "viper-ex" (arg &optional string)) +(declare-function viper-normalize-minor-mode-map-alist "viper-cmd" ()) +(declare-function viper-set-mode-vars-for "viper-cmd" (state)) ;;; Variables diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index e725a8affb0..eb96ef07612 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -229,6 +229,9 @@ Type SPC to scroll through this section and its subsections.")))) (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point)))) (goto-char user-point))) +(declare-function Info-menu "info" (menu-item &optional fork)) +(declare-function Info-goto-node "info" (nodename &optional fork)) + (defun report-emacs-bug-info () "Go to the Info node on reporting Emacs bugs." (interactive) diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el index c131575f57c..8b26db1a12e 100644 --- a/lisp/progmodes/ps-mode.el +++ b/lisp/progmodes/ps-mode.el @@ -480,6 +480,9 @@ If nil, the following are tried in turn, until success: (setq i (1+ i))))) + +(declare-function doc-view-minor-mode "../doc-view") + ;; PostScript mode. ;;;###autoload diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f54b7c9f928..4039a4f4a43 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1656,6 +1656,8 @@ instance. Assumes an inferior Python is running." ;;;; Info-look functionality. +(declare-function info-lookup-maybe-add-help "info-look" (&rest arg)) + (defun python-after-info-look () "Set up info-look for Python. Used with `eval-after-load'." diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 56df401cb53..e8ae7233c20 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -3,8 +3,8 @@ * url-mailto.el (mail-send-and-exit): * url-http.el (url-dav-file-attributes): * url-file.el (ange-ftp-set-passwd, ange-ftp-copy-file-internal): - Declare as functions. - + (url-generate-unique-filename): Declare as functions. + * url-privacy.el (url-device-type): Define unconditionally. 2007-10-31 Juanma Barranquero diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el index 9faee051f46..c39dcc030ac 100644 --- a/lisp/url/url-file.el +++ b/lisp/url/url-file.el @@ -90,6 +90,7 @@ to them." (declare-function ange-ftp-copy-file-internal "../net/ange-ftp" (filename newname ok-if-already-exists keep-date &optional msg cont nowait)) +(declare-function url-generate-unique-filename "url-utile" (&optional fmt)) (defun url-file-build-filename (url) (if (not (vectorp url)) -- cgit v1.2.3 From b1dfec553a2be7e1bd027a9f7abdf328bcc379cb Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 20 Nov 2007 12:38:26 +0000 Subject: Comment change. --- lisp/emacs-lisp/byte-opt.el | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 6f653c8fc6e..ebe490fb229 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -276,6 +276,8 @@ ;; Isn't it an error for `string' not to be unibyte?? --stef (if (fboundp 'string-as-unibyte) (setq string (string-as-unibyte string))) + ;; `byte-compile-splice-in-already-compiled-code' + ;; takes care of inlining the body. (cons `(lambda ,(aref fn 0) (byte-code ,string ,(aref fn 2) ,(aref fn 3))) (cdr form))) -- cgit v1.2.3 From 2ae3bb8564e12902c7bdefe692de5292ea6a423d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 21 Nov 2007 09:03:16 +0000 Subject: (check-declare-verify): Skip C files for now. Handle define-minor-mode, and defalias (with no argument checking). --- lisp/ChangeLog | 6 +++ lisp/emacs-lisp/check-declare.el | 90 +++++++++++++++++++++++----------------- 2 files changed, 59 insertions(+), 37 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6a8e8e75186..20a65f205f5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2007-11-21 Glenn Morris + + * emacs-lisp/check-declare.el (check-declare-verify): Skip C files + for now. Handle define-minor-mode, and defalias (with no argument + checking). + 2007-11-21 Dan Nicolaescu * frame.el (msdos-mouse-p): diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index c3e41086599..76719f1b876 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -34,6 +34,8 @@ ;; 1. Handle defstructs (eg uniquify-item-base in desktop.el). +;; 2. Check C files (look in src/)? + ;;; Code: (defconst check-declare-warning-buffer "*Check Declarations Warnings*" @@ -80,43 +82,57 @@ found to be true, otherwise a list of errors with elements of the form (let ((m (format "Checking %s..." fnfile)) re fn sig siglist arglist type errlist) (message "%s" m) - (or (file-exists-p fnfile) - (setq fnfile (concat fnfile ".el"))) - (if (file-exists-p fnfile) - (with-temp-buffer - (insert-file-contents fnfile) - ;; defsubst's don't _have_ to be known at compile time. - (setq re (format "^[ \t]*(\\(def\\(?:un\\|subst\\|\ -ine-derived-mode\\)\\)\[ \t]+%s\\([ \t;]+\\|$\\)" - (regexp-opt (mapcar 'cadr fnlist) t))) - (while (re-search-forward re nil t) - (skip-chars-forward " \t\n") - (setq fn (match-string 2) - sig (if (string-equal "define-derived-mode" - (match-string 1)) - '(0 . 0) - (if (looking-at "\\((\\|nil\\)") - (byte-compile-arglist-signature - (read (current-buffer))))) - ;; alist of functions and arglist signatures. - siglist (cons (cons fn sig) siglist))))) - (dolist (e fnlist) - (setq arglist (nth 2 e) - type - (if re ; re non-nil means found a file - (if (setq sig (assoc (cadr e) siglist)) - ;; Recall we use t to mean no arglist specified, - ;; to distinguish from an empty arglist. - (unless (eq arglist t) - (unless (equal (byte-compile-arglist-signature arglist) - (cdr sig)) - "arglist mismatch")) - "function not found") - "file not found")) - (when type - (setq errlist (cons (list (car e) (cadr e) type) errlist)))) - (message "%s%s" m (if errlist "problems found" "OK")) - errlist)) + (if (string-equal (file-name-extension fnfile) "c") + (progn + (message "%sskipping C file" m) + nil) + (or (file-exists-p fnfile) + (setq fnfile (concat fnfile ".el"))) + (if (file-exists-p fnfile) + (with-temp-buffer + (insert-file-contents fnfile) + ;; defsubst's don't _have_ to be known at compile time. + (setq re (format "^[ \t]*(\\(def\\(?:un\\|subst\\|\ +ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\ +\[ \t]*%s\\([ \t;]+\\|$\\)" + (regexp-opt (mapcar 'cadr fnlist) t))) + (while (re-search-forward re nil t) + (skip-chars-forward " \t\n") + (setq fn (match-string 2) + sig (cond ((string-equal (match-string 1) + "define-derived-mode") + '(0 . 0)) + ((string-equal (match-string 1) + "define-minor-mode") + '(0 . 1)) + ;; Can't easily check alias arguments. + ((string-equal (match-string 1) + "defalias") + t) + (t + (if (looking-at "\\((\\|nil\\)") + (byte-compile-arglist-signature + (read (current-buffer)))))) + ;; alist of functions and arglist signatures. + siglist (cons (cons fn sig) siglist))))) + (dolist (e fnlist) + (setq arglist (nth 2 e) + type + (if re ; re non-nil means found a file + (if (setq sig (assoc (cadr e) siglist)) + ;; Recall we use t to mean no arglist specified, + ;; to distinguish from an empty arglist. + (unless (or (eq arglist t) + (eq sig t)) + (unless (equal (byte-compile-arglist-signature arglist) + (cdr sig)) + "arglist mismatch")) + "function not found") + "file not found")) + (when type + (setq errlist (cons (list (car e) (cadr e) type) errlist)))) + (message "%s%s" m (if errlist "problems found" "OK")) + errlist))) (defun check-declare-sort (alist) "Sort a list with elements FILE (FNFILE ...). -- cgit v1.2.3 From c2ca78bc31645e04406a57fd5ee52b8e9486b9fd Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Wed, 21 Nov 2007 22:40:10 +0000 Subject: (declare-function): Return nil. --- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/byte-run.el | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 234d71a68bc..53522780557 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2007-11-21 Jason Rumney + + * emacs-lisp/byte-run.el (declare-function): Return nil. + 2007-11-21 Stefan Monnier * progmodes/sh-script.el (sh-mode): Set defun-prompt-regexp. diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index b0525cbc7c6..bf91a8d58fc 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -120,7 +120,7 @@ the end of FILE must be all on the same line. For example: \(declare-function c-end-of-defun \"progmodes/cc-cmds.el\" \(&optional arg))" ;; Does nothing - byte-compile-declare-function does the work. - ) + nil) (defun make-obsolete (obsolete-name current-name &optional when) "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. -- cgit v1.2.3 From 3ab75caec0317d22b5ecf301d55467eb8a685f61 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 22 Nov 2007 04:17:44 +0000 Subject: (declare-function): Doc fix. --- lisp/emacs-lisp/byte-run.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index bf91a8d58fc..2ba708d9c92 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -108,10 +108,14 @@ The return value of this function is not used." Optional ARGLIST is the argument list used by the function. The FILE argument is not used by the byte-compiler, but by the `check-declare' package, which checks that FILE contains a -definition for FN. FILE should be either absolute, or relative -to the location of the file containing the declaration. ARGLIST -is used by both the byte-compiler and `check-declare' to check -for consistency. +definition for FN. ARGLIST is used by both the byte-compiler and +`check-declare' to check for consistency. + +FILE can be either a Lisp file (in which case the \".el\" +extension is optional), or a C file. FILE should be either +absolute, or relative to the location of the file containing the +declaration (for a Lisp file), or to the Emacs \"src/\" directory +\(for a C file). Note that for the purposes of `check-declare', this statement must be the first non-whitespace on a line, and everything up to -- cgit v1.2.3 From 9769d49f91e944dfe1b7a44684df4382c8a19411 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 22 Nov 2007 04:19:48 +0000 Subject: (check-declare-scan): Expand .c files relative to src/ directory. (check-declare-verify): Handle .c files (without arg checking). --- lisp/ChangeLog | 15 +++++ lisp/emacs-lisp/check-declare.el | 117 ++++++++++++++++++++++----------------- 2 files changed, 80 insertions(+), 52 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2280c706bd5..08cfd22f581 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,18 @@ +2007-11-22 Glenn Morris + + * dos-fns.el (int86): + * term/mac-win.el (mac-font-panel-mode): Fix declarations. + + * calendar/cal-menu.el (cal-menu-holidays-menu): Fix holiday-list call. + + * calendar/holidays.el (holiday-list): Add autoload cookie. + + * emacs-lisp/check-declare.el (check-declare-scan): Expand .c + files relative to src/ directory. + (check-declare-verify): Handle .c files (without arg checking). + + * emacs-lisp/byte-run.el (declare-function): Doc fix. + 2007-11-22 Dan Nicolaescu * replace.el (occur-mode-map): Add a major mode menu with entries diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 76719f1b876..5da8691beed 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -34,7 +34,7 @@ ;; 1. Handle defstructs (eg uniquify-item-base in desktop.el). -;; 2. Check C files (look in src/)? +;; 2. Argument checking for functions defined in C. ;;; Code: @@ -56,7 +56,15 @@ ARGLIST may be absent. This claims that FNFILE defines FN, with ARGLIST." (setq fn (match-string 1) fnfile (match-string 2)) (or (file-name-absolute-p fnfile) - (setq fnfile (expand-file-name fnfile (file-name-directory file)))) + (setq fnfile + (expand-file-name fnfile + ;; .c files are assumed to be + ;; relative to the Emacs src/ directory. + (if (string-equal + "c" (file-name-extension fnfile)) + (expand-file-name "src" + source-directory) + (file-name-directory file))))) (setq alist (cons (list fnfile fn (progn @@ -80,59 +88,64 @@ FNFILE with the specified ARGLIST. Returns nil if all claims are found to be true, otherwise a list of errors with elements of the form \(FILE FN TYPE), where TYPE is a string giving details of the error." (let ((m (format "Checking %s..." fnfile)) + (cflag (string-equal "c" (file-name-extension fnfile))) re fn sig siglist arglist type errlist) (message "%s" m) - (if (string-equal (file-name-extension fnfile) "c") - (progn - (message "%sskipping C file" m) - nil) - (or (file-exists-p fnfile) - (setq fnfile (concat fnfile ".el"))) - (if (file-exists-p fnfile) - (with-temp-buffer - (insert-file-contents fnfile) - ;; defsubst's don't _have_ to be known at compile time. - (setq re (format "^[ \t]*(\\(def\\(?:un\\|subst\\|\ + (or cflag + (file-exists-p fnfile) + (setq fnfile (concat fnfile ".el"))) + (if (file-exists-p fnfile) + (with-temp-buffer + (insert-file-contents fnfile) + ;; defsubst's don't _have_ to be known at compile time. + (setq re (format (if cflag + "^[ \t]*\\(DEFUN\\)[ \t]*([ \t]*\"%s\"" + "^[ \t]*(\\(def\\(?:un\\|subst\\|\ ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\ -\[ \t]*%s\\([ \t;]+\\|$\\)" - (regexp-opt (mapcar 'cadr fnlist) t))) - (while (re-search-forward re nil t) - (skip-chars-forward " \t\n") - (setq fn (match-string 2) - sig (cond ((string-equal (match-string 1) - "define-derived-mode") - '(0 . 0)) - ((string-equal (match-string 1) - "define-minor-mode") - '(0 . 1)) - ;; Can't easily check alias arguments. - ((string-equal (match-string 1) - "defalias") - t) - (t - (if (looking-at "\\((\\|nil\\)") - (byte-compile-arglist-signature - (read (current-buffer)))))) - ;; alist of functions and arglist signatures. - siglist (cons (cons fn sig) siglist))))) - (dolist (e fnlist) - (setq arglist (nth 2 e) - type - (if re ; re non-nil means found a file - (if (setq sig (assoc (cadr e) siglist)) - ;; Recall we use t to mean no arglist specified, - ;; to distinguish from an empty arglist. - (unless (or (eq arglist t) - (eq sig t)) - (unless (equal (byte-compile-arglist-signature arglist) - (cdr sig)) - "arglist mismatch")) - "function not found") - "file not found")) - (when type - (setq errlist (cons (list (car e) (cadr e) type) errlist)))) - (message "%s%s" m (if errlist "problems found" "OK")) - errlist))) +\[ \t]*%s\\([ \t;]+\\|$\\)") + (regexp-opt (mapcar 'cadr fnlist) t))) + (while (re-search-forward re nil t) + (skip-chars-forward " \t\n") + (setq fn (match-string 2) + ;; (min . max) for a fixed number of arguments, or + ;; arglists with optional elements. + ;; (min) for arglists with &rest. + sig (cond ((string-equal (match-string 1) + "define-derived-mode") + '(0 . 0)) + ((string-equal (match-string 1) + "define-minor-mode") + '(0 . 1)) + ;; Can't easily check alias arguments. + ((string-equal (match-string 1) + "defalias") + t) + (t + (if (looking-at "\\((\\|nil\\)") + (byte-compile-arglist-signature + (read (current-buffer)))))) + ;; alist of functions and arglist signatures. + siglist (cons (cons fn sig) siglist))))) + (dolist (e fnlist) + (setq arglist (nth 2 e) + type + (if re ; re non-nil means found a file + (if (setq sig (assoc (cadr e) siglist)) + ;; Recall we use t to mean no arglist specified, + ;; to distinguish from an empty arglist. + ;; FIXME c arg checking not yet implemented. + (unless (or cflag + (eq arglist t) + (eq sig t)) + (unless (equal (byte-compile-arglist-signature arglist) + (cdr sig)) + "arglist mismatch")) + "function not found") + "file not found")) + (when type + (setq errlist (cons (list (car e) (cadr e) type) errlist)))) + (message "%s%s" m (if errlist "problems found" "OK")) + errlist)) (defun check-declare-sort (alist) "Sort a list with elements FILE (FNFILE ...). -- cgit v1.2.3 From ad95f32a98471c83bbb612925e3f3cbc4d30d08d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 22 Nov 2007 06:20:53 +0000 Subject: (check-declare-verify): Implement arglist checking for C files. --- lisp/emacs-lisp/check-declare.el | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 5da8691beed..c1cdb3a2e80 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -34,8 +34,6 @@ ;; 1. Handle defstructs (eg uniquify-item-base in desktop.el). -;; 2. Argument checking for functions defined in C. - ;;; Code: (defconst check-declare-warning-buffer "*Check Declarations Warnings*" @@ -89,7 +87,7 @@ found to be true, otherwise a list of errors with elements of the form \(FILE FN TYPE), where TYPE is a string giving details of the error." (let ((m (format "Checking %s..." fnfile)) (cflag (string-equal "c" (file-name-extension fnfile))) - re fn sig siglist arglist type errlist) + re fn sig siglist arglist type errlist minargs maxargs) (message "%s" m) (or cflag (file-exists-p fnfile) @@ -110,7 +108,18 @@ ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\ ;; (min . max) for a fixed number of arguments, or ;; arglists with optional elements. ;; (min) for arglists with &rest. - sig (cond ((string-equal (match-string 1) + sig (cond (cflag + (re-search-forward "," nil t 3) + (skip-chars-forward " \t\n") + ;; Assuming minargs and maxargs on same line. + (when (looking-at "\\([0-9]+\\)[ \t]*,[ \t]*\ +\\([0-9]+\\|MANY\\|UNEVALLED\\)") + (setq minargs (string-to-number (match-string 1)) + maxargs (match-string 2)) + (cons minargs (unless (string-match "[^0-9]" + maxargs) + (string-to-number maxargs))))) + ((string-equal (match-string 1) "define-derived-mode") '(0 . 0)) ((string-equal (match-string 1) @@ -133,9 +142,7 @@ ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\ (if (setq sig (assoc (cadr e) siglist)) ;; Recall we use t to mean no arglist specified, ;; to distinguish from an empty arglist. - ;; FIXME c arg checking not yet implemented. - (unless (or cflag - (eq arglist t) + (unless (or (eq arglist t) (eq sig t)) (unless (equal (byte-compile-arglist-signature arglist) (cdr sig)) -- cgit v1.2.3 From 64cea5550d3c36c42da295585b8591e7fc58e6a6 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 22 Nov 2007 06:53:24 +0000 Subject: (check-declare-verify): Fix previous change. Warn if could not find an arglist to check. --- lisp/emacs-lisp/check-declare.el | 48 ++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index c1cdb3a2e80..a4767794132 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -108,17 +108,22 @@ ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\ ;; (min . max) for a fixed number of arguments, or ;; arglists with optional elements. ;; (min) for arglists with &rest. + ;; sig = 'err means we could not find an arglist. sig (cond (cflag - (re-search-forward "," nil t 3) - (skip-chars-forward " \t\n") - ;; Assuming minargs and maxargs on same line. - (when (looking-at "\\([0-9]+\\)[ \t]*,[ \t]*\ + (or + (when (re-search-forward "," nil t 3) + (skip-chars-forward " \t\n") + ;; Assuming minargs and maxargs on same line. + (when (looking-at "\\([0-9]+\\)[ \t]*,[ \t]*\ \\([0-9]+\\|MANY\\|UNEVALLED\\)") - (setq minargs (string-to-number (match-string 1)) - maxargs (match-string 2)) - (cons minargs (unless (string-match "[^0-9]" - maxargs) - (string-to-number maxargs))))) + (setq minargs (string-to-number + (match-string 1)) + maxargs (match-string 2)) + (cons minargs (unless (string-match "[^0-9]" + maxargs) + (string-to-number + maxargs))))) + 'err)) ((string-equal (match-string 1) "define-derived-mode") '(0 . 0)) @@ -129,24 +134,29 @@ ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\ ((string-equal (match-string 1) "defalias") t) + ((looking-at "\\((\\|nil\\)") + (byte-compile-arglist-signature + (read (current-buffer)))) (t - (if (looking-at "\\((\\|nil\\)") - (byte-compile-arglist-signature - (read (current-buffer)))))) + 'err)) ;; alist of functions and arglist signatures. siglist (cons (cons fn sig) siglist))))) (dolist (e fnlist) (setq arglist (nth 2 e) type - (if re ; re non-nil means found a file - (if (setq sig (assoc (cadr e) siglist)) + (if re ; re non-nil means found a file + (if (setq sig (assoc (cadr e) siglist)) ; found function ;; Recall we use t to mean no arglist specified, ;; to distinguish from an empty arglist. - (unless (or (eq arglist t) - (eq sig t)) - (unless (equal (byte-compile-arglist-signature arglist) - (cdr sig)) - "arglist mismatch")) + (unless (eq arglist t) + (setq sig (cdr-safe sig)) + (cond ((eq sig t)) ; defalias, can't check + ((eq sig 'err) + "arglist not found") ; internal error + ((not (equal (byte-compile-arglist-signature + arglist) + sig)) + "arglist mismatch"))) "function not found") "file not found")) (when type -- cgit v1.2.3 From 2546bcdd94d00d87ea5559cfd93a342b3ad87807 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 22 Nov 2007 18:03:05 +0000 Subject: (byte-compile-file-form-custom-declare-variable): Simplify. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/bytecomp.el | 19 +++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 67552437f30..7ecd1b1d981 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2007-11-22 Stefan Monnier + + * emacs-lisp/bytecomp.el + (byte-compile-file-form-custom-declare-variable): Simplify. + 2007-11-22 Juanma Barranquero * cus-edit.el (custom-mode): Define with `define-derived-mode'. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index b40eac3b9d1..7d1b2b94572 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2277,18 +2277,17 @@ list that represents a doc string reference. (byte-compile-nogroup-warn form)) (when (byte-compile-warning-enabled-p 'free-vars) (push (nth 1 (nth 1 form)) byte-compile-bound-variables)) + ;; Don't compile the expression because it may be displayed to the user. + ;; (when (eq (car-safe (nth 2 form)) 'quote) + ;; ;; (nth 2 form) is meant to evaluate to an expression, so if we have the + ;; ;; final value already, we can byte-compile it. + ;; (setcar (cdr (nth 2 form)) + ;; (byte-compile-top-level (cadr (nth 2 form)) nil 'file))) (let ((tail (nthcdr 4 form))) (while tail - ;; If there are any (function (lambda ...)) expressions, compile - ;; those functions. - (if (and (consp (car tail)) - (eq (car (car tail)) 'function) - (consp (nth 1 (car tail)))) - (setcar tail (byte-compile-lambda (nth 1 (car tail)))) - ;; Likewise for a bare lambda. - (if (and (consp (car tail)) - (eq (car (car tail)) 'lambda)) - (setcar tail (byte-compile-lambda (car tail))))) + (unless (keywordp (car tail)) ;No point optimizing keywords. + ;; Compile the keyword arguments. + (setcar tail (byte-compile-top-level (car tail) nil 'file))) (setq tail (cdr tail)))) form) -- cgit v1.2.3 From 7d4184ba6f4495a049b179c948acbd05da4c5040 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 22 Nov 2007 20:25:51 +0000 Subject: (check-declare-locate): New function. (check-declare-scan): Use check-declare-locate. (check-declare-verify): No longer adjust fnfile, now check-declare-locate does it. --- lisp/emacs-lisp/check-declare.el | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index a4767794132..08172c08e95 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -39,6 +39,23 @@ (defconst check-declare-warning-buffer "*Check Declarations Warnings*" "Name of buffer used to display any `check-declare' warnings.") +(defun check-declare-locate (file basefile) + "Return the full path of FILE. +Expands files with a \".c\" extension relative to the Emacs +\"src/\" directory. Otherwise, `locate-library' searches for +FILE. If that fails, expands FILE relative to BASEFILE's +directory part. The returned file might not exist." + (if (string-equal "c" (file-name-extension file)) + (expand-file-name file (expand-file-name "src" source-directory)) + (let ((tfile (locate-library (file-name-nondirectory file)))) + (if tfile + (replace-regexp-in-string "\\.elc\\'" ".el" tfile) + (setq tfile (expand-file-name file (file-name-directory basefile))) + (if (or (file-exists-p tfile) + (string-match "\\.el\\'" tfile)) + tfile + (concat tfile ".el")))))) + (defun check-declare-scan (file) "Scan FILE for `declare-function' calls. Return a list with elements of the form (FNFILE FN ARGLIST), where @@ -52,18 +69,9 @@ ARGLIST may be absent. This claims that FNFILE defines FN, with ARGLIST." "^[ \t]*(declare-function[ \t]+\\(\\S-+\\)[ \t]+\ \"\\(\\S-+\\)\"" nil t) (setq fn (match-string 1) - fnfile (match-string 2)) - (or (file-name-absolute-p fnfile) - (setq fnfile - (expand-file-name fnfile - ;; .c files are assumed to be - ;; relative to the Emacs src/ directory. - (if (string-equal - "c" (file-name-extension fnfile)) - (expand-file-name "src" - source-directory) - (file-name-directory file))))) - (setq alist (cons + fnfile (match-string 2) + fnfile (check-declare-locate fnfile (expand-file-name file)) + alist (cons (list fnfile fn (progn (skip-chars-forward " \t\n") @@ -89,9 +97,6 @@ found to be true, otherwise a list of errors with elements of the form (cflag (string-equal "c" (file-name-extension fnfile))) re fn sig siglist arglist type errlist minargs maxargs) (message "%s" m) - (or cflag - (file-exists-p fnfile) - (setq fnfile (concat fnfile ".el"))) (if (file-exists-p fnfile) (with-temp-buffer (insert-file-contents fnfile) -- cgit v1.2.3 From e3e7216217d8df0261e4e317c7d2e368d78a9377 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 22 Nov 2007 20:26:33 +0000 Subject: (declare-function): Doc fix. --- lisp/ChangeLog | 9 +++++++++ lisp/emacs-lisp/byte-run.el | 9 +++++---- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 452a9847f6c..ae7927296f6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2007-11-22 Glenn Morris + + * emacs-lisp/check-declare.el (check-declare-locate): New function. + (check-declare-scan): Use check-declare-locate. + (check-declare-verify): No longer adjust fnfile, now + check-declare-locate does it. + + * emacs-lisp/byte-run.el (declare-function): Doc fix. + 2007-11-22 Stefan Monnier * subr.el (posn-col-row): Make the `default-value' use explicit. diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 2ba708d9c92..9a516b9d36e 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -112,10 +112,11 @@ definition for FN. ARGLIST is used by both the byte-compiler and `check-declare' to check for consistency. FILE can be either a Lisp file (in which case the \".el\" -extension is optional), or a C file. FILE should be either -absolute, or relative to the location of the file containing the -declaration (for a Lisp file), or to the Emacs \"src/\" directory -\(for a C file). +extension is optional), or a C file. C files are expanded +relative to the Emacs \"src/\" directory. Lisp files are +searched for using `locate-library', and if that fails they are +expanded relative to the location of the file containing the +declaration. Note that for the purposes of `check-declare', this statement must be the first non-whitespace on a line, and everything up to -- cgit v1.2.3 From 50bfa18a09a1d1257116d0e391da864e79ebd669 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 22 Nov 2007 22:12:22 +0000 Subject: (beginning-of-defun-raw): Pass `arg' down to beginning-of-defun-function. --- etc/NEWS | 3 +++ lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/lisp.el | 29 ++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 9 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/etc/NEWS b/etc/NEWS index e336a757b24..f9817d634f0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -383,6 +383,9 @@ because they clash with commands provided by dirtrack.el. Use * Lisp Changes in Emacs 23.1 +** `beginning-of-defun-function' now takes one argument, the count + given to `beginning-of-defun'. + +++ ** New function `match-substitute-replacement' returns the result of `replace-match' without actually using it in the buffer. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 43ef38d73cd..393f7791e2c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2007-11-22 Stefan Monnier + + * emacs-lisp/lisp.el (beginning-of-defun-raw): Pass `arg' down to + beginning-of-defun-function. + 2007-11-22 Reiner Steib * mail/hashcash.el: Move from ../gnus. Add hashcash payments to email. diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 788be284cda..e607245d0ed 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -175,9 +175,10 @@ normal recipe (see `beginning-of-defun'). Major modes can define this if defining `defun-prompt-regexp' is not sufficient to handle the mode's needs. -The function (of no args) should go to the line on which the current -defun starts, and return non-nil, or should return nil if it can't -find the beginning.") +The function takes the same argument as `beginning-of-defun' and should +behave similarly, returning non-nil if it found the beginning of a defun. +Ideally it should move to a point right before an open-paren which encloses +the body of the defun.") (defun beginning-of-defun (&optional arg) "Move backward to the beginning of a defun. @@ -218,12 +219,22 @@ is called as a function to find the defun's beginning." (unless arg (setq arg 1)) (cond (beginning-of-defun-function - (if (> arg 0) - (dotimes (i arg) - (funcall beginning-of-defun-function)) - ;; Better not call end-of-defun-function directly, in case - ;; it's not defined. - (end-of-defun (- arg)))) + (condition-case nil + (funcall beginning-of-defun-function arg) + ;; We used to define beginning-of-defun-function as taking no argument + ;; but that makes it impossible to implement correct forward motion: + ;; we used to use end-of-defun for that, but it's not supposed to do + ;; the same thing (it moves to the end of a defun not to the beginning + ;; of the next). + ;; In case the beginning-of-defun-function uses the old calling + ;; convention, fallback on the old implementation. + (wrong-number-of-arguments + (if (> arg 0) + (dotimes (i arg) + (funcall beginning-of-defun-function)) + ;; Better not call end-of-defun-function directly, in case + ;; it's not defined. + (end-of-defun (- arg)))))) ((or defun-prompt-regexp open-paren-in-column-0-is-defun-start) (and (< arg 0) (not (eobp)) (forward-char 1)) -- cgit v1.2.3 From e1b0f17b8d4f79d2d4e9b929180414c50341e2d3 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 24 Nov 2007 03:09:55 +0000 Subject: (declare-function): Doc fix. --- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/byte-run.el | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8ceffc0dd6a..49a08c36ddf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2007-11-24 Glenn Morris + + * emacs-lisp/byte-run.el (declare-function): Doc fix. + 2007-11-24 Kenichi Handa * international/ucs-tables.el (ucs-8859-7-alist): Update the table. diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 9a516b9d36e..bc1f4af6a9a 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -123,7 +123,9 @@ must be the first non-whitespace on a line, and everything up to the end of FILE must be all on the same line. For example: \(declare-function c-end-of-defun \"progmodes/cc-cmds.el\" - \(&optional arg))" + \(&optional arg)) + +For more information, see Info node `elisp(Declaring Functions)'." ;; Does nothing - byte-compile-declare-function does the work. nil) -- cgit v1.2.3 From faf7b3960e4cd3e0122529d9efdd337bc6f3d876 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 24 Nov 2007 03:11:14 +0000 Subject: Comment. --- lisp/emacs-lisp/check-declare.el | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 08172c08e95..14342264bf6 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -30,6 +30,8 @@ ;; checks that all such statements in a file or directory are accurate. ;; The entry points are `check-declare-file' and `check-declare-directory'. +;; For more information, see Info node `elisp(Declaring Functions)'. + ;;; TODO: ;; 1. Handle defstructs (eg uniquify-item-base in desktop.el). -- cgit v1.2.3 From 42e32ed89c84725531121a99129767a52b22b105 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 26 Nov 2007 03:49:23 +0000 Subject: (easy-menu-define): Doc fix. --- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/easymenu.el | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2fb77a9f9a2..8b8d3798922 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2007-11-26 Glenn Morris + + * emacs-lisp/easymenu.el (easy-menu-define): Doc fix. + 2007-11-26 Simon Josefsson * net/imap.el: Move from ../gnus. diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index b802d8acd43..d6c23de0be8 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -116,10 +116,15 @@ whenever this expression's value is non-nil. INCLUDE is an expression; this item is only visible if this expression has a non-nil value. `:included' is an alias for `:visible'. + :label FORM + +FORM is an expression that will be dynamically evaluated and whose +value will be used for the menu entry's text label (the default is NAME). + :suffix FORM FORM is an expression that will be dynamically evaluated and whose -value will be concatenated to the menu entry's NAME. +value will be concatenated to the menu entry's label. :style STYLE -- cgit v1.2.3 From 516b36532677ba43963f6ea656678eaf47cf4709 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Mon, 26 Nov 2007 15:38:18 +0000 Subject: (batch-byte-recompile-directory): Doc fix. --- lisp/emacs-lisp/bytecomp.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 7d1b2b94572..bc83a25cb3a 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3506,12 +3506,12 @@ That command is designed for interactive use only" fn)) ;; Return the list of items in CONDITION-PARAM that match PRED-LIST. ;; Only return items that are not in ONLY-IF-NOT-PRESENT. -(defun byte-compile-find-bound-condition (condition-param - pred-list +(defun byte-compile-find-bound-condition (condition-param + pred-list &optional only-if-not-present) (let ((result nil) (nth-one nil) - (cond-list + (cond-list (if (memq (car-safe condition-param) pred-list) ;; The condition appears by itself. (list condition-param) @@ -3519,7 +3519,7 @@ That command is designed for interactive use only" fn)) ;; `and' arguments. (when (eq 'and (car-safe condition-param)) (cdr condition-param))))) - + (dolist (crt cond-list) (when (and (memq (car-safe crt) pred-list) (eq 'quote (car-safe (setq nth-one (nth 1 crt)))) @@ -3541,10 +3541,10 @@ being undefined will be suppressed. If CONDITION's value is (not (featurep 'emacs)) or (featurep 'xemacs), that suppresses all warnings during execution of BODY." (declare (indent 1) (debug t)) - `(let* ((fbound-list (byte-compile-find-bound-condition - ,condition (list 'fboundp) + `(let* ((fbound-list (byte-compile-find-bound-condition + ,condition (list 'fboundp) byte-compile-unresolved-functions)) - (bound-list (byte-compile-find-bound-condition + (bound-list (byte-compile-find-bound-condition ,condition (list 'boundp 'default-boundp))) ;; Maybe add to the bound list. (byte-compile-bound-variables @@ -4274,7 +4274,7 @@ Must be used only with `-batch', and kills Emacs on completion. For example, invoke `emacs -batch -f batch-byte-recompile-directory .'. Optional argument ARG is passed as second argument ARG to -`batch-recompile-directory'; see there for its possible values +`byte-recompile-directory'; see there for its possible values and corresponding effects." ;; command-line-args-left is what is left of the command line (startup.el) (defvar command-line-args-left) ;Avoid 'free variable' warning -- cgit v1.2.3 From 61e216073765f9808eee55bc15c5f4e4c61323a0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 26 Nov 2007 20:27:12 +0000 Subject: (end-of-defun): Restructure so that end-of-defun-function is called consistently, even for negative arguments. (end-of-defun-function): Default to forward-sexp. --- lisp/ChangeLog | 6 +++ lisp/emacs-lisp/lisp.el | 126 +++++++++++++++++++++++++++++------------------- 2 files changed, 83 insertions(+), 49 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0ccf22ad007..09fd7fe55c2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2007-11-26 Stefan Monnier + + * emacs-lisp/lisp.el (end-of-defun): Restructure so that + end-of-defun-function is called consistently, even for negative arguments. + (end-of-defun-function): Default to forward-sexp. + 2007-11-26 Juanma Barranquero * emacs-lisp/bytecomp.el (batch-byte-recompile-directory): Doc fix. diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index e607245d0ed..65bbade816e 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -297,11 +297,11 @@ is called as a function to find the defun's beginning." (goto-char (if arg-+ve floor ceiling)) nil)))))))) -(defvar end-of-defun-function nil - "If non-nil, function for function `end-of-defun' to call. -This is used to find the end of the defun instead of using the normal -recipe (see `end-of-defun'). Major modes can define this if the -normal method is not appropriate.") +(defvar end-of-defun-function #'forward-sexp + "Function for `end-of-defun' to call. +This is used to find the end of the defun. +It is called with no argument, right after calling `beginning-of-defun-raw'. +So the function can assume that point is at the beginning of the defun body.") (defun buffer-end (arg) "Return the \"far end\" position of the buffer, in direction ARG. @@ -326,45 +326,38 @@ is called as a function to find the defun's end." (and transient-mark-mode mark-active) (push-mark)) (if (or (null arg) (= arg 0)) (setq arg 1)) - (if end-of-defun-function - (if (> arg 0) - (dotimes (i arg) - (funcall end-of-defun-function)) - ;; Better not call beginning-of-defun-function - ;; directly, in case it's not defined. - (beginning-of-defun (- arg))) - (let ((first t)) - (while (and (> arg 0) (< (point) (point-max))) - (let ((pos (point))) - (while (progn - (if (and first - (progn - (end-of-line 1) - (beginning-of-defun-raw 1))) - nil - (or (bobp) (forward-char -1)) - (beginning-of-defun-raw -1)) - (setq first nil) - (forward-list 1) - (skip-chars-forward " \t") - (if (looking-at "\\s<\\|\n") - (forward-line 1)) - (<= (point) pos)))) - (setq arg (1- arg))) - (while (< arg 0) - (let ((pos (point))) - (beginning-of-defun-raw 1) - (forward-sexp 1) - (forward-line 1) - (if (>= (point) pos) - (if (beginning-of-defun-raw 2) - (progn - (forward-list 1) - (skip-chars-forward " \t") - (if (looking-at "\\s<\\|\n") - (forward-line 1))) - (goto-char (point-min))))) - (setq arg (1+ arg)))))) + (while (> arg 0) + (let ((pos (point))) + (end-of-line 1) + (beginning-of-defun-raw 1) + (while (unless (eobp) + (funcall end-of-defun-function) + (skip-chars-forward " \t") + (if (looking-at "\\s<\\|\n") + (forward-line 1)) + ;; If we started after the end of the previous function, then + ;; try again with the next one. + (when (<= (point) pos) + (or (bobp) (forward-char -1)) + (beginning-of-defun-raw -1) + 'try-again)))) + (setq arg (1- arg))) + (while (< arg 0) + (let ((pos (point))) + (while (unless (bobp) + (beginning-of-line 1) + (beginning-of-defun-raw 1) + (let ((beg (point))) + (funcall end-of-defun-function) + (skip-chars-forward " \t") + (if (looking-at "\\s<\\|\n") + (forward-line 1)) + ;; If we started from within the function just found, then + ;; try again with the previous one. + (when (>= (point) pos) + (goto-char beg) + 'try-again))))) + (setq arg (1+ arg)))) (defun mark-defun (&optional allow-extend) "Put mark at end of this defun, point at beginning. @@ -573,12 +566,47 @@ character." ;; "Unbalanced parentheses", but those may not be so ;; accurate/helpful, e.g. quotes may actually be ;; mismatched. - (error "Unmatched bracket or quote")) - (error (cond ((eq 'scan-error (car data)) - (goto-char (nth 2 data)) - (error "Unmatched bracket or quote")) - (t (signal (car data) (cdr data))))))) + (error "Unmatched bracket or quote")))) +(defun field-complete (table &optional predicate) + (let* ((pattern (field-string-no-properties)) + (completion (try-completion pattern table predicate))) + (cond ((eq completion t)) + ((null completion) + (message "Can't find completion for \"%s\"" pattern) + (ding)) + ((not (string= pattern completion)) + (delete-region (field-beginning) (field-end)) + (insert completion) + ;; Don't leave around a completions buffer that's out of date. + (let ((win (get-buffer-window "*Completions*" 0))) + (if win (with-selected-window win (bury-buffer))))) + (t + (let ((minibuf-is-in-use + (eq (minibuffer-window) (selected-window)))) + (unless minibuf-is-in-use + (message "Making completion list...")) + (let ((list (all-completions pattern table predicate))) + (setq list (sort list 'string<)) + (or (eq predicate 'fboundp) + (let (new) + (while list + (setq new (cons (if (fboundp (intern (car list))) + (list (car list) " ") + (car list)) + new)) + (setq list (cdr list))) + (setq list (nreverse new)))) + (if (> (length list) 1) + (with-output-to-temp-buffer "*Completions*" + (display-completion-list list pattern)) + ;; Don't leave around a completions buffer that's + ;; out of date. + (let ((win (get-buffer-window "*Completions*" 0))) + (if win (with-selected-window win (bury-buffer)))))) + (unless minibuf-is-in-use + (message "Making completion list...%s" "done"))))))) + (defun lisp-complete-symbol (&optional predicate) "Perform completion on Lisp symbol preceding point. Compare that symbol against the known Lisp symbols. -- cgit v1.2.3 From a6e02a86c73e9aae58fb4e761fba9330effb8cfd Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 27 Nov 2007 03:54:47 +0000 Subject: (check-declare-locate): Handle compressed files. (check-declare-verify): Handle define-generic-mode, define-global(ized)-minor-mode, define-obsolete-function-alias. --- lisp/emacs-lisp/check-declare.el | 63 +++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 23 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 14342264bf6..800d0fa5fc0 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -36,6 +36,8 @@ ;; 1. Handle defstructs (eg uniquify-item-base in desktop.el). +;; 2. Handle fset (eg dired-omit-old-add-entry in dired-x.el). + ;;; Code: (defconst check-declare-warning-buffer "*Check Declarations Warnings*" @@ -51,7 +53,12 @@ directory part. The returned file might not exist." (expand-file-name file (expand-file-name "src" source-directory)) (let ((tfile (locate-library (file-name-nondirectory file)))) (if tfile - (replace-regexp-in-string "\\.elc\\'" ".el" tfile) + (progn + (setq tfile (replace-regexp-in-string "\\.elc\\'" ".el" tfile)) + (if (and (not (file-exists-p tfile)) + (file-exists-p (concat tfile ".gz"))) + (concat tfile ".gz") + tfile)) (setq tfile (expand-file-name file (file-name-directory basefile))) (if (or (file-exists-p tfile) (string-match "\\.el\\'" tfile)) @@ -106,12 +113,14 @@ found to be true, otherwise a list of errors with elements of the form (setq re (format (if cflag "^[ \t]*\\(DEFUN\\)[ \t]*([ \t]*\"%s\"" "^[ \t]*(\\(def\\(?:un\\|subst\\|\ -ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\ +ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\ +\\|\\(?:ine-obsolete-function-\\)?alias[ \t]+'\\)\\)\ \[ \t]*%s\\([ \t;]+\\|$\\)") (regexp-opt (mapcar 'cadr fnlist) t))) (while (re-search-forward re nil t) (skip-chars-forward " \t\n") (setq fn (match-string 2) + type (match-string 1) ;; (min . max) for a fixed number of arguments, or ;; arglists with optional elements. ;; (min) for arglists with &rest. @@ -131,15 +140,21 @@ ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\ (string-to-number maxargs))))) 'err)) - ((string-equal (match-string 1) - "define-derived-mode") + ((string-match + "\\`define-\\(derived\\|generic\\)-mode\\'" + type) '(0 . 0)) - ((string-equal (match-string 1) - "define-minor-mode") + ((string-match + "\\`define\\(-global\\(ized\\)?\\)?-minor-mode\\'" + type) '(0 . 1)) + ;; Prompt to update. + ((string-match + "\\`define-obsolete-function-alias\\>" + type) + 'obsolete) ;; Can't easily check alias arguments. - ((string-equal (match-string 1) - "defalias") + ((string-match "\\`defalias\\>" type) t) ((looking-at "\\((\\|nil\\)") (byte-compile-arglist-signature @@ -151,21 +166,23 @@ ine-derived-mode\\|ine-minor-mode\\|alias[ \t]+'\\)\\)\ (dolist (e fnlist) (setq arglist (nth 2 e) type - (if re ; re non-nil means found a file - (if (setq sig (assoc (cadr e) siglist)) ; found function - ;; Recall we use t to mean no arglist specified, - ;; to distinguish from an empty arglist. - (unless (eq arglist t) - (setq sig (cdr-safe sig)) - (cond ((eq sig t)) ; defalias, can't check - ((eq sig 'err) - "arglist not found") ; internal error - ((not (equal (byte-compile-arglist-signature - arglist) - sig)) - "arglist mismatch"))) - "function not found") - "file not found")) + (if (not re) + "file not found" + (if (not (setq sig (assoc (cadr e) siglist))) + "function not found" + (setq sig (cdr sig)) + (cond ((eq sig 'obsolete) ; check even when no arglist specified + "obsolete alias") + ;; arglist t means no arglist specified, as + ;; opposed to an empty arglist. + ((eq arglist t) nil) + ((eq sig t) nil) ; defalias, can't check + ((eq sig 'err) + "arglist not found") ; internal error + ((not (equal (byte-compile-arglist-signature + arglist) + sig)) + "arglist mismatch"))))) (when type (setq errlist (cons (list (car e) (cadr e) type) errlist)))) (message "%s%s" m (if errlist "problems found" "OK")) -- cgit v1.2.3 From 4ab4de9ce6fec1ff368f5b244ba1f8d3b37632cc Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 28 Nov 2007 03:53:44 +0000 Subject: (check-declare-locate): Reflow doc. (check-declare-verify): Handle fset. --- lisp/emacs-lisp/check-declare.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 800d0fa5fc0..d98b59d774e 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -46,9 +46,9 @@ (defun check-declare-locate (file basefile) "Return the full path of FILE. Expands files with a \".c\" extension relative to the Emacs -\"src/\" directory. Otherwise, `locate-library' searches for -FILE. If that fails, expands FILE relative to BASEFILE's -directory part. The returned file might not exist." +\"src/\" directory. Otherwise, `locate-library' searches for FILE. +If that fails, expands FILE relative to BASEFILE's directory part. +The returned file might not exist." (if (string-equal "c" (file-name-extension file)) (expand-file-name file (expand-file-name "src" source-directory)) (let ((tfile (locate-library (file-name-nondirectory file)))) @@ -112,7 +112,7 @@ found to be true, otherwise a list of errors with elements of the form ;; defsubst's don't _have_ to be known at compile time. (setq re (format (if cflag "^[ \t]*\\(DEFUN\\)[ \t]*([ \t]*\"%s\"" - "^[ \t]*(\\(def\\(?:un\\|subst\\|\ + "^[ \t]*(\\(fset[ \t]+'\\|def\\(?:un\\|subst\\|\ ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\ \\|\\(?:ine-obsolete-function-\\)?alias[ \t]+'\\)\\)\ \[ \t]*%s\\([ \t;]+\\|$\\)") @@ -153,8 +153,8 @@ ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\ "\\`define-obsolete-function-alias\\>" type) 'obsolete) - ;; Can't easily check alias arguments. - ((string-match "\\`defalias\\>" type) + ;; Can't easily check arguments in these cases. + ((string-match "\\`\\(defalias\\|fset\\)\\>" type) t) ((looking-at "\\((\\|nil\\)") (byte-compile-arglist-signature @@ -176,7 +176,7 @@ ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\ ;; arglist t means no arglist specified, as ;; opposed to an empty arglist. ((eq arglist t) nil) - ((eq sig t) nil) ; defalias, can't check + ((eq sig t) nil) ; eg defalias - can't check arguments ((eq sig 'err) "arglist not found") ; internal error ((not (equal (byte-compile-arglist-signature -- cgit v1.2.3 From 122bcd7ef24fbf416f339dc093d0bf59bbb1ed5b Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 29 Nov 2007 04:23:49 +0000 Subject: (check-declare-locate, check-declare-verify): Handle `external' files. (check-declare-errmsg): New function. (check-declare-verify, check-declare-file, check-declare-directory): Use check-declare-errmsg to report the number of problems. --- lisp/emacs-lisp/check-declare.el | 68 +++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 19 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index d98b59d774e..5d2ee740e4b 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -48,22 +48,31 @@ Expands files with a \".c\" extension relative to the Emacs \"src/\" directory. Otherwise, `locate-library' searches for FILE. If that fails, expands FILE relative to BASEFILE's directory part. -The returned file might not exist." - (if (string-equal "c" (file-name-extension file)) - (expand-file-name file (expand-file-name "src" source-directory)) - (let ((tfile (locate-library (file-name-nondirectory file)))) - (if tfile - (progn - (setq tfile (replace-regexp-in-string "\\.elc\\'" ".el" tfile)) - (if (and (not (file-exists-p tfile)) - (file-exists-p (concat tfile ".gz"))) - (concat tfile ".gz") - tfile)) - (setq tfile (expand-file-name file (file-name-directory basefile))) - (if (or (file-exists-p tfile) - (string-match "\\.el\\'" tfile)) - tfile - (concat tfile ".el")))))) +The returned file might not exist. If FILE has an \"ext:\" prefix, so does +the result." + (let ((ext (string-match "^ext:" file)) + tfile) + (if ext + (setq file (substring file 4))) + (setq file + (if (string-equal "c" (file-name-extension file)) + (expand-file-name file (expand-file-name "src" source-directory)) + (if (setq tfile (locate-library (file-name-nondirectory file))) + (progn + (setq tfile + (replace-regexp-in-string "\\.elc\\'" ".el" tfile)) + (if (and (not (file-exists-p tfile)) + (file-exists-p (concat tfile ".gz"))) + (concat tfile ".gz") + tfile)) + (setq tfile (expand-file-name file + (file-name-directory basefile))) + (if (or (file-exists-p tfile) + (string-match "\\.el\\'" tfile)) + tfile + (concat tfile ".el"))))) + (if ext (concat "ext:" file) + file))) (defun check-declare-scan (file) "Scan FILE for `declare-function' calls. @@ -93,6 +102,19 @@ ARGLIST may be absent. This claims that FNFILE defines FN, with ARGLIST." (message "%sdone" m) alist)) +(defun check-declare-errmsg (errlist &optional full) + "Return a string with the number of errors in ERRLIST, if any. +Normally just counts the number of elements in ERRLIST. +With optional argument FULL, sums the number of elements in each element." + (if errlist + (let ((l (length errlist))) + (when full + (setq l 0) + (dolist (e errlist) + (setq l (1+ l)))) + (format "%d problem%s found" l (if (= l 1) "" "s"))) + "OK")) + (autoload 'byte-compile-arglist-signature "bytecomp") (defun check-declare-verify (fnfile fnlist) @@ -104,8 +126,11 @@ found to be true, otherwise a list of errors with elements of the form \(FILE FN TYPE), where TYPE is a string giving details of the error." (let ((m (format "Checking %s..." fnfile)) (cflag (string-equal "c" (file-name-extension fnfile))) + (ext (string-match "^ext:" fnfile)) re fn sig siglist arglist type errlist minargs maxargs) (message "%s" m) + (if ext + (setq fnfile (substring fnfile 4))) (if (file-exists-p fnfile) (with-temp-buffer (insert-file-contents fnfile) @@ -185,7 +210,12 @@ ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\ "arglist mismatch"))))) (when type (setq errlist (cons (list (car e) (cadr e) type) errlist)))) - (message "%s%s" m (if errlist "problems found" "OK")) + (message "%s%s" m + (if (or re (not ext)) + (check-declare-errmsg errlist) + (prog1 + "skipping external file" + (setq errlist nil)))) errlist)) (defun check-declare-sort (alist) @@ -244,7 +274,7 @@ See `check-declare-directory' for more information." errlist) (message "%s" m) (setq errlist (check-declare-files file)) - (message "%s%s" m (if errlist "problems found" "OK")) + (message "%s%s" m (check-declare-errmsg errlist)) errlist)) ;;;###autoload @@ -267,7 +297,7 @@ described in the documentation of `declare-function'." (message "%s%d found" m2 (length files)) (when files (setq errlist (apply 'check-declare-files files)) - (message "%s%s" m (if errlist "problems found" "OK")) + (message "%s%s" m (check-declare-errmsg errlist t)) errlist))) (provide 'check-declare) -- cgit v1.2.3 From 0cc61e9904c3c150960fd1cf00badff7c83b1f05 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 29 Nov 2007 04:25:13 +0000 Subject: (declare-function): Doc fix. --- lisp/emacs-lisp/byte-run.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index bc1f4af6a9a..0445e7ca63e 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -116,7 +116,9 @@ extension is optional), or a C file. C files are expanded relative to the Emacs \"src/\" directory. Lisp files are searched for using `locate-library', and if that fails they are expanded relative to the location of the file containing the -declaration. +declaration. A FILE with an \"ext:\" prefix is an external file. +`check-declare' will check such files if they are found, and skip +them without error if they are not. Note that for the purposes of `check-declare', this statement must be the first non-whitespace on a line, and everything up to -- cgit v1.2.3 From 7b58c351cf9f19ac243f33efcab74d475a58f947 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 30 Nov 2007 07:44:24 +0000 Subject: (declare-function): Add optional fourth argument and document it. --- lisp/emacs-lisp/byte-run.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 0445e7ca63e..6a5458df30f 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -103,7 +103,7 @@ The return value of this function is not used." (eval-and-compile (put ',name 'byte-optimizer 'byte-compile-inline-expand)))) -(defmacro declare-function (fn file &optional arglist) +(defmacro declare-function (fn file &optional arglist fileonly) "Tell the byte-compiler that function FN is defined, in FILE. Optional ARGLIST is the argument list used by the function. The FILE argument is not used by the byte-compiler, but by the @@ -120,6 +120,15 @@ declaration. A FILE with an \"ext:\" prefix is an external file. `check-declare' will check such files if they are found, and skip them without error if they are not. +FILEONLY non-nil means that `check-declare' will only check that +FILE exists, not that it defines FN. This is intended for +function-definitions that `check-declare' does not recognize, e.g. +`defstruct'. + +To specify a value for FILEONLY without passing an argument list, +set ARGLIST to `t'. This is necessary because `nil' means an +empty argument list, rather than an unspecified one. + Note that for the purposes of `check-declare', this statement must be the first non-whitespace on a line, and everything up to the end of FILE must be all on the same line. For example: -- cgit v1.2.3 From abc11cbb564f87fe3531822e079453155ab186fd Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 30 Nov 2007 07:45:18 +0000 Subject: (byte-compile-declare-function): Third argument to declare-function must be a list to specify arglist. --- lisp/emacs-lisp/bytecomp.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index bc83a25cb3a..0f7546bc642 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2823,7 +2823,8 @@ If FORM is a lambda or a macro, byte-compile it as a function." (put 'declare-function 'byte-hunk-handler 'byte-compile-declare-function) (defun byte-compile-declare-function (form) (push (cons (nth 1 form) - (if (< (length form) 4) ; arglist not specified + (if (or (< (length form) 4) ; arglist not specified + (not (listp (nth 3 form)))) t (list 'declared (nth 3 form)))) byte-compile-function-environment) -- cgit v1.2.3 From 630456e692497691ef97c9e3f140efc796817558 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 30 Nov 2007 07:47:39 +0000 Subject: (check-declare-scan): Doc fix. Handle declare-function third argument `t' and fourth argument. (check-declare-verify): Doc fix. Handle `fileonly' case. Use progn rather than prog1. --- lisp/emacs-lisp/check-declare.el | 57 ++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 26 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el index 5d2ee740e4b..9fc8a9e61e7 100644 --- a/lisp/emacs-lisp/check-declare.el +++ b/lisp/emacs-lisp/check-declare.el @@ -34,10 +34,6 @@ ;;; TODO: -;; 1. Handle defstructs (eg uniquify-item-base in desktop.el). - -;; 2. Handle fset (eg dired-omit-old-add-entry in dired-x.el). - ;;; Code: (defconst check-declare-warning-buffer "*Check Declarations Warnings*" @@ -76,10 +72,13 @@ the result." (defun check-declare-scan (file) "Scan FILE for `declare-function' calls. -Return a list with elements of the form (FNFILE FN ARGLIST), where -ARGLIST may be absent. This claims that FNFILE defines FN, with ARGLIST." +Return a list with elements of the form (FNFILE FN ARGLIST FILEONLY), +where only the first two elements need be present. This claims that FNFILE +defines FN, with ARGLIST. FILEONLY non-nil means only check that FNFILE +exists, not that it defines FN. This is for function definitions that we +don't know how to recognize (e.g. some macros)." (let ((m (format "Scanning %s..." file)) - alist fnfile fn) + alist fnfile fn arglist fileonly) (message "%s" m) (with-temp-buffer (insert-file-contents file) @@ -89,16 +88,18 @@ ARGLIST may be absent. This claims that FNFILE defines FN, with ARGLIST." (setq fn (match-string 1) fnfile (match-string 2) fnfile (check-declare-locate fnfile (expand-file-name file)) - alist (cons - (list fnfile fn - (progn - (skip-chars-forward " \t\n") - ;; Use `t' to distinguish no arglist - ;; specified from an empty one. - (if (looking-at "\\((\\|nil\\)") - (read (current-buffer)) - t))) - alist)))) + arglist (progn + (skip-chars-forward " \t\n") + ;; Use `t' to distinguish no arglist + ;; specified from an empty one. + (if (looking-at "\\((\\|nil\\|t\\)") + (read (current-buffer)) + t)) + fileonly (progn + (skip-chars-forward " \t\n") + (if (looking-at "\\(t\\|'\\sw+\\)") + (match-string 1))) + alist (cons (list fnfile fn arglist fileonly) alist)))) (message "%sdone" m) alist)) @@ -119,11 +120,14 @@ With optional argument FULL, sums the number of elements in each element." (defun check-declare-verify (fnfile fnlist) "Check that FNFILE contains function definitions matching FNLIST. -Each element of FNLIST has the form (FILE FN ARGLIST), where -ARGLIST is optional. This means FILE claimed FN was defined in -FNFILE with the specified ARGLIST. Returns nil if all claims are -found to be true, otherwise a list of errors with elements of the form -\(FILE FN TYPE), where TYPE is a string giving details of the error." +Each element of FNLIST has the form (FILE FN ARGLIST FILEONLY), where +only the first two elements need be present. This means FILE claimed FN +was defined in FNFILE with the specified ARGLIST. FILEONLY non-nil means +to only check that FNFILE exists, not that it actually defines FN. + +Returns nil if all claims are found to be true, otherwise a list +of errors with elements of the form \(FILE FN TYPE), where TYPE +is a string giving details of the error." (let ((m (format "Checking %s..." fnfile)) (cflag (string-equal "c" (file-name-extension fnfile))) (ext (string-match "^ext:" fnfile)) @@ -194,7 +198,8 @@ ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\ (if (not re) "file not found" (if (not (setq sig (assoc (cadr e) siglist))) - "function not found" + (unless (nth 3 e) ; fileonly + "function not found") (setq sig (cdr sig)) (cond ((eq sig 'obsolete) ; check even when no arglist specified "obsolete alias") @@ -213,9 +218,9 @@ ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\ (message "%s%s" m (if (or re (not ext)) (check-declare-errmsg errlist) - (prog1 - "skipping external file" - (setq errlist nil)))) + (progn + (setq errlist nil) + "skipping external file"))) errlist)) (defun check-declare-sort (alist) -- cgit v1.2.3 From 7628b337d8365ee63e5373adcd6bb9142894fddc Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 2 Dec 2007 21:41:33 +0000 Subject: (byte-compile-declare-function): Reverse branches of if statement. --- lisp/emacs-lisp/bytecomp.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 0f7546bc642..e6418a5e331 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2823,10 +2823,10 @@ If FORM is a lambda or a macro, byte-compile it as a function." (put 'declare-function 'byte-hunk-handler 'byte-compile-declare-function) (defun byte-compile-declare-function (form) (push (cons (nth 1 form) - (if (or (< (length form) 4) ; arglist not specified - (not (listp (nth 3 form)))) - t - (list 'declared (nth 3 form)))) + (if (and (> (length form) 3) + (listp (nth 3 form))) + (list 'declared (nth 3 form)) + t)) ; arglist not specified byte-compile-function-environment) nil) -- cgit v1.2.3 From e9fa6d0a4c565561c028b226237cdc58032da6e4 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 3 Dec 2007 00:33:06 +0000 Subject: (declare-function): Macro deleted. --- lisp/emacs-lisp/byte-run.el | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 6a5458df30f..267173c1713 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -103,43 +103,6 @@ The return value of this function is not used." (eval-and-compile (put ',name 'byte-optimizer 'byte-compile-inline-expand)))) -(defmacro declare-function (fn file &optional arglist fileonly) - "Tell the byte-compiler that function FN is defined, in FILE. -Optional ARGLIST is the argument list used by the function. The -FILE argument is not used by the byte-compiler, but by the -`check-declare' package, which checks that FILE contains a -definition for FN. ARGLIST is used by both the byte-compiler and -`check-declare' to check for consistency. - -FILE can be either a Lisp file (in which case the \".el\" -extension is optional), or a C file. C files are expanded -relative to the Emacs \"src/\" directory. Lisp files are -searched for using `locate-library', and if that fails they are -expanded relative to the location of the file containing the -declaration. A FILE with an \"ext:\" prefix is an external file. -`check-declare' will check such files if they are found, and skip -them without error if they are not. - -FILEONLY non-nil means that `check-declare' will only check that -FILE exists, not that it defines FN. This is intended for -function-definitions that `check-declare' does not recognize, e.g. -`defstruct'. - -To specify a value for FILEONLY without passing an argument list, -set ARGLIST to `t'. This is necessary because `nil' means an -empty argument list, rather than an unspecified one. - -Note that for the purposes of `check-declare', this statement -must be the first non-whitespace on a line, and everything up to -the end of FILE must be all on the same line. For example: - -\(declare-function c-end-of-defun \"progmodes/cc-cmds.el\" - \(&optional arg)) - -For more information, see Info node `elisp(Declaring Functions)'." - ;; Does nothing - byte-compile-declare-function does the work. - nil) - (defun make-obsolete (obsolete-name current-name &optional when) "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. The warning will say that CURRENT-NAME should be used instead. -- cgit v1.2.3 From a342aca45cc34d5a6a7e70eff177425dcd23fbb9 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 5 Dec 2007 03:36:23 +0000 Subject: (byte-compile-declare-function): Remove declared function from byte-compile-noruntime-functions. --- lisp/ChangeLog | 18 ++++++++++++++++++ lisp/emacs-lisp/bytecomp.el | 3 +++ 2 files changed, 21 insertions(+) (limited to 'lisp/emacs-lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3318864873e..baddff10bac 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,21 @@ +2007-12-05 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-declare-function): Remove + declared function from byte-compile-noruntime-functions. + + * ediff-util.el (ediff-version): + * progmodes/python.el (compilation-shell-minor-mode): + * textmodes/org.el (Info-goto-node, calendar-astro-date-string) + (calendar-bahai-date-string, calendar-check-holidays) + (calendar-chinese-date-string, calendar-coptic-date-string) + (calendar-ethiopic-date-string, calendar-forward-day) + (calendar-french-date-string, calendar-goto-date) + (calendar-goto-today, calendar-hebrew-date-string) + (calendar-islamic-date-string, calendar-iso-date-string) + (calendar-julian-date-string, calendar-mayan-date-string) + (calendar-persian-date-string, gnus-summary-last-subject) + (parse-time-string, rmail-show-message): Declare as functions. + 2007-12-05 Michael Olson * textmodes/remember.el: Merge contents of remember-diary.el here, diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e6418a5e331..4ef32a244eb 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2828,6 +2828,9 @@ If FORM is a lambda or a macro, byte-compile it as a function." (list 'declared (nth 3 form)) t)) ; arglist not specified byte-compile-function-environment) + ;; We are stating that it _will_ be defined at runtime. + (setq byte-compile-noruntime-functions + (delq (nth 1 form) byte-compile-noruntime-functions)) nil) -- cgit v1.2.3 From 8aa8da0595964fc0a0e5980b05afed9050031abe Mon Sep 17 00:00:00 2001 From: Deepak Goel Date: Wed, 5 Dec 2007 22:16:17 +0000 Subject: Make `find-function' prefer ".el" over "" to fix a bug (see emacs-devel) --- lisp/emacs-lisp/find-func.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index b3c7c339030..24e26827f7c 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -149,10 +149,14 @@ See the functions `find-function' and `find-variable'." ;; the same name. (if (string-match "\\.el\\(c\\(\\..*\\)?\\)\\'" library) (setq library (replace-match "" t t library))) - (or (locate-file library - (or find-function-source-path load-path) - (append (find-library-suffixes) load-file-rep-suffixes)) - (error "Can't find library %s" library))) + (or + (locate-file library + (or find-function-source-path load-path) + (find-library-suffixes)) + (locate-file library + (or find-function-source-path load-path) + load-file-rep-suffixes) + (error "Can't find library %s" library))) (defvar find-function-C-source-directory (let ((dir (expand-file-name "src" source-directory))) -- cgit v1.2.3 From 2c52d7a3b2fcbd32259bf4ca896b0813e5fc844f Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 6 Dec 2007 04:05:51 +0000 Subject: Remove directory part from filenames in function declarations. --- lisp/add-log.el | 4 ++-- lisp/emacs-lisp/bytecomp.el | 2 +- lisp/emacs-lisp/gulp.el | 4 ++-- lisp/font-lock.el | 12 ++++++------ lisp/help-fns.el | 2 +- lisp/ido.el | 2 +- lisp/informat.el | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/add-log.el b/lisp/add-log.el index 89aeafc75d6..33ecd98ec44 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el @@ -826,8 +826,8 @@ Prefix arg means justify as well." '(TeX-mode plain-TeX-mode LaTeX-mode tex-mode) "*Modes that look like TeX to `add-log-current-defun'.") -(declare-function c-beginning-of-defun "progmodes/cc-cmds" (&optional arg)) -(declare-function c-end-of-defun "progmodes/cc-cmds" (&optional arg)) +(declare-function c-beginning-of-defun "cc-cmds" (&optional arg)) +(declare-function c-end-of-defun "cc-cmds" (&optional arg)) ;;;###autoload (defun add-log-current-defun () diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 4ef32a244eb..eaff1ad72f5 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1054,7 +1054,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." nil) ;; (compile-mode) will cause this to be loaded. -(declare-function compilation-forget-errors "../progmodes/compile" nil) +(declare-function compilation-forget-errors "compile" ()) ;; Log the start of a file in *Compile-Log*, and mark it as done. ;; Return the position of the start of the page in the log buffer. diff --git a/lisp/emacs-lisp/gulp.el b/lisp/emacs-lisp/gulp.el index a75b52d99bd..5ff2b8f564c 100644 --- a/lisp/emacs-lisp/gulp.el +++ b/lisp/emacs-lisp/gulp.el @@ -78,8 +78,8 @@ Thanks.") :type 'string :group 'gulp) -(declare-function mail-subject "../mail/sendmail" ()) -(declare-function mail-send "../mail/sendmail" ()) +(declare-function mail-subject "sendmail" ()) +(declare-function mail-send "sendmail" ()) (defun gulp-send-requests (dir &optional time) "Send requests for updates to the authors of Lisp packages in directory DIR. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 7e1fff79772..dc350ce146b 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -886,12 +886,12 @@ The value of this variable is used when Font Lock mode is turned on." (defvar lazy-lock-mode) (defvar jit-lock-mode) -(declare-function fast-lock-after-fontify-buffer "obsolete/fast-lock") -(declare-function fast-lock-after-unfontify-buffer "obsolete/fast-lock") -(declare-function fast-lock-mode "obsolete/fast-lock") -(declare-function lazy-lock-after-fontify-buffer "obsolete/lazy-lock") -(declare-function lazy-lock-after-unfontify-buffer "obsolete/lazy-lock") -(declare-function lazy-lock-mode "obsolete/lazy-lock") +(declare-function fast-lock-after-fontify-buffer "fast-lock") +(declare-function fast-lock-after-unfontify-buffer "fast-lock") +(declare-function fast-lock-mode "fast-lock") +(declare-function lazy-lock-after-fontify-buffer "lazy-lock") +(declare-function lazy-lock-after-unfontify-buffer "lazy-lock") +(declare-function lazy-lock-mode "lazy-lock") (defun font-lock-turn-on-thing-lock () (let ((thing-mode (font-lock-value-in-major-mode font-lock-support-mode))) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 0643b85672c..5aa8860ae9d 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -248,7 +248,7 @@ face (according to `face-differs-from-default-p')." src-file file-name))) -(declare-function ad-get-advice-info "emacs-lisp/advice" (function)) +(declare-function ad-get-advice-info "advice" (function)) ;;;###autoload (defun describe-function-1 (function) diff --git a/lisp/ido.el b/lisp/ido.el index 2a327439078..4658a887716 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3365,7 +3365,7 @@ for first matching file." (nconc ido-temp-list items) (setq ido-temp-list items))) -(declare-function tramp-tramp-file-p "net/tramp" (name)) +(declare-function tramp-tramp-file-p "tramp" (name)) (defun ido-file-name-all-completions-1 (dir) (cond diff --git a/lisp/informat.el b/lisp/informat.el index 747d57c4f38..05be680bfa8 100644 --- a/lisp/informat.el +++ b/lisp/informat.el @@ -32,7 +32,7 @@ (require 'info) -(declare-function texinfo-format-refill "textmodes/texinfmt" ()) +(declare-function texinfo-format-refill "texinfmt" ()) ;;;###autoload (defun Info-tagify (&optional input-buffer-name) -- cgit v1.2.3 From 292071b483f53e5b8fa8541f1de08ba5ba4f211a Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 6 Dec 2007 04:06:27 +0000 Subject: Re-fill copyright. Remove directory part from filenames in function declarations. --- lisp/emacs-lisp/tcover-ses.el | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/tcover-ses.el b/lisp/emacs-lisp/tcover-ses.el index 0a4bdce0412..a0097ef9052 100644 --- a/lisp/emacs-lisp/tcover-ses.el +++ b/lisp/emacs-lisp/tcover-ses.el @@ -1,6 +1,7 @@ ;;;; testcover-ses.el -- Example use of `testcover' to test "SES" -;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 +;; Free Software Foundation, Inc. ;; Author: Jonathan Yavner ;; Maintainer: Jonathan Yavner @@ -26,15 +27,15 @@ (defvar ses-initial-global-parameters) (defvar ses-mode-map) -(declare-function ses-set-curcell "../ses") -(declare-function ses-update-cells "../ses") -(declare-function ses-load "../ses") -(declare-function ses-vector-delete "../ses") -(declare-function ses-create-header-string "../ses") -(declare-function ses-read-cell "../ses") -(declare-function ses-read-symbol "../ses") -(declare-function ses-command-hook "../ses") -(declare-function ses-jump "../ses") +(declare-function ses-set-curcell "ses") +(declare-function ses-update-cells "ses") +(declare-function ses-load "ses") +(declare-function ses-vector-delete "ses") +(declare-function ses-create-header-string "ses") +(declare-function ses-read-cell "ses") +(declare-function ses-read-symbol "ses") +(declare-function ses-command-hook "ses") +(declare-function ses-jump "ses") ;;;Here are some macros that exercise SES. Set `pause' to t if you want the -- cgit v1.2.3 From 5cec305694c24f57f0cb0b46a089323d18274142 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 6 Dec 2007 04:09:57 +0000 Subject: Remove directory part from filenames in function declarations. --- lisp/emacs-lisp/timer.el | 2 +- lisp/emulation/edt.el | 2 +- lisp/emulation/vi.el | 2 +- lisp/emulation/viper-cmd.el | 4 ++-- lisp/international/titdic-cnv.el | 2 +- lisp/mail/emacsbug.el | 4 ++-- lisp/progmodes/dcl-mode.el | 2 +- lisp/progmodes/prolog.el | 8 ++++---- lisp/progmodes/ps-mode.el | 2 +- lisp/progmodes/python.el | 2 +- lisp/textmodes/fill.el | 4 ++-- 11 files changed, 17 insertions(+), 17 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 023a4a3e4b7..b11f7ca9d5c 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -357,7 +357,7 @@ This function is called, by name, directly by the C code." (and (listp event) (eq (car event) 'timer-event))) -(declare-function diary-entry-time "../calendar/diary-lib" (s)) +(declare-function diary-entry-time "diary-lib" (s)) ;;;###autoload (defun run-at-time (time repeat function &rest args) diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el index d43c118f4e1..1674e7a266b 100644 --- a/lisp/emulation/edt.el +++ b/lisp/emulation/edt.el @@ -1619,7 +1619,7 @@ Argument NUM is the percentage into the buffer to move." (fill-region (point) (mark)))) -(declare-function c-mark-function "../progmodes/cc-cmds" ()) +(declare-function c-mark-function "cc-cmds" ()) ;;; ;;; MARK SECTION WISELY ;;; diff --git a/lisp/emulation/vi.el b/lisp/emulation/vi.el index 889f81e75c7..de7bcffdf0e 100644 --- a/lisp/emulation/vi.el +++ b/lisp/emulation/vi.el @@ -1375,7 +1375,7 @@ The following CHAR will be the name for the command or macro." (setq char (read-char)) (vi-ask-for-info char)))) -(declare-function c-mark-function "../progmodes/cc-cmds" ()) +(declare-function c-mark-function "cc-cmds" ()) (defun vi-mark-region (arg region) "Mark region appropriately. The next char REGION is d(efun),s(-exp),b(uffer), diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 5637fad59c7..8603169819f 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el @@ -3079,8 +3079,8 @@ On reaching beginning of line, stop and signal error." (setq this-command 'next-line) (if com (viper-execute-com 'viper-next-line val com)))) -(declare-function widget-type "../wid-edit" (widget)) -(declare-function widget-button-press "../wid-edit" (pos &optional event)) +(declare-function widget-type "wid-edit" (widget)) +(declare-function widget-button-press "wid-edit" (pos &optional event)) (declare-function viper-set-hooks "viper" ()) (defun viper-next-line-at-bol (arg) diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index 83c765dd887..ff909f6bba7 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -1112,7 +1112,7 @@ To input symbols and punctuations, type `/' followed by one of `a' to Some infrequent characters are accessed by typing \\, followed by the Cantonese romanization of the respective radical ($(0?f5}(B).")) -(declare-function dos-8+3-filename "../dos-fns.el" (filename)) +(declare-function dos-8+3-filename "dos-fns.el" (filename)) (defun miscdic-convert (filename &optional dirname) "Convert a dictionary file FILENAME into a Quail package. diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index dab87e04497..eb96ef07612 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -229,8 +229,8 @@ Type SPC to scroll through this section and its subsections.")))) (setq report-emacs-bug-orig-text (buffer-substring (point-min) (point)))) (goto-char user-point))) -(declare-function Info-menu "../info" (menu-item &optional fork)) -(declare-function Info-goto-node "../info" (nodename &optional fork)) +(declare-function Info-menu "info" (menu-item &optional fork)) +(declare-function Info-goto-node "info" (nodename &optional fork)) (defun report-emacs-bug-info () "Go to the Info node on reporting Emacs bugs." diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el index 5df2c72b7e0..4546880cca5 100644 --- a/lisp/progmodes/dcl-mode.el +++ b/lisp/progmodes/dcl-mode.el @@ -2201,7 +2201,7 @@ otherwise return nil." () (equal start (match-end 0)))))) -(declare-function imenu-default-create-index-function "../imenu" ()) +(declare-function imenu-default-create-index-function "imenu" ()) ;;;------------------------------------------------------------------------- (defun dcl-imenu-create-index-function () diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 190442bf26e..dd3503f16b0 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -240,10 +240,10 @@ rigidly along with this one (not yet)." (defvar inferior-prolog-mode-syntax-table prolog-mode-syntax-table) (defvar inferior-prolog-mode-abbrev-table prolog-mode-abbrev-table) -(declare-function comint-mode "../comint") -(declare-function comint-send-string "../comint" (process string)) -(declare-function comint-send-region "../comint" (process start end)) -(declare-function comint-send-eof "../comint" ()) +(declare-function comint-mode "comint") +(declare-function comint-send-string "comint" (process string)) +(declare-function comint-send-region "comint" (process start end)) +(declare-function comint-send-eof "comint" ()) (define-derived-mode inferior-prolog-mode comint-mode "Inferior Prolog" "Major mode for interacting with an inferior Prolog process. diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el index 8b26db1a12e..6327a68302b 100644 --- a/lisp/progmodes/ps-mode.el +++ b/lisp/progmodes/ps-mode.el @@ -481,7 +481,7 @@ If nil, the following are tried in turn, until success: -(declare-function doc-view-minor-mode "../doc-view") +(declare-function doc-view-minor-mode "doc-view") ;; PostScript mode. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 0708bf7037d..66779acb103 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1658,7 +1658,7 @@ instance. Assumes an inferior Python is running." ;;;; Info-look functionality. -(declare-function info-lookup-maybe-add-help "../info-look" (&rest arg)) +(declare-function info-lookup-maybe-add-help "info-look" (&rest arg)) (defun python-after-info-look () "Set up info-look for Python. diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index cd60cf3bf34..5c6638a51e9 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -831,8 +831,8 @@ in the active region." (fill-region-as-paragraph beg end justify)))))) fill-pfx))) -(declare-function comment-search-forward "../newcomment" (limit &optional noerror)) -(declare-function comment-string-strip "../newcomment" (str beforep afterp)) +(declare-function comment-search-forward "newcomment" (limit &optional noerror)) +(declare-function comment-string-strip "newcomment" (str beforep afterp)) (defun fill-comment-paragraph (&optional justify) -- cgit v1.2.3