carbon2-commit: Make my Lisp a little more sophisticated, select.el.
13 years, 7 months
Aidan Kehoe
changeset: 5423:0f9aa4eb4bec
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Tue Mar 08 21:00:36 2011 +0000
files: lisp/ChangeLog lisp/select.el
description:
Make my Lisp a little more sophisticated, select.el.
2011-03-08 Aidan Kehoe <kehoea(a)parhasard.net>
* select.el (selection-preferred-types):
* select.el (cut-copy-clear-internal):
* select.el (create-image-functions):
* select.el (select-convert-from-image/gif):
* select.el (select-convert-from-image/jpeg):
* select.el (select-convert-from-image/png):
* select.el (select-convert-from-image/tiff):
* select.el (select-convert-from-image/xpm):
* select.el (select-convert-from-image/xbm):
* select.el (selection-converter-in-alist):
Make my Lisp a little more sophisticated in this file.
diff -r 311f6817efc2 -r 0f9aa4eb4bec lisp/ChangeLog
--- a/lisp/ChangeLog Tue Mar 08 18:12:48 2011 +0000
+++ b/lisp/ChangeLog Tue Mar 08 21:00:36 2011 +0000
@@ -1,3 +1,17 @@
+2011-03-08 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * select.el (selection-preferred-types):
+ * select.el (cut-copy-clear-internal):
+ * select.el (create-image-functions):
+ * select.el (select-convert-from-image/gif):
+ * select.el (select-convert-from-image/jpeg):
+ * select.el (select-convert-from-image/png):
+ * select.el (select-convert-from-image/tiff):
+ * select.el (select-convert-from-image/xpm):
+ * select.el (select-convert-from-image/xbm):
+ * select.el (selection-converter-in-alist):
+ Make my Lisp a little more sophisticated in this file.
+
2011-03-08 Aidan Kehoe <kehoea(a)parhasard.net>
* package-ui.el (pui-add-required-packages):
diff -r 311f6817efc2 -r 0f9aa4eb4bec lisp/select.el
--- a/lisp/select.el Tue Mar 08 18:12:48 2011 +0000
+++ b/lisp/select.el Tue Mar 08 21:00:36 2011 +0000
@@ -38,10 +38,11 @@
;; Mozilla will happily give us broken COMPOUND_TEXT where a non-broken
;; UTF8_STRING is available.
(defvar selection-preferred-types
- (let ((res '(UTF8_STRING COMPOUND_TEXT STRING image/png image/gif
- image/jpeg image/tiff image/xpm image/xbm)))
- (unless (featurep 'mule) (delq 'COMPOUND_TEXT res))
- res)
+ `(UTF8_STRING ,@(and (featurep 'mule) '(COMPOUND_TEXT)) STRING
+ ,@(mapcan #'(lambda (format)
+ (and (featurep format)
+ (list (intern (format "image/%s" format)))))
+ '(png gif jpeg tiff xpm xbm)))
"An ordered list of X11 type atoms for selections we want to receive.
We prefer UTF8_STRING over COMPOUND_TEXT, for compatibility with a certain
widely-used browser suite, and COMPOUND_TEXT over STRING. (COMPOUND_TEXT
@@ -379,7 +380,7 @@
(buffer-live-p (marker-buffer (cdr data))))))
(defun cut-copy-clear-internal (mode)
- (or (memq mode '(cut copy clear)) (error "unkown mode %S" mode))
+ (or (memq mode '(cut copy clear)) (error "unknown mode %S" mode))
(or (selection-owner-p)
(error "XEmacs does not own the primary selection"))
(setq last-command nil)
@@ -777,26 +778,19 @@
(set-extent-end-glyph extent glyph)
str)))
-;; Could automate defining these functions these with a macro, but damned if
-;; I can get that to work. Anyway, this is more readable.
-
-(defun select-convert-from-image/gif (selection type value)
- (if (featurep 'gif) (select-convert-from-image-data 'gif value)))
-
-(defun select-convert-from-image/jpeg (selection type value)
- (if (featurep 'jpeg) (select-convert-from-image-data 'jpeg value)))
-
-(defun select-convert-from-image/png (selection type value)
- (if (featurep 'png) (select-convert-from-image-data 'png value)))
-
-(defun select-convert-from-image/tiff (selection type value)
- (if (featurep 'tiff) (select-convert-from-image-data 'tiff value)))
-
-(defun select-convert-from-image/xpm (selection type value)
- (if (featurep 'xpm) (select-convert-from-image-data 'xpm value)))
-
-(defun select-convert-from-image/xbm (selection type value)
- (if (featurep 'xbm) (select-convert-from-image-data 'xbm value)))
+(macrolet
+ ((create-image-functions (&rest formats)
+ (cons
+ 'progn
+ (mapcar
+ #'(lambda (format)
+ `(if (featurep ',format)
+ (defalias (intern (concat "select-convert-from-image/"
+ ,(symbol-name format)))
+ #'(lambda (selection type value)
+ (select-convert-from-image-data ',format
+ value))))) formats))))
+ (create-image-functions gif jpeg png tiff xpm xbm))
;;; CF_xxx conversions
(defun select-convert-from-cf-text (selection type value)
@@ -931,7 +925,7 @@
;; Types listed here can be selections foreign to XEmacs
(setq selection-converter-in-alist
- '(; Specific types that get handled by generic converters
+ `(; Specific types that get handled by generic converters
(INTEGER . select-convert-from-integer)
(TIMESTAMP . select-convert-from-integer)
(LENGTH . select-convert-from-integer)
@@ -948,13 +942,12 @@
(text/html . select-convert-from-utf-16-le-text) ; Mozilla
(text/_moz_htmlcontext . select-convert-from-utf-16-le-text)
(text/_moz_htmlinfo . select-convert-from-utf-16-le-text)
- (image/png . select-convert-from-image/png)
- (image/gif . select-convert-from-image/gif)
- (image/jpeg . select-convert-from-image/jpeg )
- (image/tiff . select-convert-from-image/tiff )
- (image/xpm . select-convert-from-image/xpm)
- (image/xbm . select-convert-from-image/xbm)
- ))
+ ,@(loop
+ for format in '(gif jpeg png tiff xpm xbm)
+ nconc (if (featurep format)
+ (list (cons (intern (format "image/%s" format))
+ (intern (format "select-convert-from-image/%s"
+ format))))))))
;; Types listed here have special coercion functions that can munge
;; other types. This can also be used to add special features - e.g.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: Remove various redundant wrapper lambdas, core lisp.
13 years, 7 months
Aidan Kehoe
changeset: 5422:311f6817efc2
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Tue Mar 08 18:12:48 2011 +0000
files: lisp/ChangeLog lisp/bytecomp-runtime.el lisp/mule/devan-util.el lisp/mule/japanese.el lisp/mule/make-coding-system.el lisp/mule/mule-category.el lisp/package-ui.el lisp/packages.el
description:
Remove various redundant wrapper lambdas, core lisp.
2011-03-08 Aidan Kehoe <kehoea(a)parhasard.net>
* package-ui.el (pui-add-required-packages):
* packages.el (packages-handle-package-dumped-lisps):
* bytecomp-runtime.el (byte-compile-with-fboundp):
* bytecomp-runtime.el (globally-declare-fboundp):
* bytecomp-runtime.el
(byte-compile-with-byte-compiler-warnings-suppressed):
* mule/devan-util.el (devanagari-reorder-glyphs-for-composition):
* mule/devan-util.el (devanagari-compose-to-one-glyph):
* mule/japanese.el:
* mule/japanese.el ("Japanese"):
* mule/make-coding-system.el (fixed-width-generate-helper):
* mule/mule-category.el (defined-category-list):
* mule/mule-category.el (undefined-category-designator):
Style change: remove redundant lambdas, things like (mapcar
#'(lambda (pkg) (symbol-name pkg)) ...) => (mapcar #'symbol-name ...).
diff -r 1cfe6b84efbf -r 311f6817efc2 lisp/ChangeLog
--- a/lisp/ChangeLog Tue Mar 01 14:18:54 2011 +0000
+++ b/lisp/ChangeLog Tue Mar 08 18:12:48 2011 +0000
@@ -1,3 +1,21 @@
+2011-03-08 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * package-ui.el (pui-add-required-packages):
+ * packages.el (packages-handle-package-dumped-lisps):
+ * bytecomp-runtime.el (byte-compile-with-fboundp):
+ * bytecomp-runtime.el (globally-declare-fboundp):
+ * bytecomp-runtime.el
+ (byte-compile-with-byte-compiler-warnings-suppressed):
+ * mule/devan-util.el (devanagari-reorder-glyphs-for-composition):
+ * mule/devan-util.el (devanagari-compose-to-one-glyph):
+ * mule/japanese.el:
+ * mule/japanese.el ("Japanese"):
+ * mule/make-coding-system.el (fixed-width-generate-helper):
+ * mule/mule-category.el (defined-category-list):
+ * mule/mule-category.el (undefined-category-designator):
+ Style change: remove redundant lambdas, things like (mapcar
+ #'(lambda (pkg) (symbol-name pkg)) ...) => (mapcar #'symbol-name ...).
+
2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-normal-call):
diff -r 1cfe6b84efbf -r 311f6817efc2 lisp/bytecomp-runtime.el
--- a/lisp/bytecomp-runtime.el Tue Mar 01 14:18:54 2011 +0000
+++ b/lisp/bytecomp-runtime.el Tue Mar 08 18:12:48 2011 +0000
@@ -310,7 +310,7 @@
(let ((symbols (eval (car (cdr form)))))
(unless (consp symbols)
(setq symbols (list symbols)))
- (setq symbols (mapcar #'(lambda (sym) (cons sym nil)) symbols))
+ (setq symbols (mapcar #'list symbols))
(setq byte-compile-unresolved-functions
(set-difference byte-compile-unresolved-functions symbols
:key #'car))
@@ -427,7 +427,7 @@
;; have an autoload later in the file for any functions in FUNCTIONS.
;; This is not something that code should ever do, though.)
(setq byte-compile-autoload-environment
- (append (mapcar #'(lambda (sym) (cons sym nil)) functions)
+ (append (mapcar #'list functions)
byte-compile-autoload-environment)))
nil)
diff -r 1cfe6b84efbf -r 311f6817efc2 lisp/mule/devan-util.el
--- a/lisp/mule/devan-util.el Tue Mar 01 14:18:54 2011 +0000
+++ b/lisp/mule/devan-util.el Tue Mar 08 18:12:48 2011 +0000
@@ -1057,8 +1057,7 @@
(setq ordered-glyphs
(append ordered-glyphs
(list (assq glyph devanagari-composition-rules))))))
- (sort ordered-glyphs #'(lambda (x y) (< (car (cdr x)) (car (cdr y)))))))
-
+ (sort* ordered-glyphs '< :key 'cadr)))
;;(devanagari-compose-to-one-glyph "$(5"5!X![(B") => "4$(6!Xv#"5t%![0!X"5![1(B"
(defun devanagari-compose-to-one-glyph (devanagari-string)
diff -r 1cfe6b84efbf -r 311f6817efc2 lisp/mule/japanese.el
--- a/lisp/mule/japanese.el Tue Mar 01 14:18:54 2011 +0000
+++ b/lisp/mule/japanese.el Tue Mar 08 18:12:48 2011 +0000
@@ -444,44 +444,38 @@
;; little helps there.)
(set-language-info "Japanese"
'native-coding-system
- (list
- ;; first, see if an explicit encoding was given.
- (lambda (locale)
- (let ((case-fold-search t))
- (cond
- ;; many unix versions
- ((string-match "\\.euc" locale) 'euc-jp)
- ((string-match "\\.sjis" locale) 'shift-jis)
+ ;; first, see if an explicit encoding was given.
+ (lambda (locale)
+ (let ((case-fold-search t))
+ (cond
+ ;; many unix versions
+ ((string-match "\\.euc" locale) 'euc-jp)
+ ((string-match "\\.sjis" locale) 'shift-jis)
- ;; X11R6 (CJKV p. 471)
- ((string-match "\\.jis7" locale) 'jis7)
- ((string-match "\\.jis8" locale) 'jis8)
- ((string-match "\\.mscode" locale) 'shift-jis)
- ((string-match "\\.pjis" locale) 'iso-2022-jp)
- ((string-match "\\.ujis" locale) 'euc-jp)
+ ;; X11R6 (CJKV p. 471)
+ ((string-match "\\.jis7" locale) 'jis7)
+ ((string-match "\\.jis8" locale) 'jis8)
+ ((string-match "\\.mscode" locale) 'shift-jis)
+ ((string-match "\\.pjis" locale) 'iso-2022-jp)
+ ((string-match "\\.ujis" locale) 'euc-jp)
- ;; other names in X11R6 locale.alias
- ((string-match "\\.ajec" locale) 'euc-jp)
- ((string-match "-euc" locale) 'euc-jp)
- ((string-match "\\.iso-2022-jp" locale) 'iso-2022-jp)
- ((string-match "\\.jis" locale) 'jis7) ;; or just jis?
- )))
+ ;; other names in X11R6 locale.alias
+ ((string-match "\\.ajec" locale) 'euc-jp)
+ ((string-match "-euc" locale) 'euc-jp)
+ ((string-match "\\.iso-2022-jp" locale) 'iso-2022-jp)
+ ((string-match "\\.jis" locale) 'jis7) ;; or just jis?
- ;; aix (CJKV p. 465)
- (lambda (locale)
- (when (eq system-type 'aix)
- (cond
- ((string-match "^Ja_JP" locale) 'shift-jis)
- ((string-match "^ja_JP" locale) 'euc-jp))))
+ ;; aix (CJKV p. 465)
+ ((and (eq system-type 'aix)
+ (string-match "^Ja_JP" locale)) 'shift-jis)
+ ((and (eq system-type 'aix)
+ (string-match "^ja_JP" locale)) 'euc-jp)
- ;; other X11R6 locale.alias
- (lambda (locale)
- (cond
+ ;; other X11R6 locale.alias
((string-match "^Jp_JP" locale) 'euc-jp)
((and (eq system-type 'hpux) (eq locale "japanese"))
- 'shift-jis)))
-
- ;; fallback
- 'euc-jp))
+ 'shift-jis)
+ ;; fallback
+ (t 'euc-jp)))))
;;; japanese.el ends here
diff -r 1cfe6b84efbf -r 311f6817efc2 lisp/mule/make-coding-system.el
--- a/lisp/mule/make-coding-system.el Tue Mar 01 14:18:54 2011 +0000
+++ b/lisp/mule/make-coding-system.el Tue Mar 08 18:12:48 2011 +0000
@@ -68,10 +68,7 @@
(repeat)))) nil))
(first-part compiled)
(last-part
- (member-if-not (lambda (entr) (eq #xBFFE entr))
- (member-if
- (lambda (entr) (eq #xBFFE entr))
- first-part))))
+ (member* #xBFFE (member* #xBFFE first-part) :test-not 'eql)))
(while compiled
(when (eq #xBFFE (cadr compiled))
(assert (= vec-len (search '(#xBFFE) (cdr compiled)
diff -r 1cfe6b84efbf -r 311f6817efc2 lisp/mule/mule-category.el
--- a/lisp/mule/mule-category.el Tue Mar 01 14:18:54 2011 +0000
+++ b/lisp/mule/mule-category.el Tue Mar 08 18:12:48 2011 +0000
@@ -64,11 +64,7 @@
(defun defined-category-list ()
"Return a list of the currently defined categories.
Categories are given by their designators."
- (let (list)
- (maphash #'(lambda (key value)
- (setq list (cons key list)))
- defined-category-hashtable)
- (nreverse list)))
+ (hash-table-key-list defined-category-hashtable))
(defun undefined-category-designator ()
"Return an undefined category designator, or nil if there are none."
diff -r 1cfe6b84efbf -r 311f6817efc2 lisp/package-ui.el
--- a/lisp/package-ui.el Tue Mar 01 14:18:54 2011 +0000
+++ b/lisp/package-ui.el Tue Mar 08 18:12:48 2011 +0000
@@ -435,9 +435,7 @@
(save-window-excursion
(with-output-to-temp-buffer tmpbuf
(display-completion-list (sort
- (mapcar #'(lambda (pkg)
- (symbol-name pkg))
- dependencies)
+ (mapcar #'symbol-name dependencies)
'string<)
:activate-callback nil
:help-string "Required packages:\n"
diff -r 1cfe6b84efbf -r 311f6817efc2 lisp/packages.el
--- a/lisp/packages.el Tue Mar 01 14:18:54 2011 +0000
+++ b/lisp/packages.el Tue Mar 08 18:12:48 2011 +0000
@@ -517,9 +517,7 @@
(load file-name)
;; dumped-lisp.el could have set this ...
(if package-lisp
- (mapcar #'(lambda (base)
- (funcall handle base))
- package-lisp))))))
+ (mapcar handle package-lisp))))))
package-load-path))
(defun packages-load-package-dumped-lisps (package-load-path)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: Change "special form" to "special operator" in the manuals, too
13 years, 7 months
Aidan Kehoe
changeset: 5420:62b9ef1ed4ac
parent: 5418:f5a5501814f5
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Tue Mar 01 14:18:45 2011 +0000
files: man/ChangeLog man/cl.texi man/lispref/commands.texi man/lispref/compile.texi man/lispref/control.texi man/lispref/display.texi man/lispref/eval.texi man/lispref/frames.texi man/lispref/functions.texi man/lispref/internationalization.texi man/lispref/intro.texi man/lispref/lists.texi man/lispref/macros.texi man/lispref/positions.texi man/lispref/searching.texi man/lispref/sequences.texi man/lispref/specifiers.texi man/lispref/variables.texi man/lispref/windows.texi
description:
Change "special form" to "special operator" in the manuals, too
2011-03-01 Aidan Kehoe <kehoea(a)parhasard.net>
* lispref/commands.texi (Using Interactive):
* lispref/compile.texi (Eval During Compile):
* lispref/compile.texi (Compiled-Function Objects):
* lispref/control.texi (Sequencing):
* lispref/control.texi (Conditionals):
* lispref/control.texi (Combining Conditions):
* lispref/control.texi (Iteration):
* lispref/control.texi (Catch and Throw):
* lispref/control.texi (Handling Errors):
* lispref/control.texi (Cleanups):
* lispref/display.texi (Temporary Displays):
* lispref/eval.texi (Quoting):
* lispref/eval.texi (Multiple values):
* lispref/frames.texi (Input Focus):
* lispref/functions.texi (Argument List):
* lispref/functions.texi (Defining Functions):
* lispref/functions.texi (Anonymous Functions):
* lispref/internationalization.texi (Level 3 Primitives):
* lispref/internationalization.texi (Domain Specification):
* lispref/intro.texi (A Sample Function Description):
* lispref/intro.texi (A Sample Variable Description):
* lispref/lists.texi (Sets And Lists):
* lispref/macros.texi (Defining Macros):
* lispref/macros.texi (Backquote):
* lispref/positions.texi (Excursions):
* lispref/positions.texi (Narrowing):
* lispref/searching.texi (Saving Match Data):
* lispref/sequences.texi (Sequence Functions):
* lispref/sequences.texi (Array Functions):
* lispref/specifiers.texi (Adding Specifications):
* lispref/variables.texi (Local Variables):
* lispref/variables.texi (Defining Variables):
* lispref/variables.texi (Setting Variables):
* lispref/variables.texi (Default Value):
* lispref/windows.texi (Selecting Windows):
* lispref/windows.texi (Window Configurations):
No longer use @defspec, since we no longer use the term "special
form"; instead use @deffn {Special Operator}. Unfortunately
there's no way in texinfo to redefine @defspec in one place.
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/ChangeLog
--- a/man/ChangeLog Sat Feb 19 11:03:46 2011 +0000
+++ b/man/ChangeLog Tue Mar 01 14:18:45 2011 +0000
@@ -1,3 +1,69 @@
+2011-03-01 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * lispref/commands.texi (Using Interactive):
+ * lispref/compile.texi (Eval During Compile):
+ * lispref/compile.texi (Compiled-Function Objects):
+ * lispref/control.texi (Sequencing):
+ * lispref/control.texi (Conditionals):
+ * lispref/control.texi (Combining Conditions):
+ * lispref/control.texi (Iteration):
+ * lispref/control.texi (Catch and Throw):
+ * lispref/control.texi (Handling Errors):
+ * lispref/control.texi (Cleanups):
+ * lispref/display.texi (Temporary Displays):
+ * lispref/eval.texi (Quoting):
+ * lispref/eval.texi (Multiple values):
+ * lispref/frames.texi (Input Focus):
+ * lispref/functions.texi (Argument List):
+ * lispref/functions.texi (Defining Functions):
+ * lispref/functions.texi (Anonymous Functions):
+ * lispref/internationalization.texi (Level 3 Primitives):
+ * lispref/internationalization.texi (Domain Specification):
+ * lispref/intro.texi (A Sample Function Description):
+ * lispref/intro.texi (A Sample Variable Description):
+ * lispref/lists.texi (Sets And Lists):
+ * lispref/macros.texi (Defining Macros):
+ * lispref/macros.texi (Backquote):
+ * lispref/positions.texi (Excursions):
+ * lispref/positions.texi (Narrowing):
+ * lispref/searching.texi (Saving Match Data):
+ * lispref/sequences.texi (Sequence Functions):
+ * lispref/sequences.texi (Array Functions):
+ * lispref/specifiers.texi (Adding Specifications):
+ * lispref/variables.texi (Local Variables):
+ * lispref/variables.texi (Defining Variables):
+ * lispref/variables.texi (Setting Variables):
+ * lispref/variables.texi (Default Value):
+ * lispref/windows.texi (Selecting Windows):
+ * lispref/windows.texi (Window Configurations):
+ No longer use @defspec, since we no longer use the term "special
+ form"; instead use @deffn {Special Operator}. Unfortunately
+ there's no way in texinfo to redefine @defspec in one place.
+
+2011-03-01 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * cl.texi (Argument Lists):
+ * cl.texi (Time of Evaluation):
+ * cl.texi (Type Predicates):
+ * cl.texi (Assignment):
+ * cl.texi (Basic Setf):
+ * cl.texi (Modify Macros):
+ * cl.texi (Customizing Setf):
+ * cl.texi (Dynamic Bindings):
+ * cl.texi (Lexical Bindings):
+ * cl.texi (Function Bindings):
+ * cl.texi (Macro Bindings):
+ * cl.texi (Conditionals):
+ * cl.texi (Blocks and Exits):
+ * cl.texi (Iteration):
+ * cl.texi (Loop Basics):
+ * cl.texi (Macros):
+ * cl.texi (Declarations):
+ * cl.texi (Property Lists):
+ * cl.texi (Structures):
+ * cl.texi (Assertions):
+ * cl.texi (Efficiency Concerns):
+
2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
* lispref/lists.texi (Sets And Lists):
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/cl.texi
--- a/man/cl.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/cl.texi Tue Mar 01 14:18:45 2011 +0000
@@ -381,14 +381,14 @@
Instead, this package defines alternates for several Lisp forms
which you must use if you need Common Lisp argument lists.
-@defspec defun* name arglist body...
+@deffn {Special Operator} defun* name arglist body...
This form is identical to the regular @code{defun} form, except
that @var{arglist} is allowed to be a full Common Lisp argument
list. Also, the function body is enclosed in an implicit block
called @var{name}; @pxref{Blocks and Exits}.
-@end defspec
-
-@defspec defsubst* name arglist body...
+@end deffn
+
+@deffn {Special Operator} defsubst* name arglist body...
This is just like @code{defun*}, except that the function that
is defined is automatically proclaimed @code{inline}, i.e.,
calls to it may be expanded into in-line code by the byte compiler.
@@ -398,9 +398,9 @@
efficient inline expansions. In particular, @code{defsubst*}
arranges for the processing of keyword arguments, default values,
etc., to be done at compile-time whenever possible.
-@end defspec
-
-@defspec defmacro* name arglist body...
+@end deffn
+
+@deffn {Special Operator} defmacro* name arglist body...
This is identical to the regular @code{defmacro} form,
except that @var{arglist} is allowed to be a full Common Lisp
argument list. The @code{&environment} keyword is supported as
@@ -409,13 +409,13 @@
cannot be implemented with the current Emacs Lisp interpreter.
The macro expander body is enclosed in an implicit block called
@var{name}.
-@end defspec
-
-@defspec function* symbol-or-lambda
+@end deffn
+
+@deffn {Special Operator} function* symbol-or-lambda
This is identical to the regular @code{function} form,
except that if the argument is a @code{lambda} form then that
form may use a full Common Lisp argument list.
-@end defspec
+@end deffn
Also, all forms (such as @code{defsetf} and @code{flet}) defined
in this package that include @var{arglist}s in their syntax allow
@@ -606,7 +606,7 @@
at compile-time so that later parts of the file can refer to the
macros that are defined.
-@defspec eval-when (situations...) forms...
+@deffn {Special Operator} eval-when (situations...) forms...
This form controls when the body @var{forms} are evaluated.
The @var{situations} list may contain any set of the symbols
@code{compile}, @code{load}, and @code{eval} (or their long-winded
@@ -678,7 +678,7 @@
certain top-level forms, like @code{defmacro} (sort-of) and
@code{require}, as if they were wrapped in @code{(eval-when
(compile load eval) @dots{})}.
-@end defspec
+@end deffn
Emacs 19 includes two special operators related to @code{eval-when}.
One of these, @code{eval-when-compile}, is not quite equivalent to
@@ -690,7 +690,7 @@
equivalent to @samp{(eval-when (compile load eval) @dots{})} and
so is not itself defined by this package.
-@defspec eval-when-compile forms...
+@deffn {Special Operator} eval-when-compile forms...
The @var{forms} are evaluated at compile-time; at execution time,
this form acts like a quoted constant of the resulting value. Used
at top-level, @code{eval-when-compile} is just like @samp{eval-when
@@ -699,9 +699,9 @@
or other reasons.
This form is similar to the @samp{#.} syntax of true Common Lisp.
-@end defspec
-
-@defspec load-time-value form
+@end deffn
+
+@deffn {Special Operator} load-time-value form
The @var{form} is evaluated at load-time; at execution time,
this form acts like a quoted constant of the resulting value.
@@ -742,7 +742,7 @@
", and loaded on: "
--temp--))
@end example
-@end defspec
+@end deffn
@node Function Aliases, , Time of Evaluation, Program Structure
@section Function Aliases
@@ -869,7 +869,7 @@
error.
@end defun
-@defspec deftype name arglist forms...
+@deffn {Special Operator} deftype name arglist forms...
This macro defines a new type called @var{name}. It is similar
to @code{defmacro} in many ways; when @var{name} is encountered
as a type name, the body @var{forms} are evaluated and should
@@ -897,7 +897,7 @@
The last example shows how the Common Lisp @code{unsigned-byte}
type specifier could be implemented if desired; this package does
not implement @code{unsigned-byte} by default.
-@end defspec
+@end deffn
The @code{typecase} and @code{check-type} macros also use type
names. @xref{Conditionals}. @xref{Assertions}. The @code{map},
@@ -989,7 +989,7 @@
The @code{psetq} form is just like @code{setq}, except that multiple
assignments are done in parallel rather than sequentially.
-@defspec psetq [symbol form]@dots{}
+@deffn {Special Operator} psetq [symbol form]@dots{}
This macro is used to assign to several
variables simultaneously. Given only one @var{symbol} and @var{form},
it has the same effect as @code{setq}. Given several @var{symbol}
@@ -1017,7 +1017,7 @@
@pxref{Modify Macros}.)
@code{psetq} always returns @code{nil}.
-@end defspec
+@end deffn
@node Generalized Variables, Variable Bindings, Assignment, Control Structure
@section Generalized Variables
@@ -1055,7 +1055,7 @@
The @code{setf} macro is the most basic way to operate on generalized
variables.
-@defspec setf [place form]@dots{}
+@deffn {Special Operator} setf [place form]@dots{}
This macro evaluates @var{form} and stores it in @var{place}, which
must be a valid generalized variable form. If there are several
@var{place} and @var{form} pairs, the assignments are done sequentially
@@ -1218,7 +1218,7 @@
the form @code{(setf (wrong-order @var{a} @var{b}) 17)} will
evaluate @var{b} first, then @var{a}, just as in an actual call
to @code{wrong-order}.
-@end defspec
+@end deffn
@node Modify Macros, Customizing Setf, Basic Setf, Generalized Variables
@subsection Modify Macros
@@ -1228,15 +1228,15 @@
that operate on generalized variables. Many are interesting and
useful even when the @var{place} is just a variable name.
-@defspec psetf [place form]@dots{}
+@deffn {Special Operator} psetf [place form]@dots{}
This macro is to @code{setf} what @code{psetq} is to @code{setq}:
When several @var{place}s and @var{form}s are involved, the
assignments take place in parallel rather than sequentially.
Specifically, all subforms are evaluated from left to right, then
all the assignments are done (in an undefined order).
-@end defspec
-
-@defspec incf place &optional x
+@end deffn
+
+@deffn {Special Operator} incf place &optional x
This macro increments the number stored in @var{place} by one, or
by @var{x} if specified. The incremented value is returned. For
example, @code{(incf i)} is equivalent to @code{(setq i (1+ i))}, and
@@ -1274,35 +1274,35 @@
As a more Emacs-specific example of @code{incf}, the expression
@code{(incf (point) @var{n})} is essentially equivalent to
@code{(forward-char @var{n})}.
-@end defspec
-
-@defspec decf place &optional x
+@end deffn
+
+@deffn {Special Operator} decf place &optional x
This macro decrements the number stored in @var{place} by one, or
by @var{x} if specified.
-@end defspec
-
-@defspec pop place
+@end deffn
+
+@deffn {Special Operator} pop place
This macro removes and returns the first element of the list stored
in @var{place}. It is analogous to @code{(prog1 (car @var{place})
(setf @var{place} (cdr @var{place})))}, except that it takes care
to evaluate all subforms only once.
-@end defspec
-
-@defspec push x place
+@end deffn
+
+@deffn {Special Operator} push x place
This macro inserts @var{x} at the front of the list stored in
@var{place}. It is analogous to @code{(setf @var{place} (cons
@var{x} @var{place}))}, except for evaluation of the subforms.
-@end defspec
-
-@defspec pushnew x place @t{&key :test :test-not :key}
+@end deffn
+
+@deffn {Special Operator} pushnew x place @t{&key :test :test-not :key}
This macro inserts @var{x} at the front of the list stored in
@var{place}, but only if @var{x} was not @code{eql} to any
existing element of the list. The optional keyword arguments
are interpreted in the same way as for @code{adjoin}.
@xref{Lists as Sets}.
-@end defspec
-
-@defspec shiftf place@dots{} newvalue
+@end deffn
+
+@deffn {Special Operator} shiftf place@dots{} newvalue
This macro shifts the @var{place}s left by one, shifting in the
value of @var{newvalue} (which may be any Lisp expression, not just
a generalized variable), and returning the value shifted out of
@@ -1320,9 +1320,9 @@
@noindent
except that the subforms of @var{a}, @var{b}, and @var{c} are actually
evaluated only once each and in the apparent order.
-@end defspec
-
-@defspec rotatef place@dots{}
+@end deffn
+
+@deffn {Special Operator} rotatef place@dots{}
This macro rotates the @var{place}s left by one in circular fashion.
Thus, @code{(rotatef @var{a} @var{b} @var{c} @var{d})} is equivalent to
@@ -1337,12 +1337,12 @@
except for the evaluation of subforms. @code{rotatef} always
returns @code{nil}. Note that @code{(rotatef @var{a} @var{b})}
conveniently exchanges @var{a} and @var{b}.
-@end defspec
+@end deffn
The following macros were invented for this package; they have no
analogues in Common Lisp.
-@defspec letf (bindings@dots{}) forms@dots{}
+@deffn {Special Operator} letf (bindings@dots{}) forms@dots{}
This macro is analogous to @code{let}, but for generalized variables
rather than just symbols. Each @var{binding} should be of the form
@code{(@var{place} @var{value})}; the original contents of the
@@ -1392,14 +1392,14 @@
variables and calls to @code{symbol-value} and @code{symbol-function}.
If the symbol is not bound on entry, it is simply made unbound by
@code{makunbound} or @code{fmakunbound} on exit.
-@end defspec
-
-@defspec letf* (bindings@dots{}) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} letf* (bindings@dots{}) forms@dots{}
This macro is to @code{letf} what @code{let*} is to @code{let}:
It does the bindings in sequential rather than parallel order.
-@end defspec
-
-@defspec callf @var{function} @var{place} @var{args}@dots{}
+@end deffn
+
+@deffn {Special Operator} callf @var{function} @var{place} @var{args}@dots{}
This is the ``generic'' modify macro. It calls @var{function},
which should be an unquoted function name, macro name, or lambda.
It passes @var{place} and @var{args} as arguments, and assigns the
@@ -1416,14 +1416,14 @@
@xref{Customizing Setf}, for @code{define-modify-macro}, a way
to create even more concise notations for modify macros. Note
again that @code{callf} is an extension to standard Common Lisp.
-@end defspec
-
-@defspec callf2 @var{function} @var{arg1} @var{place} @var{args}@dots{}
+@end deffn
+
+@deffn {Special Operator} callf2 @var{function} @var{arg1} @var{place} @var{args}@dots{}
This macro is like @code{callf}, except that @var{place} is
the @emph{second} argument of @var{function} rather than the
first. For example, @code{(push @var{x} @var{place})} is
equivalent to @code{(callf2 cons @var{x} @var{place})}.
-@end defspec
+@end deffn
The @code{callf} and @code{callf2} macros serve as building
blocks for other macros like @code{incf}, @code{pushnew}, and
@@ -1439,7 +1439,7 @@
@code{defsetf}, and @code{define-setf-method}, that allow the
user to extend generalized variables in various ways.
-@defspec define-modify-macro name arglist function [doc-string]
+@deffn {Special Operator} define-modify-macro name arglist function [doc-string]
This macro defines a ``read-modify-write'' macro similar to
@code{incf} and @code{decf}. The macro @var{name} is defined
to take a @var{place} argument followed by additional arguments
@@ -1480,9 +1480,9 @@
using @code{get-setf-method}, or consult the source file
@file{cl-macs.el} to see how to use the internal @code{setf}
building blocks.
-@end defspec
-
-@defspec defsetf access-fn update-fn
+@end deffn
+
+@deffn {Special Operator} defsetf access-fn update-fn
This is the simpler of two @code{defsetf} forms. Where
@var{access-fn} is the name of a function which accesses a place,
this declares @var{update-fn} to be the corresponding store
@@ -1525,9 +1525,9 @@
(defsetf symbol-value set)
(defsetf buffer-name rename-buffer t)
@end example
-@end defspec
-
-@defspec defsetf access-fn arglist (store-var) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} defsetf access-fn arglist (store-var) forms@dots{}
This is the second, more complex, form of @code{defsetf}. It is
rather like @code{defmacro} except for the additional @var{store-var}
argument. The @var{forms} should return a Lisp form which stores
@@ -1556,9 +1556,9 @@
(defsetf nth (n x) (store)
(list 'setcar (list 'nthcdr n x) store))
@end example
-@end defspec
-
-@defspec define-setf-method access-fn arglist forms@dots{}
+@end deffn
+
+@deffn {Special Operator} define-setf-method access-fn arglist forms@dots{}
This is the most general way to create new place forms. When
a @code{setf} to @var{access-fn} with arguments described by
@var{arglist} is expanded, the @var{forms} are evaluated and
@@ -1603,7 +1603,7 @@
use this setf-method will optimize away most temporaries that
turn out to be unnecessary, so there is little reason for the
setf-method itself to optimize.
-@end defspec
+@end deffn
@defun get-setf-method place &optional env
This function returns the setf-method for @var{place}, by
@@ -1669,7 +1669,7 @@
at compile-time. The @code{progv} form provides an easy way to
bind variables whose names are computed at run-time.
-@defspec progv symbols values forms@dots{}
+@deffn {Special Operator} progv symbols values forms@dots{}
This form establishes @code{let}-style variable bindings on a
set of variables computed at run-time. The expressions
@var{symbols} and @var{values} are evaluated, and must return lists
@@ -1679,7 +1679,7 @@
are made unbound (as if by @code{makunbound}) inside the body.
If @var{symbols} is shorter than @var{values}, the excess values
are ignored.
-@end defspec
+@end deffn
@node Lexical Bindings, Function Bindings, Dynamic Bindings, Variable Bindings
@subsection Lexical Bindings
@@ -1688,7 +1688,7 @@
The @dfn{CL} package defines the following macro which
more closely follows the Common Lisp @code{let} form:
-@defspec lexical-let (bindings@dots{}) forms@dots{}
+@deffn {Special Operator} lexical-let (bindings@dots{}) forms@dots{}
This form is exactly like @code{let} except that the bindings it
establishes are purely lexical. Lexical bindings are similar to
local variables in a language like C: Only the code physically
@@ -1788,12 +1788,12 @@
The @code{lexical-let} form is an extension to Common Lisp. In
true Common Lisp, all bindings are lexical unless declared otherwise.
-@end defspec
-
-@defspec lexical-let* (bindings@dots{}) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} lexical-let* (bindings@dots{}) forms@dots{}
This form is just like @code{lexical-let}, except that the bindings
are made sequentially in the manner of @code{let*}.
-@end defspec
+@end deffn
@node Function Bindings, Macro Bindings, Lexical Bindings, Variable Bindings
@subsection Function Bindings
@@ -1802,7 +1802,7 @@
These forms make @code{let}-like bindings to functions instead
of variables.
-@defspec flet (bindings@dots{}) forms@dots{}
+@deffn {Special Operator} flet (bindings@dots{}) forms@dots{}
This form establishes @code{let}-style bindings on the function
cells of symbols rather than on the value cells. Each @var{binding}
must be a list of the form @samp{(@var{name} @var{arglist}
@@ -1841,14 +1841,14 @@
argument notation supported by @code{defun*}; also, the function
body is enclosed in an implicit block as if by @code{defun*}.
@xref{Program Structure}.
-@end defspec
-
-@defspec labels (bindings@dots{}) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} labels (bindings@dots{}) forms@dots{}
The @code{labels} form is a synonym for @code{flet}. (In Common
Lisp, @code{labels} and @code{flet} differ in ways that depend on
their lexical scoping; these distinctions vanish in dynamically
scoped Emacs Lisp.)
-@end defspec
+@end deffn
@node Macro Bindings, , Function Bindings, Variable Bindings
@subsection Macro Bindings
@@ -1856,7 +1856,7 @@
@noindent
These forms create local macros and ``symbol macros.''
-@defspec macrolet (bindings@dots{}) forms@dots{}
+@deffn {Special Operator} macrolet (bindings@dots{}) forms@dots{}
This form is analogous to @code{flet}, but for macros instead of
functions. Each @var{binding} is a list of the same form as the
arguments to @code{defmacro*} (i.e., a macro name, argument list,
@@ -1868,9 +1868,9 @@
affect only calls that appear physically within the body
@var{forms}, possibly after expansion of other macros in the
body.
-@end defspec
-
-@defspec symbol-macrolet (bindings@dots{}) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} symbol-macrolet (bindings@dots{}) forms@dots{}
This form creates @dfn{symbol macros}, which are macros that look
like variable references rather than function calls. Each
@var{binding} is a list @samp{(@var{var} @var{expansion})};
@@ -1935,7 +1935,7 @@
@xref{Loop Facility}, for a description of the @code{loop} macro.
This package defines a nonstandard @code{in-ref} loop clause that
works much like @code{my-dolist}.
-@end defspec
+@end deffn
@node Conditionals, Blocks and Exits, Variable Bindings, Control Structure
@section Conditionals
@@ -1944,7 +1944,7 @@
These conditional forms augment Emacs Lisp's simple @code{if},
@code{and}, @code{or}, and @code{cond} forms.
-@defspec when test forms@dots{}
+@deffn {Special Operator} when test forms@dots{}
This is a variant of @code{if} where there are no ``else'' forms,
and possibly several ``then'' forms. In particular,
@@ -1958,9 +1958,9 @@
@example
(if @var{test} (progn @var{a} @var{b} @var{c}) nil)
@end example
-@end defspec
-
-@defspec unless test forms@dots{}
+@end deffn
+
+@deffn {Special Operator} unless test forms@dots{}
This is a variant of @code{if} where there are no ``then'' forms,
and possibly several ``else'' forms:
@@ -1974,9 +1974,9 @@
@example
(when (not @var{test}) @var{a} @var{b} @var{c})
@end example
-@end defspec
-
-@defspec case keyform clause@dots{}
+@end deffn
+
+@deffn {Special Operator} case keyform clause@dots{}
This macro evaluates @var{keyform}, then compares it with the key
values listed in the various @var{clause}s. Whichever clause matches
the key is executed; comparison is done by @code{eql}. If no clause
@@ -2010,15 +2010,15 @@
((?\r ?\n) (do-ret-thing))
(t (do-other-thing)))
@end example
-@end defspec
-
-@defspec ecase keyform clause@dots{}
+@end deffn
+
+@deffn {Special Operator} ecase keyform clause@dots{}
This macro is just like @code{case}, except that if the key does
not match any of the clauses, an error is signalled rather than
simply returning @code{nil}.
-@end defspec
-
-@defspec typecase keyform clause@dots{}
+@end deffn
+
+@deffn {Special Operator} typecase keyform clause@dots{}
This macro is a version of @code{case} that checks for types
rather than values. Each @var{clause} is of the form
@samp{(@var{type} @var{body}...)}. @xref{Type Predicates},
@@ -2035,13 +2035,13 @@
The type specifier @code{t} matches any type of object; the word
@code{otherwise} is also allowed. To make one clause match any of
several types, use an @code{(or ...)} type specifier.
-@end defspec
-
-@defspec etypecase keyform clause@dots{}
+@end deffn
+
+@deffn {Special Operator} etypecase keyform clause@dots{}
This macro is just like @code{typecase}, except that if the key does
not match any of the clauses, an error is signalled rather than
simply returning @code{nil}.
-@end defspec
+@end deffn
@node Blocks and Exits, Iteration, Conditionals, Control Structure
@section Blocks and Exits
@@ -2054,7 +2054,7 @@
optimizing byte-compiler to omit the costly @code{catch} step if the
body of the block does not actually @code{return-from} the block.
-@defspec block name forms@dots{}
+@deffn {Special Operator} block name forms@dots{}
The @var{forms} are evaluated as if by a @code{progn}. However,
if any of the @var{forms} execute @code{(return-from @var{name})},
they will jump out and return directly from the @code{block} form.
@@ -2093,20 +2093,20 @@
that jump to it. This means that @code{do} loops and @code{defun*}
functions which don't use @code{return} don't pay the overhead to
support it.
-@end defspec
-
-@defspec return-from name [result]
+@end deffn
+
+@deffn {Special Operator} return-from name [result]
This macro returns from the block named @var{name}, which must be
an (unevaluated) symbol. If a @var{result} form is specified, it
is evaluated to produce the result returned from the @code{block}.
Otherwise, @code{nil} is returned.
-@end defspec
-
-@defspec return [result]
+@end deffn
+
+@deffn {Special Operator} return [result]
This macro is exactly like @code{(return-from nil @var{result})}.
Common Lisp loops like @code{do} and @code{dolist} implicitly enclose
themselves in @code{nil} blocks.
-@end defspec
+@end deffn
@node Iteration, Loop Facility, Blocks and Exits, Control Structure
@section Iteration
@@ -2116,7 +2116,7 @@
looping constructs to complement Emacs Lisp's basic @code{while}
loop.
-@defspec loop forms@dots{}
+@deffn {Special Operator} loop forms@dots{}
The @dfn{CL} package supports both the simple, old-style meaning of
@code{loop} and the extremely powerful and flexible feature known as
the @dfn{Loop Facility} or @dfn{Loop Macro}. This more advanced
@@ -2144,9 +2144,9 @@
(This is not a restriction in practice, since a plain symbol
in the above notation would simply access and throw away the
value of a variable.)
-@end defspec
-
-@defspec do (spec@dots{}) (end-test [result@dots{}]) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} do (spec@dots{}) (end-test [result@dots{}]) forms@dots{}
This macro creates a general iterative loop. Each @var{spec} is
of the form
@@ -2192,9 +2192,9 @@
((or (null x) (null y))
(nreverse z)))
@end example
-@end defspec
-
-@defspec do* (spec@dots{}) (end-test [result@dots{}]) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} do* (spec@dots{}) (end-test [result@dots{}]) forms@dots{}
This is to @code{do} what @code{let*} is to @code{let}. In
particular, the initial values are bound as if by @code{let*}
rather than @code{let}, and the steps are assigned as if by
@@ -2212,18 +2212,18 @@
(nreverse z))
(push (f x y) z))
@end example
-@end defspec
-
-@defspec dolist (var list [result]) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} dolist (var list [result]) forms@dots{}
This is a more specialized loop which iterates across the elements
of a list. @var{list} should evaluate to a list; the body @var{forms}
are executed with @var{var} bound to each element of the list in
turn. Finally, the @var{result} form (or @code{nil}) is evaluated
with @var{var} bound to @code{nil} to produce the result returned by
the loop. The loop is surrounded by an implicit @code{nil} block.
-@end defspec
-
-@defspec dotimes (var count [result]) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} dotimes (var count [result]) forms@dots{}
This is a more specialized loop which iterates a specified number
of times. The body is executed with @var{var} bound to the integers
from zero (inclusive) to @var{count} (exclusive), in turn. Then
@@ -2231,9 +2231,9 @@
number of iterations that were done (i.e., @code{(max 0 @var{count})})
to get the return value for the loop form. The loop is surrounded
by an implicit @code{nil} block.
-@end defspec
-
-@defspec do-symbols (var [obarray [result]]) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} do-symbols (var [obarray [result]]) forms@dots{}
This loop iterates over all interned symbols. If @var{obarray}
is specified and is not @code{nil}, it loops over all symbols in
that obarray. For each symbol, the body @var{forms} are evaluated
@@ -2241,12 +2241,12 @@
an unspecified order. Afterward the @var{result} form, if any,
is evaluated (with @var{var} bound to @code{nil}) to get the return
value. The loop is surrounded by an implicit @code{nil} block.
-@end defspec
-
-@defspec do-all-symbols (var [result]) forms@dots{}
+@end deffn
+
+@deffn {Special Operator} do-all-symbols (var [result]) forms@dots{}
This is identical to @code{do-symbols} except that the @var{obarray}
argument is omitted; it always iterates over the default obarray.
-@end defspec
+@end deffn
@xref{Mapping over Sequences}, for some more functions for
iterating over vectors or lists.
@@ -2286,7 +2286,7 @@
takes place at byte-compile time; compiled @code{loop}s are just
as efficient as the equivalent @code{while} loops written longhand.
-@defspec loop clauses@dots{}
+@deffn {Special Operator} loop clauses@dots{}
A loop construct consists of a series of @var{clause}s, each
introduced by a symbol like @code{for} or @code{do}. Clauses
are simply strung together in the argument list of @code{loop},
@@ -2325,7 +2325,7 @@
(Because the loop body is enclosed in an implicit block, you can
also use regular Lisp @code{return} or @code{return-from} to
break out of the loop.)
-@end defspec
+@end deffn
The following sections give some examples of the Loop Macro in
action, and describe the particular loop clauses in great detail.
@@ -3003,7 +3003,7 @@
Destructuring is made available to the user by way of the
following macro:
-@defspec destructuring-bind arglist expr forms@dots{}
+@deffn {Special Operator} destructuring-bind arglist expr forms@dots{}
This macro expands to code which executes @var{forms}, with
the variables in @var{arglist} bound to the list of values
returned by @var{expr}. The @var{arglist} can include all
@@ -3012,13 +3012,13 @@
is not allowed.) The macro expansion will signal an error
if @var{expr} returns a list of the wrong number of arguments
or with incorrect keyword arguments.
-@end defspec
+@end deffn
This package also includes the Common Lisp @code{define-compiler-macro}
facility, which allows you to define compile-time expansions and
optimizations for your functions.
-@defspec define-compiler-macro name arglist forms@dots{}
+@deffn {Special Operator} define-compiler-macro name arglist forms@dots{}
This form is similar to @code{defmacro}, except that it only expands
calls to @var{name} at compile-time; calls processed by the Lisp
interpreter are not expanded, nor are they expanded by the
@@ -3052,7 +3052,7 @@
@code{member*} call is left intact. (The actual compiler macro
for @code{member*} optimizes a number of other cases, including
common @code{:test} predicates.)
-@end defspec
+@end deffn
@defun compiler-macroexpand form
This function is analogous to @code{macroexpand}, except that it
@@ -3094,7 +3094,7 @@
is evaluated and thus should normally be quoted.
@end defun
-@defspec declaim decl-specs@dots{}
+@deffn {Special Operator} declaim decl-specs@dots{}
This macro is like @code{proclaim}, except that it takes any number
of @var{decl-spec} arguments, and the arguments are unevaluated and
unquoted. The @code{declaim} macro also puts an @code{(eval-when
@@ -3103,22 +3103,22 @@
since normally the declarations are meant to influence the way the
compiler treats the rest of the file that contains the @code{declaim}
form.)
-@end defspec
-
-@defspec declare decl-specs@dots{}
+@end deffn
+
+@deffn {Special Operator} declare decl-specs@dots{}
This macro is used to make declarations within functions and other
code. Common Lisp allows declarations in various locations, generally
at the beginning of any of the many ``implicit @code{progn}s''
throughout Lisp syntax, such as function bodies, @code{let} bodies,
etc. Currently the only declaration understood by @code{declare}
is @code{special}.
-@end defspec
-
-@defspec locally declarations@dots{} forms@dots{}
+@end deffn
+
+@deffn {Special Operator} locally declarations@dots{} forms@dots{}
In this package, @code{locally} is no different from @code{progn}.
-@end defspec
-
-@defspec the type form
+@end deffn
+
+@deffn {Special Operator} the type form
Type information provided by @code{the} is ignored in this package;
in other words, @code{(the @var{type} @var{form})} is equivalent
to @var{form}. Future versions of the optimizing byte-compiler may
@@ -3131,7 +3131,7 @@
compiler would have enough information to expand the loop in-line.
For now, Emacs Lisp will treat the above code as exactly equivalent
to @code{(mapcar 'car foo)}.
-@end defspec
+@end deffn
Each @var{decl-spec} in a @code{proclaim}, @code{declaim}, or
@code{declare} should be a list beginning with a symbol that says
@@ -3313,7 +3313,7 @@
expression.
@end defun
-@defspec remf place property
+@deffn {Special Operator} remf place property
This macro removes the property-value pair for @var{property} from
the property list stored at @var{place}, which is any @code{setf}-able
place expression. It returns true if the property was found. Note
@@ -3321,7 +3321,7 @@
effectively do a @code{(setf @var{place} (cddr @var{place}))},
whereas if it occurs later, this simply uses @code{setcdr} to splice
out the property and value cells.
-@end defspec
+@end deffn
@iftex
@secno=2
@@ -4677,7 +4677,7 @@
implements structures as vectors (or lists upon request) with a
special ``tag'' symbol to identify them.
-@defspec defstruct name slots@dots{}
+@deffn {Special Operator} defstruct name slots@dots{}
The @code{defstruct} form defines a new structure type called
@var{name}, with the specified @var{slots}. (The @var{slots}
may begin with a string which documents the structure type.)
@@ -4984,7 +4984,7 @@
specifies a number of slots to be skipped between the last slot
of the included type and the first new slot.
@end table
-@end defspec
+@end deffn
Except as noted, the @code{defstruct} facility of this package is
entirely compatible with that of Common Lisp.
@@ -5007,7 +5007,7 @@
away the following assertions. Because assertions might be optimized
away, it is a bad idea for them to include side-effects.
-@defspec assert test-form [show-args string args@dots{}]
+@deffn {Special Operator} assert test-form [show-args string args@dots{}]
This form verifies that @var{test-form} is true (i.e., evaluates to
a non-@code{nil} value). If so, it returns @code{nil}. If the test
is not satisfied, @code{assert} signals an error.
@@ -5030,9 +5030,9 @@
true Common Lisp, the second argument gives a list of @var{places}
which can be @code{setf}'d by the user before continuing from the
error.
-@end defspec
-
-@defspec check-type place type &optional string
+@end deffn
+
+@deffn {Special Operator} check-type place type &optional string
This form verifies that @var{place} evaluates to a value of type
@var{type}. If so, it returns @code{nil}. If not, @code{check-type}
signals a continuable @code{wrong-type-argument} error. The default
@@ -5051,18 +5051,18 @@
should be a @var{place} suitable for use by @code{setf}, because
@code{check-type} signals a continuable error that allows the user to
modify @var{place}, most simply by returning a value from the debugger.
-@end defspec
+@end deffn
The following error-related macro is also defined:
-@defspec ignore-errors forms@dots{}
+@deffn {Special Operator} ignore-errors forms@dots{}
This executes @var{forms} exactly like a @code{progn}, except that
errors are ignored during the @var{forms}. More precisely, if
an error is signalled then @code{ignore-errors} immediately
aborts execution of the @var{forms} and returns @code{nil}.
If the @var{forms} complete successfully, @code{ignore-errors}
returns the result of the last @var{form}.
-@end defspec
+@end deffn
@node Efficiency Concerns, Common Lisp Compatibility, Assertions, Top
@appendix Efficiency Concerns
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/commands.texi
--- a/man/lispref/commands.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/commands.texi Tue Mar 01 14:18:45 2011 +0000
@@ -120,7 +120,7 @@
This section describes how to write the @code{interactive} form that
makes a Lisp function an interactively-callable command.
-@defspec interactive arg-descriptor
+@deffn {Special Operator} interactive arg-descriptor
@cindex argument descriptors
This special operator declares that the function in which it appears is a
command, and that it may therefore be called interactively (via
@@ -139,7 +139,7 @@
@code{interactive} form are executed, but at this time
@code{interactive} simply returns @code{nil} without even evaluating its
argument.
-@end defspec
+@end deffn
There are three possibilities for the argument @var{arg-descriptor}:
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/compile.texi
--- a/man/lispref/compile.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/compile.texi Tue Mar 01 14:18:45 2011 +0000
@@ -691,7 +691,7 @@
These features permit you to write code to be evaluated during
compilation of a program.
-@defspec eval-and-compile body
+@deffn {Special Operator} eval-and-compile body
This form marks @var{body} to be evaluated both when you compile the
containing code and when you run it (whether compiled or not).
@@ -699,9 +699,9 @@
and referring to that file with @code{require}. Using @code{require} is
preferable if there is a substantial amount of code to be executed in
this way.
-@end defspec
+@end deffn
-@defspec eval-when-compile body
+@deffn {Special Operator} eval-when-compile body
This form marks @var{body} to be evaluated at compile time and not when
the compiled program is loaded. The result of evaluation by the
compiler becomes a constant which appears in the compiled program. When
@@ -712,7 +712,7 @@
@code{(eval-when (compile eval) @dots{})}. Elsewhere, the Common Lisp
@samp{#.} reader macro (but not when interpreting) is closer to what
@code{eval-when-compile} does.
-@end defspec
+@end deffn
@node Compiled-Function Objects
@section Compiled-Function Objects
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/control.texi
--- a/man/lispref/control.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/control.texi Tue Mar 01 14:18:45 2011 +0000
@@ -76,7 +76,7 @@
needed now most often inside an @code{unwind-protect}, @code{and},
@code{or}, or in the @var{then}-part of an @code{if}.
-@defspec progn forms@dots{}
+@deffn {Special Operator} progn forms@dots{}
This special operator evaluates all of the @var{forms}, in textual
order, returning the result of the final form.
@@ -91,12 +91,12 @@
@result{} "The third form"
@end group
@end example
-@end defspec
+@end deffn
Two other control constructs likewise evaluate a series of forms but return
a different value:
-@defspec prog1 form1 forms@dots{}
+@deffn {Special Operator} prog1 form1 forms@dots{}
This special operator evaluates @var{form1} and all of the @var{forms}, in
textual order, returning the result of @var{form1}.
@@ -118,9 +118,9 @@
@example
(prog1 (car x) (setq x (cdr x)))
@end example
-@end defspec
+@end deffn
-@defspec prog2 form1 form2 forms@dots{}
+@deffn {Special Operator} prog2 form1 form2 forms@dots{}
This special operator evaluates @var{form1}, @var{form2}, and all of the
following @var{forms}, in textual order, returning the result of
@var{form2}.
@@ -136,7 +136,7 @@
@result{} "The second form"
@end group
@end example
-@end defspec
+@end deffn
@node Conditionals
@section Conditionals
@@ -146,7 +146,7 @@
has two conditional forms: @code{if}, which is much the same as in other
languages, and @code{cond}, which is a generalized case statement.
-@defspec if condition then-form else-forms@dots{}
+@deffn {Special Operator} if condition then-form else-forms@dots{}
@code{if} chooses between the @var{then-form} and the @var{else-forms}
based on the value of @var{condition}. If the evaluated @var{condition} is
non-@code{nil}, @var{then-form} is evaluated and the result returned.
@@ -169,9 +169,9 @@
@result{} very-false
@end group
@end example
-@end defspec
+@end deffn
-@defspec cond clause@dots{}
+@deffn {Special Operator} cond clause@dots{}
@code{cond} chooses among an arbitrary number of alternatives. Each
@var{clause} in the @code{cond} must be a list. The @sc{car} of this
list is the @var{condition}; the remaining elements, if any, the
@@ -239,7 +239,7 @@
@noindent
This expression is a @code{cond} which returns @code{foo} if the value
of @code{a} is 1, and returns the string @code{"default"} otherwise.
-@end defspec
+@end deffn
Any conditional construct can be expressed with @code{cond} or with
@code{if}. Therefore, the choice between them is a matter of style.
@@ -268,7 +268,7 @@
using the name @code{null} if you are testing for an empty list.
@end defun
-@defspec and conditions@dots{}
+@deffn {Special Operator} and conditions@dots{}
The @code{and} special operator tests whether all the @var{conditions} are
true. It works by evaluating the @var{conditions} one by one in the
order written.
@@ -320,9 +320,9 @@
(cond (@var{arg1} (cond (@var{arg2} @var{arg3}))))
@end group
@end example
-@end defspec
+@end deffn
-@defspec or conditions@dots{}
+@deffn {Special Operator} or conditions@dots{}
The @code{or} special operator tests whether at least one of the
@var{conditions} is true. It works by evaluating all the
@var{conditions} one by one in the order written.
@@ -369,7 +369,7 @@
This is not completely equivalent because it can evaluate @var{arg1} or
@var{arg2} twice. By contrast, @code{(or @var{arg1} @var{arg2}
@var{arg3})} never evaluates any argument more than once.
-@end defspec
+@end deffn
@node Iteration
@section Iteration
@@ -381,7 +381,7 @@
of a list, or once for each integer from 0 to @var{n}. You can do this
in XEmacs Lisp with the special operator @code{while}:
-@defspec while condition forms@dots{}
+@deffn {Special Operator} while condition forms@dots{}
@code{while} first evaluates @var{condition}. If the result is
non-@code{nil}, it evaluates @var{forms} in textual order. Then it
reevaluates @var{condition}, and if the result is non-@code{nil}, it
@@ -427,7 +427,7 @@
This moves forward one line and continues moving by lines until it
reaches an empty. It is unusual in that the @code{while} has no body,
just the end test (which also does the real work of moving point).
-@end defspec
+@end deffn
@node Nonlocal Exits
@section Nonlocal Exits
@@ -499,15 +499,7 @@
@code{throw} can be used in commands such as @code{exit-recursive-edit}
that throw back to the editor command loop (@pxref{Recursive Editing}).
-@cindex CL note---only @code{throw} in Emacs
-@quotation
-@b{Common Lisp note:} Most other versions of Lisp, including Common Lisp,
-have several ways of transferring control nonsequentially: @code{return},
-@code{return-from}, and @code{go}, for example. XEmacs Lisp has only
-@code{throw}.
-@end quotation
-
-@defspec catch tag body@dots{}
+@deffn {Special Operator} catch tag body@dots{}
@cindex tag on run time stack
@code{catch} establishes a return point for the @code{throw} function. The
return point is distinguished from other such return points by @var{tag},
@@ -522,7 +514,7 @@
If a @code{throw} is done within @var{body} specifying the same value
@var{tag}, the @code{catch} exits immediately; the value it returns is
whatever was specified as the second argument of @code{throw}.
-@end defspec
+@end deffn
@defun throw tag value
The purpose of @code{throw} is to return from a return point previously
@@ -1028,7 +1020,7 @@
by an error handler (though using @code{throw} when there is no suitable
@code{catch} signals an error that can be handled).
-@defspec condition-case var protected-form handlers@dots{}
+@deffn {Special Operator} condition-case var protected-form handlers@dots{}
This special operator establishes the error handlers @var{handlers} around
the execution of @var{protected-form}. If @var{protected-form} executes
without error, the value it returns becomes the value of the
@@ -1077,7 +1069,7 @@
If @var{var} is @code{nil}, that means no variable is bound. Then the
error symbol and associated data are not available to the handler.
-@end defspec
+@end deffn
@cindex @code{arith-error} example
Here is an example of using @code{condition-case} to handle the error
@@ -1252,7 +1244,7 @@
temporarily put a data structure in an inconsistent state; it permits
you to ensure the data are consistent in the event of an error or throw.
-@defspec unwind-protect body cleanup-forms@dots{}
+@deffn {Special Operator} unwind-protect body cleanup-forms@dots{}
@cindex cleanup forms
@cindex protected forms
@cindex error cleanup
@@ -1278,7 +1270,7 @@
The number of currently active @code{unwind-protect} forms counts,
together with the number of local variable bindings, against the limit
@code{max-specpdl-size} (@pxref{Local Variables}).
-@end defspec
+@end deffn
For example, here we make an invisible buffer for temporary use, and
make sure to kill it before finishing:
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/display.texi
--- a/man/lispref/display.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/display.texi Tue Mar 01 14:18:45 2011 +0000
@@ -720,7 +720,7 @@
and then present it to the user for perusal rather than for editing.
Many of the help commands use this feature.
-@defspec with-output-to-temp-buffer buffer-name forms@dots{}
+@deffn {Special Operator} with-output-to-temp-buffer buffer-name forms@dots{}
This function executes @var{forms} while arranging to insert any
output they print into the buffer named @var{buffer-name}. The buffer
is then shown in some window for viewing, displayed but not selected.
@@ -760,7 +760,7 @@
---------- Buffer: foo ----------
@end group
@end example
-@end defspec
+@end deffn
@defvar temp-buffer-show-function
If this variable is non-@code{nil}, @code{with-output-to-temp-buffer}
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/eval.texi
--- a/man/lispref/eval.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/eval.texi Tue Mar 01 14:18:45 2011 +0000
@@ -663,9 +663,9 @@
not necessary to quote self-evaluating objects such as numbers, strings,
and vectors.)
-@defspec quote object
+@deffn {Special Operator} quote object
This special operator returns @var{object}, without evaluating it.
-@end defspec
+@end deffn
@cindex @samp{'} for quoting
@cindex quoting using apostrophe
@@ -743,48 +743,48 @@
values.
@end defun
-@defspec multiple-value-bind (var@dots{}) values-form forms@dots{}
+@deffn {Special Operator} multiple-value-bind (var@dots{}) values-form forms@dots{}
This special operator evaluates @var{values-form}, which may return
multiple values. It then binds the @var{var}s to these respective values,
as if by @code{let}, and then executes the body @var{forms}.
If there are more @var{var}s than values, the extra @var{var}s
are bound to @code{nil}. If there are fewer @var{var}s than
values, the excess values are ignored.
-@end defspec
+@end deffn
-@defspec multiple-value-setq (var@dots{}) form
+@deffn {Special Operator} multiple-value-setq (var@dots{}) form
This special operator evaluates @var{form}, which may return multiple
values. It then sets the @var{var}s to these respective values, as if by
@code{setq}. Extra @var{var}s or values are treated the same as
in @code{multiple-value-bind}.
-@end defspec
+@end deffn
-@defspec multiple-value-call function forms@dots{}
+@deffn {Special Operator} multiple-value-call function forms@dots{}
This special operator evaluates function, discarding any multiple
values. It then evaluates @var{forms}, preserving any multiple values,
and calls @var{function} as a function with the results. Conceptually, this
function is a version of @code{apply'}that by-passes the multiple values
infrastructure, treating multiple values as intercalated lists.
-@end defspec
+@end deffn
-@defspec multiple-value-list form
+@deffn {Special Operator} multiple-value-list form
This special operator evaluates @var{form} and returns a list of the
multiple values given by it.
-@end defspec
+@end deffn
-@defspec multiple-value-prog1 first body@dots{}
+@deffn {Special Operator} multiple-value-prog1 first body@dots{}
This special operator evaluates the form @var{first}, then the
forms @var{body}. It returns the value given by @var{first}, preserving
any multiple values. This is identical to @code{prog1}, except that
@code{prog1} always discards multiple values.
-@end defspec
+@end deffn
-@defspec nth-value n form
+@deffn {Special Operator} nth-value n form
This special operator evaluates @var{form} and returns the @var{n}th
value it gave. @var{n} must be an integer of value zero or more.
If @var{form} gave insufficient multiple values, @code{nth-value}
returns @code{nil}.
-@end defspec
+@end deffn
@defvar multiple-values-limit
This constant describes the exclusive upper bound on the number of
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/frames.texi
--- a/man/lispref/frames.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/frames.texi Tue Mar 01 14:18:45 2011 +0000
@@ -785,18 +785,18 @@
@code{focus-follows-mouse}.
@end defun
-@defspec save-selected-frame forms@dots{}
+@deffn {Special Operator} save-selected-frame forms@dots{}
This special operator records the selected frame, executes @var{forms} in
sequence, then restores the earlier selected frame. The value returned
is the value of the last form.
-@end defspec
+@end deffn
-@defspec with-selected-frame frame forms@dots{}
+@deffn {Special Operator} with-selected-frame frame forms@dots{}
This special operator records the selected frame, then selects @var{frame}
and executes @var{forms} in sequence. After the last form is finished,
the earlier selected frame is restored. The value returned is the value
of the last form.
-@end defspec
+@end deffn
@ignore (FSF Emacs, continued from defun select-frame)
XEmacs cooperates with the X server and the window managers by arranging
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/functions.texi
--- a/man/lispref/functions.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/functions.texi Tue Mar 01 14:18:45 2011 +0000
@@ -337,8 +337,9 @@
@cindex CL note---default optional arg
@quotation
@b{Common Lisp note:} Common Lisp allows the function to specify what
-default value to use when an optional argument is omitted; XEmacs Lisp
-always uses @code{nil}.
+default value to use when an optional argument is omitted; this is
+available in XEmacs Lisp with the @code{defun*} macro, an alternative to
+@code{defun}.
@end quotation
For example, an argument list that looks like this:
@@ -474,7 +475,7 @@
is called @dfn{defining a function}, and it is done with the
@code{defun} special operator.
-@defspec defun name argument-list body-forms
+@deffn {Special Operator} defun name argument-list body-forms
@code{defun} is the usual way to define new Lisp functions. It
defines the symbol @var{name} as a function that looks like this:
@@ -543,7 +544,7 @@
without any hesitation or notification. Redefining a function already
defined is often done deliberately, and there is no way to distinguish
deliberate redefinition from unintentional redefinition.
-@end defspec
+@end deffn
@defun define-function name definition
@defunx defalias name definition
@@ -833,14 +834,14 @@
In such cases, we usually use the special operator @code{function} instead
of simple quotation to quote the anonymous function.
-@defspec function function-object
+@deffn {Special Operator} function function-object
@cindex function quoting
This special operator returns @var{function-object} without evaluating it.
In this, it is equivalent to @code{quote}. However, it serves as a
note to the XEmacs Lisp compiler that @var{function-object} is intended
to be used only as a function, and therefore can safely be compiled.
Contrast this with @code{quote}, in @ref{Quoting}.
-@end defspec
+@end deffn
Using @code{function} instead of @code{quote} makes a difference
inside a function or macro that you are going to compile. For example:
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/internationalization.texi
--- a/man/lispref/internationalization.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/internationalization.texi Tue Mar 01 14:18:45 2011 +0000
@@ -83,7 +83,7 @@
nothing.
@end defun
-@defspec domain string
+@deffn {Special Operator} domain string
This function specifies the text domain used for translating documentation
strings and interactive prompts of a function. For example, write:
@@ -94,7 +94,7 @@
to specify @code{emacs-foo} as the text domain of the function @code{foo}.
The ``call'' to @code{domain} is actually a declaration rather than a
function; when actually called, @code{domain} just returns @code{nil}.
-@end defspec
+@end deffn
@defun domain-of function
This function returns the text domain of @var{function}; it returns
@@ -145,19 +145,19 @@
For variables and constants which have documentation strings, specify the
domain after the documentation.
-@defspec defvar symbol [value [doc-string [domain]]]
+@deffn {Special Operator} defvar symbol [value [doc-string [domain]]]
Example:
@example
(defvar weight 250 "Weight of gorilla, in pounds." "emacs-gorilla")
@end example
-@end defspec
+@end deffn
-@defspec defconst symbol [value [doc-string [domain]]]
+@deffn {Special Operator} defconst symbol [value [doc-string [domain]]]
Example:
@example
(defconst limbs 4 "Number of limbs" "emacs-gorilla")
@end example
-@end defspec
+@end deffn
@defun autoload function filename &optional docstring interactive type
This function defines @var{function} to autoload from @var{filename}
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/intro.texi
--- a/man/lispref/intro.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/intro.texi Tue Mar 01 14:18:45 2011 +0000
@@ -787,7 +787,7 @@
arguments. Parentheses are used when several arguments are grouped into
additional levels of list structure. Here is an example:
-@defspec count-loop (@var{var} [@var{from} @var{to} [@var{inc}]]) @var{body}@dots{}
+@deffn {Special Operator} count-loop (@var{var} [@var{from} @var{to} [@var{inc}]]) @var{body}@dots{}
This imaginary special operator implements a loop that executes the
@var{body} forms and then increments the variable @var{var} on each
iteration. On the first iteration, the variable has the value
@@ -817,7 +817,7 @@
@var{inc} may optionally be specified as well. These arguments are
grouped with the argument @var{var} into a list, to distinguish them
from @var{body}, which includes all remaining elements of the form.
-@end defspec
+@end deffn
@node A Sample Variable Description
@subsubsection A Sample Variable Description
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/lists.texi
--- a/man/lispref/lists.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/lists.texi Tue Mar 01 14:18:45 2011 +0000
@@ -1271,7 +1271,7 @@
@end example
In the following example, the @code{(4)} that @code{remove*} attempts to match
-and the @code{(4)} in the @code{sample-list} are not @code{eq}:
+and the @code{(4)} in the @code{sample-list} are not @code{eql}:
@example
@group
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/macros.texi
--- a/man/lispref/macros.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/macros.texi Tue Mar 01 14:18:45 2011 +0000
@@ -212,7 +212,7 @@
In practice, almost all Lisp macros have names, and they are usually
defined with the special operator @code{defmacro}.
-@defspec defmacro name argument-list body-forms@dots{}
+@deffn {Special Operator} defmacro name argument-list body-forms@dots{}
@code{defmacro} defines the symbol @var{name} as a macro that looks
like this:
@@ -229,7 +229,7 @@
(@pxref{Argument List}). Macros may have a documentation string, but
any @code{interactive} declaration is ignored since macros cannot be
called interactively.
-@end defspec
+@end deffn
@node Backquote
@section Backquote
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/positions.texi
--- a/man/lispref/positions.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/positions.texi Tue Mar 01 14:18:45 2011 +0000
@@ -766,7 +766,7 @@
described elsewhere (see @ref{Window Configurations} and @pxref{Frame
Configurations}).
-@defspec save-excursion forms@dots{}
+@deffn {Special Operator} save-excursion forms@dots{}
@cindex mark excursion
@cindex point excursion
@cindex current buffer excursion
@@ -810,29 +810,29 @@
(set-marker (mark-marker) old-mark)))
@end group
@end example
-@end defspec
+@end deffn
-@defspec save-current-buffer forms@dots{}
+@deffn {Special Operator} save-current-buffer forms@dots{}
This special operator is similar to @code{save-excursion} but it only
saves and restores the current buffer. Beginning with XEmacs 20.3,
@code{save-current-buffer} is a primitive.
-@end defspec
+@end deffn
-@defspec with-current-buffer buffer forms@dots{}
+@deffn {Special Operator} with-current-buffer buffer forms@dots{}
This macro evaluates @var{forms} with @var{buffer} as the current
buffer. It returns the value of the last form.
-@end defspec
+@end deffn
-@defspec with-temp-file filename forms@dots{}
+@deffn {Special Operator} with-temp-file filename forms@dots{}
This macro creates a new buffer, evaluates @var{forms} there, and
writes the buffer to @var{filename}. It returns the value of the last form
evaluated.
-@end defspec
+@end deffn
-@defspec save-selected-window forms@dots{}
+@deffn {Special Operator} save-selected-window forms@dots{}
This macro is similar to @code{save-excursion} but it saves and
restores the selected window and nothing else.
-@end defspec
+@end deffn
@node Narrowing
@section Narrowing
@@ -893,7 +893,7 @@
@var{buffer} defaults to the current buffer if omitted.
@end deffn
-@defspec save-restriction body@dots{}
+@deffn {Special Operator} save-restriction body@dots{}
This special operator saves the current bounds of the accessible portion,
evaluates the @var{body} forms, and finally restores the saved bounds,
thus restoring the same state of narrowing (or absence thereof) formerly
@@ -972,4 +972,4 @@
---------- Buffer: foo ----------
@end group
@end example
-@end defspec
+@end deffn
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/searching.texi
--- a/man/lispref/searching.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/searching.texi Tue Mar 01 14:18:45 2011 +0000
@@ -1458,10 +1458,10 @@
You can save and restore the match data with @code{save-match-data}:
-@defspec save-match-data body@dots{}
+@deffn {Special Operator} save-match-data body@dots{}
This special operator executes @var{body}, saving and restoring the match
data around it.
-@end defspec
+@end deffn
Emacs automatically saves and restores the match data when it runs
process filter functions (@pxref{Filter Functions}) and process
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/sequences.texi
--- a/man/lispref/sequences.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/sequences.texi Tue Mar 01 14:18:45 2011 +0000
@@ -219,6 +219,44 @@
@code{nth} (@pxref{List Elements}).
@end defun
+@defun fill sequence object @t{&key :start :end}
+This function fills the sequence @var{sequence} with @var{object}, so
+that each element of @var{sequence} between the indices specified by
+@code{:start} (inclusive) and @code{:end} (exclusive), is @var{object}.
+It returns @var{sequence}.
+
+@example
+@group
+(setq a [a b c d e f g])
+ @result{} [a b c d e f g]
+(fill a 0 :end 2)
+ @result{} [0 0 c d e f g]
+(fill a 0)
+ @result{} [0 0 0 0 0 0 0]
+a
+ @result{} [0 0 0 0 0 0 0]
+@end group
+
+@group
+(setq s "When in the course")
+ @result{} "When in the course"
+(fill s ?-)
+ @result{} "------------------"
+@end group
+
+@group
+(setq bv #*1101)
+ @result{} #*1101
+(fill bv 0)
+ @result{} #*0000
+@end group
+@end example
+
+If @var{sequence} is of a type that cannot hold @var{object} (
+bit-vector can only hold the integers one or zero, strings can only hold
+characters) a @code{wrong-type-argument} error results.
+@end defun
+
@node Arrays
@section Arrays
@cindex array
@@ -380,39 +418,6 @@
@result{} 0
bv
@result{} #*1101
-@end group
-@end example
-
-If @var{array} is a string and @var{object} is not a character, a
-@code{wrong-type-argument} error results.
-@end defun
-
-@defun fillarray array object
-This function fills the array @var{array} with @var{object}, so that
-each element of @var{array} is @var{object}. It returns @var{array}.
-
-@example
-@group
-(setq a [a b c d e f g])
- @result{} [a b c d e f g]
-(fillarray a 0)
- @result{} [0 0 0 0 0 0 0]
-a
- @result{} [0 0 0 0 0 0 0]
-@end group
-
-@group
-(setq s "When in the course")
- @result{} "When in the course"
-(fillarray s ?-)
- @result{} "------------------"
-@end group
-
-@group
-(setq bv #*1101)
- @result{} #*1101
-(fillarray bv 0)
- @result{} #*0000
@end group
@end example
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/specifiers.texi
--- a/man/lispref/specifiers.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/specifiers.texi Tue Mar 01 14:18:45 2011 +0000
@@ -875,7 +875,7 @@
@code{add-spec-list-to-specifier}.
@end defun
-@defspec let-specifier specifier-list &rest body
+@deffn {Special Operator} let-specifier specifier-list &rest body
This macro temporarily adds specifications to specifiers,
evaluates forms in @var{body} and restores the specifiers to their
previous states. The specifiers and their temporary specifications are
@@ -912,7 +912,7 @@
(let-specifier ((modeline-shadow-thickness 0 (selected-window)))
(sit-for 1))
@end example
-@end defspec
+@end deffn
@defun set-specifier specifier value &optional locale tag-set how-to-add
This function adds some specifications to @var{specifier}. @var{value}
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/variables.texi
--- a/man/lispref/variables.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/variables.texi Tue Mar 01 14:18:45 2011 +0000
@@ -168,7 +168,7 @@
The special operators @code{let} and @code{let*} exist to create
local bindings.
-@defspec let (bindings@dots{}) forms@dots{}
+@deffn {Special Operator} let (bindings@dots{}) forms@dots{}
This special operator binds variables according to @var{bindings} and then
evaluates all of the @var{forms} in textual order. The @code{let}-form
returns the value of the last form in @var{forms}.
@@ -196,9 +196,9 @@
@result{} (1 2)
@end group
@end example
-@end defspec
+@end deffn
-@defspec let* (bindings@dots{}) forms@dots{}
+@deffn {Special Operator} let* (bindings@dots{}) forms@dots{}
This special operator is like @code{let}, but it binds each variable right
after computing its local value, before computing the local value for
the next variable. Therefore, an expression in @var{bindings} can
@@ -218,7 +218,7 @@
@result{} (1 1)
@end group
@end example
-@end defspec
+@end deffn
Here is a complete list of the other facilities that create local
bindings:
@@ -403,7 +403,7 @@
files, and override the default values given in the definitions. For
this reason, user options must be defined with @code{defvar}.
-@defspec defvar symbol [value [doc-string]]
+@deffn {Special Operator} defvar symbol [value [doc-string]]
This special operator defines @var{symbol} as a value and initializes it.
The definition informs a person reading your code that @var{symbol} is
used as a variable that programs are likely to set or change. It is
@@ -491,9 +491,9 @@
The @code{defvar} form returns @var{symbol}, but it is normally used
at top level in a file where its value does not matter.
-@end defspec
+@end deffn
-@defspec defconst symbol [value [doc-string]]
+@deffn {Special Operator} defconst symbol [value [doc-string]]
This special operator defines @var{symbol} as a value and initializes it.
It informs a person reading your code that @var{symbol} has a global
value, established here, that will not normally be changed or locally
@@ -530,7 +530,7 @@
@result{} 3
@end group
@end example
-@end defspec
+@end deffn
@defun user-variable-p variable
@cindex user option
@@ -615,7 +615,7 @@
form @code{setq}. When you need to compute the choice of variable at
run time, use the function @code{set}.
-@defspec setq [symbol form]@dots{}
+@deffn {Special Operator} setq [symbol form]@dots{}
This special operator is the most common method of changing a variable's
value. Each @var{symbol} is given a new value, which is the result of
evaluating the corresponding @var{form}. The most-local existing
@@ -655,7 +655,7 @@
@result{} 11
@end group
@end example
-@end defspec
+@end deffn
@defun set symbol value
This function sets @var{symbol}'s value to @var{value}, then returns
@@ -1253,7 +1253,7 @@
@code{symbol-value}.
@end defun
-@defspec setq-default symbol value
+@deffn {Special Operator} setq-default symbol value
This sets the default value of @var{symbol} to @var{value}. It does not
evaluate @var{symbol}, but does evaluate @var{value}. The value of the
@code{setq-default} form is @var{value}.
@@ -1314,7 +1314,7 @@
@result{} another-default
@end group
@end example
-@end defspec
+@end deffn
@defun set-default symbol value
This function is like @code{setq-default}, except that @var{symbol} is
diff -r f5a5501814f5 -r 62b9ef1ed4ac man/lispref/windows.texi
--- a/man/lispref/windows.texi Sat Feb 19 11:03:46 2011 +0000
+++ b/man/lispref/windows.texi Tue Mar 01 14:18:45 2011 +0000
@@ -442,12 +442,12 @@
@end example
@end defun
-@defspec save-selected-window forms@dots{}
+@deffn {Special Operator} save-selected-window forms@dots{}
This macro records the selected window, executes @var{forms} in
sequence, then restores the earlier selected window. It does not save
or restore anything about the sizes, arrangement or contents of windows;
therefore, if the @var{forms} change them, the changes are permanent.
-@end defspec
+@end deffn
@cindex finding windows
The following functions choose one of the windows on the screen,
@@ -1969,7 +1969,7 @@
@end example
@end defun
-@defspec save-window-excursion forms@dots{}
+@deffn {Special Operator} save-window-excursion forms@dots{}
This macro records the window configuration, executes @var{forms}
in sequence, then restores the earlier window configuration. The window
configuration includes the value of point and the portion of the buffer
@@ -2005,7 +2005,7 @@
;; @r{The frame is now split again.}
@end group
@end example
-@end defspec
+@end deffn
@defun window-configuration-p object
This function returns @code{t} if @var{object} is a window configuration.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: #'substring-no-properties: check STRING's type, get_string_range_char won't.
13 years, 7 months
Aidan Kehoe
changeset: 5419:46b53e84ea7a
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Thu Feb 24 09:36:19 2011 +0000
files: src/ChangeLog src/fns.c tests/ChangeLog tests/automated/lisp-tests.el
description:
#'substring-no-properties: check STRING's type, get_string_range_char won't.
src/ChangeLog addition:
2011-02-24 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (Fsubstring_no_properties):
Sigh, get_string_range_char checks the type of its START and END
arguments, but doesn't check the type of its STRING
argument. Thank you Raymond Toy!
tests/ChangeLog addition:
2011-02-24 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el (substring-no-properties):
Make sure this function checks its arguments' types, the absence
of which was revealed by Raymond Toy's bug report of
http://mid.gmane.org/4D65D413.5050103@gmail.com .
diff -r f5a5501814f5 -r 46b53e84ea7a src/ChangeLog
--- a/src/ChangeLog Sat Feb 19 11:03:46 2011 +0000
+++ b/src/ChangeLog Thu Feb 24 09:36:19 2011 +0000
@@ -1,3 +1,10 @@
+2011-02-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * fns.c (Fsubstring_no_properties):
+ Sigh, get_string_range_char checks the type of its START and END
+ arguments, but doesn't check the type of its STRING
+ argument. Thank you Raymond Toy!
+
2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (Fset_exclusive_or):
diff -r f5a5501814f5 -r 46b53e84ea7a src/fns.c
--- a/src/fns.c Sat Feb 19 11:03:46 2011 +0000
+++ b/src/fns.c Thu Feb 24 09:36:19 2011 +0000
@@ -2095,6 +2095,7 @@
Bytecount bstart, blen;
Lisp_Object val;
+ CHECK_STRING (string);
get_string_range_char (string, start, end, &ccstart, &ccend,
GB_HISTORICAL_STRING_BEHAVIOR);
bstart = string_index_char_to_byte (string, ccstart);
diff -r f5a5501814f5 -r 46b53e84ea7a tests/ChangeLog
--- a/tests/ChangeLog Sat Feb 19 11:03:46 2011 +0000
+++ b/tests/ChangeLog Thu Feb 24 09:36:19 2011 +0000
@@ -1,3 +1,10 @@
+2011-02-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/lisp-tests.el (substring-no-properties):
+ Make sure this function checks its arguments' types, the absence
+ of which was revealed by Raymond Toy's bug report of
+ http://mid.gmane.org/4D65D413.5050103@gmail.com .
+
2011-02-10 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
diff -r f5a5501814f5 -r 46b53e84ea7a tests/automated/lisp-tests.el
--- a/tests/automated/lisp-tests.el Sat Feb 19 11:03:46 2011 +0000
+++ b/tests/automated/lisp-tests.el Thu Feb 24 09:36:19 2011 +0000
@@ -1338,6 +1338,10 @@
(Check-Error wrong-type-argument (subseq 3 2))
(Check-Error args-out-of-range (subseq [1 2 3] -42))
(Check-Error args-out-of-range (subseq [1 2 3] 0 42))
+
+(Check-Error wrong-type-argument (substring-no-properties nil 4))
+(Check-Error wrong-type-argument (substring-no-properties "hi there" pi))
+(Check-Error wrong-type-argument (substring-no-properties "hi there" 0))
;;-----------------------------------------------------
;; Time-related tests
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: Document the CL set functions and #'eql in the Lispref, not just cl.texi
13 years, 7 months
Aidan Kehoe
changeset: 5418:f5a5501814f5
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sat Feb 19 11:03:46 2011 +0000
files: man/ChangeLog man/lispref/lists.texi man/lispref/objects.texi src/ChangeLog src/fns.c
description:
Document the CL set functions and #'eql in the Lispref, not just cl.texi
man/ChangeLog addition:
2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
* lispref/lists.texi (Sets And Lists):
Document #'member*, #'remove*, #'delete* in this file. Document
#'memq, #'member, #'remq, #'remove, #'delq, #'delete in terms of
the former functions.
Document #'subsetp, #'union, #'intersection, #'set-difference,
#'set-exclusive-or and their destructive analogues in this file.
* lispref/lists.texi (Association Lists):
Document #'assoc*, #'rassoc* in this file. Document #'assq,
#'assoc, #'rassq, #'rassoc in terms of the first two functions.
* lispref/objects.texi (Equality Predicates):
Document #'eql here, don't leave it to cl.texi.
src/ChangeLog addition:
2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (Fset_exclusive_or):
This function accepts the :stable keyword too, document this in
its arglist.
diff -r 31475de17064 -r f5a5501814f5 man/ChangeLog
--- a/man/ChangeLog Wed Feb 16 18:26:40 2011 +0000
+++ b/man/ChangeLog Sat Feb 19 11:03:46 2011 +0000
@@ -1,3 +1,17 @@
+2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * lispref/lists.texi (Sets And Lists):
+ Document #'member*, #'remove*, #'delete* in this file. Document
+ #'memq, #'member, #'remq, #'remove, #'delq, #'delete in terms of
+ the former functions.
+ Document #'subsetp, #'union, #'intersection, #'set-difference,
+ #'set-exclusive-or and their destructive analogues in this file.
+ * lispref/lists.texi (Association Lists):
+ Document #'assoc*, #'rassoc* in this file. Document #'assq,
+ #'assoc, #'rassq, #'rassoc in terms of the first two functions.
+ * lispref/objects.texi (Equality Predicates):
+ Document #'eql here, don't leave it to cl.texi.
+
2010-11-06 Aidan Kehoe <kehoea(a)parhasard.net>
* lispref/lists.texi (Rearrangement, Building Lists):
diff -r 31475de17064 -r f5a5501814f5 man/lispref/lists.texi
--- a/man/lispref/lists.texi Wed Feb 16 18:26:40 2011 +0000
+++ b/man/lispref/lists.texi Sat Feb 19 11:03:46 2011 +0000
@@ -1146,59 +1146,97 @@
A list can represent an unordered mathematical set---simply consider a
value an element of a set if it appears in the list, and ignore the
-order of the list. To form the union of two sets, use @code{append} (as
-long as you don't mind having duplicate elements). Other useful
-functions for sets include @code{memq} and @code{delq}, and their
-@code{equal} versions, @code{member} and @code{delete}.
+order of the list. XEmacs provides set operations inherited from Common
+Lisp.
-@cindex CL note---lack @code{union}, @code{set}
-@quotation
-@b{Common Lisp note:} Common Lisp has functions @code{union} (which
-avoids duplicate elements) and @code{intersection} for set operations,
-but XEmacs Lisp does not have them. You can write them in Lisp if
-you wish.
-@end quotation
+@defun member* item list @t{&key :test :test-not :key}
+This function tests to see whether @var{item} is a member of @var{list},
+comparing with @code{eql}. If it is, @code{member*} returns the tail of
+@var{list} starting with the first occurrence of @var{item}. Otherwise,
+it returns @code{nil}.
-@defun memq object list
-@cindex membership in a list
-This function tests to see whether @var{object} is a member of
-@var{list}. If it is, @code{memq} returns a list starting with the
-first occurrence of @var{object}. Otherwise, it returns @code{nil}.
-The letter @samp{q} in @code{memq} says that it uses @code{eq} to
-compare @var{object} against the elements of the list. For example:
+This is equivalent to the Common Lisp @code{member} function, but that
+name was already taken in Emacs Lisp, whence the asterisk at the end of
+@code{member*}.
+
+The @code{:test} keyword argument allows you to specify the test used to
+decide whether @var{item} is equivalent to a given element of
+@var{list}. The function should return non-@code{nil} if the items
+match, @code{nil} if they do not. The @code{:test-not} keyword is
+similar, but the meaning of @code{nil} and non-@code{nil} results are
+reversed. The @code{:key} keyword allows you to examine a component of
+each object in @var{list}, rather than the object itself.
@example
@group
-(memq 'b '(a b c b a))
+(member* 'b '(a b c b a))
@result{} (b c b a)
@end group
@group
-(memq '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are not @code{eq}.}
+(member* '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are not @code{eql}.}
@result{} nil
+@end group
+@group
+(member* '(2) '((1) (2)) :test #'equal) ; @r{but they are @code{equal}.}
+ @result{} ((2))
+@end group
+@group
+(member* 3 '((1) (2) (3) (4)) :key 'car) ; @r{key not applied to @var{item}}
+ @result{} ((3) (4))
@end group
@end example
@end defun
-@defun delq object list
-@cindex deletion of elements
-This function destructively removes all elements @code{eq} to
-@var{object} from @var{list}. The letter @samp{q} in @code{delq} says
-that it uses @code{eq} to compare @var{object} against the elements of
-the list, like @code{memq}.
+@defun memq item list
+This is equivalent to calling @code{(member* item list :test 'eq)}, but
+for historical reasons is more common in the XEmacs code base. Both
+expressions compile to the same byte-code.
@end defun
-When @code{delq} deletes elements from the front of the list, it does so
-simply by advancing down the list and returning a sublist that starts
-after those elements:
+@defun member item list
+This is equivalent to calling @code{(member* item list :test 'equal)}.
+@end defun
+
+@defun remove* item sequence @t{&key (test #'eql) (key #'identity) (start 0) (end (length sequence)) from-end count test-not}
+@cindex removal of elements
+
+This function removes all occurrences of @var{object} from
+@var{sequence}, which can be a list, vector, or bit-vector.
+
+The @code{:test} keyword argument allows you to specify the test used to
+decide whether @var{item} is equivalent to a given element of
+@var{sequence}. The function should return non-@code{nil} if the items
+match, @code{nil} if they do not. The @code{:test-not} keyword is
+similar, but the meaning of @code{nil} and non-@code{nil} results are
+reversed. The @code{:key} keyword allows you to examine a component of
+each object in @var{sequence}, rather than the object itself.
+
+The @code{:start} and @code{:end} keywords allow you to specify a
+zero-based subrange of @var{sequence} to operate on, @code{remove*} will
+call the test function on all items of @var{sequence} between the index
+specified by @code{:start}, inclusive, and @code{:end},
+exclusive. @code{:count} gives a maximum number of items to remove, and
+@code{:from-end}, most useful in combination with @code{:count},
+specifies that the removal should start from the end of @var{sequence}.
+
+As with @code{member*}, this function is equivalent to the Common Lisp
+function of almost the same name (the Common Lisp function has no
+asterisk.)
+
+When @code{remove*} removes elements from the front of a list
+@var{sequence}, it does so simply by advancing down the list and
+returning a sublist that starts after those elements:
@example
@group
-(delq 'a '(a b c)) @equiv{} (cdr '(a b c))
+(remove* 'a '(a b c)) @equiv{} (cdr '(a b c))
@end group
@end example
When an element to be deleted appears in the middle of the list,
-removing it involves changing the @sc{cdr}s (@pxref{Setcdr}).
+removing it involves copying the list conses up to that point, and
+setting the tail of the copied list to the tail of the original list
+past that point.
@example
@group
@@ -1206,7 +1244,7 @@
@result{} (a b c (4))
@end group
@group
-(delq 'a sample-list)
+(remove* 'a sample-list)
@result{} (b c (4))
@end group
@group
@@ -1214,7 +1252,55 @@
@result{} (a b c (4))
@end group
@group
-(delq 'c sample-list)
+(remove* 'c sample-list)
+ @result{} (a b (4))
+@end group
+@group
+sample-list
+ @result{} (a b c (4))
+@end group
+@end example
+
+Don't assume that a variable which formerly held the argument @var{list}
+now has fewer elements, or that it still holds the original list!
+Instead, save the result of @code{remove*} and use that. Most often we
+store the result back into the variable that held the original list:
+
+@example
+(setq flowers (remove* 'rose flowers))
+@end example
+
+In the following example, the @code{(4)} that @code{remove*} attempts to match
+and the @code{(4)} in the @code{sample-list} are not @code{eq}:
+
+@example
+@group
+(remove* '(4) sample-list)
+ @result{} (a b c (4))
+@end group
+@end example
+@end defun
+
+@defun remq item sequence
+This is equivalent to calling @code{(remove* item sequence :test #'eq)}.
+@end defun
+
+@defun remove item sequence
+This is equivalent to calling @code{(remove* item sequence :test #'equal)}.
+@end defun
+
+@defun delete* item sequence @t{&key (test #'eql) (key #'identity) (start 0) (end (length sequence)) from-end count test-not}
+This is like @code{remove*}, but a list @var{sequence} is modified
+in-place (`destructively', in Lisp parlance). So some of the examples
+above change:
+
+@example
+@group
+(setq sample-list '(a b c (4)))
+ @result{} (a b c (4))
+@end group
+@group
+(delete* 'c sample-list)
@result{} (a b (4))
@end group
@group
@@ -1222,78 +1308,80 @@
@result{} (a b (4))
@end group
@end example
-
-Note that @code{(delq 'c sample-list)} modifies @code{sample-list} to
-splice out the third element, but @code{(delq 'a sample-list)} does not
-splice anything---it just returns a shorter list. Don't assume that a
-variable which formerly held the argument @var{list} now has fewer
-elements, or that it still holds the original list! Instead, save the
-result of @code{delq} and use that. Most often we store the result back
-into the variable that held the original list:
-
-@example
-(setq flowers (delq 'rose flowers))
-@end example
-
-In the following example, the @code{(4)} that @code{delq} attempts to match
-and the @code{(4)} in the @code{sample-list} are not @code{eq}:
-
-@example
-@group
-(delq '(4) sample-list)
- @result{} (a c (4))
-@end group
-@end example
-
-The following two functions are like @code{memq} and @code{delq} but use
-@code{equal} rather than @code{eq} to compare elements. They are new in
-Emacs 19.
-
-@defun member object list
-The function @code{member} tests to see whether @var{object} is a member
-of @var{list}, comparing members with @var{object} using @code{equal}.
-If @var{object} is a member, @code{member} returns a list starting with
-its first occurrence in @var{list}. Otherwise, it returns @code{nil}.
-
-Compare this with @code{memq}:
-
-@example
-@group
-(member '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are @code{equal}.}
- @result{} ((2))
-@end group
-@group
-(memq '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are not @code{eq}.}
- @result{} nil
-@end group
-@group
-;; @r{Two strings with the same contents are @code{equal}.}
-(member "foo" '("foo" "bar"))
- @result{} ("foo" "bar")
-@end group
-@end example
@end defun
-@defun delete object list
-This function destructively removes all elements @code{equal} to
-@var{object} from @var{list}. It is to @code{delq} as @code{member} is
-to @code{memq}: it uses @code{equal} to compare elements with
-@var{object}, like @code{member}; when it finds an element that matches,
-it removes the element just as @code{delq} would. For example:
-
-@example
-@group
-(delete '(2) '((2) (1) (2)))
- @result{} '((1))
-@end group
-@end example
+@defun delq item sequence
+This is equivalent to calling @code{(delete* item sequence :test #'eq)}.
@end defun
-@quotation
-@b{Common Lisp note:} The functions @code{member} and @code{delete} in
-XEmacs Lisp are derived from Maclisp, not Common Lisp. The Common
-Lisp versions do not use @code{equal} to compare elements.
-@end quotation
+@defun delete item list
+This is equivalent to calling @code{(delete* item sequence :test #'equal)}.
+@end defun
+
+@defun subsetp list1 list2 @t{&key :test :test-not :key}
+This function returns non-@code{nil} if every item in @var{list1} is
+present in @var{list2}.
+@end defun
+
+@defun union list1 list2 @t{&key :test :test-not :key :stable}
+This function calculates the union of two lists, returning a list
+containing all those items that appear in either list. It doesn't
+guarantee that duplicates in @var{list1} or @var{list2} will be
+eliminated; see @code{remove-duplicates} if this is important to you.
+
+A non-nil value for the @code{:stable} keyword, not specified by Common
+Lisp, means return the items in the order they appear in @var{list1},
+followed by the remaining items in the order they appear in @var{list2}.
+The other keywords are as in @code{member*}.
+
+@code{union} does not modify @var{list1} or @var{list2}.
+@end defun
+
+@defun intersection list1 list2 @t{&key :test :test-not :key :stable}
+This function calculates the intersection of two lists, returning a list
+containing all those items that appear in both lists. It doesn't
+guarantee that duplicates in @var{list1} or @var{list2} will be
+eliminated; see @code{remove-duplicates} if this is important to
+you. @code{intersection} does not modify either list.
+
+A non-nil value for the @code{:stable} keyword, not specified by Common
+Lisp, means return the items in the order they appear in @var{list1}.
+The other keywords are as in @code{member*}.
+@end defun
+
+@defun set-difference list1 list2 @t{&key :test :test-not :key :stable}
+This function returns those items that are in @var{list1} but not in
+@var{list2}. It does not modify either list.
+
+A non-nil value for the @code{:stable} keyword, not specified by Common
+Lisp, means return the items in the order they appear in @var{list1}.
+The other keywords are as in @code{member*}.
+@end defun
+
+@defun set-exclusive-or list1 list2 @t{&key :test :test-not :key :stable}
+This function returns those items that are in @var{list1} but not in
+@var{list2}, together with those in @var{list2} but not in @var{list1}.
+It does not modify either list.
+
+A non-nil value for the @code{:stable} keyword, not specified by Common
+Lisp, means return the items in the order they appear in @var{list1},
+followed by the remaining items in the order they appear in @var{list2}.
+The other keywords are as in @code{member*}.
+@end defun
+
+The following functions are equivalent to the previous four functions,
+but with two important differences; they do not accept the
+@code{:stable} keyword, and they modify one or both list arguments in
+the same way @code{delete*} does.
+
+@defun nintersection list1 list2 @t{&key :test :test-not :key}
+@end defun
+@defun nset-difference list1 list2 @t{&key :test :test-not :key}
+@end defun
+@defun nset-exclusive-or list1 list2 @t{&key :test :test-not :key}
+@end defun
+@defun nunion list1 list2 @t{&key :test :test-not :key}
+@end defun
See also the function @code{add-to-list}, in @ref{Setting Variables},
for another way to add an element to a list stored in a variable.
@@ -1370,21 +1458,21 @@
each key can occur only once. @xref{Property Lists}, for a comparison
of property lists and association lists.
-@defun assoc key alist
+@defun assoc* key alist @t{&key :test :test-not :key}
This function returns the first association for @var{key} in
@var{alist}. It compares @var{key} against the alist elements using
-@code{equal} (@pxref{Equality Predicates}). It returns @code{nil} if no
-association in @var{alist} has a @sc{car} @code{equal} to @var{key}.
-For example:
+@code{eql} (@pxref{Equality Predicates}), or the test specified with the
+@code{:test} keyword. It returns @code{nil} if no association in
+@var{alist} has a @sc{car} @code{equal} to @var{key}. For example:
@smallexample
(setq trees '((pine . cones) (oak . acorns) (maple . seeds)))
@result{} ((pine . cones) (oak . acorns) (maple . seeds))
-(assoc 'oak trees)
+(assoc* 'oak trees)
@result{} (oak . acorns)
-(cdr (assoc 'oak trees))
+(cdr (assoc* 'oak trees))
@result{} acorns
-(assoc 'birch trees)
+(assoc* 'birch trees)
@result{} nil
@end smallexample
@@ -1396,31 +1484,36 @@
(3 "Pitch Pine")
(5 "White Pine")))
-(cdr (assoc 3 needles-per-cluster))
+(cdr (assoc* 3 needles-per-cluster))
@result{} ("Pitch Pine")
-(cdr (assoc 2 needles-per-cluster))
+(cdr (assoc* 2 needles-per-cluster))
@result{} ("Austrian Pine" "Red Pine")
@end smallexample
+
+The @code{:test} keyword argument allows you to specify the test used to
+decide whether @var{key} is equivalent to a given element of
+@var{alist}. The function should return non-@code{nil} if the items
+match, @code{nil} if they do not. The @code{:test-not} keyword is
+similar, but the meaning of @code{nil} and non-@code{nil} results are
+reversed. The @code{:key} keyword allows you to examine a component of
+each @sc{car} in @var{alist}, rather than the @sc{car} itself.
@end defun
-@defun rassoc value alist
+@defun rassoc* value alist @t{&key :test :test-not :key}
This function returns the first association with value @var{value} in
@var{alist}. It returns @code{nil} if no association in @var{alist} has
-a @sc{cdr} @code{equal} to @var{value}.
+a @sc{cdr} @code{eql} to @var{value}.
-@code{rassoc} is like @code{assoc} except that it compares the @sc{cdr} of
+@code{rassoc*} is like @code{assoc*} except that it compares the @sc{cdr} of
each @var{alist} association instead of the @sc{car}. You can think of
-this as ``reverse @code{assoc}'', finding the key for a given value.
+this as ``reverse @code{assoc*}'', finding the key for a given value.
+
+The keywords work similarly to @code{assoc*}.
@end defun
@defun assq key alist
-This function is like @code{assoc} in that it returns the first
-association for @var{key} in @var{alist}, but it makes the comparison
-using @code{eq} instead of @code{equal}. @code{assq} returns @code{nil}
-if no association in @var{alist} has a @sc{car} @code{eq} to @var{key}.
-This function is used more often than @code{assoc}, since @code{eq} is
-faster than @code{equal} and most alists use symbols as keys.
-@xref{Equality Predicates}.
+This is equivalent to calling @code{(assoc* key alist :test 'eq)}, and
+compiles to the same byte code.
@smallexample
(setq trees '((pine . cones) (oak . acorns) (maple . seeds)))
@@ -1429,8 +1522,8 @@
@result{} (pine . cones)
@end smallexample
-On the other hand, @code{assq} is not usually useful in alists where the
-keys may not be symbols:
+@code{assq} is not usually useful in alists where the keys may not be
+symbols:
@smallexample
(setq leaves
@@ -1445,15 +1538,8 @@
@end defun
@defun rassq value alist
-This function returns the first association with value @var{value} in
-@var{alist}. It returns @code{nil} if no association in @var{alist} has
-a @sc{cdr} @code{eq} to @var{value}.
-
-@code{rassq} is like @code{assq} except that it compares the @sc{cdr} of
-each @var{alist} association instead of the @sc{car}. You can think of
-this as ``reverse @code{assq}'', finding the key for a given value.
-
-For example:
+This is equivalent to calling @code{(rassoc* value alist :test 'eq)}, and
+compiles to the same byte code. For example:
@smallexample
(setq trees '((pine . cones) (oak . acorns) (maple . seeds)))
diff -r 31475de17064 -r f5a5501814f5 man/lispref/objects.texi
--- a/man/lispref/objects.texi Wed Feb 16 18:26:40 2011 +0000
+++ b/man/lispref/objects.texi Sat Feb 19 11:03:46 2011 +0000
@@ -2237,7 +2237,7 @@
@section Equality Predicates
@cindex equality
- Here we describe two functions that test for equality between any two
+ Here we describe functions that test for equality between any two
objects. Other functions test equality between objects of specific
types, e.g., strings. For these predicates, see the appropriate chapter
describing the data type.
@@ -2339,6 +2339,31 @@
@result{} t ; @r{Eek, we've been infected.}
(eq ?A 65)
@result{} nil ; @r{We are still healthy.}
+@end group
+@end example
+@end defun
+
+@defun eql object1 object2
+
+This function returns @code{t} if the two arguments are the same object,
+as with @code{eq}. In addition, it returns @code{t} if @var{object1}
+and @var{object2} are numeric objects of the same type and with equal
+values. Otherwise it returns @code{nil}. @code{eql} is the default
+test for hash tables, and for many sequence-oriented functions inherited
+from Common Lisp.
+
+@example
+@group
+(eql 1 1)
+ @result{} t
+(eql 1 1.0) ; different types
+ @result{} nil
+(eq (+ 0.0 pi) pi)
+ @result{} nil ; in some contexts can be t, but don't rely on this!
+(eql (+ 0.0 pi) pi)
+ @result{} t ; this is more reliable.
+(position (+ 0 pi) (list 0 1 2 pi 4))
+ @result{} 3 ; function's test defaults to eql
@end group
@end example
@end defun
diff -r 31475de17064 -r f5a5501814f5 src/ChangeLog
--- a/src/ChangeLog Wed Feb 16 18:26:40 2011 +0000
+++ b/src/ChangeLog Sat Feb 19 11:03:46 2011 +0000
@@ -1,3 +1,9 @@
+2011-02-19 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * fns.c (Fset_exclusive_or):
+ This function accepts the :stable keyword too, document this in
+ its arglist.
+
2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
* xemacs.def.in.in:
diff -r 31475de17064 -r f5a5501814f5 src/fns.c
--- a/src/fns.c Wed Feb 16 18:26:40 2011 +0000
+++ b/src/fns.c Sat Feb 19 11:03:46 2011 +0000
@@ -10876,7 +10876,7 @@
return the items in the order they appear in LIST1, followed by the
remaining items in the order they appear in LIST2.
-arguments: (LIST1 LIST2 &key (TEST #'eql) (KEY #'identity) TEST-NOT)
+arguments: (LIST1 LIST2 &key (TEST #'eql) (KEY #'identity) TEST-NOT STABLE)
*/
(int nargs, Lisp_Object *args))
{
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: #'byte-compile-normal-call; only examine properties of (car FORM) if a symbol
13 years, 7 months
Aidan Kehoe
changeset: 5417:31475de17064
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Feb 16 18:26:40 2011 +0000
files: lisp/ChangeLog lisp/bytecomp.el
description:
#'byte-compile-normal-call; only examine properties of (car FORM) if a symbol
2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-normal-call):
Check that the car of FORM is a symbol before examining its
properties; it can be a lambda form if byte-optimize.el hasn't
worked its magic and transformed such a lambda call into inline
code.
diff -r 503b9a3e5e46 -r 31475de17064 lisp/ChangeLog
--- a/lisp/ChangeLog Wed Feb 16 15:35:35 2011 +0000
+++ b/lisp/ChangeLog Wed Feb 16 18:26:40 2011 +0000
@@ -1,3 +1,11 @@
+2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp.el (byte-compile-normal-call):
+ Check that the car of FORM is a symbol before examining its
+ properties; it can be a lambda form if byte-optimize.el hasn't
+ worked its magic and transformed such a lambda call into inline
+ code.
+
2011-02-12 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el:
diff -r 503b9a3e5e46 -r 31475de17064 lisp/bytecomp.el
--- a/lisp/bytecomp.el Wed Feb 16 15:35:35 2011 +0000
+++ b/lisp/bytecomp.el Wed Feb 16 18:26:40 2011 +0000
@@ -2888,7 +2888,7 @@
(tree-equal . 3)))
(defun byte-compile-normal-call (form)
- (and (get (car form) 'byte-compile-keyword-start)
+ (and (symbolp (car form)) (get (car form) 'byte-compile-keyword-start)
(let ((plist (nthcdr (get (car form) 'byte-compile-keyword-start)
form)))
(symbol-macrolet
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: xemacs.def.in.in: no longer export acons(), export Facons() instead.
13 years, 7 months
Aidan Kehoe
changeset: 5416:503b9a3e5e46
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Wed Feb 16 15:35:35 2011 +0000
files: src/ChangeLog src/xemacs.def.in.in
description:
xemacs.def.in.in: no longer export acons(), export Facons() instead.
2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
* xemacs.def.in.in:
No longer export acons(), export Facons() instead, thank you Mats,
Jerry and Jeff Sparkes.
diff -r 5dd1ba5e0113 -r 503b9a3e5e46 src/ChangeLog
--- a/src/ChangeLog Sat Feb 12 14:07:38 2011 +0000
+++ b/src/ChangeLog Wed Feb 16 15:35:35 2011 +0000
@@ -1,3 +1,9 @@
+2011-02-16 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * xemacs.def.in.in:
+ No longer export acons(), export Facons() instead, thank you Mats,
+ Jerry and Jeff Sparkes.
+
2011-02-10 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (shortest_length_among_sequences):
diff -r 5dd1ba5e0113 -r 503b9a3e5e46 src/xemacs.def.in.in
--- a/src/xemacs.def.in.in Sat Feb 12 14:07:38 2011 +0000
+++ b/src/xemacs.def.in.in Wed Feb 16 15:35:35 2011 +0000
@@ -34,7 +34,6 @@
NAME xemacs.exe
EXPORTS
/* Exported functions */
-acons
#ifdef NEW_GC
alloc_lrecord /* ALLOC_LISP_OBJECT */
alloc_sized_lrecord /* ALLOC_SIZED_LISP_OBJECT */
@@ -249,6 +248,7 @@
Dynarr_insert_many /* Dynarr_add_{literal,lisp}_string */
Dynarr_newf /* Dynarr_new, Dynarr_new2 */
Dynarr_resize /* Dynarr_add */
+Facons
Fappend
Fapply
Fbuffer_modified_p
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: Be better about eliminating `block's that are not `return-from'd, bytecomp.el
13 years, 7 months
Aidan Kehoe
changeset: 5415:5dd1ba5e0113
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Sat Feb 12 14:07:38 2011 +0000
files: lisp/ChangeLog lisp/bytecomp.el lisp/cl-macs.el
description:
Be better about eliminating `block's that are not `return-from'd, bytecomp.el
2011-02-12 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el:
* bytecomp.el (byte-compile-initial-macro-environment):
* bytecomp.el (unwind-protect):
* bytecomp.el (byte-compile-active-blocks):
* bytecomp.el (byte-compile-catch):
* bytecomp.el ('return-from-1): Removed.
* bytecomp.el ('block-1): Removed.
* bytecomp.el (byte-compile-block-1): Removed.
* bytecomp.el (byte-compile-return-from-1): Removed.
* bytecomp.el (byte-compile-throw):
* cl-macs.el (block):
* cl-macs.el (return-from):
In my last change, the elimination of `block's that were never
`return-from'd didn't work if `cl-macroexpand-all' was called
explicitly, something much code in cl-macs.el does. Change the
implementation to something that doesn't require shadowing of the
macros in `byte-compile-initial-macro-environment', putting a
`cl-block-name' property on the gensym'd symbol argument to
`catch' instead.
diff -r 70b15ac66ee5 -r 5dd1ba5e0113 lisp/ChangeLog
--- a/lisp/ChangeLog Thu Feb 10 08:46:10 2011 +0000
+++ b/lisp/ChangeLog Sat Feb 12 14:07:38 2011 +0000
@@ -1,3 +1,25 @@
+2011-02-12 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp.el:
+ * bytecomp.el (byte-compile-initial-macro-environment):
+ * bytecomp.el (unwind-protect):
+ * bytecomp.el (byte-compile-active-blocks):
+ * bytecomp.el (byte-compile-catch):
+ * bytecomp.el ('return-from-1): Removed.
+ * bytecomp.el ('block-1): Removed.
+ * bytecomp.el (byte-compile-block-1): Removed.
+ * bytecomp.el (byte-compile-return-from-1): Removed.
+ * bytecomp.el (byte-compile-throw):
+ * cl-macs.el (block):
+ * cl-macs.el (return-from):
+ In my last change, the elimination of `block's that were never
+ `return-from'd didn't work if `cl-macroexpand-all' was called
+ explicitly, something much code in cl-macs.el does. Change the
+ implementation to something that doesn't require shadowing of the
+ macros in `byte-compile-initial-macro-environment', putting a
+ `cl-block-name' property on the gensym'd symbol argument to
+ `catch' instead.
+
2011-02-09 Aidan Kehoe <kehoea(a)parhasard.net>
* cl.el (acons): Removed, make the implementation in alloc.c
diff -r 70b15ac66ee5 -r 5dd1ba5e0113 lisp/bytecomp.el
--- a/lisp/bytecomp.el Thu Feb 10 08:46:10 2011 +0000
+++ b/lisp/bytecomp.el Sat Feb 12 14:07:38 2011 +0000
@@ -511,11 +511,7 @@
"%s is not of type %s" form type)))
(if byte-compile-delete-errors
form
- (funcall (cdr (symbol-function 'the)) type form))))
- (return-from .
- ,#'(lambda (name &optional result) `(return-from-1 ',name ,result)))
- (block .
- ,#'(lambda (name &rest body) `(block-1 ',name ,@body))))
+ (funcall (cdr (symbol-function 'the)) type form)))))
"The default macro-environment passed to macroexpand by the compiler.
Placing a macro here will cause a macro to have different semantics when
expanded by the compiler as when expanded by the interpreter.")
@@ -4186,8 +4182,6 @@
;;; other tricky macro-like special-operators
(byte-defop-compiler-1 catch)
-(byte-defop-compiler-1 block-1)
-(byte-defop-compiler-1 return-from-1)
(byte-defop-compiler-1 unwind-protect)
(byte-defop-compiler-1 condition-case)
(byte-defop-compiler-1 save-excursion)
@@ -4196,44 +4190,33 @@
(byte-defop-compiler-1 with-output-to-temp-buffer)
;; no track-mouse.
+(defvar byte-compile-active-blocks nil)
+
(defun byte-compile-catch (form)
- (byte-compile-form (car (cdr form)))
- (byte-compile-push-constant
- (byte-compile-top-level (cons 'progn (cdr (cdr form))) for-effect))
- (byte-compile-out 'byte-catch 0))
-
-;; `return-from' and `block' are different from `throw' and `catch' when it
-;; comes to scope and extent. These differences are implemented for
-;; interpreted code in cl-macs.el, in compiled code in bytecomp.el. There's
-;; a certain amount of bootstrapping needed for the latter, and until this
-;; is done return-from and block behave as throw and catch in their scope
-;; and extent. This is only relevant to people working on bytecomp.el.
-
-(defalias 'return-from-1 'throw)
-(defalias 'block-1 'catch)
-
-(defvar byte-compile-active-blocks nil)
-
-(defun byte-compile-block-1 (form)
- (let* ((name (nth 1 (nth 1 form)))
- (elt (list name (copy-symbol name) nil))
- (byte-compile-active-blocks (cons elt byte-compile-active-blocks))
- (body (byte-compile-top-level (cons 'progn (cddr form)))))
- (if (nth 2 elt)
- (byte-compile-catch `(catch ',(nth 1 elt) ,body))
- (byte-compile-form body))))
-
-(defun byte-compile-return-from-1 (form)
- (let* ((name (nth 1 (nth 1 form)))
- (assq (assq name byte-compile-active-blocks)))
- (if assq
- (setf (nth 2 assq) t)
- (byte-compile-warn
- "return-from: %S: no current lexical block with this name"
- name))
- (byte-compile-throw
- `(throw ',(or (nth 1 assq) (copy-symbol name))
- ,@(nthcdr 2 form)))))
+ "Byte-compile and return a `catch' from.
+
+If FORM is the result of macroexpanding a `block' form (the TAG argument is
+a quoted symbol with a non-nil `cl-block-name' property) and there is no
+corresponding `return-from' within the block--or equivalently, it was
+optimized away--just byte compile and return the BODY."
+ (let* ((symbol (car-safe (cdr-safe (nth 1 form))))
+ (block (and symbol (symbolp symbol) (get symbol 'cl-block-name)))
+ (elt (and block (cons block nil)))
+ (byte-compile-active-blocks
+ (if block
+ (cons elt byte-compile-active-blocks)
+ byte-compile-active-blocks))
+ (body
+ (byte-compile-top-level (cons 'progn (cddr form))
+ (if block nil for-effect))))
+ (if (and block (not (cdr elt)))
+ ;; A lexical block without any contained return-from clauses:
+ (byte-compile-form body)
+ ;; A normal catch call, or a lexical block with a contained
+ ;; return-from clause.
+ (byte-compile-form (car (cdr form)))
+ (byte-compile-push-constant body)
+ (byte-compile-out 'byte-catch 0))))
(defun byte-compile-unwind-protect (form)
(byte-compile-push-constant
@@ -4383,6 +4366,12 @@
(byte-compile-normal-call
`(signal 'wrong-number-of-arguments '(,(car form)
,(length (cdr form))))))
+ ;; If this form was macroexpanded from `return-from', mark the
+ ;; corresponding block as having been referenced.
+ (let* ((symbol (car-safe (cdr-safe (nth 1 form))))
+ (block (and symbol (symbolp symbol) (get symbol 'cl-block-name)))
+ (assq (and block (assq block byte-compile-active-blocks))))
+ (and assq (setcdr assq t)))
(byte-compile-form (nth 1 form)) ;; Push the arguments
(byte-compile-form (nth 2 form))
(byte-compile-out (get (car form) 'byte-opcode) 0)
diff -r 70b15ac66ee5 -r 5dd1ba5e0113 lisp/cl-macs.el
--- a/lisp/cl-macs.el Thu Feb 10 08:46:10 2011 +0000
+++ b/lisp/cl-macs.el Sat Feb 12 14:07:38 2011 +0000
@@ -747,6 +747,9 @@
(let ((cl-active-block-names (acons name (copy-symbol name)
cl-active-block-names))
(body (cons 'progn body)))
+ ;; Tell the byte-compiler this is a block, not a normal catch call, and
+ ;; as such it can eliminate it if that's appropriate:
+ (put (cdar cl-active-block-names) 'cl-block-name name)
`(catch ',(cdar cl-active-block-names)
,(cl-macroexpand-all body cl-macro-environment))))
@@ -763,8 +766,13 @@
returning RESULT from that form (or nil if RESULT is omitted).
This is compatible with Common Lisp, but note that `defun' and
`defmacro' do not create implicit blocks as they do in Common Lisp."
- `(throw ',(or (cdr (assq name cl-active-block-names)) (copy-symbol name))
- ,result))
+ `(throw ',(or (cdr (assq name cl-active-block-names))
+ (prog1 (copy-symbol name)
+ (and-fboundp 'byte-compile-warn (cl-compiling-file)
+ (byte-compile-warn
+ "return-from: no enclosing block named `%s'"
+ name))))
+ ,result))
;;; The "loop" macro.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: Correct a bug with circularity checking in #'mapcar*, #'map, etc.
13 years, 7 months
Aidan Kehoe
changeset: 5414:70b15ac66ee5
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Thu Feb 10 08:46:10 2011 +0000
files: src/ChangeLog src/fns.c tests/ChangeLog tests/automated/lisp-tests.el
description:
Correct a bug with circularity checking in #'mapcar*, #'map, etc.
src/ChangeLog addition:
2011-02-10 Aidan Kehoe <kehoea(a)parhasard.net>
* fns.c (shortest_length_among_sequences):
This was buggy, it always errored if the last argument was
circular, even if other arguments were non-circular. Correct that.
tests/ChangeLog addition:
2011-02-10 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
* automated/lisp-tests.el (mapcar*):
If multiple SEQUENCE arguments are passed to #'mapcar*, and the
last one is circular while the others aren't, make sure that
#'mapcar* doesn't error.
diff -r 22c4e67a2e69 -r 70b15ac66ee5 src/ChangeLog
--- a/src/ChangeLog Wed Feb 09 20:15:50 2011 +0000
+++ b/src/ChangeLog Thu Feb 10 08:46:10 2011 +0000
@@ -1,3 +1,9 @@
+2011-02-10 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * fns.c (shortest_length_among_sequences):
+ This was buggy, it always errored if the last argument was
+ circular, even if other arguments were non-circular. Correct that.
+
2011-02-09 Aidan Kehoe <kehoea(a)parhasard.net>
* alloc.c (Facons):
diff -r 22c4e67a2e69 -r 70b15ac66ee5 src/fns.c
--- a/src/fns.c Wed Feb 09 20:15:50 2011 +0000
+++ b/src/fns.c Thu Feb 10 08:46:10 2011 +0000
@@ -7145,7 +7145,7 @@
static Elemcount
shortest_length_among_sequences (int nsequences, Lisp_Object *sequences)
{
- Elemcount len = EMACS_INT_MAX;
+ Elemcount len = 1 + EMACS_INT_MAX;
Lisp_Object length = Qnil;
int i;
@@ -7167,7 +7167,7 @@
}
}
- if (NILP (length))
+ if (len == 1 + EMACS_INT_MAX)
{
signal_circular_list_error (sequences[0]);
}
diff -r 22c4e67a2e69 -r 70b15ac66ee5 tests/ChangeLog
--- a/tests/ChangeLog Wed Feb 09 20:15:50 2011 +0000
+++ b/tests/ChangeLog Thu Feb 10 08:46:10 2011 +0000
@@ -1,3 +1,11 @@
+2011-02-10 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/lisp-tests.el:
+ * automated/lisp-tests.el (mapcar*):
+ If multiple SEQUENCE arguments are passed to #'mapcar*, and the
+ last one is circular while the others aren't, make sure that
+ #'mapcar* doesn't error.
+
2011-02-07 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
diff -r 22c4e67a2e69 -r 70b15ac66ee5 tests/automated/lisp-tests.el
--- a/tests/automated/lisp-tests.el Wed Feb 09 20:15:50 2011 +0000
+++ b/tests/automated/lisp-tests.el Thu Feb 10 08:46:10 2011 +0000
@@ -1045,6 +1045,12 @@
(setcdr (cdr x) 42)) ; drop a brick wall onto the freeway
(car y))
x)))
+
+(Assert
+ (equal
+ (let ((list (list pi))) (mapcar* #'cons [1 2 3 4] (nconc list list)))
+ `((1 . ,pi) (2 . ,pi) (3 . ,pi) (4 . ,pi)))
+ "checking mapcar* behaves correctly when only one arg is circular")
(Assert (eql
(length (multiple-value-list
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches
carbon2-commit: Correct the order of arguments to map_keymap_sort_predicate(), keymap.c.
13 years, 7 months
Aidan Kehoe
changeset: 5411:cc7d0e19173c
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Mon Feb 07 00:03:41 2011 +0000
files: src/ChangeLog src/keymap.c
description:
Correct the order of arguments to map_keymap_sort_predicate(), keymap.c.
2011-02-07 Aidan Kehoe <kehoea(a)parhasard.net>
* keymap.c (describe_map_sort_predicate): Correct the order of
arguments to map_keymap_sort_predicate() here. Thanks again, Mats.
diff -r b5561bfd5061 -r cc7d0e19173c src/ChangeLog
--- a/src/ChangeLog Sun Feb 06 23:46:17 2011 +0000
+++ b/src/ChangeLog Mon Feb 07 00:03:41 2011 +0000
@@ -1,3 +1,8 @@
+2011-02-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * keymap.c (describe_map_sort_predicate): Correct the order of
+ arguments to map_keymap_sort_predicate() here. Thanks again, Mats.
+
2011-02-06 Aidan Kehoe <kehoea(a)parhasard.net>
* symbols.c (Fapropos_internal):
diff -r b5561bfd5061 -r cc7d0e19173c src/keymap.c
--- a/src/keymap.c Sun Feb 06 23:46:17 2011 +0000
+++ b/src/keymap.c Mon Feb 07 00:03:41 2011 +0000
@@ -4102,7 +4102,7 @@
if (bit1 != bit2)
return bit1 < bit2;
else
- return map_keymap_sort_predicate (obj1, obj2, pred, key_func);
+ return map_keymap_sort_predicate (pred, key_func, obj1, obj2);
}
/* Elide 2 or more consecutive numeric keysyms bound to the same thing,
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches