diff options
author | Karoly Lorentey <karoly@lorentey.hu> | 2007-02-24 19:26:54 +0000 |
---|---|---|
committer | Karoly Lorentey <karoly@lorentey.hu> | 2007-02-24 19:26:54 +0000 |
commit | f65f7603312547e51230192daf34349b8ac569a0 (patch) | |
tree | cbc5877854d00bbdd5ecd4906d130ab8fbb44430 /lisp/emacs-lisp | |
parent | 9440b75fccbf763e3fb23a31a128d97eb4debdf5 (diff) | |
parent | 735895f1fa28f88c559e73910ea0ff0bda0f228c (diff) | |
download | emacs-f65f7603312547e51230192daf34349b8ac569a0.tar.gz |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-619
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-620
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-621
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-622
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-623
Remove RCS keywords
* emacs@sv.gnu.org/emacs--devo--0--patch-624
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-625
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-626
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-627
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-628
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-629
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-630
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-631
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-632
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-633
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-634
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-635
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-636
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-637
Remove RCS keywords
* emacs@sv.gnu.org/emacs--devo--0--patch-638
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-639
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-640
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-641
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-642
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-643
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-644
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-645
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-646
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-647
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-648
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-649
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-197
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-198
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-199
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-200
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-201
Update from CVS: lisp/nnweb.el (nnweb-google-parse-1): Update parser.
* emacs@sv.gnu.org/gnus--rel--5.10--patch-202
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-596
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/autoload.el | 3 | ||||
-rw-r--r-- | lisp/emacs-lisp/bindat.el | 62 | ||||
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 17 | ||||
-rw-r--r-- | lisp/emacs-lisp/easy-mmode.el | 10 | ||||
-rw-r--r-- | lisp/emacs-lisp/float-sup.el | 5 | ||||
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 38 | ||||
-rw-r--r-- | lisp/emacs-lisp/shadow.el | 6 |
7 files changed, 99 insertions, 42 deletions
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index e6822d90ee2..5e37e275632 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -73,6 +73,7 @@ or macro definition or a defcustom)." (cond ;; For complex cases, try again on the macro-expansion. ((and (memq car '(easy-mmode-define-global-mode define-global-minor-mode + define-globalized-minor-mode easy-mmode-define-minor-mode define-minor-mode)) (setq expand (let ((load-file-name file)) (macroexpand form))) (eq (car expand) 'progn) @@ -88,6 +89,7 @@ or macro definition or a defcustom)." ((memq car '(defun define-skeleton defmacro define-derived-mode define-compilation-mode define-generic-mode easy-mmode-define-global-mode define-global-minor-mode + define-globalized-minor-mode easy-mmode-define-minor-mode define-minor-mode defun* defmacro*)) (let* ((macrop (memq car '(defmacro defmacro*))) @@ -110,6 +112,7 @@ or macro definition or a defcustom)." define-generic-mode easy-mmode-define-global-mode define-global-minor-mode + define-globalized-minor-mode easy-mmode-define-minor-mode define-minor-mode)) t) (eq (car-safe (car body)) 'interactive)) diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index c58c286ef75..1e491697430 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -147,7 +147,7 @@ ;; | u16r | u24r | u32r -- little endian byte order. ;; | str LEN -- LEN byte string ;; | strz LEN -- LEN byte (zero-terminated) string -;; | vec LEN -- LEN byte vector +;; | vec LEN [TYPE] -- vector of LEN items of TYPE (default: u8) ;; | ip -- 4 byte vector ;; | bits LEN -- List with bits set in LEN bytes. ;; @@ -207,30 +207,24 @@ (setq bindat-idx (1+ bindat-idx)))) (defun bindat--unpack-u16 () - (let* ((a (bindat--unpack-u8)) (b (bindat--unpack-u8))) - (logior (lsh a 8) b))) + (logior (lsh (bindat--unpack-u8) 8) (bindat--unpack-u8))) (defun bindat--unpack-u24 () - (let* ((a (bindat--unpack-u16)) (b (bindat--unpack-u8))) - (logior (lsh a 8) b))) + (logior (lsh (bindat--unpack-u16) 8) (bindat--unpack-u8))) (defun bindat--unpack-u32 () - (let* ((a (bindat--unpack-u16)) (b (bindat--unpack-u16))) - (logior (lsh a 16) b))) + (logior (lsh (bindat--unpack-u16) 16) (bindat--unpack-u16))) (defun bindat--unpack-u16r () - (let* ((a (bindat--unpack-u8)) (b (bindat--unpack-u8))) - (logior a (lsh b 8)))) + (logior (bindat--unpack-u8) (lsh (bindat--unpack-u8) 8))) (defun bindat--unpack-u24r () - (let* ((a (bindat--unpack-u16r)) (b (bindat--unpack-u8))) - (logior a (lsh b 16)))) + (logior (bindat--unpack-u16r) (lsh (bindat--unpack-u8) 16))) (defun bindat--unpack-u32r () - (let* ((a (bindat--unpack-u16r)) (b (bindat--unpack-u16r))) - (logior a (lsh b 16)))) + (logior (bindat--unpack-u16r) (lsh (bindat--unpack-u16r) 16))) -(defun bindat--unpack-item (type len) +(defun bindat--unpack-item (type len &optional vectype) (if (eq type 'ip) (setq type 'vec len 4)) (cond @@ -274,9 +268,14 @@ (if (stringp s) s (string-make-unibyte (concat s))))) ((eq type 'vec) - (let ((v (make-vector len 0)) (i 0)) + (let ((v (make-vector len 0)) (i 0) (vlen 1)) + (if (consp vectype) + (setq vlen (nth 1 vectype) + vectype (nth 2 vectype)) + (setq type (or vectype 'u8) + vectype nil)) (while (< i len) - (aset v i (bindat--unpack-u8)) + (aset v i (bindat--unpack-item type vlen vectype)) (setq i (1+ i))) v)) (t nil))) @@ -288,6 +287,7 @@ (field (car item)) (type (nth 1 item)) (len (nth 2 item)) + (vectype (and (eq type 'vec) (nth 3 item))) (tail 3) data) (setq spec (cdr spec)) @@ -335,7 +335,7 @@ (setq data (bindat--unpack-group (cdr case)) cases nil))))) (t - (setq data (bindat--unpack-item type len) + (setq data (bindat--unpack-item type len vectype) last data))) (if data (if field @@ -384,6 +384,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (field (car item)) (type (nth 1 item)) (len (nth 2 item)) + (vectype (and (eq type 'vec) (nth 3 item))) (tail 3)) (setq spec (cdr spec)) (if (and (consp field) (eq (car field) 'eval)) @@ -401,6 +402,13 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (setq len (apply 'bindat-get-field struct len))) (if (not len) (setq len 1)) + (while (eq type 'vec) + (let ((vlen 1)) + (if (consp vectype) + (setq len (* len (nth 1 vectype)) + type (nth 2 vectype)) + (setq type (or vectype 'u8) + vectype nil)))) (cond ((eq type 'eval) (if field @@ -434,7 +442,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (setq cases nil)))))) (t (if (setq type (assq type bindat--fixed-length-alist)) - (setq len (cdr type))) + (setq len (* len (cdr type)))) (if field (setq last (bindat-get-field struct field))) (setq bindat-idx (+ bindat-idx len)))))))) @@ -478,7 +486,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (bindat--pack-u16r v) (bindat--pack-u16r (lsh v -16))) -(defun bindat--pack-item (v type len) +(defun bindat--pack-item (v type len &optional vectype) (if (eq type 'ip) (setq type 'vec len 4)) (cond @@ -511,13 +519,24 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (setq bnum (1- bnum) j (lsh j -1)))) (bindat--pack-u8 m)))) - ((memq type '(str strz vec)) + ((memq type '(str strz)) (let ((l (length v)) (i 0)) (if (> l len) (setq l len)) (while (< i l) (aset bindat-raw (+ bindat-idx i) (aref v i)) (setq i (1+ i))) (setq bindat-idx (+ bindat-idx len)))) + ((eq type 'vec) + (let ((l (length v)) (i 0) (vlen 1)) + (if (consp vectype) + (setq vlen (nth 1 vectype) + vectype (nth 2 vectype)) + (setq type (or vectype 'u8) + vectype nil)) + (if (> l len) (setq l len)) + (while (< i l) + (bindat--pack-item (aref v i) type vlen vectype) + (setq i (1+ i))))) (t (setq bindat-idx (+ bindat-idx len))))) @@ -528,6 +547,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (field (car item)) (type (nth 1 item)) (len (nth 2 item)) + (vectype (and (eq type 'vec) (nth 3 item))) (tail 3)) (setq spec (cdr spec)) (if (and (consp field) (eq (car field) 'eval)) @@ -578,7 +598,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (setq cases nil)))))) (t (setq last (bindat-get-field struct field)) - (bindat--pack-item last type len) + (bindat--pack-item last type len vectype) )))))) (defun bindat-pack (spec struct &optional bindat-raw bindat-idx) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 4b31a0e6943..1d7cbfc422c 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -219,7 +219,9 @@ if you change this variable." ;; The user may want to redefine this along with emacs-lisp-file-regexp, ;; so only define it if it is undefined. (defun byte-compile-dest-file (filename) - "Convert an Emacs Lisp source file name to a compiled file name." + "Convert an Emacs Lisp source file name to a compiled file name. +If FILENAME matches `emacs-lisp-file-regexp' (by default, files +with the extension `.el'), add `c' to it; otherwise add `.elc'." (setq filename (byte-compiler-base-file-name filename)) (setq filename (file-name-sans-versions filename)) (cond ((eq system-type 'vax-vms) @@ -296,6 +298,10 @@ When this option is true, if you load the compiled file and then move it, the functions you loaded will not be able to run.") ;;;###autoload(put 'byte-compile-dynamic 'safe-local-variable 'booleanp) +(defvar byte-compile-disable-print-circle nil + "If non-nil, disable `print-circle' on printing a byte-compiled code.") +;;;###autoload(put 'byte-compile-disable-print-circle 'safe-local-variable 'booleanp) + (defcustom byte-compile-dynamic-docstrings t "*If non-nil, compile doc strings for lazy access. We bury the doc strings of functions and variables @@ -1611,7 +1617,8 @@ This is normally set in local file variables at the end of the elisp file: ;;;###autoload (defun byte-compile-file (filename &optional load) "Compile a file of Lisp code named FILENAME into a file of byte code. -The output file's name is made by appending `c' to the end of FILENAME. +The output file's name is generated by passing FILENAME to the +`byte-compile-dest-file' function (which see). With prefix arg (noninteractively: 2nd arg), LOAD the file after compiling. The value is non-nil if there were no errors, nil if errors." ;; (interactive "fByte compile file: \nP") @@ -2003,7 +2010,8 @@ With argument, insert value in current buffer after the form." (print-level nil) (print-quoted t) (print-gensym t) - (print-circle t)) ; handle circular data structures + (print-circle ; handle circular data structures + (not byte-compile-disable-print-circle))) (princ "\n" outbuffer) (prin1 form outbuffer) nil))) @@ -2060,7 +2068,8 @@ list that represents a doc string reference. ;; print-gensym-alist not to be cleared ;; between calls to print functions. (print-gensym '(t)) - (print-circle t) ; handle circular data structures + (print-circle ; handle circular data structures + (not byte-compile-disable-print-circle)) print-gensym-alist ; was used before print-circle existed. (print-continuous-numbering t) print-number-table diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 7c6a26e59d6..8b8dc6ba09d 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -271,9 +271,11 @@ With zero or negative ARG turn mode off. ;;; ;;;###autoload -(defalias 'easy-mmode-define-global-mode 'define-global-minor-mode) +(defalias 'easy-mmode-define-global-mode 'define-globalized-minor-mode) ;;;###autoload -(defmacro define-global-minor-mode (global-mode mode turn-on &rest keys) +(defalias 'define-global-minor-mode 'define-globalized-minor-mode) +;;;###autoload +(defmacro define-globalized-minor-mode (global-mode mode turn-on &rest keys) "Make a global mode GLOBAL-MODE corresponding to buffer-local minor MODE. TURN-ON is a function that will be called with no args in every buffer and that should try to turn MODE on if applicable for that buffer. @@ -283,7 +285,7 @@ KEYS is a list of CL-style keyword arguments. As the minor mode which see. In particular, :group specifies the custom group. The most useful keywords are those that are passed on to the `defcustom'. It normally makes no sense to pass the :lighter - or :keymap keywords to `define-global-minor-mode', since these + or :keymap keywords to `define-globalized-minor-mode', since these are usually passed to the buffer-local version of the minor mode. If MODE's set-up depends on the major mode in effect when it was @@ -348,7 +350,7 @@ in which `%s' turns it on." (with-current-buffer buf (if ,global-mode (,turn-on) (when ,mode (,mode -1)))))) - ;; Autoloading define-global-minor-mode autoloads everything + ;; Autoloading define-globalized-minor-mode autoloads everything ;; up-to-here. :autoload-end diff --git a/lisp/emacs-lisp/float-sup.el b/lisp/emacs-lisp/float-sup.el index 6f24e9bb749..68326c1bc06 100644 --- a/lisp/emacs-lisp/float-sup.el +++ b/lisp/emacs-lisp/float-sup.el @@ -37,14 +37,11 @@ ;; provide an easy hook to tell if we are running with floats or not. ;; define pi and e via math-lib calls. (much less prone to killer typos.) (defconst pi (* 4 (atan 1)) "The value of Pi (3.1415926...).") + ;; It's too inconvenient to make `e' a constant because it's used as ;; a temporary variable all the time. (defvar e (exp 1) "The value of e (2.7182818...).") -;; Careful when editing this file ... typos here will be hard to spot. -;; (defconst pi 3.14159265358979323846264338327 -;; "The value of Pi (3.14159265358979323846264338327...)") - (defconst degrees-to-radians (/ pi 180.0) "Degrees to radian conversion constant.") (defconst radians-to-degrees (/ 180.0 pi) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 5aa656bd2b5..5576a4882b0 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -97,6 +97,7 @@ '("defun" "defun*" "defsubst" "defmacro" "defadvice" "define-skeleton" "define-minor-mode" "define-global-minor-mode" + "define-globalized-minor-mode" "define-derived-mode" "define-generic-mode" "define-compiler-macro" "define-modify-macro" "defsetf" "define-setf-expander" @@ -143,6 +144,7 @@ (put 'define-minor-mode 'doc-string-elt 2) (put 'easy-mmode-define-global-mode 'doc-string-elt 2) (put 'define-global-minor-mode 'doc-string-elt 2) +(put 'define-globalized-minor-mode 'doc-string-elt 2) (put 'define-generic-mode 'doc-string-elt 7) (put 'define-ibuffer-filter 'doc-string-elt 2) (put 'define-ibuffer-op 'doc-string-elt 3) @@ -907,6 +909,24 @@ is the buffer position of the start of the containing expression." (cond ((elt state 3) ;; Inside a string, don't change indentation. nil) + ((save-excursion + ;; test whether current line begins with a constant + (goto-char indent-point) + (skip-chars-forward " \t") + (looking-at ":")) + (let ((desired-indent + (save-excursion + (goto-char (1+ containing-sexp)) + (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t) + (point))) + (parse-sexp-ignore-comments t)) + ;; Align a constant symbol under the last constant symbol + (goto-char calculate-lisp-indent-last-sexp) + (while (> (point) desired-indent) + (if (looking-at ":") + (setq desired-indent (point)) + (backward-sexp 1)))) + (current-column)) ((and (integerp lisp-indent-offset) containing-sexp) ;; Indent by constant offset (goto-char containing-sexp) @@ -1128,19 +1148,25 @@ ENDPOS is encountered." (make-list (- next-depth) nil)) last-depth (- last-depth next-depth) next-depth 0))) - (or outer-loop-done endpos - (setq outer-loop-done (<= next-depth 0))) - (if outer-loop-done - (forward-line 1) + (forward-line 1) + ;; Decide whether to exit. + (if endpos + ;; If we have already reached the specified end, + ;; give up and do not reindent this line. + (if (<= endpos (point)) + (setq outer-loop-done t)) + ;; If no specified end, we are done if we have finished one sexp. + (if (<= next-depth 0) + (setq outer-loop-done t))) + (unless outer-loop-done (while (> last-depth next-depth) (setq indent-stack (cdr indent-stack) last-depth (1- last-depth))) (while (< last-depth next-depth) (setq indent-stack (cons nil indent-stack) last-depth (1+ last-depth))) - ;; Now go to the next line and indent it according + ;; Now indent the next line according ;; to what we learned from parsing the previous one. - (forward-line 1) (setq bol (point)) (skip-chars-forward " \t") ;; But not if the line is blank, or just a comment diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el index 827ee9c4e6b..03c3c94b54a 100644 --- a/lisp/emacs-lisp/shadow.el +++ b/lisp/emacs-lisp/shadow.el @@ -93,7 +93,7 @@ See the documentation for `list-load-path-shadows' for further information." (setq dir (directory-file-name (file-truename (or (car path) ".")))) (if (member dir true-names) ;; We have already considered this PATH redundant directory. - ;; Show the redundancy if we are interactiver, unless the PATH + ;; Show the redundancy if we are interactive, unless the PATH ;; dir is nil or "." (these redundant directories are just a ;; result of the current working directory, and are therefore ;; not always redundant). @@ -170,8 +170,8 @@ See the documentation for `list-load-path-shadows' for further information." (defun list-load-path-shadows () "Display a list of Emacs Lisp files that shadow other files. -This function lists potential load-path problems. Directories in the -`load-path' variable are searched, in order, for Emacs Lisp +This function lists potential load path problems. Directories in +the `load-path' variable are searched, in order, for Emacs Lisp files. When a previously encountered file name is found again, a message is displayed indicating that the later file is \"hidden\" by the earlier. |