diff --git a/ChangeLog b/ChangeLog index 81eddade0a0..1d30382d34d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2012-10-23 Paul Eggert + + * configure.ac (_FORTIFY_SOURCE): Do not multiply define (Bug#12714). + This ports to Gentoo. Problem originally reported against coreutils, + but Emacs has it too. + +2012-10-23 Glenn Morris + + * Makefile.in (emacs_transform): Remove. + (install-man): Revert 2012-10-21 change. (Bug#12713) + +2012-10-21 Glenn Morris + + * Makefile.in (install-etc): Don't install emacs22 icons. + + * Makefile.in (emacs_transform): New variable. + (install-etc): Prefer a make variable to a shell variable. + 2012-10-18 Stefan Monnier * Makefile.in ($(MAKEFILE_NAME)): Depend on src/lisp.mk as well. diff --git a/Makefile.in b/Makefile.in index c27b6777162..5c5d30fb63f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -645,7 +645,7 @@ install-etc: for dir in */*/apps */*/mimetypes; do \ [ -d $${dir} ] || continue ; \ ( cd $${thisdir}; ${MKDIR_P} $(DESTDIR)${icondir}/$${dir} ) ; \ - for icon in $${dir}/*.*; do \ + for icon in $${dir}/emacs[.-]*; do \ [ -r $${icon} ] || continue ; \ dest=`echo "$${icon}" | sed -e 's|.*/||' -e '$(TRANSFORM)'` ; \ ( cd $${thisdir}; \ diff --git a/autogen/config.in b/autogen/config.in index c5f32371dd7..8fe2170d89d 100644 --- a/autogen/config.in +++ b/autogen/config.in @@ -144,7 +144,7 @@ along with GNU Emacs. If not, see . */ /* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting glibc 2.15+. */ - #if defined __OPTIMIZE__ && __OPTIMIZE__ + #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ # define _FORTIFY_SOURCE 2 #endif diff --git a/configure.ac b/configure.ac index 9332dba8f56..2751abf3677 100644 --- a/configure.ac +++ b/configure.ac @@ -745,7 +745,7 @@ else AH_VERBATIM([FORTIFY_SOURCE], [/* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting glibc 2.15+. */ - #if defined __OPTIMIZE__ && __OPTIMIZE__ + #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ # define _FORTIFY_SOURCE 2 #endif ]) @@ -2599,7 +2599,7 @@ no_return_alloc_pixels fi if test "${HAVE_XPM}" = "yes"; then - AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).]) + AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).]) LIBXPM=-lXpm fi fi diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 66bb2de921b..9a71ed5b272 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,16 @@ +2012-10-23 Bastien Guerry + + * text.texi (Org Authoring): Use a comma after @ref to avoid the + insertion of a period in the Info output. + +2012-10-23 Stefan Monnier + + * custom.texi (Hooks): Clarify that -hooks is deprecated. + +2012-10-23 Chong Yidong + + * kmacro.texi (Edit Keyboard Macro): Fix typo. + 2012-10-18 Dani Moncayo * mini.texi (Completion Options): Fix off-by-one error. (Bug#12644) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 68219d7890f..a614126dbc0 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -838,7 +838,8 @@ is a normal hook. @cindex abnormal hook A few hooks are @dfn{abnormal hooks}. Their names end in -@samp{-hooks} or @samp{-functions}, instead of @samp{-hook}. What +@samp{-functions}, instead of @samp{-hook} (some old code may also use +the deprecated suffix @samp{-hooks}). What makes these hooks abnormal is the way its functions are called---perhaps they are given arguments, or perhaps the values they return are used in some way. For example, @@ -1735,11 +1736,11 @@ and @kbd{C-c p} in Texinfo mode: @example (add-hook 'texinfo-mode-hook - '(lambda () - (define-key texinfo-mode-map "\C-cp" - 'backward-paragraph) - (define-key texinfo-mode-map "\C-cn" - 'forward-paragraph))) + (lambda () + (define-key texinfo-mode-map "\C-cp" + 'backward-paragraph) + (define-key texinfo-mode-map "\C-cn" + 'forward-paragraph))) @end example @node Modifier Keys diff --git a/doc/emacs/kmacro.texi b/doc/emacs/kmacro.texi index 7a3f3151e5c..3b83d24e405 100644 --- a/doc/emacs/kmacro.texi +++ b/doc/emacs/kmacro.texi @@ -482,10 +482,11 @@ Edit the last 300 keystrokes as a keyboard macro @kindex C-x C-k C-e @kindex C-x C-k RET You can edit the last keyboard macro by typing @kbd{C-x C-k C-e} or -@kbd{C-x C-k RET} (@code{kmacro-edit-macro}). This formats the macro -definition in a buffer and enters a specialized major mode for editing -it. Type @kbd{C-h m} once in that buffer to display details of how to -edit the macro. When you are finished editing, type @kbd{C-c C-c}. +@kbd{C-x C-k @key{RET}} (@code{kmacro-edit-macro}). This formats the +macro definition in a buffer and enters a specialized major mode for +editing it. Type @kbd{C-h m} once in that buffer to display details +of how to edit the macro. When you are finished editing, type +@kbd{C-c C-c}. @findex edit-kbd-macro @kindex C-x C-k e diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index f10e78e17ad..6e895d3ac3c 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -1399,7 +1399,7 @@ This is an example. #+end_example @end example - For further details, see @ref{Exporting,,,org, The Org Manual} and + For further details, @ref{Exporting,,,org, The Org Manual}, and @ref{Publishing,,,org, The Org Manual}. @node TeX Mode diff --git a/doc/lispintro/ChangeLog b/doc/lispintro/ChangeLog index 6c524f5a0ae..396e3857c58 100644 --- a/doc/lispintro/ChangeLog +++ b/doc/lispintro/ChangeLog @@ -1,3 +1,8 @@ +2012-10-24 Paul Eggert + + * emacs-lisp-intro.texi (Files List): + Update manual for new time stamp format (Bug#12706). + 2012-10-17 Gregor Zattler (tiny change) * emacs-lisp-intro.texi (Narrowing advantages): diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 55c3ef4e09e..f885d6c15e8 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -238,7 +238,7 @@ GNU Press, @hfill @uref{http://www.fsf.org/campaigns/gnu-press/}@* a division of the @hfill email: @email{sales@@fsf.org}@* Free Software Foundation, Inc. @hfill Tel: +1 (617) 542-5942@* 51 Franklin Street, Fifth Floor @hfill Fax: +1 (617) 542-2652@* -Boston, MA 02110-1301 USA +Boston, MA 02110-1301 USA @end iftex @ifnottex @@ -249,7 +249,7 @@ GNU Press, http://www.fsf.org/campaigns/gnu-press/ a division of the email: sales@@fsf.org Free Software Foundation, Inc. Tel: +1 (617) 542-5942 51 Franklin Street, Fifth Floor Fax: +1 (617) 542-2652 -Boston, MA 02110-1301 USA +Boston, MA 02110-1301 USA @end example @end ifnottex @@ -15680,11 +15680,11 @@ nil 100 @end group @group -(17733 259) -(17491 28834) -(17596 62124) -13157 -"-rw-rw-r--" +(20615 27034 579989 697000) +(17905 55681 0 0) +(20615 26327 734791 805000) +13188 +"-rw-r--r--" @end group @group nil @@ -17909,10 +17909,10 @@ file that set values: @group ;; Set calendar highlighting colors (setq calendar-load-hook - '(lambda () - (set-face-foreground 'diary-face "skyblue") - (set-face-background 'holiday-face "slate blue") - (set-face-foreground 'holiday-face "white"))) + (lambda () + (set-face-foreground 'diary-face "skyblue") + (set-face-background 'holiday-face "slate blue") + (set-face-foreground 'holiday-face "white"))) @end group @end smallexample @@ -20947,7 +20947,7 @@ not yet seen, @code{mapcar} and @code{lambda}. @group (defun one-fiftieth (full-range) "Return list, each number one-fiftieth of previous." - (mapcar '(lambda (arg) (/ arg 50)) full-range)) + (mapcar (lambda (arg) (/ arg 50)) full-range)) @end group @end smallexample @@ -21168,7 +21168,7 @@ and the second argument is @code{full-range}, which will be bound to The whole expression looks like this: @smallexample -(mapcar '(lambda (arg) (/ arg 50)) full-range)) +(mapcar (lambda (arg) (/ arg 50)) full-range)) @end smallexample @xref{Mapping Functions, , Mapping Functions, elisp, The GNU Emacs @@ -21840,7 +21840,7 @@ each column." @group (defun one-fiftieth (full-range) "Return list, each number of which is 1/50th previous." - (mapcar '(lambda (arg) (/ arg 50)) full-range)) + (mapcar (lambda (arg) (/ arg 50)) full-range)) @end group @end smallexample diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index acf6f8a51ff..bed74bb688a 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,45 @@ +2012-10-24 Paul Eggert + + Update manual for new time stamp format (Bug#12706). + * buffers.texi (Modification Time): + * files.texi (Testing Accessibility, File Attributes): + * intro.texi (Version Info): + * os.texi (Time of Day): + Update for new time stamp format (HIGH LOW MICROSEC PICOSEC). + These instances were missed the first time around. + Problem reported by Glenn Morris in . + +2012-10-24 Chong Yidong + + * keymaps.texi (Toolkit Differences): Node deleted. + (Easy Menu): New node. + +2012-10-23 Stefan Monnier + + * hooks.texi (Standard Hooks): Clarify that -hooks is deprecated. + +2012-10-23 Paul Eggert + + Fix outdated timestamp documentation in Elisp manual (bug#12706). + * files.texi (File Attributes): + * text.texi (Undo): + Time stamp resolution is now 1 picosecond, not 1 second. + +2012-10-23 Chong Yidong + + * display.texi (Font Lookup): Remove font-list-limit. + + * keymaps.texi (Key Sequences): Avoid referring to Edit Macro mode + (Bug#12529). + +2012-10-22 Glenn Morris + + * os.texi (Recording Input): Tiny fix. + + * intro.texi (Lisp History): + * lists.texi (Sets And Lists): Refer to cl-lib rather than cl. + * tips.texi (Coding Conventions): Recommend cl-lib over cl. + 2012-10-15 Chong Yidong * macros.texi (Defining Macros): defmacro is now a macro. diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi index b9666a79f5b..4a556895de7 100644 --- a/doc/lispref/buffers.texi +++ b/doc/lispref/buffers.texi @@ -634,7 +634,8 @@ file should not be done. @c Emacs 19 feature @defun visited-file-modtime This function returns the current buffer's recorded last file -modification time, as a list of the form @code{(@var{high} @var{low})}. +modification time, as a list of the form @code{(@var{high} @var{low} +@var{microsec} @var{picosec})}. (This is the same format that @code{file-attributes} uses to return time values; see @ref{File Attributes}.) @@ -664,9 +665,8 @@ is not @code{nil}, and otherwise to the last modification time of the visited file. If @var{time} is neither @code{nil} nor zero, it should have the form -@code{(@var{high} . @var{low})} or @code{(@var{high} @var{low})}, in -either case containing two integers, each of which holds 16 bits of the -time. +@code{(@var{high} @var{low} @var{microsec} @var{picosec})}, +the format used by @code{current-time} (@pxref{Time of Day}). This function is useful if the buffer was not read from the file normally, or if the file itself has been changed for some known benign @@ -1237,4 +1237,3 @@ This function returns the current gap position in the current buffer. @defun gap-size This function returns the current gap size of the current buffer. @end defun - diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 3f92c50e2bc..0b5ada43744 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -2944,14 +2944,6 @@ The last three elements give additional information about the font. encoding of the font. @end defun -@defopt font-list-limit -This variable specifies maximum number of fonts to consider in font -matching. The function @code{x-family-fonts} will not return more -than that many fonts, and font selection will consider only that many -fonts when searching a matching font for face attributes. The default -is 100. -@end defopt - @node Fontsets @subsection Fontsets diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index d46cb071bf7..1d1dab8faac 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -800,17 +800,14 @@ Menu Keymaps * Menu Bar:: How to customize the menu bar. * Tool Bar:: A tool bar is a row of images. * Modifying Menus:: How to add new items to a menu. +* Easy Menu:: A convenience macro for defining menus. Defining Menus -* Simple Menu Items:: A simple kind of menu key binding, - limited in capabilities. -* Extended Menu Items:: More powerful menu item definitions - let you specify keywords to enable - various features. +* Simple Menu Items:: A simple kind of menu key binding. +* Extended Menu Items:: More complex menu item definitions. * Menu Separators:: Drawing a horizontal line through a menu. * Alias Menu Items:: Using command aliases in menu items. -* Toolkit Differences:: Not all toolkits provide the same features. Major and Minor Modes diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 9424a661236..a5710c789e9 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -938,7 +938,7 @@ on the 19th, @file{aug-20} was written on the 20th, and the file @end example You can use @code{file-attributes} to get a file's last modification -time as a list of two numbers. @xref{File Attributes}. +time as a list of four integers. @xref{File Attributes}. @end defun @node Kinds of Files @@ -1220,20 +1220,19 @@ point number. The file's @acronym{GID}, likewise. @item -The time of last access, as a list of two integers. -The first integer has the high-order 16 bits of time, -the second has the low 16 bits. (This is similar to the +The time of last access, as a list of four integers @code{(@var{sec-high} +@var{sec-low} @var{microsec} @var{picosec})}. (This is similar to the value of @code{current-time}; see @ref{Time of Day}.) Note that on some FAT-based filesystems, only the date of last access is recorded, so this time will always hold the midnight of the day of last access. @cindex modification time of file @item -The time of last modification as a list of two integers (as above). +The time of last modification as a list of four integers (as above). This is the last time when the file's contents were modified. @item -The time of last status change as a list of two integers (as above). +The time of last status change as a list of four integers (as above). This is the time of the last change to the file's access mode bits, its owner and group, and other information recorded in the filesystem for the file, beyond the file's contents. @@ -1276,9 +1275,9 @@ For example, here are the file attributes for @file{files.texi}: @group (file-attributes "files.texi" 'string) @result{} (nil 1 "lh" "users" - (19145 42977) - (19141 59576) - (18340 17300) + (20614 64019 50040 152000) + (20000 23 0 0) + (20614 64555 902289 872000) 122295 "-rw-rw-rw-" nil (5888 2 . 43978) (15479 . 46724)) @@ -1302,14 +1301,14 @@ is owned by the user with name "lh". @item "users" is in the group with name "users". -@item (19145 42977) -was last accessed on Oct 5 2009, at 10:01:37. +@item (20614 64019 50040 152000) +was last accessed on October 23, 2012, at 20:12:03.050040152 UTC. -@item (19141 59576) -last had its contents modified on Oct 2 2009, at 13:49:12. +@item (20000 23 0 0) +was last modified on July 15, 2001, at 08:53:43 UTC. -@item (18340 17300) -last had its status changed on Feb 2 2008, at 12:19:00. +@item (20614 64555 902289 872000) +last had its status changed on October 23, 2012, at 20:20:59.902289872 UTC. @item 122295 is 122295 bytes long. (It may not contain 122295 characters, though, diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index c94e46dad18..623106b6d06 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -978,7 +978,7 @@ anonymous function by quoting it as a list: @example @group (defun double-property (symbol prop) - (change-property symbol prop '(lambda (x) (* 2 x)))) + (change-property symbol prop (lambda (x) (* 2 x)))) @end group @end example diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi index 7c91b51b290..a7f01243641 100644 --- a/doc/lispref/hooks.texi +++ b/doc/lispref/hooks.texi @@ -17,11 +17,11 @@ arguments and their values are completely ignored. The recommended way to put a new function on such a hook is to call @code{add-hook}. @xref{Hooks}, for more information about using hooks. -The variables whose names end in @samp{-hooks} or @samp{-functions} are -usually @dfn{abnormal hooks}; their values are lists of functions, but -these functions are called in a special way (they are passed arguments, -or their values are used). The variables whose names end in -@samp{-function} have single functions as their values. +The variables whose names end in @samp{-functions} are usually @dfn{abnormal +hooks} (some old code may also use the deprecated @samp{-hooks} suffix); their +values are lists of functions, but these functions are called in a special way +(they are passed arguments, or their return values are used). The variables +whose names end in @samp{-function} have single functions as their values. This is not an exhaustive list, it only covers the more general hooks. For example, every major mode defines a hook named diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi index ce103a84a74..4770701b601 100644 --- a/doc/lispref/intro.texi +++ b/doc/lispref/intro.texi @@ -119,7 +119,7 @@ worry about it; this manual is self-contained. @pindex cl A certain amount of Common Lisp emulation is available via the -@file{cl} library. @xref{Top,, Overview, cl, Common Lisp Extensions}. +@file{cl-lib} library. @xref{Top,, Overview, cl, Common Lisp Extensions}. Emacs Lisp is not at all influenced by Scheme; but the GNU project has an implementation of Scheme, called Guile. We use it in all new GNU @@ -493,13 +493,13 @@ giving a prefix argument makes @var{here} non-@code{nil}. @defvar emacs-build-time The value of this variable indicates the time at which Emacs was -built. It is a list of three integers, like the value of +built. It is a list of four integers, like the value of @code{current-time} (@pxref{Time of Day}). @example @group emacs-build-time - @result{} (18846 52016 156039) + @result{} (20614 63694 515336 438000) @end group @end example @end defvar diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 40dfcaea043..8fe729d50f2 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -78,11 +78,11 @@ representations, @ref{Init Rebinding,,, emacs, The GNU Emacs Manual}. @defmac kbd keyseq-text This macro converts the text @var{keyseq-text} (a string constant) into a key sequence (a string or vector constant). The contents of -@var{keyseq-text} should describe the key sequence using almost the same -syntax used in this manual. More precisely, it uses the same syntax -that Edit Macro mode uses for editing keyboard macros (@pxref{Edit -Keyboard Macro,,, emacs, The GNU Emacs Manual}); you must surround -function key names with @samp{<@dots{}>}. +@var{keyseq-text} should use the same syntax as in the buffer invoked +by the @kbd{C-x C-k @key{RET}} (@code{kmacro-edit-macro}) command; in +particular, you must surround function key names with +@samp{<@dots{}>}. @xref{Edit Keyboard Macro,,, emacs, The GNU Emacs +Manual}. @example (kbd "C-x") @result{} "\C-x" @@ -1963,13 +1963,14 @@ is active for the next input event, that activates the keyboard menu feature. @menu -* Defining Menus:: How to make a keymap that defines a menu. -* Mouse Menus:: How users actuate the menu with the mouse. -* Keyboard Menus:: How users actuate the menu with the keyboard. -* Menu Example:: Making a simple menu. -* Menu Bar:: How to customize the menu bar. -* Tool Bar:: A tool bar is a row of images. -* Modifying Menus:: How to add new items to a menu. +* Defining Menus:: How to make a keymap that defines a menu. +* Mouse Menus:: How users actuate the menu with the mouse. +* Keyboard Menus:: How users actuate the menu with the keyboard. +* Menu Example:: Making a simple menu. +* Menu Bar:: How to customize the menu bar. +* Tool Bar:: A tool bar is a row of images. +* Modifying Menus:: How to add new items to a menu. +* Easy Menu:: A convenience macro for making menus. @end menu @node Defining Menus @@ -2015,17 +2016,12 @@ an existing menu, you can specify its position in the menu using @code{define-key-after} (@pxref{Modifying Menus}). @menu -* Simple Menu Items:: A simple kind of menu key binding, - limited in capabilities. -* Extended Menu Items:: More powerful menu item definitions - let you specify keywords to enable - various features. +* Simple Menu Items:: A simple kind of menu key binding. +* Extended Menu Items:: More complex menu item definitions. * Menu Separators:: Drawing a horizontal line through a menu. * Alias Menu Items:: Using command aliases in menu items. -* Toolkit Differences:: Not all toolkits provide the same features. @end menu - @node Simple Menu Items @subsubsection Simple Menu Items @@ -2312,28 +2308,6 @@ itself). To request this, give the alias symbol a non-@code{nil} causes menu items for @code{make-read-only} and @code{make-writable} to show the keyboard bindings for @code{read-only-mode}. -@node Toolkit Differences -@subsubsection Toolkit Differences - -The various toolkits with which you can build Emacs do not all support -the same set of features for menus. Some code works as expected with -one toolkit, but not under another. - -One example is menu actions or buttons in a top-level menu bar. The -following works with the Lucid toolkit or on MS Windows, but not with -GTK or Nextstep, where clicking on the item has no effect. - -@example -(defun menu-action-greet () - (interactive) - (message "Hello Emacs User!")) - -(defun top-level-menu () - (interactive) - (define-key lisp-interaction-mode-map [menu-bar m] - '(menu-item "Action Button" menu-action-greet))) -@end example - @node Mouse Menus @subsection Menus and the Mouse @@ -2813,3 +2787,125 @@ menu of Shell mode, after the item @code{break}: [work] '("Work" . work-command) 'break) @end example @end defun + +@node Easy Menu +@subsection Easy Menu + + The following macro provides a convenient way to define pop-up menus +and/or menu bar menus. + +@defmac easy-menu-define symbol maps doc menu +This macro defines a pop-up menu and/or menu bar submenu, whose +contents are given by @var{menu}. + +If @var{symbol} is non-@code{nil}, it should be a symbol; then this +macro defines @var{symbol} as a function for popping up the menu +(@pxref{Pop-Up Menus}), with @var{doc} as its documentation string. +@var{symbol} should not be quoted. + +Regardless of the value of @var{symbol}, if @var{maps} is a keymap, +the menu is added to that keymap, as a top-level menu for the menu bar +(@pxref{Menu Bar}). It can also be a list of keymaps, in which case +the menu is added separately to each of those keymaps. + +The first element of @var{menu} must be a string, which serves as the +menu label. It may be followed by any number of the following +keyword-argument pairs: + +@table @code +@item :filter @var{function} +@var{function} must be a function which, if called with one +argument---the list of the other menu items---returns the actual items +to be displayed in the menu. + +@item :visible @var{include} +@var{include} is an expression; if it evaluates to @code{nil}, the +menu is made invisible. @code{:included} is an alias for +@code{:visible}. + +@item :active @var{enable} +@var{enable} is an expression; if it evaluates to @code{nil}, the menu +is not selectable. @code{:enable} is an alias for @code{:active}. +@end table + +The remaining elements in @var{menu} are menu items. + +A menu item can be a vector of three elements, @code{[@var{name} +@var{callback} @var{enable}]}. @var{name} is the menu item name (a +string). @var{callback} is a command to run, or an expression to +evaluate, when the item is chosen. @var{enable} is an expression; if +it evaluates to @code{nil}, the item is disabled for selection. + +Alternatively, a menu item may have the form: + +@smallexample + [ @var{name} @var{callback} [ @var{keyword} @var{arg} ]... ] +@end smallexample + +@noindent +where @var{name} and @var{callback} have the same meanings as above, +and each optional @var{keyword} and @var{arg} pair should be one of +the following: + +@table @code +@item :keys @var{keys} +@var{keys} is a keyboard equivalent to the menu item (a string). This +is normally not needed, as keyboard equivalents are computed +automatically. @var{keys} is expanded with +@code{substitute-command-keys} before it is displayed (@pxref{Keys in +Documentation}). + +@item :key-sequence @var{keys} +@var{keys} is a hint for speeding up Emacs's first display of the +menu. It should be nil if you know that the menu item has no keyboard +equivalent; otherwise it should be a string or vector specifying a +keyboard equivalent for the menu item. + +@item :active @var{enable} +@var{enable} is an expression; if it evaluates to @code{nil}, the item +is make unselectable.. @code{:enable} is an alias for @code{:active}. + +@item :visible @var{include} +@var{include} is an expression; if it evaluates to @code{nil}, the +item is made invisible. @code{:included} is an alias for +@code{:visible}. + +@item :label @var{form} +@var{form} is an expression that is evaluated to obtain a value which +serves as the menu item's label (the default is @var{name}). + +@item :suffix @var{form} +@var{form} is an expression that is dynamically evaluated and whose +value is concatenated with the menu entry's label. + +@item :style @var{style} +@var{style} is a symbol describing the type of menu item; it should be +@code{toggle} (a checkbox), or @code{radio} (a radio button), or +anything else (meaning an ordinary menu item). + +@item :selected @var{selected} +@var{selected} is an expression; the checkbox or radio button is +selected whenever the expression's value is non-nil. + +@item :help @var{help} +@var{help} is a string describing the menu item. +@end table + +Alternatively, a menu item can be a string. Then that string appears +in the menu as unselectable text. A string consisting of dashes is +displayed as a separator (@pxref{Menu Separators}). + +Alternatively, a menu item can be a list with the same format as +@var{menu}. This is a submenu. +@end defmac + +Here is an example of using @code{easy-menu-define} to define a menu +similar to the one defined in the example in @ref{Menu Bar}: + +@example +(easy-menu-define words-menu global-map + "Menu for word navigation commands." + '("Words" + ["Forward word" forward-word] + ["Backward word" backward-word])) +@end example diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index d685ce0aa74..4a8740a5734 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1266,7 +1266,7 @@ functions for sets include @code{memq} and @code{delq}, and their @quotation @b{Common Lisp note:} Common Lisp has functions @code{union} (which avoids duplicate elements) and @code{intersection} for set operations. -Although standard GNU Emacs Lisp does not have them, the @file{cl} +Although standard GNU Emacs Lisp does not have them, the @file{cl-lib} library provides versions. @xref{Top,, Overview, cl, Common Lisp Extensions}. @end quotation diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index aa243185359..77a31cfde7a 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -897,8 +897,8 @@ It then restores any autoloads formerly associated with those symbols. Before restoring the previous definitions, @code{unload-feature} runs @code{remove-hook} to remove functions in the library from certain -hooks. These hooks include variables whose names end in @samp{hook} -or @samp{-hooks}, plus those listed in +hooks. These hooks include variables whose names end in @samp{-hook} +(or the deprecated suffix @samp{-hooks}), plus those listed in @code{unload-feature-special-hooks}, as well as @code{auto-mode-alist}. This is to prevent Emacs from ceasing to function because important hooks refer to functions that are no longer diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 8b5e3da493a..4e4d700aade 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -70,9 +70,9 @@ called. You can use @code{add-hook} to add a function to an abnormal hook, but you must write the function to follow the hook's calling convention. - By convention, abnormal hook names end in @samp{-functions} or -@samp{-hooks}. If the variable's name ends in @samp{-function}, then -its value is just a single function, not a list of functions. + By convention, abnormal hook names end in @samp{-functions}. If the +variable's name ends in @samp{-function}, then its value is just a single +function, not a list of functions. @menu * Running Hooks:: How to run a hook. diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 54754f8e5e9..6c5f6e85683 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1199,7 +1199,7 @@ Similarly, the fourth list element @var{picosec}, if present, gives the number of picoseconds from the start of that microsecond to the specified time. - The return value of @code{current-time} represents time using three + The return value of @code{current-time} represents time using four integers, as do the timestamps in the return value of @code{file-attributes} (@pxref{Definition of file-attributes}). In function arguments, e.g.@: the @var{time-value} @@ -1963,7 +1963,7 @@ is the character Emacs currently uses for quitting, usually @kbd{C-g}. This function returns a vector containing the last 300 input events from the keyboard or mouse. All input events are included, whether or not they were used as parts of key sequences. Thus, you always get the last -100 input events, not counting events generated by keyboard macros. +300 input events, not counting events generated by keyboard macros. (These are excluded because they are less interesting for debugging; it should be enough to see the events that invoked the macros.) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index a5910ea921b..50b97cd4204 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -1233,11 +1233,12 @@ reinsert it is @code{(abs @var{position})}. If @var{position} is positive, point was at the beginning of the deleted text, otherwise it was at the end. -@item (t @var{high} . @var{low}) +@item (t @var{sec-high} @var{sec-low} @var{microsec} @var{picosec}) This kind of element indicates that an unmodified buffer became -modified. The elements @var{high} and @var{low} are two integers, each -recording 16 bits of the visited file's modification time as of when it -was previously visited or saved. @code{primitive-undo} uses those +modified. The list @code{(@var{sec-high} @var{sec-low} @var{microsec} +@var{picosec})} represents the visited file's modification time as of +when it was previously visited or saved, using the same format as +@code{current-time}; see @ref{Time of Day}. @code{primitive-undo} uses those values to determine whether to mark the buffer as unmodified once again; it does so only if the file's modification time matches those numbers. diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 0c7282c3586..4336baa128f 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -120,15 +120,18 @@ library when needed. This way people who don't use those aspects of your file do not need to load the extra library. @item -Please don't require the @code{cl} package of Common Lisp extensions at -run time. Use of this package is optional, and it is not part of the -standard Emacs namespace. If your package loads @code{cl} at run time, -that could cause name clashes for users who don't use that package. +If you need Common Lisp extensions, use the @code{cl-lib} library +rather than the old @code{cl} library. The latter does not +use a clean namespace (i.e., its definitions do not +start with a @samp{cl-} prefix). If your package loads @code{cl} at +run time, that could cause name clashes for users who don't use that +package. -However, there is no problem with using the @code{cl} package at -compile time, with @code{(eval-when-compile (require 'cl))}. That's +There is no problem with using the @code{cl} package at @emph{compile} +time, with @code{(eval-when-compile (require 'cl))}. That's sufficient for using the macros in the @code{cl} package, because the -compiler expands them before generating the byte-code. +compiler expands them before generating the byte-code. It is still +better to use the more modern @code{cl-lib} in this case, though. @item When defining a major mode, please follow the major mode diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 3ee183ff255..76859e09d42 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,32 @@ +2012-10-24 Glenn Morris + + * cl.texi (Basic Setf, Macros, Declarations, Symbols, Numbers) + (Sequences, Lists, Structures, Assertions, Efficiency Concerns) + (Efficiency Concerns, Efficiency Concerns) + (Common Lisp Compatibility, Old CL Compatibility): + Further updates for cl-lib namespace. + +2012-10-24 Paul Eggert + + Update manual for new time stamp format (Bug#12706). + * emacs-mime.texi (time-date): Update for new format. + Also, fix bogus time stamp and modernize a bit. + +2012-10-23 Glenn Morris + + * cl.texi: Include emacsver.texi. Use Emacs version number rather + than unchanging cl.el version number. + End all menu descriptions with a period. + Do not use @dfn{CL} for every instance of "CL". + (Overview): Remove no-runtime caveat, and note about foo* names. + (Usage): Use cl-lib rather than cl. + (Organization, Naming Conventions): Update for cl-lib.el. + (Installation): Remove long-irrelevant node. + (Program Structure, Predicates, Control Structure): + Start updating for cl-lib namespace. + * Makefile.in ($(buildinfodir)/cl$(INFO_EXT), cl.dvi, cl.pdf): + Depend on emacsver.texi. + 2012-10-09 Michael Albinus * trampver.texi: Update release number. diff --git a/doc/misc/Makefile.in b/doc/misc/Makefile.in index 5ce6d82e683..ea1e87333bd 100644 --- a/doc/misc/Makefile.in +++ b/doc/misc/Makefile.in @@ -237,12 +237,12 @@ cc-mode.pdf: ${srcdir}/cc-mode.texi $(ENVADD) $(TEXI2PDF) ${srcdir}/cc-mode.texi cl : $(buildinfodir)/cl$(INFO_EXT) -$(buildinfodir)/cl$(INFO_EXT): ${srcdir}/cl.texi +$(buildinfodir)/cl$(INFO_EXT): ${srcdir}/cl.texi $(emacsdir)/emacsver.texi $(mkinfodir) $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/cl.texi -cl.dvi: ${srcdir}/cl.texi +cl.dvi: ${srcdir}/cl.texi $(emacsdir)/emacsver.texi $(ENVADD) $(TEXI2DVI) ${srcdir}/cl.texi -cl.pdf: ${srcdir}/cl.texi +cl.pdf: ${srcdir}/cl.texi $(emacsdir)/emacsver.texi $(ENVADD) $(TEXI2PDF) ${srcdir}/cl.texi dbus : $(buildinfodir)/dbus$(INFO_EXT) diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 18abb0647a2..5908e94be02 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -1,6 +1,7 @@ \input texinfo @c -*-texinfo-*- @setfilename ../../info/cl @settitle Common Lisp Extensions +@include emacsver.texi @copying This file documents the GNU Emacs Common Lisp emulation package. @@ -34,7 +35,7 @@ developing GNU and promoting software freedom.'' @sp 4 @center For GNU Emacs Lisp @sp 1 -@center Version 2.02 +@center as distributed with Emacs @value{EMACSVER} @sp 5 @center Dave Gillespie @center daveg@@synaptics.com @@ -53,23 +54,23 @@ developing GNU and promoting software freedom.'' @end ifnottex @menu -* Overview:: Installation, usage, etc. -* Program Structure:: Arglists, @code{eval-when}, @code{defalias} -* Predicates:: @code{typep} and @code{equalp} -* Control Structure:: @code{setf}, @code{do}, @code{loop}, etc. -* Macros:: Destructuring, @code{define-compiler-macro} -* Declarations:: @code{proclaim}, @code{declare}, etc. -* Symbols:: Property lists, @code{gensym} -* Numbers:: Predicates, functions, random numbers -* Sequences:: Mapping, functions, searching, sorting -* Lists:: @code{caddr}, @code{sublis}, @code{member*}, @code{assoc*}, etc. -* Structures:: @code{defstruct} -* Assertions:: @code{check-type}, @code{assert}, @code{ignore-errors}. +* Overview:: Basics, usage, etc. +* Program Structure:: Arglists, @code{cl-eval-when}, @code{defalias}. +* Predicates:: @code{cl-typep} and @code{cl-equalp}. +* Control Structure:: @code{setf}, @code{cl-do}, @code{cl-loop}, etc. +* Macros:: Destructuring, @code{cl-define-compiler-macro}. +* Declarations:: @code{cl-proclaim}, @code{cl-declare}, etc. +* Symbols:: Property lists, @code{cl-gensym}. +* Numbers:: Predicates, functions, random numbers. +* Sequences:: Mapping, functions, searching, sorting. +* Lists:: @code{cl-caddr}, @code{cl-sublis}, @code{cl-member}, @code{cl-assoc}, etc. +* Structures:: @code{cl-defstruct}. +* Assertions:: @code{cl-check-type}, @code{cl-assert}, @code{ignore-errors}. -* Efficiency Concerns:: Hints and techniques -* Common Lisp Compatibility:: All known differences with Steele -* Old CL Compatibility:: All known differences with old cl.el -* Porting Common Lisp:: Hints for porting Common Lisp code +* Efficiency Concerns:: Hints and techniques. +* Common Lisp Compatibility:: All known differences with Steele. +* Old CL Compatibility:: All known differences with old cl.el. +* Porting Common Lisp:: Hints for porting Common Lisp code. * GNU Free Documentation License:: The license for this documentation. * Function Index:: @@ -92,21 +93,11 @@ As Emacs Lisp programmers have grown in number, and the applications they write have grown more ambitious, it has become clear that Emacs Lisp could benefit from many of the conveniences of Common Lisp. -The @dfn{CL} package adds a number of Common Lisp functions and +The @code{CL} package adds a number of Common Lisp functions and control structures to Emacs Lisp. While not a 100% complete -implementation of Common Lisp, @dfn{CL} adds enough functionality +implementation of Common Lisp, @code{CL} adds enough functionality to make Emacs Lisp programming significantly more convenient. -@strong{Please note:} the @dfn{CL} functions are not standard parts of -the Emacs Lisp name space, so it is legitimate for users to define -them with other, conflicting meanings. To avoid conflicting with -those user activities, we have a policy that packages installed in -Emacs must not load @dfn{CL} at run time. (It is ok for them to load -@dfn{CL} at compile time only, with @code{eval-when-compile}, and use -the macros it provides.) If you are writing packages that you plan to -distribute and invite widespread use for, you might want to observe -the same rule. - Some Common Lisp features have been omitted from this package for various reasons: @@ -119,152 +110,131 @@ examples of this group. @item Other features cannot be implemented without modification to the Emacs Lisp interpreter itself, such as multiple return values, -lexical scoping, case-insensitive symbols, and complex numbers. -The @dfn{CL} package generally makes no attempt to emulate these +case-insensitive symbols, and complex numbers. +The @code{CL} package generally makes no attempt to emulate these features. -@item -Some features conflict with existing things in Emacs Lisp. For -example, Emacs's @code{assoc} function is incompatible with the -Common Lisp @code{assoc}. In such cases, this package usually -adds the suffix @samp{*} to the function name of the Common -Lisp version of the function (e.g., @code{assoc*}). @end itemize -The package described here was written by Dave Gillespie, -@file{daveg@@synaptics.com}. It is a total rewrite of the original +The package described here was originally written by Dave Gillespie, +@file{daveg@@synaptics.com}, as a total rewrite of an earlier 1986 @file{cl.el} package by Cesar Quiroz. Most features of the -Quiroz package have been retained; any incompatibilities are +Quiroz package were retained; any incompatibilities are noted in the descriptions below. Care has been taken in this version to ensure that each function is defined efficiently, concisely, and with minimal impact on the rest of the Emacs -environment. +environment. Stefan Monnier added the file @file{cl-lib.el} and +rationalized the namespace for Emacs 24.3. @menu -* Usage:: How to use the CL package -* Organization:: The package's five component files -* Installation:: Compiling and installing CL -* Naming Conventions:: Notes on CL function names +* Usage:: How to use the CL package. +* Organization:: The package's five component files. +* Naming Conventions:: Notes on CL function names. @end menu @node Usage @section Usage @noindent -Lisp code that uses features from the @dfn{CL} package should -include at the beginning: +The @code{CL} package is distributed with Emacs, so there is no need +to install any additional files in order to start using it. Lisp code +that uses features from the @code{CL} package should simply include at +the beginning: @example -(require 'cl) +(require 'cl-lib) @end example @noindent -It is safe to arrange to load @dfn{CL} at all times, e.g., -in your @file{.emacs} file. But it's a good idea, for portability, -to @code{(require 'cl)} in your code even if you do this. +You may wish to add such a statement to your init file, if you +make frequent use of CL features. @node Organization @section Organization @noindent -The Common Lisp package is organized into four files: +The Common Lisp package is organized into four main files: @table @file -@item cl.el -This is the ``main'' file, which contains basic functions -and information about the package. This file is relatively -compact---about 700 lines. +@item cl-lib.el +This is the main file, which contains basic functions +and information about the package. This file is relatively compact. @item cl-extra.el This file contains the larger, more complex or unusual functions. It is kept separate so that packages which only want to use Common -Lisp fundamentals like the @code{cadr} function won't need to pay +Lisp fundamentals like the @code{cl-incf} function won't need to pay the overhead of loading the more advanced functions. @item cl-seq.el This file contains most of the advanced functions for operating -on sequences or lists, such as @code{delete-if} and @code{assoc*}. +on sequences or lists, such as @code{cl-delete-if} and @code{cl-assoc}. @item cl-macs.el -This file contains the features of the packages which are macros -instead of functions. Macros expand when the caller is compiled, -not when it is run, so the macros generally only need to be -present when the byte-compiler is running (or when the macros are -used in uncompiled code such as a @file{.emacs} file). Most of -the macros of this package are isolated in @file{cl-macs.el} so -that they won't take up memory unless you are compiling. +This file contains the features that are macros instead of functions. +Macros expand when the caller is compiled, not when it is run, so the +macros generally only need to be present when the byte-compiler is +running (or when the macros are used in uncompiled code). Most of the +macros of this package are isolated in @file{cl-macs.el} so that they +won't take up memory unless you are compiling. @end table -The file @file{cl.el} includes all necessary @code{autoload} +The file @file{cl-lib.el} includes all necessary @code{autoload} commands for the functions and macros in the other three files. -All you have to do is @code{(require 'cl)}, and @file{cl.el} +All you have to do is @code{(require 'cl-lib)}, and @file{cl-lib.el} will take care of pulling in the other files when they are needed. -There is another file, @file{cl-compat.el}, which defines some -routines from the older @file{cl.el} package that are not otherwise +There is another file, @file{cl.el}, which was the main entry point +to the CL package prior to Emacs 24.3. Nowadays, it is replaced +by @file{cl-lib.el}. The two provide the same features, but use +different function names (in fact, @file{cl.el} just defines aliases +to the @file{cl-lib.el} definitions). In particular, the old @file{cl.el} +does not use a clean namespace. For this reason, Emacs has a policy +that packages distributed with Emacs must not load @code{cl} at run time. +(It is ok for them to load @code{cl} at @emph{compile} time, with +@code{eval-when-compile}, and use the macros it provides.) There is +no such restriction on the use of @code{cl-lib}. New code should use +@code{cl-lib} rather than @code{cl}. @xref{Naming Conventions}. + +There is one more file, @file{cl-compat.el}, which defines some +routines from the older CL package that are not otherwise present in the new package. This includes internal routines like @code{setelt} and @code{zip-lists}, deprecated features like @code{defkeyword}, and an emulation of the old-style multiple-values feature. This file is obsolete and should not be used in new code. @xref{Old CL Compatibility}. -@node Installation -@section Installation - -@noindent -The @dfn{CL} package is distributed with Emacs, so there is no need -to install anything. - -If you do need to install it, just put the byte-compiled files -@file{cl.elc}, @file{cl-extra.elc}, @file{cl-seq.elc}, -@file{cl-macs.elc}, and (if necessary) @file{cl-compat.elc} into a -directory on your @code{load-path}. Also, format the @file{cl.texi} -file and put the resulting Info files into a directory in your -@code{Info-directory-list}. - @node Naming Conventions @section Naming Conventions @noindent Except where noted, all functions defined by this package have the -same names and calling conventions as their Common Lisp counterparts. - -Following is a complete list of functions whose names were changed -from Common Lisp, usually to avoid conflicts with Emacs. In each -case, a @samp{*} has been appended to the Common Lisp name to obtain -the Emacs name: - -@example -defun* defsubst* defmacro* function* -member* assoc* rassoc* get* -remove* delete* mapcar* sort* -floor* ceiling* truncate* round* -mod* rem* random* -@end example +same calling conventions as their Common Lisp counterparts, and +names that are those of Common Lisp plus a @samp{cl-} prefix. Internal function and variable names in the package are prefixed -by @code{cl-}. Here is a complete list of functions @emph{not} -prefixed by @code{cl-} which were not taken from Common Lisp: +by @code{cl--}. Here is a complete list of functions prefixed by +@code{cl-} that were not taken from Common Lisp: +@c FIXME lexical-let lexical-let* @example -floatp-safe lexical-let lexical-let* -callf callf2 letf letf* -defsubst* +cl-callf cl-callf2 cl-defsubst +cl-floatp-safe cl-letf cl-letf* @end example -The following simple functions and macros are defined in @file{cl.el}; +The following simple functions and macros are defined in @file{cl-lib.el}; they do not cause other components like @file{cl-extra} to be loaded. @example -floatp-safe endp -evenp oddp plusp minusp -caaar .. cddddr -list* ldiff rest first .. tenth -copy-list subst mapcar* [2] -adjoin [3] acons pairlis pop [4] -push [4] pushnew [3,4] incf [4] decf [4] -proclaim declaim +cl-floatp-safe cl-endp +cl-evenp cl-oddp cl-plusp cl-minusp +cl-caaar .. cl-cddddr +cl-list* cl-ldiff cl-rest cl-first .. cl-tenth +cl-copy-list cl-subst cl-mapcar [2] +cl-adjoin [3] cl-acons cl-pairlis +cl-pushnew [3,4] cl-incf [4] cl-decf [4] +cl-proclaim cl-declaim @end example @noindent @@ -281,13 +251,13 @@ and @code{:key} is not used. @chapter Program Structure @noindent -This section describes features of the @dfn{CL} package which have to +This section describes features of the @code{CL} package that have to do with programs as a whole: advanced argument lists for functions, -and the @code{eval-when} construct. +and the @code{cl-eval-when} construct. @menu -* Argument Lists:: @code{&key}, @code{&aux}, @code{defun*}, @code{defmacro*}. -* Time of Evaluation:: The @code{eval-when} construct. +* Argument Lists:: @code{&key}, @code{&aux}, @code{cl-defun}, @code{cl-defmacro}. +* Time of Evaluation:: The @code{cl-eval-when} construct. @end menu @iftex @@ -309,26 +279,26 @@ this package to implement Common Lisp argument lists seamlessly. 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... +@defspec cl-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... -This is just like @code{defun*}, except that the function that +@defspec cl-defsubst name arglist body... +This is just like @code{cl-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. This is analogous to the @code{defsubst} form; -@code{defsubst*} uses a different method (compiler macros) which +@code{cl-defsubst} uses a different method (compiler macros) which works in all versions of Emacs, and also generates somewhat more -efficient inline expansions. In particular, @code{defsubst*} +efficient inline expansions. In particular, @code{cl-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... +@defspec cl-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 @@ -339,19 +309,19 @@ The macro expander body is enclosed in an implicit block called @var{name}. @end defspec -@defspec function* symbol-or-lambda +@defspec cl-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 -Also, all forms (such as @code{defsetf} and @code{flet}) defined +Also, all forms (such as @code{cl-flet} and @code{cl-labels}) defined in this package that include @var{arglist}s in their syntax allow full Common Lisp argument lists. -Note that it is @emph{not} necessary to use @code{defun*} in -order to have access to most @dfn{CL} features in your function. -These features are always present; @code{defun*}'s only +Note that it is @emph{not} necessary to use @code{cl-defun} in +order to have access to most @code{CL} features in your function. +These features are always present; @code{cl-defun}'s only difference from @code{defun} is its more flexible argument lists and its implicit block. @@ -401,7 +371,7 @@ are optional arguments which are specified by name rather than positionally in the argument list. For example, @example -(defun* foo (a &optional b &key c d (e 17))) +(cl-defun foo (a &optional b &key c d (e 17))) @end example @noindent @@ -427,7 +397,7 @@ You can also explicitly specify the keyword argument; it need not be simply the variable name prefixed with a colon. For example, @example -(defun* bar (&key (a 1) ((baz b) 4))) +(cl-defun bar (&key (a 1) ((baz b) 4))) @end example @noindent @@ -453,16 +423,16 @@ the ``rest'' argument is bound to the keyword list as it appears in the call. For example: @smallexample -(defun* find-thing (thing &rest rest &key need &allow-other-keys) - (or (apply 'member* thing thing-list :allow-other-keys t rest) +(cl-defun find-thing (thing &rest rest &key need &allow-other-keys) + (or (apply 'cl-member thing thing-list :allow-other-keys t rest) (if need (error "Thing not found")))) @end smallexample @noindent This function takes a @code{:need} keyword argument, but also accepts other keyword arguments which are passed on to the -@code{member*} function. @code{allow-other-keys} is used to -keep both @code{find-thing} and @code{member*} from complaining +@code{cl-member} function. @code{allow-other-keys} is used to +keep both @code{find-thing} and @code{cl-member} from complaining about each others' keywords in the arguments. The fifth section of the argument list consists of @dfn{auxiliary @@ -473,17 +443,17 @@ difference between the following two functions, except for a matter of stylistic taste: @example -(defun* foo (a b &aux (c (+ a b)) d) +(cl-defun foo (a b &aux (c (+ a b)) d) @var{body}) -(defun* foo (a b) +(cl-defun foo (a b) (let ((c (+ a b)) d) @var{body})) @end example Argument lists support @dfn{destructuring}. In Common Lisp, destructuring is only allowed with @code{defmacro}; this package -allows it with @code{defun*} and other argument lists as well. +allows it with @code{cl-defun} and other argument lists as well. In destructuring, any argument variable (@var{var} in the above diagram) can be replaced by a list of variables, or more generally, a recursive argument list. The corresponding argument value must @@ -491,7 +461,7 @@ be a list whose elements match this recursive argument list. For example: @example -(defmacro* dolist ((var listform &optional resultform) +(cl-defmacro dolist ((var listform &optional resultform) &rest body) ...) @end example @@ -532,21 +502,21 @@ For example, the compiler effectively evaluates @code{defmacro} forms at compile-time so that later parts of the file can refer to the macros that are defined. -@defspec eval-when (situations...) forms... +@defspec cl-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 ANSI equivalents, @code{:compile-toplevel}, @code{:load-toplevel}, and @code{:execute}). -The @code{eval-when} form is handled differently depending on +The @code{cl-eval-when} form is handled differently depending on whether or not it is being compiled as a top-level form. Specifically, it gets special treatment if it is being compiled by a command such as @code{byte-compile-file} which compiles files or buffers of code, and it appears either literally at the top level of the file or inside a top-level @code{progn}. -For compiled top-level @code{eval-when}s, the body @var{forms} are +For compiled top-level @code{cl-eval-when}s, the body @var{forms} are executed at compile-time if @code{compile} is in the @var{situations} list, and the @var{forms} are written out to the file (to be executed at load-time) if @code{load} is in the @var{situations} list. @@ -554,11 +524,11 @@ at load-time) if @code{load} is in the @var{situations} list. For non-compiled-top-level forms, only the @code{eval} situation is relevant. (This includes forms executed by the interpreter, forms compiled with @code{byte-compile} rather than @code{byte-compile-file}, -and non-top-level forms.) The @code{eval-when} acts like a +and non-top-level forms.) The @code{cl-eval-when} acts like a @code{progn} if @code{eval} is specified, and like @code{nil} (ignoring the body @var{forms}) if not. -The rules become more subtle when @code{eval-when}s are nested; +The rules become more subtle when @code{cl-eval-when}s are nested; consult Steele (second edition) for the gruesome details (and some gruesome examples). @@ -566,13 +536,13 @@ Some simple examples: @example ;; Top-level forms in foo.el: -(eval-when (compile) (setq foo1 'bar)) -(eval-when (load) (setq foo2 'bar)) -(eval-when (compile load) (setq foo3 'bar)) -(eval-when (eval) (setq foo4 'bar)) -(eval-when (eval compile) (setq foo5 'bar)) -(eval-when (eval load) (setq foo6 'bar)) -(eval-when (eval compile load) (setq foo7 'bar)) +(cl-eval-when (compile) (setq foo1 'bar)) +(cl-eval-when (load) (setq foo2 'bar)) +(cl-eval-when (compile load) (setq foo3 'bar)) +(cl-eval-when (eval) (setq foo4 'bar)) +(cl-eval-when (eval compile) (setq foo5 'bar)) +(cl-eval-when (eval load) (setq foo6 'bar)) +(cl-eval-when (eval compile load) (setq foo7 'bar)) @end example When @file{foo.el} is compiled, these variables will be set during @@ -595,18 +565,18 @@ be set: foo4 foo5 foo6 foo7 ; `eval' @end example -If these seven @code{eval-when}s had been, say, inside a @code{defun}, +If these seven @code{cl-eval-when}s had been, say, inside a @code{defun}, then the first three would have been equivalent to @code{nil} and the last four would have been equivalent to the corresponding @code{setq}s. -Note that @code{(eval-when (load eval) @dots{})} is equivalent +Note that @code{(cl-eval-when (load eval) @dots{})} is equivalent to @code{(progn @dots{})} in all contexts. The compiler treats 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 -Emacs includes two special forms related to @code{eval-when}. +Emacs includes two special forms related to @code{cl-eval-when}. One of these, @code{eval-when-compile}, is not quite equivalent to any @code{eval-when} construct and is described below. @@ -625,7 +595,7 @@ or other reasons. This form is similar to the @samp{#.} syntax of true Common Lisp. @end defspec -@defspec load-time-value form +@defspec cl-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. @@ -633,12 +603,12 @@ Early Common Lisp had a @samp{#,} syntax that was similar to this, but ANSI Common Lisp replaced it with @code{load-time-value} and gave it more well-defined semantics. -In a compiled file, @code{load-time-value} arranges for @var{form} +In a compiled file, @code{cl-load-time-value} arranges for @var{form} to be evaluated when the @file{.elc} file is loaded and then used as if it were a quoted constant. In code compiled by @code{byte-compile} rather than @code{byte-compile-file}, the effect is identical to @code{eval-when-compile}. In uncompiled -code, both @code{eval-when-compile} and @code{load-time-value} +code, both @code{eval-when-compile} and @code{cl-load-time-value} act exactly like @code{progn}. @example @@ -649,7 +619,7 @@ act exactly like @code{progn}. (eval-when-compile (current-time-string)) ;; or '#.(current-time-string) in real Common Lisp ", and loaded on: " - (load-time-value (current-time-string)))) + (cl-load-time-value (current-time-string)))) @end example @noindent @@ -676,21 +646,21 @@ This section describes functions for testing whether various facts are true or false. @menu -* Type Predicates:: @code{typep}, @code{deftype}, and @code{coerce} -* Equality Predicates:: @code{equalp} +* Type Predicates:: @code{cl-typep}, @code{cl-deftype}, and @code{cl-coerce}. +* Equality Predicates:: @code{cl-equalp}. @end menu @node Type Predicates @section Type Predicates @noindent -The @dfn{CL} package defines a version of the Common Lisp @code{typep} +The @code{CL} package defines a version of the Common Lisp @code{typep} predicate. -@defun typep object type +@defun cl-typep object type Check if @var{object} is of type @var{type}, where @var{type} is a (quoted) type name of the sort used by Common Lisp. For example, -@code{(typep foo 'integer)} is equivalent to @code{(integerp foo)}. +@code{(cl-typep foo 'integer)} is equivalent to @code{(integerp foo)}. @end defun The @var{type} argument to the above function is either a symbol @@ -705,18 +675,18 @@ than @samp{-p} are used when appropriate.) @item The type symbol @code{t} stands for the union of all types. -@code{(typep @var{object} t)} is always true. Likewise, the +@code{(cl-typep @var{object} t)} is always true. Likewise, the type symbol @code{nil} stands for nothing at all, and -@code{(typep @var{object} nil)} is always false. +@code{(cl-typep @var{object} nil)} is always false. @item The type symbol @code{null} represents the symbol @code{nil}. -Thus @code{(typep @var{object} 'null)} is equivalent to +Thus @code{(cl-typep @var{object} 'null)} is equivalent to @code{(null @var{object})}. @item The type symbol @code{atom} represents all objects that are not cons -cells. Thus @code{(typep @var{object} 'atom)} is equivalent to +cells. Thus @code{(cl-typep @var{object} 'atom)} is equivalent to @code{(atom @var{object})}. @item @@ -728,7 +698,7 @@ The type symbols @code{character} and @code{string-char} match integers in the range from 0 to 255. @item -The type symbol @code{float} uses the @code{floatp-safe} predicate +The type symbol @code{float} uses the @code{cl-floatp-safe} predicate defined by this package rather than @code{floatp}, so it will work correctly even in Emacs versions without floating-point support. @@ -750,7 +720,7 @@ combinations of types. For example, @code{(or integer (float 0 *))} represents all objects that are integers or non-negative floats. @item -Lists beginning with @code{member} or @code{member*} represent +Lists beginning with @code{member} or @code{cl-member} represent objects @code{eql} to any of the following values. For example, @code{(member 1 2 3 4)} is equivalent to @code{(integer 1 4)}, and @code{(member nil)} is equivalent to @code{null}. @@ -762,9 +732,9 @@ with that object as an argument. @end itemize The following function and macro (not technically predicates) are -related to @code{typep}. +related to @code{cl-typep}. -@defun coerce object type +@defun cl-coerce object type This function attempts to convert @var{object} to the specified @var{type}. If @var{object} is already of that type as determined by @code{typep}, it is simply returned. Otherwise, certain types of @@ -774,28 +744,28 @@ converted to that type if possible. If @var{type} is @code{character}, then strings of length one and symbols with one-character names can be coerced. If @var{type} is @code{float}, then integers can be coerced in versions of Emacs that support -floats. In all other circumstances, @code{coerce} signals an +floats. In all other circumstances, @code{cl-coerce} signals an error. @end defun -@defspec deftype name arglist forms... +@defspec cl-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 return a type specifier that is equivalent to the type. The @var{arglist} is a Common Lisp argument list of the sort accepted -by @code{defmacro*}. The type specifier @samp{(@var{name} @var{args}...)} +by @code{cl-defmacro}. The type specifier @samp{(@var{name} @var{args}...)} is expanded by calling the expander with those arguments; the type symbol @samp{@var{name}} is expanded by calling the expander with no arguments. The @var{arglist} is processed the same as for -@code{defmacro*} except that optional arguments without explicit +@code{cl-defmacro} except that optional arguments without explicit defaults use @code{*} instead of @code{nil} as the ``default'' default. Some examples: @example -(deftype null () '(satisfies null)) ; predefined -(deftype list () '(or null cons)) ; predefined -(deftype unsigned-byte (&optional bits) +(cl-deftype null () '(satisfies null)) ; predefined +(cl-deftype list () '(or null cons)) ; predefined +(cl-deftype unsigned-byte (&optional bits) (list 'integer 0 (if (eq bits '*) bits (1- (lsh 1 bits))))) (unsigned-byte 8) @equiv{} (integer 0 255) (unsigned-byte) @equiv{} (integer 0 *) @@ -808,21 +778,21 @@ type specifier could be implemented if desired; this package does not implement @code{unsigned-byte} by default. @end defspec -The @code{typecase} and @code{check-type} macros also use type -names. @xref{Conditionals}. @xref{Assertions}. The @code{map}, -@code{concatenate}, and @code{merge} functions take type-name +The @code{cl-typecase} and @code{cl-check-type} macros also use type +names. @xref{Conditionals}. @xref{Assertions}. The @code{cl-map}, +@code{cl-concatenate}, and @code{cl-merge} functions take type-name arguments to specify the type of sequence to return. @xref{Sequences}. @node Equality Predicates @section Equality Predicates @noindent -This package defines the Common Lisp predicate @code{equalp}. +This package defines the Common Lisp predicate @code{cl-equalp}. -@defun equalp a b +@defun cl-equalp a b This function is a more flexible version of @code{equal}. In particular, it compares strings case-insensitively, and it compares -numbers without regard to type (so that @code{(equalp 3 3.0)} is +numbers without regard to type (so that @code{(cl-equalp 3 3.0)} is true). Vectors and conses are compared recursively. All other objects are compared as if by @code{equal}. @@ -831,15 +801,15 @@ respects. First, Common Lisp's @code{equalp} also compares @emph{characters} case-insensitively, which would be impractical in this package since Emacs does not distinguish between integers and characters. In keeping with the idea that strings are less -vector-like in Emacs Lisp, this package's @code{equalp} also will +vector-like in Emacs Lisp, this package's @code{cl-equalp} also will not compare strings against vectors of integers. @end defun Also note that the Common Lisp functions @code{member} and @code{assoc} use @code{eql} to compare elements, whereas Emacs Lisp follows the MacLisp tradition and uses @code{equal} for these two functions. -In Emacs, use @code{member*} and @code{assoc*} to get functions -which use @code{eql} for comparisons. +In Emacs, use @code{memq} (or @code{cl-member}) and @code{assq} (or +@code{cl-assoc}) to get functions which use @code{eql} for comparisons. @node Control Structure @chapter Control Structure @@ -847,28 +817,32 @@ which use @code{eql} for comparisons. @noindent The features described in the following sections implement various advanced control structures, including the powerful +@c FIXME setf is now in gv.el, not cl. @code{setf} facility and a number of looping and conditional constructs. +@c FIXME setf, push are standard now. +@c lexical-let is obsolete; flet is not cl-flet. +@c values is not cl-values. @menu -* Assignment:: The @code{psetq} form -* Generalized Variables:: @code{setf}, @code{incf}, @code{push}, etc. -* Variable Bindings:: @code{progv}, @code{lexical-let}, @code{flet}, @code{macrolet} -* Conditionals:: @code{case}, @code{typecase} -* Blocks and Exits:: @code{block}, @code{return}, @code{return-from} -* Iteration:: @code{do}, @code{dotimes}, @code{dolist}, @code{do-symbols} -* Loop Facility:: The Common Lisp @code{loop} macro -* Multiple Values:: @code{values}, @code{multiple-value-bind}, etc. +* Assignment:: The @code{cl-psetq} form. +* Generalized Variables:: @code{setf}, @code{cl-incf}, @code{push}, etc. +* Variable Bindings:: @code{cl-progv}, @code{lexical-let}, @code{flet}, @code{cl-macrolet}. +* Conditionals:: @code{cl-case}, @code{cl-typecase}. +* Blocks and Exits:: @code{cl-block}, @code{cl-return}, @code{cl-return-from}. +* Iteration:: @code{cl-do}, @code{cl-dotimes}, @code{cl-dolist}, @code{cl-do-symbols}. +* Loop Facility:: The Common Lisp @code{cl-loop} macro. +* Multiple Values:: @code{values}, @code{cl-multiple-value-bind}, etc. @end menu @node Assignment @section Assignment @noindent -The @code{psetq} form is just like @code{setq}, except that multiple +The @code{cl-psetq} form is just like @code{setq}, except that multiple assignments are done in parallel rather than sequentially. -@defspec psetq [symbol form]@dots{} +@defspec cl-psetq [symbol form]@dots{} This special form (actually a 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} @@ -883,21 +857,22 @@ x y ; @r{@code{y} was computed after @code{x} was set.} @result{} 15 (setq x 2 y 3) -(psetq x (+ x y) y (* x y)) +(cl-psetq x (+ x y) y (* x y)) x @result{} 5 y ; @r{@code{y} was computed before @code{x} was set.} @result{} 6 @end example -The simplest use of @code{psetq} is @code{(psetq x y y x)}, which -exchanges the values of two variables. (The @code{rotatef} form +The simplest use of @code{cl-psetq} is @code{(cl-psetq x y y x)}, which +exchanges the values of two variables. (The @code{cl-rotatef} form provides an even more convenient way to swap two variables; @pxref{Modify Macros}.) -@code{psetq} always returns @code{nil}. +@code{cl-psetq} always returns @code{nil}. @end defspec +@c FIXME now in gv.el. @node Generalized Variables @section Generalized Variables @@ -922,9 +897,9 @@ Just as certain forms like @code{a[i]} can be lvalues in C, there is a set of forms that can be generalized variables in Lisp. @menu -* Basic Setf:: @code{setf} and place forms -* Modify Macros:: @code{incf}, @code{push}, @code{rotatef}, @code{letf}, @code{callf}, etc. -* Customizing Setf:: @code{define-modify-macro}, @code{defsetf}, @code{define-setf-method} +* Basic Setf:: @code{setf} and place forms. +* Modify Macros:: @code{cl-incf}, @code{push}, @code{cl-rotatef}, @code{letf}, @code{cl-callf}, etc. +* Customizing Setf:: @code{define-modify-macro}, @code{defsetf}, @code{define-setf-method}. @end menu @node Basic Setf @@ -1072,11 +1047,11 @@ The @code{setf} macro takes care to evaluate all subforms in the proper left-to-right order; for example, @example -(setf (aref vec (incf i)) i) +(setf (aref vec (cl-incf i)) i) @end example @noindent -looks like it will evaluate @code{(incf i)} exactly once, before the +looks like it will evaluate @code{(cl-incf i)} exactly once, before the following access to @code{i}; the @code{setf} expander will insert temporary variables as necessary to ensure that it does in fact work this way no matter what setf-method is defined for @code{aref}. @@ -1106,25 +1081,25 @@ This package defines a number of other macros besides @code{setf} 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{} -This macro is to @code{setf} what @code{psetq} is to @code{setq}: +@defspec cl-psetf [place form]@dots{} +This macro is to @code{setf} what @code{cl-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 +@defspec cl-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 -@code{(incf (car x) 2)} is equivalent to @code{(setcar x (+ (car x) 2))}. +example, @code{(cl-incf i)} is equivalent to @code{(setq i (1+ i))}, and +@code{(cl-incf (car x) 2)} is equivalent to @code{(setcar x (+ (car x) 2))}. Once again, care is taken to preserve the ``apparent'' order of evaluation. For example, @example -(incf (aref vec (incf i))) +(cl-incf (aref vec (cl-incf i))) @end example @noindent @@ -1134,27 +1109,27 @@ does, which means the above form is @emph{not} equivalent to the ``obvious'' expansion, @example -(setf (aref vec (incf i)) (1+ (aref vec (incf i)))) ; Wrong! +(setf (aref vec (cl-incf i)) (1+ (aref vec (cl-incf i)))) ; Wrong! @end example @noindent but rather to something more like @example -(let ((temp (incf i))) +(let ((temp (cl-incf i))) (setf (aref vec temp) (1+ (aref vec temp)))) @end example @noindent -Again, all of this is taken care of automatically by @code{incf} and +Again, all of this is taken care of automatically by @code{cl-incf} and the other generalized-variable macros. -As a more Emacs-specific example of @code{incf}, the expression -@code{(incf (point) @var{n})} is essentially equivalent to +As a more Emacs-specific example of @code{cl-incf}, the expression +@code{(cl-incf (point) @var{n})} is essentially equivalent to @code{(forward-char @var{n})}. @end defspec -@defspec decf place &optional x +@defspec cl-decf place &optional x This macro decrements the number stored in @var{place} by one, or by @var{x} if specified. @end defspec @@ -1281,7 +1256,7 @@ It does the bindings in sequential rather than parallel order. 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 -result back to @var{place}. For example, @code{(incf @var{place} +result back to @var{place}. For example, @code{(cl-incf @var{place} @var{n})} is the same as @code{(callf + @var{place} @var{n})}. Some more examples: @@ -1304,7 +1279,7 @@ equivalent to @code{(callf2 cons @var{x} @var{place})}. @end defspec The @code{callf} and @code{callf2} macros serve as building -blocks for other macros like @code{incf}, @code{pushnew}, and +blocks for other macros like @code{cl-incf}, @code{pushnew}, and @code{define-modify-macro}. The @code{letf} and @code{letf*} macros are used in the processing of symbol macros; @pxref{Macro Bindings}. @@ -1319,7 +1294,7 @@ user to extend generalized variables in various ways. @defspec 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 +@code{cl-incf} and @code{cl-decf}. The macro @var{name} is defined to take a @var{place} argument followed by additional arguments described by @var{arglist}. The call @@ -1331,7 +1306,7 @@ described by @var{arglist}. The call will be expanded to @example -(callf @var{func} @var{place} @var{args}...) +(cl-callf @var{func} @var{place} @var{args}...) @end example @noindent @@ -1344,8 +1319,8 @@ which in turn is roughly equivalent to For example: @example -(define-modify-macro incf (&optional (n 1)) +) -(define-modify-macro concatf (&rest args) concat) +(define-modify-macro cl-incf (&optional (n 1)) +) +(define-modify-macro cl-concatf (&rest args) concat) @end example Note that @code{&key} is not allowed in @var{arglist}, but @@ -1424,7 +1399,7 @@ For example, the simple form of @code{defsetf} is shorthand for The Lisp form that is returned can access the arguments from @var{arglist} and @var{store-var} in an unrestricted fashion; -macros like @code{setf} and @code{incf} which invoke this +macros like @code{setf} and @code{cl-incf} which invoke this setf-method will insert temporary variables as needed to make sure the apparent order of evaluation is preserved. @@ -1477,7 +1452,7 @@ temporary variables. In the setf-methods generated by @code{defsetf}, the second return value is simply the list of arguments in the place form, and the first return value is a list of a corresponding number of temporary variables generated -by @code{gensym}. Macros like @code{setf} and @code{incf} which +by @code{cl-gensym}. Macros like @code{setf} and @code{cl-incf} which 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. @@ -1488,11 +1463,12 @@ This function returns the setf-method for @var{place}, by invoking the definition previously recorded by @code{defsetf} or @code{define-setf-method}. The result is a list of five values as described above. You can use this function to build -your own @code{incf}-like modify macros. (Actually, it is +your own @code{cl-incf}-like modify macros. (Actually, it is +@c FIXME? better to use the internal functions @code{cl-setf-do-modify} and @code{cl-setf-do-store}, which are a bit easier to use and which also do a number of optimizations; consult the source -code for the @code{incf} function for a simple example.) +code for the @code{cl-incf} function for a simple example.) The argument @var{env} specifies the ``environment'' to be passed on to @code{macroexpand} if @code{get-setf-method} should @@ -1529,14 +1505,14 @@ defined later. These Lisp forms make bindings to variables and function names, analogous to Lisp's built-in @code{let} form. -@xref{Modify Macros}, for the @code{letf} and @code{letf*} forms which +@xref{Modify Macros}, for the @code{letf} and @code{cl-letf*} forms which are also related to variable bindings. @menu -* Dynamic Bindings:: The @code{progv} form -* Lexical Bindings:: @code{lexical-let} and lexical closures -* Function Bindings:: @code{flet} and @code{labels} -* Macro Bindings:: @code{macrolet} and @code{symbol-macrolet} +* Dynamic Bindings:: The @code{cl-progv} form. +* Lexical Bindings:: @code{lexical-let} and lexical closures. +* Function Bindings:: @code{flet} and @code{labels}. +* Macro Bindings:: @code{cl-macrolet} and @code{cl-symbol-macrolet}. @end menu @node Dynamic Bindings @@ -1544,10 +1520,10 @@ are also related to variable bindings. @noindent The standard @code{let} form binds variables whose names are known -at compile-time. The @code{progv} form provides an easy way to +at compile-time. The @code{cl-progv} form provides an easy way to bind variables whose names are computed at run-time. -@defspec progv symbols values forms@dots{} +@defspec cl-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 @@ -1563,7 +1539,7 @@ are ignored. @subsection Lexical Bindings @noindent -The @dfn{CL} package defines the following macro which +The @code{CL} package defines the following macro which more closely follows the Common Lisp @code{let} form: @defspec lexical-let (bindings@dots{}) forms@dots{} @@ -1612,7 +1588,7 @@ call to @code{make-adder} itself. @example (defun make-counter () (lexical-let ((n 0)) - (function* (lambda (&optional (m 1)) (incf n m))))) + (cl-function (lambda (&optional (m 1)) (cl-incf n m))))) (setq count-1 (make-counter)) (funcall count-1 3) @result{} 3 @@ -1721,8 +1697,8 @@ handling. Attempts to redefine such functions using @code{flet} will fail if byte-compiled. In such cases, use @code{labels} instead. Functions defined by @code{flet} may use the full Common Lisp -argument notation supported by @code{defun*}; also, the function -body is enclosed in an implicit block as if by @code{defun*}. +argument notation supported by @code{cl-defun}; also, the function +body is enclosed in an implicit block as if by @code{cl-defun}. @xref{Program Structure}. @end defspec @@ -1755,21 +1731,21 @@ function, or a use of its name quoted by @code{quote} or @noindent These forms create local macros and ``symbol macros.'' -@defspec macrolet (bindings@dots{}) forms@dots{} +@defspec cl-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, +arguments to @code{cl-defmacro} (i.e., a macro name, argument list, and macro-expander forms). The macro is defined accordingly for -use within the body of the @code{macrolet}. +use within the body of the @code{cl-macrolet}. -Because of the nature of macros, @code{macrolet} is lexically -scoped even in Emacs Lisp: The @code{macrolet} binding will +Because of the nature of macros, @code{cl-macrolet} is lexically +scoped even in Emacs Lisp: The @code{cl-macrolet} binding will 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{} +@defspec cl-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})}; @@ -1778,8 +1754,8 @@ replaced by @var{expansion}. @example (setq bar '(5 . 9)) -(symbol-macrolet ((foo (car bar))) - (incf foo)) +(cl-symbol-macrolet ((foo (car bar))) + (cl-incf foo)) bar @result{} (6 . 9) @end example @@ -1791,23 +1767,23 @@ I.e., @code{(setq foo 4)} in the above would be equivalent to Likewise, a @code{let} or @code{let*} binding a symbol macro is treated like a @code{letf} or @code{letf*}. This differs from true Common Lisp, where the rules of lexical scoping cause a @code{let} -binding to shadow a @code{symbol-macrolet} binding. In this package, +binding to shadow a @code{cl-symbol-macrolet} binding. In this package, only @code{lexical-let} and @code{lexical-let*} will shadow a symbol macro. There is no analogue of @code{defmacro} for symbol macros; all symbol -macros are local. A typical use of @code{symbol-macrolet} is in the +macros are local. A typical use of @code{cl-symbol-macrolet} is in the expansion of another macro: @example -(defmacro* my-dolist ((x list) &rest body) +(cl-defmacro my-dolist ((x list) &rest body) (let ((var (gensym))) - (list 'loop 'for var 'on list 'do - (list* 'symbol-macrolet (list (list x (list 'car var))) + (list 'cl-loop 'for var 'on list 'do + (cl-list* 'cl-symbol-macrolet (list (list x (list 'car var))) body)))) (setq mylist '(1 2 3 4)) -(my-dolist (x mylist) (incf x)) +(my-dolist (x mylist) (cl-incf x)) mylist @result{} (2 3 4 5) @end example @@ -1819,19 +1795,19 @@ reference onto the elements of the list. The @code{my-dolist} call shown here expands to @example -(loop for G1234 on mylist do - (symbol-macrolet ((x (car G1234))) - (incf x))) +(cl-loop for G1234 on mylist do + (cl-symbol-macrolet ((x (car G1234))) + (cl-incf x))) @end example @noindent which in turn expands to @example -(loop for G1234 on mylist do (incf (car G1234))) +(cl-loop for G1234 on mylist do (cl-incf (car G1234))) @end example -@xref{Loop Facility}, for a description of the @code{loop} macro. +@xref{Loop Facility}, for a description of the @code{cl-loop} macro. This package defines a nonstandard @code{in-ref} loop clause that works much like @code{my-dolist}. @end defspec @@ -1843,11 +1819,11 @@ works much like @code{my-dolist}. These conditional forms augment Emacs Lisp's simple @code{if}, @code{and}, @code{or}, and @code{cond} forms. -@defspec case keyform clause@dots{} +@defspec cl-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 -matches, the @code{case} form returns @code{nil}. The clauses are +matches, the @code{cl-case} form returns @code{nil}. The clauses are of the form @example @@ -1871,7 +1847,7 @@ four things depending on whether it is an @samp{a}, a @samp{b}, a @key{RET} or @kbd{C-j}, or anything else. @example -(case (read-char) +(cl-case (read-char) (?a (do-a-thing)) (?b (do-b-thing)) ((?\r ?\n) (do-ret-thing)) @@ -1879,20 +1855,20 @@ a @key{RET} or @kbd{C-j}, or anything else. @end example @end defspec -@defspec ecase keyform clause@dots{} -This macro is just like @code{case}, except that if the key does +@defspec cl-ecase keyform clause@dots{} +This macro is just like @code{cl-case}, except that if the key does not match any of the clauses, an error is signaled rather than simply returning @code{nil}. @end defspec -@defspec typecase keyform clause@dots{} -This macro is a version of @code{case} that checks for types +@defspec cl-typecase keyform clause@dots{} +This macro is a version of @code{cl-case} that checks for types rather than values. Each @var{clause} is of the form @samp{(@var{type} @var{body}...)}. @xref{Type Predicates}, for a description of type specifiers. For example, @example -(typecase x +(cl-typecase x (integer (munch-integer x)) (float (munch-float x)) (string (munch-integer (string-to-int x))) @@ -1904,8 +1880,8 @@ The type specifier @code{t} matches any type of object; the word several types, use an @code{(or ...)} type specifier. @end defspec -@defspec etypecase keyform clause@dots{} -This macro is just like @code{typecase}, except that if the key does +@defspec cl-etypecase keyform clause@dots{} +This macro is just like @code{cl-typecase}, except that if the key does not match any of the clauses, an error is signaled rather than simply returning @code{nil}. @end defspec @@ -1916,26 +1892,26 @@ simply returning @code{nil}. @noindent Common Lisp @dfn{blocks} provide a non-local exit mechanism very similar to @code{catch} and @code{throw}, but lexically rather than -dynamically scoped. This package actually implements @code{block} +dynamically scoped. This package actually implements @code{cl-block} in terms of @code{catch}; however, the lexical scoping allows the optimizing byte-compiler to omit the costly @code{catch} step if the -body of the block does not actually @code{return-from} the block. +body of the block does not actually @code{cl-return-from} the block. -@defspec block name forms@dots{} +@defspec cl-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. -The @code{block} returns the result of the last @var{form} unless -a @code{return-from} occurs. +if any of the @var{forms} execute @code{(cl-return-from @var{name})}, +they will jump out and return directly from the @code{cl-block} form. +The @code{cl-block} returns the result of the last @var{form} unless +a @code{cl-return-from} occurs. -The @code{block}/@code{return-from} mechanism is quite similar to +The @code{cl-block}/@code{cl-return-from} mechanism is quite similar to the @code{catch}/@code{throw} mechanism. The main differences are that block @var{name}s are unevaluated symbols, rather than forms (such as quoted symbols) which evaluate to a tag at run-time; and also that blocks are lexically scoped whereas @code{catch}/@code{throw} are dynamically scoped. This means that functions called from the body of a @code{catch} can also @code{throw} to the @code{catch}, -but the @code{return-from} referring to a block name must appear +but the @code{cl-return-from} referring to a block name must appear physically within the @var{forms} that make up the body of the block. They may not appear within other called functions, although they may appear within macro expansions or @code{lambda}s in the body. Block @@ -1944,11 +1920,11 @@ names and @code{catch} names form independent name-spaces. In true Common Lisp, @code{defun} and @code{defmacro} surround the function or expander bodies with implicit blocks with the same name as the function or macro. This does not occur in Emacs -Lisp, but this package provides @code{defun*} and @code{defmacro*} +Lisp, but this package provides @code{cl-defun} and @code{cl-defmacro} forms which do create the implicit block. The Common Lisp looping constructs defined by this package, -such as @code{loop} and @code{dolist}, also create implicit blocks +such as @code{cl-loop} and @code{cl-dolist}, also create implicit blocks just as in Common Lisp. Because they are implemented in terms of Emacs Lisp @code{catch} @@ -1956,22 +1932,22 @@ and @code{throw}, blocks have the same overhead as actual @code{catch} constructs (roughly two function calls). However, the optimizing byte compiler will optimize away the @code{catch} if the block does -not in fact contain any @code{return} or @code{return-from} calls -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 +not in fact contain any @code{cl-return} or @code{cl-return-from} calls +that jump to it. This means that @code{cl-do} loops and @code{cl-defun} +functions which don't use @code{cl-return} don't pay the overhead to support it. @end defspec -@defspec return-from name [result] +@defspec cl-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] -This macro is exactly like @code{(return-from nil @var{result})}. -Common Lisp loops like @code{do} and @code{dolist} implicitly enclose +@defspec cl-return [result] +This macro is exactly like @code{(cl-return-from nil @var{result})}. +Common Lisp loops like @code{cl-do} and @code{cl-dolist} implicitly enclose themselves in @code{nil} blocks. @end defspec @@ -1983,27 +1959,27 @@ The macros described here provide more sophisticated, high-level looping constructs to complement Emacs Lisp's basic @code{while} loop. -@defspec loop forms@dots{} -The @dfn{CL} package supports both the simple, old-style meaning of +@defspec cl-loop forms@dots{} +The @code{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 facility is discussed in the following section; @pxref{Loop Facility}. The simple form of @code{loop} is described here. -If @code{loop} is followed by zero or more Lisp expressions, -then @code{(loop @var{exprs}@dots{})} simply creates an infinite +If @code{cl-loop} is followed by zero or more Lisp expressions, +then @code{(cl-loop @var{exprs}@dots{})} simply creates an infinite loop executing the expressions over and over. The loop is enclosed in an implicit @code{nil} block. Thus, @example -(loop (foo) (if (no-more) (return 72)) (bar)) +(cl-loop (foo) (if (no-more) (return 72)) (bar)) @end example @noindent is exactly equivalent to @example -(block nil (while t (foo) (if (no-more) (return 72)) (bar))) +(cl-block nil (while t (foo) (if (no-more) (return 72)) (bar))) @end example If any of the expressions are plain symbols, the loop is instead @@ -2013,7 +1989,7 @@ 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{} +@defspec cl-do (spec@dots{}) (end-test [result@dots{}]) forms@dots{} This macro creates a general iterative loop. Each @var{spec} is of the form @@ -2026,13 +2002,13 @@ associated @var{init} value as if by a @code{let} form. Then, in each iteration of the loop, the @var{end-test} is evaluated; if true, the loop is finished. Otherwise, the body @var{forms} are evaluated, then each @var{var} is set to the associated @var{step} -expression (as if by a @code{psetq} form) and the next iteration +expression (as if by a @code{cl-psetq} form) and the next iteration begins. Once the @var{end-test} becomes true, the @var{result} forms are evaluated (with the @var{var}s still bound to their values) to produce the result returned by @code{do}. -The entire @code{do} loop is enclosed in an implicit @code{nil} -block, so that you can use @code{(return)} to break out of the +The entire @code{cl-do} loop is enclosed in an implicit @code{nil} +block, so that you can use @code{(cl-return)} to break out of the loop at any time. If there are no @var{result} forms, the loop returns @code{nil}. @@ -2048,40 +2024,40 @@ in place of @samp{(@var{var})}, again following the analogy with This example (from Steele) illustrates a loop which applies the function @code{f} to successive pairs of values from the lists @code{foo} and @code{bar}; it is equivalent to the call -@code{(mapcar* 'f foo bar)}. Note that this loop has no body +@code{(cl-mapcar 'f foo bar)}. Note that this loop has no body @var{forms} at all, performing all its work as side effects of the rest of the loop. @example -(do ((x foo (cdr x)) - (y bar (cdr y)) - (z nil (cons (f (car x) (car y)) z))) - ((or (null x) (null y)) - (nreverse z))) +(cl-do ((x foo (cdr x)) + (y bar (cdr y)) + (z nil (cons (f (car x) (car y)) z))) + ((or (null x) (null y)) + (nreverse z))) @end example @end defspec -@defspec do* (spec@dots{}) (end-test [result@dots{}]) forms@dots{} -This is to @code{do} what @code{let*} is to @code{let}. In +@defspec cl-do* (spec@dots{}) (end-test [result@dots{}]) forms@dots{} +This is to @code{cl-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 -@code{setq} rather than @code{psetq}. +@code{setq} rather than @code{cl-psetq}. Here is another way to write the above loop: @example -(do* ((xp foo (cdr xp)) - (yp bar (cdr yp)) - (x (car xp) (car xp)) - (y (car yp) (car yp)) - z) +(cl-do* ((xp foo (cdr xp)) + (yp bar (cdr yp)) + (x (car xp) (car xp)) + (y (car yp) (car yp)) + z) ((or (null xp) (null yp)) (nreverse z)) (push (f x y) z)) @end example @end defspec -@defspec dolist (var list [result]) forms@dots{} +@defspec cl-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 @@ -2091,7 +2067,7 @@ the loop. Unlike with Emacs's built in @code{dolist}, the loop is surrounded by an implicit @code{nil} block. @end defspec -@defspec dotimes (var count [result]) forms@dots{} +@defspec cl-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 @@ -2101,7 +2077,7 @@ to get the return value for the loop form. Unlike with Emacs's built in @code{dolist}, the loop is surrounded by an implicit @code{nil} block. @end defspec -@defspec do-symbols (var [obarray [result]]) forms@dots{} +@defspec cl-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 @@ -2111,8 +2087,8 @@ 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{} -This is identical to @code{do-symbols} except that the @var{obarray} +@defspec cl-do-all-symbols (var [result]) forms@dots{} +This is identical to @code{cl-do-symbols} except that the @var{obarray} argument is omitted; it always iterates over the default obarray. @end defspec @@ -2133,31 +2109,31 @@ construct called the ``Loop Facility'' or ``@code{loop} macro,'' with an easy-to-use but very powerful and expressive syntax. @menu -* Loop Basics:: @code{loop} macro, basic clause structure -* Loop Examples:: Working examples of @code{loop} macro -* For Clauses:: Clauses introduced by @code{for} or @code{as} +* Loop Basics:: @code{cl-loop} macro, basic clause structure. +* Loop Examples:: Working examples of @code{cl-loop} macro. +* For Clauses:: Clauses introduced by @code{for} or @code{as}. * Iteration Clauses:: @code{repeat}, @code{while}, @code{thereis}, etc. * Accumulation Clauses:: @code{collect}, @code{sum}, @code{maximize}, etc. -* Other Clauses:: @code{with}, @code{if}, @code{initially}, @code{finally} +* Other Clauses:: @code{with}, @code{if}, @code{initially}, @code{finally}. @end menu @node Loop Basics @subsection Loop Basics @noindent -The @code{loop} macro essentially creates a mini-language within +The @code{cl-loop} macro essentially creates a mini-language within Lisp that is specially tailored for describing loops. While this language is a little strange-looking by the standards of regular Lisp, it turns out to be very easy to learn and well-suited to its purpose. -Since @code{loop} is a macro, all parsing of the loop language -takes place at byte-compile time; compiled @code{loop}s are just +Since @code{cl-loop} is a macro, all parsing of the loop language +takes place at byte-compile time; compiled @code{cl-loop}s are just as efficient as the equivalent @code{while} loops written longhand. -@defspec loop clauses@dots{} +@defspec cl-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}, +are simply strung together in the argument list of @code{cl-loop}, with minimal extra parentheses. The various types of clauses specify initializations, such as the binding of temporary variables, actions to be taken in the loop, stepping actions, @@ -2167,9 +2143,9 @@ Common Lisp specifies a certain general order of clauses in a loop: @example -(loop @var{name-clause} - @var{var-clauses}@dots{} - @var{action-clauses}@dots{}) +(cl-loop @var{name-clause} + @var{var-clauses}@dots{} + @var{action-clauses}@dots{}) @end example The @var{name-clause} optionally gives a name to the implicit @@ -2180,7 +2156,7 @@ be modified or iterated throughout the course of the loop. The @var{action-clauses} are things to be done during the loop, such as computing, collecting, and returning values. -The Emacs version of the @code{loop} macro is less restrictive about +The Emacs version of the @code{cl-loop} macro is less restrictive about the order of clauses, but things will behave most predictably if you put the variable-binding clauses @code{with}, @code{for}, and @code{repeat} before the action clauses. As in Common Lisp, @@ -2205,25 +2181,25 @@ for additional discussion and examples of the @code{loop} macro. @noindent Before listing the full set of clauses that are allowed, let's -look at a few example loops just to get a feel for the @code{loop} +look at a few example loops just to get a feel for the @code{cl-loop} language. @example -(loop for buf in (buffer-list) - collect (buffer-file-name buf)) +(cl-loop for buf in (buffer-list) + collect (buffer-file-name buf)) @end example @noindent This loop iterates over all Emacs buffers, using the list returned by @code{buffer-list}. For each buffer @code{buf}, it calls @code{buffer-file-name} and collects the results into -a list, which is then returned from the @code{loop} construct. +a list, which is then returned from the @code{cl-loop} construct. The result is a list of the file names of all the buffers in Emacs's memory. The words @code{for}, @code{in}, and @code{collect} -are reserved words in the @code{loop} language. +are reserved words in the @code{cl-loop} language. @example -(loop repeat 20 do (insert "Yowsa\n")) +(cl-loop repeat 20 do (insert "Yowsa\n")) @end example @noindent @@ -2231,7 +2207,7 @@ This loop inserts the phrase ``Yowsa'' twenty times in the current buffer. @example -(loop until (eobp) do (munch-line) (forward-line 1)) +(cl-loop until (eobp) do (munch-line) (forward-line 1)) @end example @noindent @@ -2240,7 +2216,7 @@ of the buffer. If point is already at the end of the buffer, the loop exits immediately. @example -(loop do (munch-line) until (eobp) do (forward-line 1)) +(cl-loop do (munch-line) until (eobp) do (forward-line 1)) @end example @noindent @@ -2248,10 +2224,10 @@ This loop is similar to the above one, except that @code{munch-line} is always called at least once. @example -(loop for x from 1 to 100 - for y = (* x x) - until (>= y 729) - finally return (list x (= y 729))) +(cl-loop for x from 1 to 100 + for y = (* x x) + until (>= y 729) + finally return (list x (= y 729))) @end example @noindent @@ -2271,7 +2247,7 @@ Note that even though this loop contains three clauses (two @code{for}s and an @code{until}) that would have been enough to define loops all by themselves, it still creates a single loop rather than some sort of triple-nested loop. You must explicitly -nest your @code{loop} constructs if you want nested loops. +nest your @code{cl-loop} constructs if you want nested loops. @node For Clauses @subsection For Clauses @@ -2297,7 +2273,7 @@ The variable is bound around the loop as if by @code{let}: @example (setq i 'happy) -(loop for i from 1 to 10 do (do-something-with i)) +(cl-loop for i from 1 to 10 do (do-something-with i)) i @result{} happy @end example @@ -2327,10 +2303,10 @@ which are like @code{upto} and @code{downto} respectively except that they are exclusive rather than inclusive limits: @example -(loop for x to 10 collect x) - @result{} (0 1 2 3 4 5 6 7 8 9 10) -(loop for x below 10 collect x) - @result{} (0 1 2 3 4 5 6 7 8 9) +(cl-loop for x to 10 collect x) + @result{} (0 1 2 3 4 5 6 7 8 9 10) +(cl-loop for x below 10 collect x) + @result{} (0 1 2 3 4 5 6 7 8 9) @end example The @code{by} value is always positive, even for downward-counting @@ -2345,25 +2321,25 @@ is used to traverse the list instead of @code{cdr}; it must be a function taking one argument. For example: @example -(loop for x in '(1 2 3 4 5 6) collect (* x x)) - @result{} (1 4 9 16 25 36) -(loop for x in '(1 2 3 4 5 6) by 'cddr collect (* x x)) - @result{} (1 9 25) +(cl-loop for x in '(1 2 3 4 5 6) collect (* x x)) + @result{} (1 4 9 16 25 36) +(cl-loop for x in '(1 2 3 4 5 6) by 'cddr collect (* x x)) + @result{} (1 9 25) @end example @item for @var{var} on @var{list} by @var{function} This clause iterates @var{var} over all the cons cells of @var{list}. @example -(loop for x on '(1 2 3 4) collect x) - @result{} ((1 2 3 4) (2 3 4) (3 4) (4)) +(cl-loop for x on '(1 2 3 4) collect x) + @result{} ((1 2 3 4) (2 3 4) (3 4) (4)) @end example With @code{by}, there is no real reason that the @code{on} expression must be a list. For example: @example -(loop for x on first-animal by 'next-animal collect x) +(cl-loop for x on first-animal by 'next-animal collect x) @end example @noindent @@ -2377,7 +2353,7 @@ a @code{setf}-able ``reference'' onto the elements of the list rather than just a temporary variable. For example, @example -(loop for x in-ref my-list do (incf x)) +(cl-loop for x in-ref my-list do (cl-incf x)) @end example @noindent @@ -2389,8 +2365,8 @@ This clause iterates @var{var} over all the elements of @var{array}, which may be a vector or a string. @example -(loop for x across "aeiou" - do (use-vowel (char-to-string x))) +(cl-loop for x across "aeiou" + do (use-vowel (char-to-string x))) @end example @item for @var{var} across-ref @var{array} @@ -2422,10 +2398,10 @@ an unspecified order. As an example, @example -(loop for sym being the symbols - when (fboundp sym) - when (string-match "^map" (symbol-name sym)) - collect sym) +(cl-loop for sym being the symbols + when (fboundp sym) + when (string-match "^map" (symbol-name sym)) + collect sym) @end example @noindent @@ -2436,7 +2412,7 @@ are also recognized but are equivalent to @code{symbols} in Emacs Lisp. Due to a minor implementation restriction, it will not work to have more than one @code{for} clause iterating over symbols, hash tables, -keymaps, overlays, or intervals in a given @code{loop}. Fortunately, +keymaps, overlays, or intervals in a given @code{cl-loop}. Fortunately, it would rarely if ever be useful to do so. It @emph{is} valid to mix one of these types of clauses with other clauses like @code{for ... to} or @code{while}. @@ -2448,10 +2424,10 @@ This clause iterates over the entries in @var{hash-table} with a second variable to the opposite part. @example -(loop for k being the hash-keys of h - using (hash-values v) - do - (message "key %S -> value %S" k v)) +(cl-loop for k being the hash-keys of h + using (hash-values v) + do + (message "key %S -> value %S" k v)) @end example @item for @var{var} being the key-codes of @var{keymap} @@ -2463,10 +2439,10 @@ A @code{using} clause can access both the codes and the bindings together. @example -(loop for c being the key-codes of (current-local-map) - using (key-bindings b) - do - (message "key %S -> binding %S" c b)) +(cl-loop for c being the key-codes of (current-local-map) + using (key-bindings b) + do + (message "key %S -> binding %S" c b)) @end example @@ -2522,8 +2498,8 @@ and successive iterations it will be set by evaluating @var{expr2} these two loops are effectively the same: @example -(loop for x on my-list by 'cddr do ...) -(loop for x = my-list then (cddr x) while x do ...) +(cl-loop for x on my-list by 'cddr do ...) +(cl-loop for x = my-list then (cddr x) while x do ...) @end example Note that this type of @code{for} clause does not imply any sort @@ -2534,7 +2510,7 @@ If you omit the @code{then} term, @var{expr1} is used both for the initial setting and for successive settings: @example -(loop for x = (random) when (> x 0) return x) +(cl-loop for x = (random) when (> x 0) return x) @end example @noindent @@ -2546,13 +2522,13 @@ If you include several @code{for} clauses in a row, they are treated sequentially (as if by @code{let*} and @code{setq}). You can instead use the word @code{and} to link the clauses, in which case they are processed in parallel (as if by @code{let} -and @code{psetq}). +and @code{cl-psetq}). @example -(loop for x below 5 for y = nil then x collect (list x y)) - @result{} ((0 nil) (1 1) (2 2) (3 3) (4 4)) -(loop for x below 5 and y = nil then x collect (list x y)) - @result{} ((0 nil) (1 0) (2 1) (3 2) (4 3)) +(cl-loop for x below 5 for y = nil then x collect (list x y)) + @result{} ((0 nil) (1 1) (2 2) (3 3) (4 4)) +(cl-loop for x below 5 and y = nil then x collect (list x y)) + @result{} ((0 nil) (1 0) (2 1) (3 2) (4 3)) @end example @noindent @@ -2562,7 +2538,7 @@ that was just set by the previous clause; in the second loop, based on the value of @code{x} left over from the previous time through the loop. -Another feature of the @code{loop} macro is @dfn{destructuring}, +Another feature of the @code{cl-loop} macro is @dfn{destructuring}, similar in concept to the destructuring provided by @code{defmacro}. The @var{var} part of any @code{for} clause can be given as a list of variables instead of a single variable. The values produced @@ -2570,8 +2546,8 @@ during loop execution must be lists; the values in the lists are stored in the corresponding variables. @example -(loop for (x y) in '((2 3) (4 5) (6 7)) collect (+ x y)) - @result{} (5 9 13) +(cl-loop for (x y) in '((2 3) (4 5) (6 7)) collect (+ x y)) + @result{} (5 9 13) @end example In loop destructuring, if there are more values than variables @@ -2583,9 +2559,9 @@ lists of variables like @code{(x . y)} are allowed, so for example to process an alist @example -(loop for (key . value) in '((a . 1) (b . 2)) - collect value) - @result{} (1 2) +(cl-loop for (key . value) in '((a . 1) (b . 2)) + collect value) + @result{} (1 2) @end example @node Iteration Clauses @@ -2602,8 +2578,8 @@ This clause simply counts up to the specified number using an internal temporary variable. The loops @example -(loop repeat (1+ n) do ...) -(loop for temp to n do ...) +(cl-loop repeat (1+ n) do ...) +(cl-loop for temp to n do ...) @end example @noindent @@ -2618,7 +2594,7 @@ that surrounds the second one: @example (while @var{cond} @var{forms}@dots{}) -(loop while @var{cond} do @var{forms}@dots{}) +(cl-loop while @var{cond} do @var{forms}@dots{}) @end example @item until @var{condition} @@ -2632,7 +2608,7 @@ the @code{finally} clauses are not executed. If all the conditions were non-@code{nil}, the loop returns @code{t}: @example -(if (loop for size in size-list always (> size 10)) +(if (cl-loop for size in size-list always (> size 10)) (some-big-sizes) (no-big-sizes)) @end example @@ -2709,11 +2685,11 @@ It is valid for several accumulation clauses of the same type to accumulate into the same place. From Steele: @example -(loop for name in '(fred sue alice joe june) - for kids in '((bob ken) () () (kris sunshine) ()) - collect name - append kids) - @result{} (fred bob ken sue alice joe kris sunshine june) +(cl-loop for name in '(fred sue alice joe june) + for kids in '((bob ken) () () (kris sunshine) ()) + collect name + append kids) + @result{} (fred bob ken sue alice joe kris sunshine june) @end example @node Other Clauses @@ -2729,17 +2705,17 @@ otherwise leaves the variable alone during the loop. The following loops are basically equivalent: @example -(loop with x = 17 do ...) -(let ((x 17)) (loop do ...)) -(loop for x = 17 then x do ...) +(cl-loop with x = 17 do ...) +(let ((x 17)) (cl-loop do ...)) +(cl-loop for x = 17 then x do ...) @end example Naturally, the variable @var{var} might be used for some purpose in the rest of the loop. For example: @example -(loop for x in my-list with res = nil do (push x res) - finally return res) +(cl-loop for x in my-list with res = nil do (push x res) + finally return res) @end example This loop inserts the elements of @code{my-list} at the front of @@ -2774,18 +2750,18 @@ by the name @code{it} in the ``then'' part. For example: @example (setq funny-numbers '(6 13 -1)) @result{} (6 13 -1) -(loop for x below 10 - if (oddp x) - collect x into odds - and if (memq x funny-numbers) return (cdr it) end - else - collect x into evens - finally return (vector odds evens)) - @result{} [(1 3 5 7 9) (0 2 4 6 8)] +(cl-loop for x below 10 + if (oddp x) + collect x into odds + and if (memq x funny-numbers) return (cdr it) end + else + collect x into evens + finally return (vector odds evens)) + @result{} [(1 3 5 7 9) (0 2 4 6 8)] (setq funny-numbers '(6 7 13 -1)) @result{} (6 7 13 -1) -(loop <@r{same thing again}>) - @result{} (13 -1) +(cl-loop <@r{same thing again}>) + @result{} (13 -1) @end example Note the use of @code{and} to put two clauses into the ``then'' @@ -2853,7 +2829,7 @@ was named). The @code{return} clause is implemented a bit more efficiently, though. @end table -While there is no high-level way to add user extensions to @code{loop} +While there is no high-level way to add user extensions to @code{cl-loop} (comparable to @code{defsetf} for @code{setf}, say), this package does offer two properties called @code{cl-loop-handler} and @code{cl-loop-for-handler} which are functions to be called when @@ -2861,7 +2837,7 @@ a given symbol is encountered as a top-level loop clause or @code{for} clause, respectively. Consult the source code in file @file{cl-macs.el} for details. -This package's @code{loop} macro is compatible with that of Common +This package's @code{cl-loop} macro is compatible with that of Common Lisp, except that a few features are not implemented: @code{loop-finish} and data-type specifiers. Naturally, the @code{for} clauses which iterate over keymaps, overlays, intervals, frames, windows, and @@ -2876,14 +2852,14 @@ functions, by contrast, always return exactly one result. This package makes no attempt to emulate Common Lisp multiple return values; Emacs versions of Common Lisp functions that return more than one value either return just the first value (as in -@code{compiler-macroexpand}) or return a list of values (as in +@code{cl-compiler-macroexpand}) or return a list of values (as in @code{get-setf-method}). This package @emph{does} define placeholders for the Common Lisp functions that work with multiple values, but in Emacs Lisp these functions simply operate on lists instead. The @code{values} form, for example, is a synonym for @code{list} in Emacs. -@defspec multiple-value-bind (var@dots{}) values-form forms@dots{} +@defspec cl-multiple-value-bind (var@dots{}) values-form forms@dots{} This form evaluates @var{values-form}, which must return a list of values. It then binds the @var{var}s to these respective values, as if by @code{let}, and then executes the body @var{forms}. @@ -2892,18 +2868,18 @@ are bound to @code{nil}. If there are fewer @var{var}s than values, the excess values are ignored. @end defspec -@defspec multiple-value-setq (var@dots{}) form +@defspec cl-multiple-value-setq (var@dots{}) form This form evaluates @var{form}, which must return a list of 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}. +in @code{cl-multiple-value-bind}. @end defspec The older Quiroz package attempted a more faithful (but still imperfect) emulation of Common Lisp multiple values. The old method ``usually'' simulated true multiple values quite well, but under certain circumstances would leave spurious return -values in memory where a later, unrelated @code{multiple-value-bind} +values in memory where a later, unrelated @code{cl-multiple-value-bind} form would see them. Since a perfect emulation is not feasible in Emacs Lisp, this @@ -2922,7 +2898,7 @@ for @code{defmacro} due to technical difficulties. Destructuring is made available to the user by way of the following macro: -@defspec destructuring-bind arglist expr forms@dots{} +@defspec cl-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 @@ -2933,11 +2909,11 @@ if @var{expr} returns a list of the wrong number of arguments or with incorrect keyword arguments. @end defspec -This package also includes the Common Lisp @code{define-compiler-macro} +This package also includes the Common Lisp @code{cl-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{} +@defspec cl-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 @@ -2955,25 +2931,25 @@ For example, here is a simplified version of a definition that appears as a standard part of this package: @example -(define-compiler-macro member* (&whole form a list &rest keys) - (if (and (null keys) - (eq (car-safe a) 'quote) - (not (floatp-safe (cadr a)))) - (list 'memq a list) - form)) +(cl-define-compiler-macro cl-member (&whole form a list &rest keys) + (if (and (null keys) + (eq (car-safe a) 'quote) + (not (floatp-safe (cadr a)))) + (list 'memq a list) + form)) @end example @noindent -This definition causes @code{(member* @var{a} @var{list})} to change +This definition causes @code{(cl-member @var{a} @var{list})} to change to a call to the faster @code{memq} in the common case where @var{a} is a non-floating-point constant; if @var{a} is anything else, or if there are any keyword arguments in the call, then the original -@code{member*} call is left intact. (The actual compiler macro -for @code{member*} optimizes a number of other cases, including +@code{cl-member} call is left intact. (The actual compiler macro +for @code{cl-member} optimizes a number of other cases, including common @code{:test} predicates.) @end defspec -@defun compiler-macroexpand form +@defun cl-compiler-macroexpand form This function is analogous to @code{macroexpand}, except that it expands compiler macros rather than regular macros. It returns @var{form} unchanged if it is not a call to a function for which @@ -2983,8 +2959,8 @@ decided to punt by returning its @code{&whole} argument. Like for which no further expansion is possible. @end defun -@xref{Macro Bindings}, for descriptions of the @code{macrolet} -and @code{symbol-macrolet} forms for making ``local'' macro +@xref{Macro Bindings}, for descriptions of the @code{cl-macrolet} +and @code{cl-symbol-macrolet} forms for making ``local'' macro definitions. @node Declarations @@ -2996,8 +2972,8 @@ mechanism that allows you to give the compiler special hints about the types of data that will be stored in particular variables, and about the ways those variables and functions will be used. This package defines versions of all the Common Lisp declaration forms: -@code{declare}, @code{locally}, @code{proclaim}, @code{declaim}, -and @code{the}. +@code{cl-declare}, @code{cl-locally}, @code{cl-proclaim}, @code{cl-declaim}, +and @code{cl-the}. Most of the Common Lisp declarations are not currently useful in Emacs Lisp, as the byte-code system provides little opportunity @@ -3007,53 +2983,53 @@ declarations are meaningful when the optimizing byte compiler is being used, however. Under the earlier non-optimizing compiler, these declarations will effectively be ignored. -@defun proclaim decl-spec +@defun cl-proclaim decl-spec This function records a ``global'' declaration specified by -@var{decl-spec}. Since @code{proclaim} is a function, @var{decl-spec} +@var{decl-spec}. Since @code{cl-proclaim} is a function, @var{decl-spec} is evaluated and thus should normally be quoted. @end defun -@defspec declaim decl-specs@dots{} -This macro is like @code{proclaim}, except that it takes any number +@defspec cl-declaim decl-specs@dots{} +This macro is like @code{cl-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 +unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when (compile load eval) ...)} around the declarations so that they will be registered at compile-time as well as at run-time. (This is vital, since normally the declarations are meant to influence the way the -compiler treats the rest of the file that contains the @code{declaim} +compiler treats the rest of the file that contains the @code{cl-declaim} form.) @end defspec -@defspec declare decl-specs@dots{} +@defspec cl-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} +etc. Currently the only declaration understood by @code{cl-declare} is @code{special}. @end defspec -@defspec locally declarations@dots{} forms@dots{} -In this package, @code{locally} is no different from @code{progn}. +@defspec cl-locally declarations@dots{} forms@dots{} +In this package, @code{cl-locally} is no different from @code{progn}. @end defspec -@defspec 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 +@defspec cl-the type form +Type information provided by @code{cl-the} is ignored in this package; +in other words, @code{(cl-the @var{type} @var{form})} is equivalent to @var{form}. Future versions of the optimizing byte-compiler may make use of this information. For example, @code{mapcar} can map over both lists and arrays. It is hard for the compiler to expand @code{mapcar} into an in-line loop unless it knows whether the sequence will be a list or an array ahead -of time. With @code{(mapcar 'car (the vector foo))}, a future +of time. With @code{(mapcar 'car (cl-the vector foo))}, a future 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 -Each @var{decl-spec} in a @code{proclaim}, @code{declaim}, or -@code{declare} should be a list beginning with a symbol that says +Each @var{decl-spec} in a @code{cl-proclaim}, @code{cl-declaim}, or +@code{cl-declare} should be a list beginning with a symbol that says what kind of declaration it is. This package currently understands @code{special}, @code{inline}, @code{notinline}, @code{optimize}, and @code{warn} declarations. (The @code{warn} declaration is an @@ -3070,16 +3046,16 @@ bound in the body of the function. The compiler normally emits warnings for such references, since they could be typographical errors for references to local variables. -The declaration @code{(declare (special @var{var1} @var{var2}))} is +The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is equivalent to @code{(defvar @var{var1}) (defvar @var{var2})} in the optimizing compiler, or to nothing at all in older compilers (which do not warn for non-local references). In top-level contexts, it is generally better to write -@code{(defvar @var{var})} than @code{(declaim (special @var{var}))}, +@code{(defvar @var{var})} than @code{(cl-declaim (special @var{var}))}, since @code{defvar} makes your intentions clearer. But the older byte compilers can not handle @code{defvar}s appearing inside of -functions, while @code{(declare (special @var{var}))} takes care +functions, while @code{(cl-declare (special @var{var}))} takes care to work correctly with all compilers. @item inline @@ -3097,8 +3073,8 @@ The following declarations are all equivalent. Note that the and declare it inline all at once. @example -(declaim (inline foo bar)) -(eval-when (compile load eval) (proclaim '(inline foo bar))) +(cl-declaim (inline foo bar)) +(cl-eval-when (compile load eval) (cl-proclaim '(inline foo bar))) (defsubst foo (...) ...) ; instead of defun @end example @@ -3108,10 +3084,10 @@ request that a function you have defined should be inlined, but it is impolite to use it to request inlining of an external function. -In Common Lisp, it is possible to use @code{(declare (inline @dots{}))} +In Common Lisp, it is possible to use @code{(cl-declare (inline @dots{}))} before a particular call to a function to cause just that call to be inlined; the current byte compilers provide no way to implement -this, so @code{(declare (inline @dots{}))} is currently ignored by +this, so @code{(cl-declare (inline @dots{}))} is currently ignored by this package. @item notinline @@ -3132,6 +3108,7 @@ and @code{safety}. The value of a quality should be an integer from The default level for both qualities is 1. In this package, with the optimizing compiler, the +@c FIXME does not exist? @code{speed} quality is tied to the @code{byte-compile-optimize} flag, which is set to @code{nil} for @code{(speed 0)} and to @code{t} for higher settings; and the @code{safety} quality is @@ -3150,10 +3127,10 @@ Emacs itself, Emacs will not crash with a segmentation fault just because of an error in a fully-optimized Lisp program. The @code{optimize} declaration is normally used in a top-level -@code{proclaim} or @code{declaim} in a file; Common Lisp allows -it to be used with @code{declare} to set the level of optimization +@code{cl-proclaim} or @code{cl-declaim} in a file; Common Lisp allows +it to be used with @code{cl-declare} to set the level of optimization locally for a given form, but this will not work correctly with the -current version of the optimizing compiler. (The @code{declare} +current version of the optimizing compiler. (The @code{cl-declare} will set the new optimization level, but that level will not automatically be unset after the enclosing form is done.) @@ -3177,8 +3154,8 @@ This package defines several symbol-related features that were missing from Emacs Lisp. @menu -* Property Lists:: @code{get*}, @code{remprop}, @code{getf}, @code{remf} -* Creating Symbols:: @code{gensym}, @code{gentemp} +* Property Lists:: @code{cl-get}, @code{cl-remprop}, @code{cl-getf}, @code{cl-remf}. +* Creating Symbols:: @code{cl-gensym}, @code{cl-gentemp}. @end menu @node Property Lists @@ -3190,18 +3167,18 @@ and @code{put} for operating on properties attached to symbols. There are also functions for working with property lists as first-class data structures not attached to particular symbols. -@defun get* symbol property &optional default +@defun cl-get symbol property &optional default This function is like @code{get}, except that if the property is not found, the @var{default} argument provides the return value. (The Emacs Lisp @code{get} function always uses @code{nil} as -the default; this package's @code{get*} is equivalent to Common +the default; this package's @code{cl-get} is equivalent to Common Lisp's @code{get}.) -The @code{get*} function is @code{setf}-able; when used in this +The @code{cl-get} function is @code{setf}-able; when used in this fashion, the @var{default} argument is allowed but ignored. @end defun -@defun remprop symbol property +@defun cl-remprop symbol property This function removes the entry for @var{property} from the property list of @var{symbol}. It returns a true value if the property was indeed found and removed, or @code{nil} if there was no such property. @@ -3209,10 +3186,10 @@ indeed found and removed, or @code{nil} if there was no such property. since @code{get} did not allow a @var{default}, it was very difficult to distinguish between a missing property and a property whose value was @code{nil}; thus, setting a property to @code{nil} was close -enough to @code{remprop} for most purposes.) +enough to @code{cl-remprop} for most purposes.) @end defun -@defun getf place property &optional default +@defun cl-getf place property &optional default This function scans the list @var{place} as if it were a property list, i.e., a list of alternating property names and values. If an even-numbered element of @var{place} is found which is @code{eq} @@ -3223,7 +3200,7 @@ is given). In particular, @example -(get sym prop) @equiv{} (getf (symbol-plist sym) prop) +(get sym prop) @equiv{} (cl-get (symbol-plist sym) prop) @end example It is valid to use @code{getf} as a @code{setf} place, in which case @@ -3234,25 +3211,26 @@ list that corresponds to @var{property}, or to cons a new property-value pair onto the list if the property is not yet present. @example -(put sym prop val) @equiv{} (setf (getf (symbol-plist sym) prop) val) +(put sym prop val) @equiv{} (setf (cl-get (symbol-plist sym) prop) val) @end example -The @code{get} and @code{get*} functions are also @code{setf}-able. +The @code{get} and @code{cl-get} functions are also @code{setf}-able. The fact that @code{default} is ignored can sometimes be useful: @example -(incf (get* 'foo 'usage-count 0)) +(cl-incf (cl-get 'foo 'usage-count 0)) @end example Here, symbol @code{foo}'s @code{usage-count} property is incremented if it exists, or set to 1 (an incremented 0) otherwise. +@c FIXME cl-getf? When not used as a @code{setf} form, @code{getf} is just a regular function and its @var{place} argument can actually be any Lisp expression. @end defun -@defspec remf place property +@defspec cl-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 @@ -3273,7 +3251,7 @@ out the property and value cells. These functions create unique symbols, typically for use as temporary variables. -@defun gensym &optional x +@defun cl-gensym &optional x This function creates a new, uninterned symbol (using @code{make-symbol}) with a unique name. (The name of an uninterned symbol is relevant only if the symbol is printed.) By default, the name is generated @@ -3285,20 +3263,20 @@ their names will not conflict with ``real'' variables in the user's code. @end defun -@defvar *gensym-counter* -This variable holds the counter used to generate @code{gensym} names. -It is incremented after each use by @code{gensym}. In Common Lisp +@defvar cl--gensym-counter +This variable holds the counter used to generate @code{cl-gensym} names. +It is incremented after each use by @code{cl-gensym}. In Common Lisp this is initialized with 0, but this package initializes it with a random (time-dependent) value to avoid trouble when two files that -each used @code{gensym} in their compilation are loaded together. +each used @code{cl-gensym} in their compilation are loaded together. (Uninterned symbols become interned when the compiler writes them out to a file and the Emacs loader loads them, so their names have to be treated a bit more carefully than in Common Lisp where uninterned symbols remain uninterned after loading.) @end defvar -@defun gentemp &optional x -This function is like @code{gensym}, except that it produces a new +@defun cl-gentemp &optional x +This function is like @code{cl-gensym}, except that it produces a new @emph{interned} symbol. If the symbol that is generated already exists, the function keeps incrementing the counter and trying again until a new symbol is generated. @@ -3319,10 +3297,10 @@ This section defines a few simple Common Lisp operations on numbers which were left out of Emacs Lisp. @menu -* Predicates on Numbers:: @code{plusp}, @code{oddp}, @code{floatp-safe}, etc. -* Numerical Functions:: @code{abs}, @code{floor*}, etc. -* Random Numbers:: @code{random*}, @code{make-random-state} -* Implementation Parameters:: @code{most-positive-float} +* Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, @code{cl-floatp-safe}, etc. +* Numerical Functions:: @code{abs}, @code{cl-floor}, etc. +* Random Numbers:: @code{cl-random}, @code{cl-make-random-state}. +* Implementation Parameters:: @code{cl-most-positive-float}. @end menu @iftex @@ -3336,27 +3314,27 @@ which were left out of Emacs Lisp. These functions return @code{t} if the specified condition is true of the numerical argument, or @code{nil} otherwise. -@defun plusp number +@defun cl-plusp number This predicate tests whether @var{number} is positive. It is an error if the argument is not a number. @end defun -@defun minusp number +@defun cl-minusp number This predicate tests whether @var{number} is negative. It is an error if the argument is not a number. @end defun -@defun oddp integer +@defun cl-oddp integer This predicate tests whether @var{integer} is odd. It is an error if the argument is not an integer. @end defun -@defun evenp integer +@defun cl-evenp integer This predicate tests whether @var{integer} is even. It is an error if the argument is not an integer. @end defun -@defun floatp-safe object +@defun cl-floatp-safe object This predicate tests whether @var{object} is a floating-point number. On systems that support floating-point, this is equivalent to @code{floatp}. On other systems, this always returns @code{nil}. @@ -3372,30 +3350,26 @@ to @code{floatp}. On other systems, this always returns @code{nil}. @noindent These functions perform various arithmetic operations on numbers. -@defun gcd &rest integers +@defun cl-gcd &rest integers This function returns the Greatest Common Divisor of the arguments. For one argument, it returns the absolute value of that argument. For zero arguments, it returns zero. @end defun -@defun lcm &rest integers +@defun cl-lcm &rest integers This function returns the Least Common Multiple of the arguments. For one argument, it returns the absolute value of that argument. For zero arguments, it returns one. @end defun -@defun isqrt integer +@defun cl-isqrt integer This function computes the ``integer square root'' of its integer argument, i.e., the greatest integer less than or equal to the true square root of the argument. @end defun -@defun floor* number &optional divisor -This function implements the Common Lisp @code{floor} function. -It is called @code{floor*} to avoid name conflicts with the -simpler @code{floor} function built-in to Emacs. - -With one argument, @code{floor*} returns a list of two numbers: +@defun cl-floor number &optional divisor +With one argument, @code{cl-floor} returns a list of two numbers: The argument rounded down (toward minus infinity) to an integer, and the ``remainder'' which would have to be added back to the first return value to yield the argument again. If the argument @@ -3404,37 +3378,37 @@ If the argument is a floating-point number, the first result is a Lisp integer and the second is a Lisp float between 0 (inclusive) and 1 (exclusive). -With two arguments, @code{floor*} divides @var{number} by +With two arguments, @code{cl-floor} divides @var{number} by @var{divisor}, and returns the floor of the quotient and the corresponding remainder as a list of two numbers. If -@code{(floor* @var{x} @var{y})} returns @code{(@var{q} @var{r})}, +@code{(cl-floor @var{x} @var{y})} returns @code{(@var{q} @var{r})}, then @code{@var{q}*@var{y} + @var{r} = @var{x}}, with @var{r} between 0 (inclusive) and @var{r} (exclusive). Also, note -that @code{(floor* @var{x})} is exactly equivalent to -@code{(floor* @var{x} 1)}. +that @code{(cl-floor @var{x})} is exactly equivalent to +@code{(cl-floor @var{x} 1)}. This function is entirely compatible with Common Lisp's @code{floor} function, except that it returns the two results in a list since Emacs Lisp does not support multiple-valued functions. @end defun -@defun ceiling* number &optional divisor +@defun cl-ceiling number &optional divisor This function implements the Common Lisp @code{ceiling} function, which is analogous to @code{floor} except that it rounds the argument or quotient of the arguments up toward plus infinity. The remainder will be between 0 and minus @var{r}. @end defun -@defun truncate* number &optional divisor +@defun cl-truncate number &optional divisor This function implements the Common Lisp @code{truncate} function, which is analogous to @code{floor} except that it rounds the argument or quotient of the arguments toward zero. Thus it is -equivalent to @code{floor*} if the argument or quotient is -positive, or to @code{ceiling*} otherwise. The remainder has +equivalent to @code{cl-floor} if the argument or quotient is +positive, or to @code{cl-ceiling} otherwise. The remainder has the same sign as @var{number}. @end defun -@defun round* number &optional divisor +@defun cl-round number &optional divisor This function implements the Common Lisp @code{round} function, which is analogous to @code{floor} except that it rounds the argument or quotient of the arguments to the nearest integer. @@ -3442,21 +3416,22 @@ In the case of a tie (the argument or quotient is exactly halfway between two integers), it rounds to the even integer. @end defun -@defun mod* number divisor +@defun cl-mod number divisor This function returns the same value as the second return value -of @code{floor}. +of @code{cl-floor}. @end defun -@defun rem* number divisor +@defun cl-rem number divisor This function returns the same value as the second return value -of @code{truncate}. +of @code{cl-truncate}. @end defun +@c FIXME this stuff is probably no longer of interest to anyone. These definitions are compatible with those in the Quiroz -@file{cl.el} package, except that this package appends @samp{*} -to certain function names to avoid conflicts with existing -Emacs functions, and that the mechanism for returning -multiple values is different. +@file{cl.el} package, except that +@c this package appends @samp{*} to certain function names to avoid +@c conflicts with existing Emacs functions, and that +the mechanism for returning multiple values is different. @iftex @secno=8 @@ -3472,7 +3447,7 @@ algorithm, which is much more likely to give statistically clean random numbers than the simple generators supplied by many operating systems. -@defun random* number &optional state +@defun cl-random number &optional state This function returns a random nonnegative number less than @var{number}, and of the same type (either integer or floating-point). The @var{state} argument should be a @code{random-state} object @@ -3483,21 +3458,21 @@ function modifies this state object as a side effect. If @code{random-state} object. @end defun -@defvar *random-state* +@defvar cl--random-state This variable contains the system ``default'' @code{random-state} -object, used for calls to @code{random*} that do not specify an +object, used for calls to @code{cl-random} that do not specify an alternative state object. Since any number of programs in the -Emacs process may be accessing @code{*random-state*} in interleaved +Emacs process may be accessing @code{cl--random-state} in interleaved fashion, the sequence generated from this variable will be irreproducible for all intents and purposes. @end defvar -@defun make-random-state &optional state +@defun cl-make-random-state &optional state This function creates or copies a @code{random-state} object. If @var{state} is omitted or @code{nil}, it returns a new copy of -@code{*random-state*}. This is a copy in the sense that future -sequences of calls to @code{(random* @var{n})} and -@code{(random* @var{n} @var{s})} (where @var{s} is the new +@code{cl--random-state}. This is a copy in the sense that future +sequences of calls to @code{(cl-random @var{n})} and +@code{(cl-random @var{n} @var{s})} (where @var{s} is the new random-state object) will return identical sequences of random numbers. @@ -3512,13 +3487,13 @@ different sequence of random numbers. It is valid to print a @code{random-state} object to a buffer or file and later read it back with @code{read}. If a program wishes to use a sequence of pseudo-random numbers which can be reproduced -later for debugging, it can call @code{(make-random-state t)} to +later for debugging, it can call @code{(cl-make-random-state t)} to get a new sequence, then print this sequence to a file. When the program is later rerun, it can read the original run's random-state from the file. @end defun -@defun random-state-p object +@defun cl-random-state-p object This predicate returns @code{t} if @var{object} is a @code{random-state} object, or @code{nil} otherwise. @end defun @@ -3537,7 +3512,7 @@ function that must be called before the parameters can be used. @defun cl-float-limits This function makes sure that the Common Lisp floating-point parameters -like @code{most-positive-float} have been initialized. Until it is +like @code{cl-most-positive-float} have been initialized. Until it is called, these parameters will be @code{nil}. If this version of Emacs does not support floats, the parameters will remain @code{nil}. If the parameters have already been initialized, the function returns @@ -3555,50 +3530,50 @@ precisions, it has families of constants like floating-point precision, so this package omits the precision word from the constants' names. -@defvar most-positive-float +@defvar cl-most-positive-float This constant equals the largest value a Lisp float can hold. For those systems whose arithmetic supports infinities, this is the largest @emph{finite} value. For IEEE machines, the value is approximately @code{1.79e+308}. @end defvar -@defvar most-negative-float +@defvar cl-most-negative-float This constant equals the most-negative value a Lisp float can hold. -(It is assumed to be equal to @code{(- most-positive-float)}.) +(It is assumed to be equal to @code{(- cl-most-positive-float)}.) @end defvar -@defvar least-positive-float +@defvar cl-least-positive-float This constant equals the smallest Lisp float value greater than zero. For IEEE machines, it is about @code{4.94e-324} if denormals are supported or @code{2.22e-308} if not. @end defvar -@defvar least-positive-normalized-float +@defvar cl-least-positive-normalized-float This constant equals the smallest @emph{normalized} Lisp float greater than zero, i.e., the smallest value for which IEEE denormalization will not result in a loss of precision. For IEEE machines, this value is about @code{2.22e-308}. For machines that do not support the concept of denormalization and gradual underflow, this constant -will always equal @code{least-positive-float}. +will always equal @code{cl-least-positive-float}. @end defvar -@defvar least-negative-float -This constant is the negative counterpart of @code{least-positive-float}. +@defvar cl-least-negative-float +This constant is the negative counterpart of @code{cl-least-positive-float}. @end defvar -@defvar least-negative-normalized-float +@defvar cl-least-negative-normalized-float This constant is the negative counterpart of -@code{least-positive-normalized-float}. +@code{cl-least-positive-normalized-float}. @end defvar -@defvar float-epsilon +@defvar cl-float-epsilon This constant is the smallest positive Lisp float that can be added to 1.0 to produce a distinct value. Adding a smaller number to 1.0 will yield 1.0 again due to roundoff. For IEEE machines, epsilon is about @code{2.22e-16}. @end defvar -@defvar float-negative-epsilon +@defvar cl-float-negative-epsilon This is the smallest positive value that can be subtracted from 1.0 to produce a distinct value. For IEEE machines, it is about @code{1.11e-16}. @@ -3614,11 +3589,11 @@ Emacs Lisp includes a few of these, notably @code{elt} and @code{length}; this package defines most of the rest. @menu -* Sequence Basics:: Arguments shared by all sequence functions -* Mapping over Sequences:: @code{mapcar*}, @code{mapcan}, @code{map}, @code{every}, etc. -* Sequence Functions:: @code{subseq}, @code{remove*}, @code{substitute}, etc. -* Searching Sequences:: @code{find}, @code{position}, @code{count}, @code{search}, etc. -* Sorting Sequences:: @code{sort*}, @code{stable-sort}, @code{merge} +* Sequence Basics:: Arguments shared by all sequence functions. +* Mapping over Sequences:: @code{cl-mapcar}, @code{cl-mapcan}, @code{cl-map}, @code{cl-every}, etc. +* Sequence Functions:: @code{cl-subseq}, @code{cl-remove}, @code{cl-substitute}, etc. +* Searching Sequences:: @code{cl-find}, @code{cl-position}, @code{cl-count}, @code{cl-search}, etc. +* Sorting Sequences:: @code{cl-sort}, @code{cl-stable-sort}, @code{cl-merge}. @end menu @node Sequence Basics @@ -3632,7 +3607,7 @@ may appear in any order. The @code{:key} argument should be passed either @code{nil}, or a function of one argument. This key function is used as a filter through which the elements of the sequence are seen; for example, -@code{(find x y :key 'car)} is similar to @code{(assoc* x y)}: +@code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}: It searches for an element of the list whose @code{car} equals @code{x}, rather than for an element which equals @code{x} itself. If @code{:key} is omitted or @code{nil}, the filter is effectively @@ -3657,7 +3632,7 @@ and sequence elements match if the predicate returns true on them (or false in the case of @code{-if-not}). For example: @example -(remove* 0 seq :test '=) @equiv{} (remove-if 'zerop seq) +(cl-remove 0 seq :test '=) @equiv{} (cl-remove-if 'zerop seq) @end example @noindent @@ -3687,14 +3662,14 @@ are called on various elements. Therefore, it is a bad idea to depend on side effects of these functions. For example, @code{:from-end} may cause the sequence to be scanned actually in reverse, or it may be scanned forwards but computing a result ``as if'' it were scanned -backwards. (Some functions, like @code{mapcar*} and @code{every}, +backwards. (Some functions, like @code{cl-mapcar} and @code{cl-every}, @emph{do} specify exactly the order in which the function is called so side effects are perfectly acceptable in those cases.) Strings may contain ``text properties'' as well as character data. Except as noted, it is undefined whether or not text properties are preserved by sequence functions. For -example, @code{(remove* ?A @var{str})} may or may not preserve +example, @code{(cl-remove ?A @var{str})} may or may not preserve the properties of the characters copied from @var{str} into the result. @@ -3706,7 +3681,7 @@ These functions ``map'' the function you specify over the elements of lists or arrays. They are all variations on the theme of the built-in function @code{mapcar}. -@defun mapcar* function seq &rest more-seqs +@defun cl-mapcar function seq &rest more-seqs This function calls @var{function} on successive parallel sets of elements from its argument sequences. Given a single @var{seq} argument it is equivalent to @code{mapcar}; given @var{n} sequences, @@ -3719,86 +3694,87 @@ is always a list. Common Lisp's @code{mapcar} accepts multiple arguments but works only on lists; Emacs Lisp's @code{mapcar} accepts a single sequence -argument. This package's @code{mapcar*} works as a compatible +argument. This package's @code{cl-mapcar} works as a compatible superset of both. @end defun -@defun map result-type function seq &rest more-seqs +@defun cl-map result-type function seq &rest more-seqs This function maps @var{function} over the argument sequences, -just like @code{mapcar*}, but it returns a sequence of type +just like @code{cl-mapcar}, but it returns a sequence of type @var{result-type} rather than a list. @var{result-type} must be one of the following symbols: @code{vector}, @code{string}, @code{list} (in which case the effect is the same as for @code{mapcar*}), or @code{nil} (in which case the results are -thrown away and @code{map} returns @code{nil}). +thrown away and @code{cl-map} returns @code{nil}). @end defun -@defun maplist function list &rest more-lists +@defun cl-maplist function list &rest more-lists This function calls @var{function} on each of its argument lists, then on the @code{cdr}s of those lists, and so on, until the shortest list runs out. The results are returned in the form -of a list. Thus, @code{maplist} is like @code{mapcar*} except +of a list. Thus, @code{cl-maplist} is like @code{cl-mapcar} except that it passes in the list pointers themselves rather than the @code{car}s of the advancing pointers. @end defun +@c FIXME does not exist? @defun cl-mapc function seq &rest more-seqs -This function is like @code{mapcar*}, except that the values returned +This function is like @code{cl-mapcar}, except that the values returned by @var{function} are ignored and thrown away rather than being collected into a list. The return value of @code{cl-mapc} is @var{seq}, the first sequence. This function is more general than the Emacs primitive @code{mapc}. @end defun -@defun mapl function list &rest more-lists -This function is like @code{maplist}, except that it throws away +@defun cl-mapl function list &rest more-lists +This function is like @code{cl-maplist}, except that it throws away the values returned by @var{function}. @end defun -@defun mapcan function seq &rest more-seqs -This function is like @code{mapcar*}, except that it concatenates +@defun cl-mapcan function seq &rest more-seqs +This function is like @code{cl-mapcar}, except that it concatenates the return values (which must be lists) using @code{nconc}, rather than simply collecting them into a list. @end defun -@defun mapcon function list &rest more-lists -This function is like @code{maplist}, except that it concatenates +@defun cl-mapcon function list &rest more-lists +This function is like @code{cl-maplist}, except that it concatenates the return values using @code{nconc}. @end defun -@defun some predicate seq &rest more-seqs +@defun cl-some predicate seq &rest more-seqs This function calls @var{predicate} on each element of @var{seq} in turn; if @var{predicate} returns a non-@code{nil} value, @code{some} returns that value, otherwise it returns @code{nil}. Given several sequence arguments, it steps through the sequences in parallel until the shortest one runs out, just as in -@code{mapcar*}. You can rely on the left-to-right order in which +@code{cl-mapcar}. You can rely on the left-to-right order in which the elements are visited, and on the fact that mapping stops immediately as soon as @var{predicate} returns non-@code{nil}. @end defun -@defun every predicate seq &rest more-seqs +@defun cl-every predicate seq &rest more-seqs This function calls @var{predicate} on each element of the sequence(s) in turn; it returns @code{nil} as soon as @var{predicate} returns @code{nil} for any element, or @code{t} if the predicate was true for all elements. @end defun -@defun notany predicate seq &rest more-seqs +@defun cl-notany predicate seq &rest more-seqs This function calls @var{predicate} on each element of the sequence(s) in turn; it returns @code{nil} as soon as @var{predicate} returns a non-@code{nil} value for any element, or @code{t} if the predicate was @code{nil} for all elements. @end defun -@defun notevery predicate seq &rest more-seqs +@defun cl-notevery predicate seq &rest more-seqs This function calls @var{predicate} on each element of the sequence(s) in turn; it returns a non-@code{nil} value as soon as @var{predicate} returns @code{nil} for any element, or @code{t} if the predicate was true for all elements. @end defun -@defun reduce function seq @t{&key :from-end :start :end :initial-value :key} +@defun cl-reduce function seq @t{&key :from-end :start :end :initial-value :key} This function combines the elements of @var{seq} using an associative binary operation. Suppose @var{function} is @code{*} and @var{seq} is the list @code{(2 3 4 5)}. The first two elements of the list are @@ -3806,16 +3782,16 @@ combined with @code{(* 2 3) = 6}; this is combined with the next element, @code{(* 6 4) = 24}, and that is combined with the final element: @code{(* 24 5) = 120}. Note that the @code{*} function happens to be self-reducing, so that @code{(* 2 3 4 5)} has the same effect as -an explicit call to @code{reduce}. +an explicit call to @code{cl-reduce}. If @code{:from-end} is true, the reduction is right-associative instead of left-associative: @example -(reduce '- '(1 2 3 4)) - @equiv{} (- (- (- 1 2) 3) 4) @result{} -8 -(reduce '- '(1 2 3 4) :from-end t) - @equiv{} (- 1 (- 2 (- 3 4))) @result{} -2 +(cl-reduce '- '(1 2 3 4)) + @equiv{} (- (- (- 1 2) 3) 4) @result{} -8 +(cl-reduce '- '(1 2 3 4) :from-end t) + @equiv{} (- 1 (- 2 (- 3 4))) @result{} -2 @end example If @code{:key} is specified, it is a function of one argument which @@ -3832,7 +3808,7 @@ If the sequence is empty (and there is no initial value), then @end defun All of these mapping operations can be expressed conveniently in -terms of the @code{loop} macro. In compiled code, @code{loop} will +terms of the @code{cl-loop} macro. In compiled code, @code{cl-loop} will be faster since it generates the loop as in-line code with no function calls. @@ -3843,7 +3819,7 @@ function calls. This section describes a number of Common Lisp functions for operating on sequences. -@defun subseq sequence start &optional end +@defun cl-subseq sequence start &optional end This function returns a given subsequence of the argument @var{sequence}, which may be a list, string, or vector. The indices @var{start} and @var{end} must be in range, and @@ -3855,30 +3831,30 @@ with @var{sequence}. As an extension to Common Lisp, @var{start} and/or @var{end} may be negative, in which case they represent a distance back from the end of the sequence. This is for compatibility with -Emacs's @code{substring} function. Note that @code{subseq} is +Emacs's @code{substring} function. Note that @code{cl-subseq} is the @emph{only} sequence function that allows negative @var{start} and @var{end}. -You can use @code{setf} on a @code{subseq} form to replace a +You can use @code{setf} on a @code{cl-subseq} form to replace a specified range of elements with elements from another sequence. -The replacement is done as if by @code{replace}, described below. +The replacement is done as if by @code{cl-replace}, described below. @end defun -@defun concatenate result-type &rest seqs +@defun cl-concatenate result-type &rest seqs This function concatenates the argument sequences together to form a result sequence of type @var{result-type}, one of the symbols @code{vector}, @code{string}, or @code{list}. The arguments are always copied, even in cases such as -@code{(concatenate 'list '(1 2 3))} where the result is +@code{(cl-concatenate 'list '(1 2 3))} where the result is identical to an argument. @end defun -@defun fill seq item @t{&key :start :end} +@defun cl-fill seq item @t{&key :start :end} This function fills the elements of the sequence (or the specified part of the sequence) with the value @var{item}. @end defun -@defun replace seq1 seq2 @t{&key :start1 :end1 :start2 :end2} +@defun cl-replace seq1 seq2 @t{&key :start1 :end1 :start2 :end2} This function copies part of @var{seq2} into part of @var{seq1}. The sequence @var{seq1} is not stretched or resized; the amount of data copied is simply the shorter of the source and destination @@ -3892,7 +3868,7 @@ start and end arguments specify overlapping regions, the effect is undefined. @end defun -@defun remove* item seq @t{&key :test :test-not :key :count :start :end :from-end} +@defun cl-remove item seq @t{&key :test :test-not :key :count :start :end :from-end} This returns a copy of @var{seq} with all elements matching @var{item} removed. The result may share storage with or be @code{eq} to @var{seq} in some circumstances, but the original @@ -3909,25 +3885,25 @@ end of the sequence rather than the beginning (this matters only if @var{count} was also specified). @end defun -@defun delete* item seq @t{&key :test :test-not :key :count :start :end :from-end} +@defun cl-delete item seq @t{&key :test :test-not :key :count :start :end :from-end} This deletes all elements of @var{seq} which match @var{item}. It is a destructive operation. Since Emacs Lisp does not support -stretchable strings or vectors, this is the same as @code{remove*} -for those sequence types. On lists, @code{remove*} will copy the +stretchable strings or vectors, this is the same as @code{cl-remove} +for those sequence types. On lists, @code{cl-remove} will copy the list if necessary to preserve the original list, whereas -@code{delete*} will splice out parts of the argument list. +@code{cl-delete} will splice out parts of the argument list. Compare @code{append} and @code{nconc}, which are analogous non-destructive and destructive list operations in Emacs Lisp. @end defun -@findex remove-if -@findex remove-if-not -@findex delete-if -@findex delete-if-not -The predicate-oriented functions @code{remove-if}, @code{remove-if-not}, -@code{delete-if}, and @code{delete-if-not} are defined similarly. +@findex cl-remove-if +@findex cl-remove-if-not +@findex cl-delete-if +@findex cl-delete-if-not +The predicate-oriented functions @code{cl-remove-if}, @code{cl-remove-if-not}, +@code{cl-delete-if}, and @code{cl-delete-if-not} are defined similarly. -@defun remove-duplicates seq @t{&key :test :test-not :key :start :end :from-end} +@defun cl-remove-duplicates seq @t{&key :test :test-not :key :start :end :from-end} This function returns a copy of @var{seq} with duplicate elements removed. Specifically, if two elements from the sequence match according to the @code{:test}, @code{:test-not}, and @code{:key} @@ -3937,30 +3913,30 @@ is true, the leftmost one is retained instead. If @code{:start} or examined or removed. @end defun -@defun delete-duplicates seq @t{&key :test :test-not :key :start :end :from-end} +@defun cl-delete-duplicates seq @t{&key :test :test-not :key :start :end :from-end} This function deletes duplicate elements from @var{seq}. It is -a destructive version of @code{remove-duplicates}. +a destructive version of @code{cl-remove-duplicates}. @end defun -@defun substitute new old seq @t{&key :test :test-not :key :count :start :end :from-end} +@defun cl-substitute new old seq @t{&key :test :test-not :key :count :start :end :from-end} This function returns a copy of @var{seq}, with all elements matching @var{old} replaced with @var{new}. The @code{:count}, @code{:start}, @code{:end}, and @code{:from-end} arguments may be used to limit the number of substitutions made. @end defun -@defun nsubstitute new old seq @t{&key :test :test-not :key :count :start :end :from-end} -This is a destructive version of @code{substitute}; it performs +@defun cl-nsubstitute new old seq @t{&key :test :test-not :key :count :start :end :from-end} +This is a destructive version of @code{cl-substitute}; it performs the substitution using @code{setcar} or @code{aset} rather than by returning a changed copy of the sequence. @end defun -@findex substitute-if -@findex substitute-if-not -@findex nsubstitute-if -@findex nsubstitute-if-not -The @code{substitute-if}, @code{substitute-if-not}, @code{nsubstitute-if}, -and @code{nsubstitute-if-not} functions are defined similarly. For +@findex cl-substitute-if +@findex cl-substitute-if-not +@findex cl-nsubstitute-if +@findex cl-nsubstitute-if-not +The @code{cl-substitute-if}, @code{cl-substitute-if-not}, @code{cl-nsubstitute-if}, +and @code{cl-nsubstitute-if-not} functions are defined similarly. For these, a @var{predicate} is given in place of the @var{old} argument. @node Searching Sequences @@ -3968,9 +3944,9 @@ these, a @var{predicate} is given in place of the @var{old} argument. @noindent These functions search for elements or subsequences in a sequence. -(See also @code{member*} and @code{assoc*}; @pxref{Lists}.) +(See also @code{cl-member} and @code{cl-assoc}; @pxref{Lists}.) -@defun find item seq @t{&key :test :test-not :key :start :end :from-end} +@defun cl-find item seq @t{&key :test :test-not :key :start :end :from-end} This function searches @var{seq} for an element matching @var{item}. If it finds a match, it returns the matching element. Otherwise, it returns @code{nil}. It returns the leftmost match, unless @@ -3979,30 +3955,30 @@ match. The @code{:start} and @code{:end} arguments may be used to limit the range of elements that are searched. @end defun -@defun position item seq @t{&key :test :test-not :key :start :end :from-end} -This function is like @code{find}, except that it returns the +@defun cl-position item seq @t{&key :test :test-not :key :start :end :from-end} +This function is like @code{cl-find}, except that it returns the integer position in the sequence of the matching item rather than the item itself. The position is relative to the start of the sequence as a whole, even if @code{:start} is non-zero. The function returns @code{nil} if no matching element was found. @end defun -@defun count item seq @t{&key :test :test-not :key :start :end} +@defun cl-count item seq @t{&key :test :test-not :key :start :end} This function returns the number of elements of @var{seq} which match @var{item}. The result is always a nonnegative integer. @end defun -@findex find-if -@findex find-if-not -@findex position-if -@findex position-if-not -@findex count-if -@findex count-if-not -The @code{find-if}, @code{find-if-not}, @code{position-if}, -@code{position-if-not}, @code{count-if}, and @code{count-if-not} +@findex cl-find-if +@findex cl-find-if-not +@findex cl-position-if +@findex cl-position-if-not +@findex cl-count-if +@findex cl-count-if-not +The @code{cl-find-if}, @code{cl-find-if-not}, @code{cl-position-if}, +@code{cl-position-if-not}, @code{cl-count-if}, and @code{cl-count-if-not} functions are defined similarly. -@defun mismatch seq1 seq2 @t{&key :test :test-not :key :start1 :end1 :start2 :end2 :from-end} +@defun cl-mismatch seq1 seq2 @t{&key :test :test-not :key :start1 :end1 :start2 :end2 :from-end} This function compares the specified parts of @var{seq1} and @var{seq2}. If they are the same length and the corresponding elements match (according to @code{:test}, @code{:test-not}, @@ -4017,11 +3993,11 @@ to left starting at @code{(1- @var{end1})} and @code{(1- @var{end2})}. If the sequences differ, then one plus the index of the rightmost difference (relative to @var{seq1}) is returned. -An interesting example is @code{(mismatch str1 str2 :key 'upcase)}, +An interesting example is @code{(cl-mismatch str1 str2 :key 'upcase)}, which compares two strings case-insensitively. @end defun -@defun search seq1 seq2 @t{&key :test :test-not :key :from-end :start1 :end1 :start2 :end2} +@defun cl-search seq1 seq2 @t{&key :test :test-not :key :from-end :start1 :end1 :start2 :end2} This function searches @var{seq2} for a subsequence that matches @var{seq1} (or part of it specified by @code{:start1} and @code{:end1}.) Only matches which fall entirely within the region @@ -4035,7 +4011,7 @@ function finds the @emph{rightmost} matching subsequence. @node Sorting Sequences @section Sorting Sequences -@defun sort* seq predicate @t{&key :key} +@defun clsort seq predicate @t{&key :key} This function sorts @var{seq} into increasing order as determined by using @var{predicate} to compare pairs of elements. @var{predicate} should return true (non-@code{nil}) if and only if its first argument @@ -4050,7 +4026,7 @@ accepts a @code{:key} argument which is used to preprocess data fed to the @var{predicate} function. For example, @example -(setq data (sort* data 'string-lessp :key 'downcase)) +(setq data (cl-sort data 'string-lessp :key 'downcase)) @end example @noindent @@ -4060,25 +4036,25 @@ would be useful for sorting association lists. It should only be a simple accessor though, it's used heavily in the current implementation. -The @code{sort*} function is destructive; it sorts lists by actually +The @code{cl-sort} function is destructive; it sorts lists by actually rearranging the @code{cdr} pointers in suitable fashion. @end defun -@defun stable-sort seq predicate @t{&key :key} +@defun cl-stable-sort seq predicate @t{&key :key} This function sorts @var{seq} @dfn{stably}, meaning two elements which are equal in terms of @var{predicate} are guaranteed not to be rearranged out of their original order by the sort. -In practice, @code{sort*} and @code{stable-sort} are equivalent +In practice, @code{cl-sort} and @code{cl-stable-sort} are equivalent in Emacs Lisp because the underlying @code{sort} function is stable by default. However, this package reserves the right to -use non-stable methods for @code{sort*} in the future. +use non-stable methods for @code{cl-sort} in the future. @end defun -@defun merge type seq1 seq2 predicate @t{&key :key} +@defun cl-merge type seq1 seq2 predicate @t{&key :key} This function merges two sequences @var{seq1} and @var{seq2} by interleaving their elements. The result sequence, of type @var{type} -(in the sense of @code{concatenate}), has length equal to the sum +(in the sense of @code{cl-concatenate}), has length equal to the sum of the lengths of the two input sequences. The sequences may be modified destructively. Order of elements within @var{seq1} and @var{seq2} is preserved in the interleaving; elements of the two @@ -4098,10 +4074,10 @@ a merged sequence which is (stably) sorted according to The functions described here operate on lists. @menu -* List Functions:: @code{caddr}, @code{first}, @code{list*}, etc. -* Substitution of Expressions:: @code{subst}, @code{sublis}, etc. -* Lists as Sets:: @code{member*}, @code{adjoin}, @code{union}, etc. -* Association Lists:: @code{assoc*}, @code{rassoc*}, @code{acons}, @code{pairlis} +* List Functions:: @code{cl-caddr}, @code{cl-first}, @code{cl-list*}, etc. +* Substitution of Expressions:: @code{cl-subst}, @code{cl-sublis}, etc. +* Lists as Sets:: @code{cl-member}, @code{cl-adjoin}, @code{cl-union}, etc. +* Association Lists:: @code{cl-assoc}, @code{cl-rassoc}, @code{cl-acons}, @code{cl-pairlis}. @end menu @node List Functions @@ -4111,7 +4087,7 @@ The functions described here operate on lists. This section describes a number of simple operations on lists, i.e., chains of cons cells. -@defun caddr x +@defun cl-caddr x This function is equivalent to @code{(car (cdr (cdr @var{x})))}. Likewise, this package defines all 28 @code{c@var{xxx}r} functions where @var{xxx} is up to four @samp{a}s and/or @samp{d}s. @@ -4119,24 +4095,24 @@ All of these functions are @code{setf}-able, and calls to them are expanded inline by the byte-compiler for maximum efficiency. @end defun -@defun first x +@defun cl-first x This function is a synonym for @code{(car @var{x})}. Likewise, -the functions @code{second}, @code{third}, @dots{}, through -@code{tenth} return the given element of the list @var{x}. +the functions @code{cl-second}, @code{cl-third}, @dots{}, through +@code{cl-tenth} return the given element of the list @var{x}. @end defun -@defun rest x +@defun cl-rest x This function is a synonym for @code{(cdr @var{x})}. @end defun -@defun endp x +@defun cl-endp x Common Lisp defines this function to act like @code{null}, but signaling an error if @code{x} is neither a @code{nil} nor a -cons cell. This package simply defines @code{endp} as a synonym +cons cell. This package simply defines @code{cl-endp} as a synonym for @code{null}. @end defun -@defun list-length x +@defun cl-list-length x This function returns the length of list @var{x}, exactly like @code{(length @var{x})}, except that if @var{x} is a circular list (where the cdr-chain forms a loop rather than terminating @@ -4144,38 +4120,35 @@ with @code{nil}), this function returns @code{nil}. (The regular @code{length} function would get stuck if given a circular list.) @end defun -@defun list* arg &rest others +@defun cl-list* arg &rest others This function constructs a list of its arguments. The final argument becomes the @code{cdr} of the last cell constructed. -Thus, @code{(list* @var{a} @var{b} @var{c})} is equivalent to +Thus, @code{(cl-list* @var{a} @var{b} @var{c})} is equivalent to @code{(cons @var{a} (cons @var{b} @var{c}))}, and -@code{(list* @var{a} @var{b} nil)} is equivalent to +@code{(cl-list* @var{a} @var{b} nil)} is equivalent to @code{(list @var{a} @var{b})}. - -(Note that this function really is called @code{list*} in Common -Lisp; it is not a name invented for this package like @code{member*} -or @code{defun*}.) @end defun -@defun ldiff list sublist +@defun cl-ldiff list sublist If @var{sublist} is a sublist of @var{list}, i.e., is @code{eq} to one of the cons cells of @var{list}, then this function returns a copy of the part of @var{list} up to but not including -@var{sublist}. For example, @code{(ldiff x (cddr x))} returns +@var{sublist}. For example, @code{(cl-ldiff x (cddr x))} returns the first two elements of the list @code{x}. The result is a copy; the original @var{list} is not modified. If @var{sublist} is not a sublist of @var{list}, a copy of the entire @var{list} is returned. @end defun -@defun copy-list list +@defun cl-copy-list list This function returns a copy of the list @var{list}. It copies dotted lists like @code{(1 2 . 3)} correctly. @end defun @defun copy-tree x &optional vecp This function returns a copy of the tree of cons cells @var{x}. -Unlike @code{copy-sequence} (and its alias @code{copy-list}), +@c FIXME? cl-copy-list is not an alias of copy-sequence. +Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}), which copies only along the @code{cdr} direction, this function copies (recursively) along both the @code{car} and the @code{cdr} directions. If @var{x} is not a cons cell, the function simply @@ -4184,7 +4157,7 @@ is true, this function copies vectors (recursively) as well as cons cells. @end defun -@defun tree-equal x y @t{&key :test :test-not :key} +@defun cl-tree-equal x y @t{&key :test :test-not :key} This function compares two trees of cons cells. If @var{x} and @var{y} are both cons cells, their @code{car}s and @code{cdr}s are compared recursively. If neither @var{x} nor @var{y} is a cons @@ -4202,10 +4175,10 @@ applied to the elements of both trees. @xref{Sequences}. @noindent These functions substitute elements throughout a tree of cons -cells. (@xref{Sequence Functions}, for the @code{substitute} +cells. (@xref{Sequence Functions}, for the @code{cl-substitute} function, which works on just the top-level elements of a list.) -@defun subst new old tree @t{&key :test :test-not :key} +@defun cl-subst new old tree @t{&key :test :test-not :key} This function substitutes occurrences of @var{old} with @var{new} in @var{tree}, a tree of cons cells. It returns a substituted tree, which will be a copy except that it may share storage with @@ -4220,21 +4193,21 @@ The @code{:key} function is applied to the elements of the tree but not to @var{old}. @end defun -@defun nsubst new old tree @t{&key :test :test-not :key} -This function is like @code{subst}, except that it works by +@defun cl-nsubst new old tree @t{&key :test :test-not :key} +This function is like @code{cl-subst}, except that it works by destructive modification (by @code{setcar} or @code{setcdr}) rather than copying. @end defun -@findex subst-if -@findex subst-if-not -@findex nsubst-if -@findex nsubst-if-not -The @code{subst-if}, @code{subst-if-not}, @code{nsubst-if}, and -@code{nsubst-if-not} functions are defined similarly. +@findex cl-subst-if +@findex cl-subst-if-not +@findex cl-nsubst-if +@findex cl-nsubst-if-not +The @code{cl-subst-if}, @code{cl-subst-if-not}, @code{cl-nsubst-if}, and +@code{cl-nsubst-if-not} functions are defined similarly. -@defun sublis alist tree @t{&key :test :test-not :key} -This function is like @code{subst}, except that it takes an +@defun cl-sublis alist tree @t{&key :test :test-not :key} +This function is like @code{cl-subst}, except that it takes an association list @var{alist} of @var{old}-@var{new} pairs. Each element of the tree (after applying the @code{:key} function, if any), is compared with the @code{car}s of @@ -4242,8 +4215,8 @@ function, if any), is compared with the @code{car}s of @code{cdr}. @end defun -@defun nsublis alist tree @t{&key :test :test-not :key} -This is a destructive version of @code{sublis}. +@defun cl-nsublis alist tree @t{&key :test :test-not :key} +This is a destructive version of @code{cl-sublis}. @end defun @node Lists as Sets @@ -4253,7 +4226,7 @@ This is a destructive version of @code{sublis}. These functions perform operations on lists which represent sets of elements. -@defun member* item list @t{&key :test :test-not :key} +@defun cl-member item list @t{&key :test :test-not :key} This function searches @var{list} for an element matching @var{item}. If a match is found, it returns the cons cell whose @code{car} was the matching element. Otherwise, it returns @code{nil}. Elements @@ -4261,34 +4234,33 @@ are compared by @code{eql} by default; you can use the @code{:test}, @code{:test-not}, and @code{:key} arguments to modify this behavior. @xref{Sequences}. -Note that this function's name is suffixed by @samp{*} to avoid -the incompatible @code{member} function defined in Emacs. -(That function uses @code{equal} for comparisons; it is equivalent -to @code{(member* @var{item} @var{list} :test 'equal)}.) +The standard Emacs lisp function @code{member} uses @code{equal} for +comparisons; it is equivalent to @code{(cl-member @var{item} @var{list} +:test 'equal)}. @end defun -@findex member-if -@findex member-if-not -The @code{member-if} and @code{member-if-not} functions +@findex cl-member-if +@findex cl-member-if-not +The @code{cl-member-if} and @code{cl-member-if-not} functions analogously search for elements which satisfy a given predicate. -@defun tailp sublist list +@defun cl-tailp sublist list This function returns @code{t} if @var{sublist} is a sublist of @var{list}, i.e., if @var{sublist} is @code{eql} to @var{list} or to any of its @code{cdr}s. @end defun -@defun adjoin item list @t{&key :test :test-not :key} +@defun cl-adjoin item list @t{&key :test :test-not :key} This function conses @var{item} onto the front of @var{list}, like @code{(cons @var{item} @var{list})}, but only if @var{item} -is not already present on the list (as determined by @code{member*}). +is not already present on the list (as determined by @code{cl-member}). If a @code{:key} argument is specified, it is applied to @var{item} as well as to the elements of @var{list} during the search, on the reasoning that @var{item} is ``about'' to become part of the list. @end defun -@defun union list1 list2 @t{&key :test :test-not :key} +@defun cl-union list1 list2 @t{&key :test :test-not :key} This function combines two lists which represent sets of items, returning a list that represents the union of those two sets. The result list will contain all items which appear in @var{list1} @@ -4300,46 +4272,46 @@ result list. The order of elements in the result list is also undefined. @end defun -@defun nunion list1 list2 @t{&key :test :test-not :key} -This is a destructive version of @code{union}; rather than copying, +@defun cl-nunion list1 list2 @t{&key :test :test-not :key} +This is a destructive version of @code{cl-union}; rather than copying, it tries to reuse the storage of the argument lists if possible. @end defun -@defun intersection list1 list2 @t{&key :test :test-not :key} +@defun cl-intersection list1 list2 @t{&key :test :test-not :key} This function computes the intersection of the sets represented by @var{list1} and @var{list2}. It returns the list of items which appear in both @var{list1} and @var{list2}. @end defun -@defun nintersection list1 list2 @t{&key :test :test-not :key} -This is a destructive version of @code{intersection}. It +@defun cl-nintersection list1 list2 @t{&key :test :test-not :key} +This is a destructive version of @code{cl-intersection}. It tries to reuse storage of @var{list1} rather than copying. It does @emph{not} reuse the storage of @var{list2}. @end defun -@defun set-difference list1 list2 @t{&key :test :test-not :key} +@defun cl-set-difference list1 list2 @t{&key :test :test-not :key} This function computes the ``set difference'' of @var{list1} and @var{list2}, i.e., the set of elements that appear in @var{list1} but @emph{not} in @var{list2}. @end defun -@defun nset-difference list1 list2 @t{&key :test :test-not :key} -This is a destructive @code{set-difference}, which will try +@defun cl-nset-difference list1 list2 @t{&key :test :test-not :key} +This is a destructive @code{cl-set-difference}, which will try to reuse @var{list1} if possible. @end defun -@defun set-exclusive-or list1 list2 @t{&key :test :test-not :key} +@defun cl-set-exclusive-or list1 list2 @t{&key :test :test-not :key} This function computes the ``set exclusive or'' of @var{list1} and @var{list2}, i.e., the set of elements that appear in exactly one of @var{list1} and @var{list2}. @end defun -@defun nset-exclusive-or list1 list2 @t{&key :test :test-not :key} -This is a destructive @code{set-exclusive-or}, which will try +@defun cl-nset-exclusive-or list1 list2 @t{&key :test :test-not :key} +This is a destructive @code{cl-set-exclusive-or}, which will try to reuse @var{list1} and @var{list2} if possible. @end defun -@defun subsetp list1 list2 @t{&key :test :test-not :key} +@defun cl-subsetp list1 list2 @t{&key :test :test-not :key} This function checks whether @var{list1} represents a subset of @var{list2}, i.e., whether every element of @var{list1} also appears in @var{list2}. @@ -4353,7 +4325,7 @@ An @dfn{association list} is a list representing a mapping from one set of values to another; any list whose elements are cons cells is an association list. -@defun assoc* item a-list @t{&key :test :test-not :key} +@defun cl-assoc item a-list @t{&key :test :test-not :key} This function searches the association list @var{a-list} for an element whose @code{car} matches (in the sense of @code{:test}, @code{:test-not}, and @code{:key}, or by comparison with @code{eql}) @@ -4365,27 +4337,27 @@ are not cons cells. (This corresponds to the behavior of elements of @var{a-list} to be an error.) @end defun -@defun rassoc* item a-list @t{&key :test :test-not :key} +@defun cl-rassoc item a-list @t{&key :test :test-not :key} This function searches for an element whose @code{cdr} matches @var{item}. If @var{a-list} represents a mapping, this applies the inverse of the mapping to @var{item}. @end defun -@findex assoc-if -@findex assoc-if-not -@findex rassoc-if -@findex rassoc-if-not -The @code{assoc-if}, @code{assoc-if-not}, @code{rassoc-if}, -and @code{rassoc-if-not} functions are defined similarly. +@findex cl-assoc-if +@findex cl-assoc-if-not +@findex cl-rassoc-if +@findex cl-rassoc-if-not +The @code{cl-assoc-if}, @code{cl-assoc-if-not}, @code{cl-rassoc-if}, +and @code{cl-rassoc-if-not} functions are defined similarly. Two simple functions for constructing association lists are: -@defun acons key value alist +@defun cl-acons key value alist This is equivalent to @code{(cons (cons @var{key} @var{value}) @var{alist})}. @end defun -@defun pairlis keys values &optional alist -This is equivalent to @code{(nconc (mapcar* 'cons @var{keys} @var{values}) +@defun cl-pairlis keys values &optional alist +This is equivalent to @code{(nconc (cl-mapcar 'cons @var{keys} @var{values}) @var{alist})}. @end defun @@ -4407,15 +4379,15 @@ system provides no way to create new distinct types, this package implements structures as vectors (or lists upon request) with a special ``tag'' symbol to identify them. -@defspec defstruct name slots@dots{} -The @code{defstruct} form defines a new structure type called +@defspec cl-defstruct name slots@dots{} +The @code{cl-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.) In the simplest case, @var{name} and each of the @var{slots} are symbols. For example, @example -(defstruct person name age sex) +(cl-defstruct person name age sex) @end example @noindent @@ -4426,7 +4398,7 @@ and @code{(person-sex @var{p})}. You can also change these slots by using @code{setf} on any of these place forms: @example -(incf (person-age birthday-boy)) +(cl-incf (person-age birthday-boy)) @end example You can create a new @code{person} by calling @code{make-person}, @@ -4490,10 +4462,10 @@ the slot's value is determined when the object is created and does not change afterward. @example -(defstruct person - (name nil :read-only t) - age - (sex 'unknown)) +(cl-defstruct person + (name nil :read-only t) + age + (sex 'unknown)) @end example Any slot options other than @code{:read-only} are ignored. @@ -4505,10 +4477,10 @@ by arguments. (By contrast, slot options are key-value pairs not enclosed in lists.) @example -(defstruct (person (:constructor create-person) - (:type list) - :named) - name age sex) +(cl-defstruct (person (:constructor create-person) + (:type list) + :named) + name age sex) @end example The following structure options are recognized. @@ -4554,15 +4526,15 @@ as well unless you disable it with a simple-format @code{:constructor} option. @example -(defstruct - (person - (:constructor nil) ; no default constructor - (:constructor new-person (name sex &optional (age 0))) - (:constructor new-hound (&key (name "Rover") - (dog-years 0) - &aux (age (* 7 dog-years)) - (sex 'canine)))) - name age sex) +(cl-defstruct + (person + (:constructor nil) ; no default constructor + (:constructor new-person (name sex &optional (age 0))) + (:constructor new-hound (&key (name "Rover") + (dog-years 0) + &aux (age (* 7 dog-years)) + (sex 'canine)))) + name age sex) @end example The first constructor here takes its arguments positionally rather @@ -4601,7 +4573,7 @@ only if they used the default predicate name. @item :include This option implements a very limited form of C++-style inheritance. The argument is the name of another structure type previously -created with @code{defstruct}. The effect is to cause the new +created with @code{cl-defstruct}. The effect is to cause the new structure type to inherit all of the included structure's slots (plus, of course, any new slots described by this struct's slot descriptors). The new structure is considered a ``specialization'' @@ -4614,12 +4586,12 @@ slot descriptors for slots in the included structure, possibly with modified default values. Borrowing an example from Steele: @example -(defstruct person name (age 0) sex) - @result{} person -(defstruct (astronaut (:include person (age 45))) - helmet-size - (favorite-beverage 'tang)) - @result{} astronaut +(cl-defstruct person name (age 0) sex) + @result{} person +(cl-defstruct (astronaut (:include person (age 45))) + helmet-size + (favorite-beverage 'tang)) + @result{} astronaut (setq joe (make-person :name "Joe")) @result{} [cl-struct-person "Joe" 0 nil] @@ -4675,9 +4647,9 @@ use named vectors. Therefore, @code{:named} is only useful in conjunction with @code{:type}. @example -(defstruct (person1) name age sex) -(defstruct (person2 (:type list) :named) name age sex) -(defstruct (person3 (:type list)) name age sex) +(cl-defstruct (person1) name age sex) +(cl-defstruct (person2 (:type list) :named) name age sex) +(cl-defstruct (person3 (:type list)) name age sex) (setq p1 (make-person1)) @result{} [cl-struct-person1 nil nil nil] @@ -4694,7 +4666,7 @@ conjunction with @code{:type}. @result{} error: function person3-p undefined @end example -Since unnamed structures don't have tags, @code{defstruct} is not +Since unnamed structures don't have tags, @code{cl-defstruct} is not able to make a useful predicate for recognizing them. Also, accessors like @code{person3-name} will be generated but they will not be able to do any type checking. The @code{person3-name} @@ -4716,7 +4688,7 @@ of the included type and the first new slot. @end table @end defspec -Except as noted, the @code{defstruct} facility of this package is +Except as noted, the @code{cl-defstruct} facility of this package is entirely compatible with that of Common Lisp. @node Assertions @@ -4733,10 +4705,10 @@ If the optimization property @code{speed} has been set to 3, and 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{}] +@defspec cl-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. +is not satisfied, @code{cl-assert} signals an error. A default error message will be supplied which includes @var{test-form}. You can specify a different error message by including a @var{string} @@ -4749,7 +4721,7 @@ will also include all non-constant arguments of the top-level @var{form}. For example: @example -(assert (> x 10) t "x is too small: %d") +(cl-assert (> x 10) t "x is too small: %d") @end example This usage of @var{show-args} is an extension to Common Lisp. In @@ -4759,16 +4731,16 @@ error. Since Emacs Lisp does not support continuable errors, it makes no sense to specify @var{places}. @end defspec -@defspec check-type form type [string] +@defspec cl-check-type form type [string] This form verifies that @var{form} evaluates to a value of type -@var{type}. If so, it returns @code{nil}. If not, @code{check-type} +@var{type}. If so, it returns @code{nil}. If not, @code{cl-check-type} signals a @code{wrong-type-argument} error. The default error message lists the erroneous value along with @var{type} and @var{form} themselves. If @var{string} is specified, it is included in the error message in place of @var{type}. For example: @example -(check-type x (integer 1 *) "a positive integer") +(cl-check-type x (integer 1 *) "a positive integer") @end example @xref{Type Predicates}, for a description of the type specifiers @@ -4782,6 +4754,7 @@ user to modify @var{place}. The following error-related macro is also defined: +@c FIXME standard for some time. @defspec 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 @@ -4797,14 +4770,14 @@ returns the result of the last @var{form}. @appendixsec Macros @noindent -Many of the advanced features of this package, such as @code{defun*}, -@code{loop}, and @code{setf}, are implemented as Lisp macros. In +Many of the advanced features of this package, such as @code{cl-defun}, +@code{cl-loop}, and @code{setf}, are implemented as Lisp macros. In byte-compiled code, these complex notations will be expanded into equivalent Lisp code which is simple and efficient. For example, the forms @example -(incf i n) +(cl-incf i n) (push x (car p)) @end example @@ -4819,13 +4792,13 @@ are expanded at compile-time to the Lisp forms @noindent which are the most efficient ways of doing these respective operations in Lisp. Thus, there is no performance penalty for using the more -readable @code{incf} and @code{push} forms in your compiled code. +readable @code{cl-incf} and @code{push} forms in your compiled code. @emph{Interpreted} code, on the other hand, must expand these macros every time they are executed. For this reason it is strongly recommended that code making heavy use of macros be compiled. (The features labeled ``Special Form'' instead of ``Function'' in -this manual are macros.) A loop using @code{incf} a hundred times +this manual are macros.) A loop using @code{cl-incf} a hundred times will execute considerably faster if compiled, and will also garbage-collect less because the macro expansion will not have to be generated, used, and thrown away a hundred times. @@ -4849,36 +4822,36 @@ and type @kbd{C-x C-e} immediately after the closing parenthesis; the expansion @example -(block nil - (let* ((x 0) - (G1004 nil)) - (while (< x 10) - (setq G1004 (cons x G1004)) - (setq x (+ x 1))) - (nreverse G1004))) +(cl-block nil + (let* ((x 0) + (G1004 nil)) + (while (< x 10) + (setq G1004 (cons x G1004)) + (setq x (+ x 1))) + (nreverse G1004))) @end example @noindent -will be inserted into the buffer. (The @code{block} macro is +will be inserted into the buffer. (The @code{cl-block} macro is expanded differently in the interpreter and compiler, so @code{cl-prettyexpand} just leaves it alone. The temporary -variable @code{G1004} was created by @code{gensym}.) +variable @code{G1004} was created by @code{cl-gensym}.) If the optional argument @var{full} is true, then @emph{all} -macros are expanded, including @code{block}, @code{eval-when}, +macros are expanded, including @code{cl-block}, @code{cl-eval-when}, and compiler macros. Expansion is done as if @var{form} were a top-level form in a file being compiled. For example, @example -(cl-prettyexpand '(pushnew 'x list)) - @print{} (setq list (adjoin 'x list)) -(cl-prettyexpand '(pushnew 'x list) t) +(cl-prettyexpand '(cl-pushnew 'x list)) + @print{} (setq list (cl-adjoin 'x list)) +(cl-prettyexpand '(cl-pushnew 'x list) t) @print{} (setq list (if (memq 'x list) list (cons 'x list))) -(cl-prettyexpand '(caddr (member* 'a list)) t) +(cl-prettyexpand '(caddr (cl-member 'a list)) t) @print{} (car (cdr (cdr (memq 'a list)))) @end example -Note that @code{adjoin}, @code{caddr}, and @code{member*} all +Note that @code{cl-adjoin}, @code{cl-caddr}, and @code{cl-member} all have built-in compiler macros to optimize them in common cases. @end defun @@ -4900,22 +4873,22 @@ phrase ``it is an error if'' to indicate a situation which is not supposed to arise in complying programs; implementations are strongly encouraged but not required to signal an error in these situations. This package sometimes omits such error checking in the interest of -compactness and efficiency. For example, @code{do} variable +compactness and efficiency. For example, @code{cl-do} variable specifiers are supposed to be lists of one, two, or three forms; extra forms are ignored by this package rather than signaling a -syntax error. The @code{endp} function is simply a synonym for +syntax error. The @code{cl-endp} function is simply a synonym for @code{null} in this package. Functions taking keyword arguments will accept an odd number of arguments, treating the trailing keyword as if it were followed by the value @code{nil}. -Argument lists (as processed by @code{defun*} and friends) +Argument lists (as processed by @code{cl-defun} and friends) @emph{are} checked rigorously except for the minor point just mentioned; in particular, keyword arguments are checked for validity, and @code{&allow-other-keys} and @code{:allow-other-keys} are fully implemented. Keyword validity checking is slightly time consuming (though not too bad in byte-compiled code); you can use @code{&allow-other-keys} to omit this check. Functions -defined in this package such as @code{find} and @code{member*} +defined in this package such as @code{cl-find} and @code{cl-member} do check their keyword arguments for validity. @ifinfo @@ -4929,10 +4902,10 @@ do check their keyword arguments for validity. Use of the optimizing Emacs compiler is highly recommended; many of the Common Lisp macros emit code which can be improved by optimization. In particular, -@code{block}s (whether explicit or implicit in constructs like -@code{defun*} and @code{loop}) carry a fair run-time penalty; the -optimizing compiler removes @code{block}s which are not actually -referenced by @code{return} or @code{return-from} inside the block. +@code{cl-block}s (whether explicit or implicit in constructs like +@code{cl-defun} and @code{cl-loop}) carry a fair run-time penalty; the +optimizing compiler removes @code{cl-block}s which are not actually +referenced by @code{cl-return} or @code{cl-return-from} inside the block. @node Common Lisp Compatibility @appendix Common Lisp Compatibility @@ -4941,20 +4914,22 @@ referenced by @code{return} or @code{return-from} inside the block. Following is a list of all known incompatibilities between this package and Common Lisp as documented in Steele (2nd edition). +@ignore Certain function names, such as @code{member}, @code{assoc}, and @code{floor}, were already taken by (incompatible) Emacs Lisp functions; this package appends @samp{*} to the names of its Common Lisp versions of these functions. +@end ignore -The word @code{defun*} is required instead of @code{defun} in order +The word @code{cl-defun} is required instead of @code{defun} in order to use extended Common Lisp argument lists in a function. Likewise, -@code{defmacro*} and @code{function*} are versions of those forms +@code{cl-defmacro} and @code{cl-function} are versions of those forms which understand full-featured argument lists. The @code{&whole} keyword does not work in @code{defmacro} argument lists (except inside recursive argument lists). The @code{equal} predicate does not distinguish -between IEEE floating-point plus and minus zero. The @code{equalp} +between IEEE floating-point plus and minus zero. The @code{cl-equalp} predicate has several differences with Common Lisp; @pxref{Predicates}. The @code{setf} mechanism is entirely compatible, except that @@ -4962,21 +4937,21 @@ setf-methods return a list of five values rather than five values directly. Also, the new ``@code{setf} function'' concept (typified by @code{(defun (setf foo) @dots{})}) is not implemented. -The @code{do-all-symbols} form is the same as @code{do-symbols} +The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols} with no @var{obarray} argument. In Common Lisp, this form would iterate over all symbols in all packages. Since Emacs obarrays are not a first-class package mechanism, there is no way for -@code{do-all-symbols} to locate any but the default obarray. +@code{cl-do-all-symbols} to locate any but the default obarray. -The @code{loop} macro is complete except that @code{loop-finish} +The @code{cl-loop} macro is complete except that @code{loop-finish} and type specifiers are unimplemented. The multiple-value return facility treats lists as multiple values, since Emacs Lisp cannot support multiple return values directly. The macros will be compatible with Common Lisp if @code{values} or @code{values-list} is always used to return to -a @code{multiple-value-bind} or other multiple-value receiver; -if @code{values} is used without @code{multiple-value-@dots{}} +a @code{cl-multiple-value-bind} or other multiple-value receiver; +if @code{values} is used without @code{cl-multiple-value-@dots{}} or vice-versa the effect will be different from Common Lisp. Many Common Lisp declarations are ignored, and others match @@ -4985,17 +4960,18 @@ example, local @code{special} declarations, which are purely advisory in Emacs Lisp, do not rigorously obey the scoping rules set down in Steele's book. -The variable @code{*gensym-counter*} starts out with a pseudo-random +The variable @code{cl--gensym-counter} starts out with a pseudo-random value rather than with zero. This is to cope with the fact that generated symbols become interned when they are written to and loaded back from a file. -The @code{defstruct} facility is compatible, except that structures +The @code{cl-defstruct} facility is compatible, except that structures are of type @code{:type vector :named} by default rather than some special, distinct type. Also, the @code{:type} slot option is ignored. -The second argument of @code{check-type} is treated differently. +The second argument of @code{cl-check-type} is treated differently. +@c FIXME Time to remove this? @node Old CL Compatibility @appendix Old CL Compatibility @@ -5014,6 +4990,7 @@ is more predictable though more noticeably different from Common Lisp. The @code{defkeyword} form and @code{keywordp} function are not implemented in this package. +@ignore The @code{member}, @code{floor}, @code{ceiling}, @code{truncate}, @code{round}, @code{mod}, and @code{rem} functions are suffixed by @samp{*} in this package to avoid collision with existing @@ -5023,6 +5000,7 @@ causing serious portability problems. (Some more recent versions of the Quiroz package changed the names to @code{cl-member}, etc.; this package defines the latter names as aliases for @code{member*}, etc.) +@end ignore Certain functions in the old package which were buggy or inconsistent with the Common Lisp standard are incompatible with the conforming @@ -5031,9 +5009,9 @@ were synonyms for @code{eq} and @code{memq} in that package, @code{setf} failed to preserve correct order of evaluation of its arguments, etc. Finally, unlike the older package, this package is careful to -prefix all of its internal names with @code{cl-}. Except for a +prefix all of its internal names with @code{cl--}. Except for a few functions which are explicitly defined as additional features -(such as @code{floatp-safe} and @code{letf}), this package does not +(such as @code{cl-floatp-safe} and @code{letf}), this package does not export any non-@samp{cl-} symbols which are not also part of Common Lisp. @@ -5045,7 +5023,7 @@ Lisp. @appendixsec The @code{cl-compat} package @noindent -The @dfn{CL} package includes emulations of some features of the +The @code{CL} package includes emulations of some features of the old @file{cl.el}, in the form of a compatibility package @code{cl-compat}. This file is obsolete and may be removed in future, so it should not be used in new code. @@ -5066,7 +5044,7 @@ best fix is to change to use @code{setf} properly. The @code{cl-compat} file defines the keyword functions @code{keywordp}, @code{keyword-of}, and @code{defkeyword}, -which are not defined by the new @dfn{CL} package because the +which are not defined by the new @code{CL} package because the use of keywords as data is discouraged. The @code{build-klist} mechanism for parsing keyword arguments @@ -5292,7 +5270,7 @@ where a more iteratively-minded programmer might write one of these forms: @example -(let ((total 0)) (dolist (x my-list) (incf total x)) total) +(let ((total 0)) (dolist (x my-list) (cl-incf total x)) total) (loop for x in my-list sum x) @end example diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi index 865e99a3aa6..1f9a401df90 100644 --- a/doc/misc/dbus.texi +++ b/doc/misc/dbus.texi @@ -1981,7 +1981,7 @@ usually not desired. D-Bus errors in events can be made visible by setting the variable @code{dbus-debug} to @code{t}. They can also be handled by a hook function. -@defvar dbus-event-error-hooks +@defvar dbus-event-error-functions This hook variable keeps a list of functions, which are called when a D-Bus error happens in the event handler. Every function must accept two arguments, the event and the error variable caught in @@ -1997,7 +1997,7 @@ Example: (message "my-dbus-event-error-handler: %S %S" event error) (signal 'file-error (cdr error)))) -(add-hook 'dbus-event-error-hooks 'my-dbus-event-error-handler) +(add-hook 'dbus-event-error-functions 'my-dbus-event-error-handler) @end lisp @end defvar diff --git a/doc/misc/ede.texi b/doc/misc/ede.texi index 046cdc99414..1299f2ff062 100644 --- a/doc/misc/ede.texi +++ b/doc/misc/ede.texi @@ -1248,7 +1248,7 @@ detection scheme works like this: @table @asis @item Step 1: -@code{find-file-hooks} calls @code{ede-turn-on-hook} on BUFFER. +@code{find-file-hook} calls @code{ede-turn-on-hook} on BUFFER. @item Step 2: @code{ede-turn-on-hook} turns on @code{ede-minor-mode} @item Step 3: diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi index 01349e31468..0afcdd923d6 100644 --- a/doc/misc/ediff.texi +++ b/doc/misc/ediff.texi @@ -1248,7 +1248,7 @@ This hook is run just before @code{ediff-quit-hook}. This is a good place to do various cleanups, such as deleting the variant buffers. Ediff provides a function, @code{ediff-janitor}, as one such possible hook, which you can add to @code{ediff-cleanup-hook} with -@code{add-hooks}. +@code{add-hook}. @findex ediff-janitor This function kills buffers A, B, and, possibly, C, if these buffers aren't diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index 896eba2f1bb..e57fcc8adf1 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -1516,16 +1516,16 @@ Here's a bunch of time/date/second/day examples: @result{} 905595714.0 (seconds-to-time 905595714.0) -@result{} (13818 19266 0) +@result{} (13818 19266 0 0) (time-to-days '(13818 19266)) @result{} 729644 (days-to-time 729644) -@result{} (961933 65536) +@result{} (961933 512) (time-since '(13818 19266)) -@result{} (0 430) +@result{} (6797 9607 984839 247000) (time-less-p '(13818 19266) '(13818 19145)) @result{} nil @@ -1546,7 +1546,7 @@ Here's a bunch of time/date/second/day examples: (time-to-number-of-days (time-since (date-to-time "Mon, 01 Jan 2001 02:22:26 GMT"))) -@result{} 4.146122685185185 +@result{} 4314.095589286675 @end example And finally, we have @code{safe-date-to-time}, which does the same as @@ -1561,7 +1561,7 @@ An RFC822 (or similar) date string. For instance: @code{"Sat Sep 12 12:21:54 1998 +0200"}. @item time -An internal Emacs time. For instance: @code{(13818 26466)}. +An internal Emacs time. For instance: @code{(13818 26466 0 0)}. @item seconds A floating point representation of the internal Emacs time. For diff --git a/doc/misc/forms.texi b/doc/misc/forms.texi index bcb8d8974ea..11c3782dd7e 100644 --- a/doc/misc/forms.texi +++ b/doc/misc/forms.texi @@ -170,8 +170,8 @@ of the buffer are parsed using the specifications in @code{forms-format-list}, and the data file is updated. If the record has fields that aren't included in the display, they are not changed. -@vindex forms-mode-hooks -Entering Forms mode runs the normal hook @code{forms-mode-hooks} to +@vindex forms-mode-hook +Entering Forms mode runs the normal hook @code{forms-mode-hook} to perform user-defined customization. To save any modified data, you can use @kbd{C-x C-s} diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index afc324e3fb4..a9cd0d3567c 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -3148,7 +3148,7 @@ following is added to a group parameter @lisp (gnus-summary-prepared-hook - '(lambda nil (local-set-key "d" (local-key-binding "n")))) + (lambda nil (local-set-key "d" (local-key-binding "n")))) @end lisp when the group is entered, the 'd' key will not mark the article as diff --git a/doc/misc/mh-e.texi b/doc/misc/mh-e.texi index f6adc435789..e59b312889d 100644 --- a/doc/misc/mh-e.texi +++ b/doc/misc/mh-e.texi @@ -429,7 +429,7 @@ for a description about @dfn{normal hooks} and @dfn{abnormal hooks}. MH-E uses normal hooks in nearly all cases, so you can assume that we are talking about normal hooks unless we explicitly mention that a hook is abnormal. We also follow the conventions described in that -section: the name of the abnormal hooks end in @code{-hooks} and all +section: the name of the abnormal hooks end in @code{-functions} and all the rest of the MH-E hooks end in @code{-hook}. You can add hooks with either @code{customize-option} or @code{add-hook}. @@ -3749,9 +3749,9 @@ when you press @key{TAB} when prompted for a folder name. @findex mh-search-p @kindex k -@vindex mh-kill-folder-suppress-prompt-hooks +@vindex mh-kill-folder-suppress-prompt-functions -The hook @code{mh-kill-folder-suppress-prompt-hooks} is an abnormal +The hook @code{mh-kill-folder-suppress-prompt-functions} is an abnormal hook run at the beginning of the command @kbd{k}. The hook functions are called with no arguments and should return a non-nil value to suppress the normal prompt when you remove a folder. This is useful diff --git a/doc/misc/sem-user.texi b/doc/misc/sem-user.texi index 9f4dc72fea3..9d6fb11db50 100644 --- a/doc/misc/sem-user.texi +++ b/doc/misc/sem-user.texi @@ -277,7 +277,7 @@ variable. This allows SemanticDB to save tag caches in directories controlled by them. @end defvar -@deffn Option semanticdb-save-database-hooks +@deffn Option semanticdb-save-database-functions Abnormal hook run after a database is saved. Each function is called with one argument, the object representing the database recently written. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 530b8fdd6c2..46f99acbb87 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -3007,10 +3007,10 @@ checksum. @lisp (add-hook - 'find-file-hooks - '(lambda () - (when (file-remote-p default-directory) - (set (make-local-variable 'file-precious-flag) t)))) + 'find-file-hook + (lambda () + (when (file-remote-p default-directory) + (set (make-local-variable 'file-precious-flag) t)))) @end lisp @end itemize @@ -3126,7 +3126,7 @@ into your @file{~/.emacs}: (setq mode-line-format (format-mode-line mode-line-format 'font-lock-warning-face)))) -(add-hook 'find-file-hooks 'my-mode-line-function) +(add-hook 'find-file-hook 'my-mode-line-function) (add-hook 'dired-mode-hook 'my-mode-line-function) @end lisp @end ifset @@ -3159,10 +3159,10 @@ should put it into your @file{~/.emacs}: (add-hook 'dired-mode-hook - '(lambda () - (setq - mode-line-buffer-identification - my-mode-line-buffer-identification))) + (lambda () + (setq + mode-line-buffer-identification + my-mode-line-buffer-identification))) @end lisp Since @value{emacsname} 23.1, the mode line contains an indication if @@ -3195,9 +3195,9 @@ like this: @lisp (add-hook 'dired-before-readin-hook - '(lambda () - (when (file-remote-p default-directory) - (setq dired-actual-switches "-al")))) + (lambda () + (when (file-remote-p default-directory) + (setq dired-actual-switches "-al")))) @end lisp @end ifset @@ -3329,9 +3329,9 @@ minibuffer: (add-hook 'minibuffer-setup-hook - '(lambda () - (abbrev-mode 1) - (setq local-abbrev-table my-tramp-abbrev-table))) + (lambda () + (abbrev-mode 1) + (setq local-abbrev-table my-tramp-abbrev-table))) (defadvice minibuffer-complete (before my-minibuffer-complete activate) @@ -3398,7 +3398,7 @@ their readability through a remote access: @ifset xemacs (recent-files-initialize) (add-hook - 'find-file-hooks + 'find-file-hook (lambda () (when (file-remote-p (buffer-file-name)) (recent-files-make-permanent))) diff --git a/etc/ChangeLog b/etc/ChangeLog index 4e1f15e913d..3ebe18b407f 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,15 @@ +2012-10-23 Paul Eggert + + Fix outdated timestamp documentation in Elisp manual (bug#12706). + * NEWS: Document increased precision in undo list. + +2012-10-21 Glenn Morris + + * images/icons/hicolor/32x32/apps/emacs22.png: + * images/icons/hicolor/16x16/apps/emacs22.png: + * images/icons/hicolor/48x48/apps/emacs22.png: + * images/icons/hicolor/24x24/apps/emacs22.png: Restore old icons. + 2012-10-14 Kenichi Handa * charsets/JISC6226.map: Re-generated. @@ -9,12 +21,12 @@ 2012-10-11 Kenichi Handa - * charsets/CNS-2.map, charsets/CNS-3.map, charsets/CNS-4.map, - charsets/CNS-5.map, charsets/CNS-6.map, charsets/CNS-7.map, - charsets/CP932-2BYTE.map, charsets/GB180302.map, - charsets/GB180304.map, charsets/JISC6226.map, - charsets/JISX2131.map, charsets/MIK.map, charsets/PTCP154.map, - charsets/stdenc.map, charsets/symbol.map: Re-generated. + * charsets/CNS-2.map, charsets/CNS-3.map, charsets/CNS-4.map: + * charsets/CNS-5.map, charsets/CNS-6.map, charsets/CNS-7.map: + * charsets/CP932-2BYTE.map, charsets/GB180302.map: + * charsets/GB180304.map, charsets/JISC6226.map: + * charsets/JISX2131.map, charsets/MIK.map, charsets/PTCP154.map: + * charsets/stdenc.map, charsets/symbol.map: Re-generate. 2012-10-07 Jan Djärv diff --git a/etc/NEWS b/etc/NEWS index 00d5109aba6..27957e6787d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -621,6 +621,29 @@ enabled. ** FIXME something happened to ses.el, 2012-04-17. +** Hooks renamed to avoid obsolete "-hooks" suffix: +*** semantic-lex-reset-hooks -> semantic-lex-reset-functions +*** semantic-change-hooks -> semantic-change-functions +*** semantic-edits-new-change-hooks -> semantic-edits-new-change-functions +*** semantic-edits-delete-change-hooks -> semantic-edits-delete-change-functions +*** semantic-edits-reparse-change-hooks -> semantic-edits-reparse-change-functions +*** semanticdb-save-database-hooks -> semanticdb-save-database-functions +*** c-prepare-bug-report-hooks -> c-prepare-bug-report-hook +*** rcirc-sentinel-hooks -> rcirc-sentinel-functions +*** rcirc-receive-message-hooks -> rcirc-receive-message-functions +*** rcirc-activity-hooks -> rcirc-activity-functions +*** rcirc-print-hooks -> rcirc-print-functions +*** dbus-event-error-hooks -> dbus-event-error-functions +*** eieio-pre-method-execution-hooks -> eieio-pre-method-execution-functions +*** checkdoc-style-hooks -> checkdoc-style-functions +*** checkdoc-comment-style-hooks -> checkdoc-comment-style-functions +*** archive-extract-hooks -> archive-extract-hook +*** filesets-cache-fill-content-hooks -> filesets-cache-fill-content-hook +*** hfy-post-html-hooks -> hfy-post-html-hook +*** nndiary-request-create-group-hooks -> nndiary-request-create-group-functions +*** nndiary-request-update-info-hooks -> nndiary-request-update-info-functions +*** nndiary-request-accept-article-hooks -> nndiary-request-accept-article-functions +*** gnus-subscribe-newsgroup-hooks -> gnus-subscribe-newsgroup-functions ** Obsolete packages: +++ @@ -830,7 +853,7 @@ in Emacs 24.1: *** `current-time-string' no longer requires that its argument's year must be in the range 1000..9999. It now works with any year supported by the underlying C implementation. ---- + *** `current-time' now returns extended-format time stamps (HIGH LOW USEC PSEC), where the new PSEC slot specifies picoseconds. PSEC is typically a multiple of 1000 on current machines. Other @@ -843,6 +866,9 @@ stamps are still accepted. The PSECS slot is new, and uses picosecond resolution. It can be accessed via the new timer--psecs accessor. +*** Last-modified time stamps in undo lists now are of the form +(t HI-SECS LO-SECS USECS PSECS) instead of (t HI-SECS . LO-SECS). + +++ ** Floating point functions now always return special values like NaN, instead of signaling errors, if given invalid args, e.g. (log -1.0). @@ -890,6 +916,7 @@ See the "Face Attributes" section of the Elisp manual. *** `window-system-version' *** `dired-pop-to-buffer' (use `dired-mark-pop-up') *** `query-replace-interactive' +*** `font-list-limit' (has had no effect since Emacs < 23) * Changes in Emacs 24.3 on non-free operating systems diff --git a/etc/images/icons/README b/etc/images/icons/README index d71641684cd..664c52906ac 100644 --- a/etc/images/icons/README +++ b/etc/images/icons/README @@ -9,6 +9,13 @@ Copyright (C) 2007-2012 Free Software Foundation, Inc. License: GNU General Public License version 3 or later (see COPYING) +Files: hicolor/16x16/apps/emacs22.png hicolor/24x24/apps/emacs22.png + hicolor/32x32/apps/emacs22.png hicolor/48x48/apps/emacs22.png + +Author: Andrew Zhilin +Copyright (C) 2005-2012 Free Software Foundation, Inc. +License: GNU General Public License version 3 or later (see COPYING) + Files: allout-widgets-dark-bg/closed.png allout-widgets-dark-bg/closed.xpm allout-widgets-dark-bg/empty.png diff --git a/etc/images/icons/hicolor/16x16/apps/emacs22.png b/etc/images/icons/hicolor/16x16/apps/emacs22.png new file mode 100644 index 00000000000..b419b01b4ee Binary files /dev/null and b/etc/images/icons/hicolor/16x16/apps/emacs22.png differ diff --git a/etc/images/icons/hicolor/24x24/apps/emacs22.png b/etc/images/icons/hicolor/24x24/apps/emacs22.png new file mode 100644 index 00000000000..790ec7e2bff Binary files /dev/null and b/etc/images/icons/hicolor/24x24/apps/emacs22.png differ diff --git a/etc/images/icons/hicolor/32x32/apps/emacs22.png b/etc/images/icons/hicolor/32x32/apps/emacs22.png new file mode 100644 index 00000000000..31fbb47c0d2 Binary files /dev/null and b/etc/images/icons/hicolor/32x32/apps/emacs22.png differ diff --git a/etc/images/icons/hicolor/48x48/apps/emacs22.png b/etc/images/icons/hicolor/48x48/apps/emacs22.png new file mode 100644 index 00000000000..f0df0fb6594 Binary files /dev/null and b/etc/images/icons/hicolor/48x48/apps/emacs22.png differ diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index bcb71daca5d..c88b467ee29 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,12 @@ +2012-10-23 Eli Zaretskii + + * makefile.w32-in (lisp2): Add cp51932.el and eucjp-ms.el, to + follow src/lisp.mk. + +2012-10-21 Glenn Morris + + * make-docfile.c (scan_lisp_file): Add cp51932.el and eucjp-ms.el. + 2012-10-20 Eli Zaretskii * make-docfile.c (IS_SLASH, DEF_ELISP_FILE): New macros. diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index b6cd1530a4c..68e7029ee85 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -1118,7 +1118,9 @@ scan_lisp_file (const char *filename, const char *mode) } const uncompiled[] = { DEF_ELISP_FILE (loaddefs.el), DEF_ELISP_FILE (loadup.el), - DEF_ELISP_FILE (charprop.el) + DEF_ELISP_FILE (charprop.el), + DEF_ELISP_FILE (cp51932.el), + DEF_ELISP_FILE (eucjp-ms.el) }; int i, match; size_t flen = strlen (filename); diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index 640e8a7c468..f3ab4421fd3 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in @@ -229,6 +229,8 @@ lisp2 = \ $(lispsource)language/greek.elc \ $(lispsource)language/hebrew.elc \ $(lispsource)language/japanese.elc \ + $(lispsource)international/cp51932.el \ + $(lispsource)international/eucjp-ms.el \ $(lispsource)language/korean.elc \ $(lispsource)language/lao.elc \ $(lispsource)language/cham.elc \ diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7d532ba899f..5b709c76c74 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,111 @@ +2012-10-24 Chong Yidong + + * emacs-lisp/easymenu.el (easy-menu-define): Doc fix (Bug#12628). + +2012-10-24 Stefan Monnier + + * minibuffer.el (completion--all-sorted-completions-location): New var. + (completion--cache-all-sorted-completions) + (completion--flush-all-sorted-completions): Use it. + (completion-in-region, completion-in-region--postch) + (completion-at-point, completion-help-at-point): Use markers in + completion-in-region--data (bug#12619). + +2012-10-23 Stefan Monnier + + * progmodes/compile.el (compilation-start): Try to handle common + quoting of `cd' argument (bug#12640). + + * vc/diff-mode.el (diff-hunk): `save-excursion' while refining + (bug#12671). + +2012-10-23 Glenn Morris + + * progmodes/gud.el (gud-menu-map): + Check gdb-active-process is bound. (Bug#12358) + +2012-10-23 Stefan Monnier + + * repeat.el (repeat): Set real-this-command (bug#12232). + + * htmlfontify.el (hfy-post-html-hook): + * filesets.el (filesets-cache-fill-content-hook): + * arc-mode.el (archive-extract-hook): + * progmodes/cc-mode.el (c-prepare-bug-report-hook): + * net/rcirc.el (rcirc-sentinel-functions) + (rcirc-receive-message-functions, rcirc-activity-functions) + (rcirc-print-functions): + * net/dbus.el (dbus-event-error-functions): + * emacs-lisp/eieio.el (eieio-pre-method-execution-functions): + * emacs-lisp/checkdoc.el (checkdoc-style-functions) + (checkdoc-comment-style-functions): Don't use "-hooks" suffix. + * term/sun.el (sun-raw-prefix-hooks): + * mail/sendmail.el (mail-yank-hooks): Use make-obsolete-variable. + +2012-10-23 Michael Albinus + + * net/tramp-smb.el (tramp-smb-maybe-open-connection): + Set `tramp-chunksize' to 1. This improves the performance. + (tramp-smb-wait-for-output): Add timeout to + `tramp-accept-process-output' calls. + +2012-10-23 Chong Yidong + + * faces.el (font-list-limit): Define as an obsolete variable. + + * startup.el (command-line): + * cus-start.el: Don't refer to font-list-limit. + + * newcomment.el (comment-normalize-vars): Doc fix (Bug#12583). + +2012-10-23 Stefan Monnier + + * subr.el (internal-temp-output-buffer-show): Rename from + temp-output-buffer-show, since previously compiled files expect this name. + +2012-10-23 Glenn Morris + + * image.el (image-type-from-file-name): If multiple types match, + return the first one that is supported. (Bug#9045) + +2012-10-22 Glenn Morris + + * image.el (imagemagick-enabled-types): Doc fix. + +2012-10-22 Takafumi Arakaki (tiny change) + + * progmodes/which-func.el (which-func-current): The hash-table may have + an explicit nil (bug#12338). + +2012-10-22 Stefan Monnier + + * electric.el (electric-pair-delete-selection-self-insert-function): + Rename to electric-pair-will-use-region, return a boolean. + (electric-pair-mode): Adjust accordingly. Don't require delsel. + + * delsel.el (delete-selection-helper): Use a function instead of a hook. + (delete-selection-pre-hook): Use use-region-p. + (delete-selection-self-insert-function): Remove. + (self-insert-command): Obey self-insert-uses-region-functions. + (self-insert-iso): Revert to previous setting, since we don't actually + know what that command does. + (delete-selection-self-insert-hooks): Remove. + +2012-10-22 Simon Law (tiny change) + + * delsel.el (delete-selection-helper): New function, extracted from + delete-selection-pre-hook. + (delete-selection-pre-hook): Use it. + (delete-selection-self-insert-function): New function. + (delete-selection-self-insert-hooks): New hook. + (self-insert-command, self-insert-iso): Use it. + * electric.el (electric-pair-syntax): New function, extracted from + electric-pair-post-self-insert-function. + (electric-pair-post-self-insert-function): Use it. + (electric-pair-delete-selection-self-insert-function): New function. + (electric-pair-mode): Require delsel and setup + delete-selection-self-insert-hooks (bug#11520). + 2012-10-20 Chong Yidong * vc/vc.el (vc-diff-internal): Set up Diff mode even if there are @@ -8,8 +116,8 @@ 2012-10-20 Arne Jørgensen - * progmodes/flymake.el (flymake-create-temp-inplace): Use - file-truename. + * progmodes/flymake.el (flymake-create-temp-inplace): + Use file-truename. 2012-10-20 Eli Zaretskii diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index c04cd8dcf9d..cebd4302d0c 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -140,8 +140,10 @@ A local copy of the archive will be used when updating." :type 'regexp :group 'archive) -(defcustom archive-extract-hooks nil - "Hooks to run when an archive member has been extracted." +(define-obsolete-variable-alias 'archive-extract-hooks + 'archive-extract-hook "24.3") +(defcustom archive-extract-hook nil + "Hook run when an archive member has been extracted." :type 'hook :group 'archive) ;; ------------------------------ @@ -1078,7 +1080,7 @@ using `make-temp-file', and the generated name is returned." ;; We will write out the archive ourselves if it is ;; part of another archive. (remove-hook 'write-contents-functions 'archive-write-file t)) - (run-hooks 'archive-extract-hooks) + (run-hooks 'archive-extract-hook) (if archive-read-only (message "Note: altering this archive is not implemented.")))) (archive-maybe-update t)) diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index e89e8ed258b..7656248cac5 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog @@ -1,14 +1,23 @@ +2012-10-23 Stefan Monnier + + * semantic/db-file.el (semanticdb-save-database-functions): + * semantic/lex.el (semantic-lex-reset-functions): + * semantic/edit.el (semantic-change-functions) + (semantic-edits-new-change-functions) + (semantic-edits-delete-change-functions) + (semantic-edits-reparse-change-functions): Don't use "-hooks" suffix. + 2012-10-14 David Engster - * semantic.el (semantic-error-if-unparsed): New function. Raise - error if buffer was not parsed by Semantic (bug #12045). + * semantic.el (semantic-error-if-unparsed): New function. + Raise error if buffer was not parsed by Semantic (bug #12045). (navigate-menu, edit-menu, cedet-menu-map): Enable Semantic items only if buffer was parsed. Also, replace ':active' with ':enable' where necessary. * semantic/wisent/python.el - (semantic-python-get-system-include-path): Use - `python-shell-internal-send-string' if available to query Python + (semantic-python-get-system-include-path): + Use `python-shell-internal-send-string' if available to query Python for system paths. * semantic/senator.el (senator-next-tag, senator-previous-tag) @@ -57,8 +66,8 @@ 2012-10-06 Chong Yidong * semantic/bovine/grammar.el: - * semantic/wisent/grammar.el: Move from admin/grammars. Add - autoloads for bovine-grammar-mode and wisent-grammar-mode. + * semantic/wisent/grammar.el: Move from admin/grammars. + Add autoloads for bovine-grammar-mode and wisent-grammar-mode. 2012-10-02 Chong Yidong @@ -163,8 +172,8 @@ (-scheme, -makefile-misc, ede-proj-target-makefile-program) (-makefile-archive, -makefile-shared-object) (ede-proj-target-makefile-info, -grammar): New autoloads. - (ede-proj-project): Inherit from eieio-persistent-read. Specify - extension and header line. + (ede-proj-project): Inherit from eieio-persistent-read. + Specify extension and header line. (ede-proj-load, ede-proj-save): Replace with impl using eieio-persistent-read. @@ -176,27 +185,27 @@ (navigate-menu): Add menu item for Stickyfunc mode. * semantic/analyze/debug.el - (semantic-analyzer-debug-insert-include-summary): Before - dereferencing tableinner, make sure it has a value. + (semantic-analyzer-debug-insert-include-summary): + Before dereferencing tableinner, make sure it has a value. * semantic/analyze/refs.el (semantic-analyze-tag-references-default): When doing a lookup, specify noerror. (semantic--analyze-refs-full-lookup): Add optional noerror input argument. Pass to to full-lookup-simple. - (semantic-analyze-refs-impl, semantic-analyze-refs-proto): Ignore - :typemodifiers during compare. + (semantic-analyze-refs-impl, semantic-analyze-refs-proto): + Ignore :typemodifiers during compare. * semantic/bovine/c.el (semantic-lex-cpp-define): Specify limits to looking back for comment chars. (semantic--tag-similar-names-p, semantic--tag-similar-names-p-default) (semantic--tag-attribute-similar-p): New. (semantic-c-describe-environment): Handle list value of ede-object. - (semantic-lex-c-preprocessor-symbol-map-builtin): Add - __attribute_pure__. + (semantic-lex-c-preprocessor-symbol-map-builtin): + Add __attribute_pure__. - * semantic/bovine/scm.el (semantic-format-tag-prototype): Add - parent and color argument. Pass them through. + * semantic/bovine/scm.el (semantic-format-tag-prototype): + Add parent and color argument. Pass them through. * semantic/complete.el (semantic-collector-calculate-completions): Search for more matches if new prefix is a substring of old one. @@ -217,15 +226,15 @@ the (%d tags) extra string. (semanticdb-project-database): Specify :type for table. (semanticdb-create-table-for-file): Specify file-truename. - (semanticdb-synchronize, semanticdb-partial-synchronize): Restore - code that refreshes references to include files. + (semanticdb-synchronize, semanticdb-partial-synchronize): + Restore code that refreshes references to include files. * semantic/decorate/include.el (semantic-decoration-on-fileless-includes): New face. (semantic-decoration-on-fileless-include-map) (semantic-decoration-on-fileless-include-menu): New variables. - (semantic-decoration-on-includes-highlight-default): Support - includes that have a table, but are not associated with a file. + (semantic-decoration-on-includes-highlight-default): + Support includes that have a table, but are not associated with a file. (semantic-decoration-fileless-include-describe) (semantic-decoration-fileless-include-menu): New functions. (semantic-decoration-all-include-summary): Add arrows to indicate @@ -262,15 +271,15 @@ * semantic/tag.el (semantic-create-tag-proxy) (semantic-tag-set-proxy, semantic-tag-resolve-proxy): New. - * semantic/util.el (semantic-describe-buffer): Add - semantic-new-buffer-fcn-was-run. + * semantic/util.el (semantic-describe-buffer): + Add semantic-new-buffer-fcn-was-run. - * semantic/wisent/java-tags.el (semantic-get-local-variables): Add - `this' to the local variable context. + * semantic/wisent/java-tags.el (semantic-get-local-variables): + Add `this' to the local variable context. (semantic-analyze-split-name, semantic-analyze-unsplit-name): New. - * semantic/wisent/python.el (semantic-python-expand-tag): New - function. + * semantic/wisent/python.el (semantic-python-expand-tag): + New function. * srecode/compile.el (srecode-compile-templates): Add "framework" special variable support. @@ -280,7 +289,7 @@ (srecode-semantic-handle-:cpp): New functions. (srecode-semantic-apply-tag-to-dict): Move from cpp-mode function to c-mode function. - (srecode-c-apply-templates): Renamed from srecode-cpp-apply-templates. + (srecode-c-apply-templates): Rename from srecode-cpp-apply-templates. * srecode/dictionary.el (initialize-instance): Remove bogus error condition. @@ -293,8 +302,8 @@ * srecode/mode.el (srecode-minor-mode): Support the m3 menu. - * srecode/semantic.el (srecode-semantic-insert-tag): Support - system includes. + * srecode/semantic.el (srecode-semantic-insert-tag): + Support system includes. * srecode/srt-mode.el (srecode-font-lock-keywords): Update. @@ -325,8 +334,8 @@ * ede/proj-comp.el (ede-proj-makefile-insert-rules): Fix insertion of phony rule. - * ede/proj-elisp.el (ede-proj-target-elisp): Remove - ede-emacs-preload-compiler. + * ede/proj-elisp.el (ede-proj-target-elisp): + Remove ede-emacs-preload-compiler. (ede-proj-makefile-insert-rules, ede-proj-makefile-dependencies): New methods. (ede-emacs-compiler): Add 'require' macro to variables and pattern @@ -362,8 +371,8 @@ (semantic-cpp-lexer): Add semantic-lex-c-ifdef. (semantic-expand-c-tag): Check if tag is non-nil before adding it to return list - (semantic-expand-c-extern-C, semantic-expand-c-complex-type): New - functions, copied from semantic-expand-c-tag. + (semantic-expand-c-extern-C, semantic-expand-c-complex-type): + New functions, copied from semantic-expand-c-tag. (semantic-find-tags-included): New override which also searches for include tags inside of namespaces. (semantic-c-dereference-typedef): Use semantic-tag-prototype-p. @@ -371,16 +380,16 @@ * semantic/bovine/el.el: Remove emacs-lisp-mode-hook. - * semantic/complete.el (semantic-complete-post-command-hook): Exit - completion when user has deleted all characters from the prefix. + * semantic/complete.el (semantic-complete-post-command-hook): + Exit completion when user has deleted all characters from the prefix. (semantic-displayor-focus-request): Return to previous window when focussing tags. * semantic/db-el.el (semanticdb-normalize-one-tag): Make obsolete. (semanticdb-elisp-sym->tag): Use help-function-arglist instead. - * semantic/db-file.el (semanticdb-create-database): Use - semantic-tag-version instead of just semantic-version as the + * semantic/db-file.el (semanticdb-create-database): + Use semantic-tag-version instead of just semantic-version as the initializer for the :semantic-tag-version slot. * semantic/db-find.el (semanticdb-find-tags-by-class-method): @@ -394,11 +403,11 @@ (semanticdb-save-current-db, semanticdb-save-all-db): Only emit message when running interactively. - * semantic/decorate/mode.el (semantic-decoration-mode): Activate - decoration of includes by default. + * semantic/decorate/mode.el (semantic-decoration-mode): + Activate decoration of includes by default. - * semantic/doc.el (semantic-doc-snarf-comment-for-tag): Remove - comment delimiter at the end of the text. + * semantic/doc.el (semantic-doc-snarf-comment-for-tag): + Remove comment delimiter at the end of the text. * semantic/ede-grammar.el (semantic-ede-proj-target-grammar): Change aux- and pre-load-packages. @@ -412,16 +421,16 @@ (ede-proj-makefile-insert-rules): Add target specific EMACSFLAGS to raise max-specpdl-size and max-lisp-eval-depth. - * semantic/find.el (semantic-find-tags-included): Make - overridable. + * semantic/find.el (semantic-find-tags-included): + Make overridable. * semantic/fw.el (semantic-alias-obsolete) (semantic-varalias-obsolete): Use byte-compile-warn. (semantic-find-file-noselect): Disable font lock by calling global-font-lock-mode. - * semantic/grammar.el (semantic-grammar-create-package): Fix - message. + * semantic/grammar.el (semantic-grammar-create-package): + Fix message. (semantic-grammar-batch-build-one-package): When generating parsers in batch-mode, ignore version control and make sure we do not use cached versions. @@ -433,16 +442,16 @@ (semantic-lex-spp-lex-text-string): Instead of only setting the lexer, call the major mode's setup function. - * semantic/scope.el (semantic-analyze-scoped-types-default): Use - semantic-tag-prototype-p. + * semantic/scope.el (semantic-analyze-scoped-types-default): + Use semantic-tag-prototype-p. (semantic-analyze-scope-nested-tags-default): Make sure we don't return tags we already have in scopetypes. * semantic/symref/filter.el (semantic-symref-test-count-hits-in-tag): Restore. - * semantic/wisent/comp.el (wisent-BITS-PER-WORD): Use - most-positive-fixnum if available. + * semantic/wisent/comp.el (wisent-BITS-PER-WORD): + Use most-positive-fixnum if available. * semantic/wisent/javascript.el (semantic-tag-protection) (semantic-analyze-scope-calculate-access) @@ -477,8 +486,8 @@ 2012-10-01 Jan Moringen * semantic/idle.el - (semantic-idle-breadcrumbs--display-in-header-line): Escape - %-characters to avoid erroneous expansion in header line. + (semantic-idle-breadcrumbs--display-in-header-line): + Escape %-characters to avoid erroneous expansion in header line. (semantic-idle-breadcrumbs--display-in-mode-line): Likewise. * semantic/wisent/python.el (wisent-python-reconstitute-function-tag) @@ -514,8 +523,8 @@ * semantic/wisent/python.el (wisent-python-string-start-re) (wisent-python-string-re, wisent-python-forward-string) - (wisent-python-forward-line,wisent-python-lex-string): New - variables. + (wisent-python-forward-line,wisent-python-lex-string): + New variables. (wisent-python-forward-balanced-expression): New function. 2012-10-01 Pete Beardmore @@ -528,16 +537,16 @@ (semantic-displayor-tooltip-mode) (semantic-displayor-tooltip-initial-max-tags) (semantic-displayor-tooltip-max-tags): New defcustoms. - (semantic-displayor-tooltip): Use new variables as initforms. Use - new slot `mode' instead of `force-show'. Rename `max-tags' to + (semantic-displayor-tooltip): Use new variables as initforms. + Use new slot `mode' instead of `force-show'. Rename `max-tags' to `max-tags-initial'. (semantic-displayor-show-request): Display completions according to new modes, and make variable names clearer. (semantic-displayor-tooltip::semantic-displayor-scroll-request): Use new max-tags-initial slot. - * semantic/idle.el (semantic-idle-local-symbol-highlight): Make - sure there actually is a tag at point. + * semantic/idle.el (semantic-idle-local-symbol-highlight): + Make sure there actually is a tag at point. (semantic-idle-completion-list-default): Report errors as messages if semantic-idle-scheduler-verbose-flag is non-nil. @@ -548,13 +557,13 @@ 2012-10-01 Alex Ott - * semantic/idle.el (semantic-idle-scheduler-enabled-p): Fix - file-checking. + * semantic/idle.el (semantic-idle-scheduler-enabled-p): + Fix file-checking. 2012-10-01 Darren Hoo (tiny change) - * semantic/db-find.el (semanticdb-find-default-throttle): Make - buffer-local. + * semantic/db-find.el (semanticdb-find-default-throttle): + Make buffer-local. (semanticdb-strip-find-results): Check for existing :filename attribute, so that file information from GNU Global is not lost. @@ -1001,7 +1010,7 @@ (ede-customize-forms-menu): Prevent error if there is no project. (ede-load-project-file): Set ede-constructing to the thing being constructed, instead of t. - (ede-project-force-load): Deleted. + (ede-project-force-load): Delete. * ede/base.el: * ede/auto.el: @@ -1011,7 +1020,7 @@ (autoconf-parameters-for-macro): Parse multiline parameters of macros. Optionally ignore case and at bol for macro. (autoconf-parameter-strip): Use greedy match for newlines. - (autoconf-new-automake-string): Deleted. + (autoconf-new-automake-string): Delete. (autoconf-new-program): Use SRecode to fill an empty file. * ede/cpp-root.el (ede-create-lots-of-projects-under-dir): @@ -1046,7 +1055,7 @@ (project-am-scan-for-targets): Scan also over project-am-meta-type-alist. (ede-system-include-path): Simple implementation. - (ede-find-target): Deleted. EDE core takes care of this. + (ede-find-target): Delete. EDE core takes care of this. (ede-buffer-mine): Create the searched filename as relative. (project-am-load): Simplify, using autoconf-edit. (project-am-extract-package-info): Fix separators. @@ -1063,7 +1072,7 @@ (ede-proj-target-makefile-objectcode): Quote initforms. Support lex and yacc. - * ede/proj-prog.el (ede-proj-makefile-insert-rules): Removed. + * ede/proj-prog.el (ede-proj-makefile-insert-rules): Remove. (ede-proj-makefile-insert-variables): New, add LDDEPS. (ede-proj-makefile-insert-automake-post-variables): Add LDADD variable. Use ldlibs-local slot. Add a -l to ldlibs strings. @@ -1158,7 +1167,7 @@ * semantic/util.el (semantic-hack-search) (semantic-recursive-find-nonterminal-by-name) - (semantic-current-tag-interactive): Deleted. + (semantic-current-tag-interactive): Delete. (semantic-describe-buffer): Fix expand-nonterminal. Add lex-syntax-mods, type relation separator char, and command separation char. @@ -1191,7 +1200,7 @@ (semantic-idle-truncate-long-summaries): New option. * semantic/ia.el (semantic-ia-cache) - (semantic-ia-get-completions): Deleted. Callers changed. + (semantic-ia-get-completions): Delete. Callers changed. (semantic-ia-show-variants): New command. (semantic-ia-show-doc): If doc is empty, don't make a temp buffer. (semantic-ia-show-summary): If there isn't anything to show, say so. diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el index 7b4a47bd260..4f8e93dc391 100644 --- a/lisp/cedet/semantic/db-file.el +++ b/lisp/cedet/semantic/db-file.el @@ -70,7 +70,9 @@ passes a list of predicates in `semanticdb-project-predicate-functions'." :group 'semanticdb :type nil) -(defcustom semanticdb-save-database-hooks nil +(define-obsolete-variable-alias 'semanticdb-save-database-hooks + 'semanticdb-save-database-functions "24.3") +(defcustom semanticdb-save-database-functions nil "Abnormal hook run after a database is saved. Each function is called with one argument, the object representing the database recently written." @@ -251,7 +253,7 @@ If DB is not specified, then use the current database." (message "Save Error: %S: %s" (car (cdr foo)) objname) (error "%S" (car (cdr foo)))))))) - (run-hook-with-args 'semanticdb-save-database-hooks + (run-hook-with-args 'semanticdb-save-database-functions (or DB semanticdb-current-database)) ;;(message "Saving tag summary for %s...done" objname) ) diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el index 23b6784fe2a..5b39dec2628 100644 --- a/lisp/cedet/semantic/edit.el +++ b/lisp/cedet/semantic/edit.el @@ -72,7 +72,9 @@ updated in the current buffer. For language specific hooks, make sure you define this as a local hook.") -(defvar semantic-change-hooks +(define-obsolete-variable-alias 'semantic-change-hooks + 'semantic-change-functions "24.3") +(defvar semantic-change-functions '(semantic-edits-change-function-handle-changes) "Abnormal hook run when semantic detects a change in a buffer. Each hook function must take three arguments, identical to the @@ -89,11 +91,15 @@ If the hook returns non-nil, then declare that a reparse is needed. For language specific hooks, make sure you define this as a local hook. Not used yet; part of the next generation reparse mechanism.") -(defvar semantic-edits-new-change-hooks nil +(define-obsolete-variable-alias 'semantic-edits-new-change-hooks + 'semantic-edits-new-change-functions "24.3") +(defvar semantic-edits-new-change-functions nil "Abnormal hook run when a new change is found. Functions must take one argument representing an overlay on that change.") -(defvar semantic-edits-delete-change-hooks nil +(define-obsolete-variable-alias 'semantic-edits-delete-change-hooks + 'semantic-edits-delete-change-functions "24.3") +(defvar semantic-edits-delete-change-functions nil "Abnormal hook run before a change overlay is deleted. Deleted changes occur when multiple changes are merged. Functions must take one argument representing an overlay being deleted.") @@ -104,7 +110,9 @@ Changes move when a new change overlaps an old change. The old change will be moved. Functions must take one argument representing an overlay being moved.") -(defvar semantic-edits-reparse-change-hooks nil +(define-obsolete-variable-alias 'semantic-edits-reparse-change-hooks + 'semantic-edits-reparse-change-functions "24.3") +(defvar semantic-edits-reparse-change-functions nil "Abnormal hook run after a change results in a reparse. Functions are called before the overlay is deleted, and after the incremental reparse.") @@ -133,7 +141,7 @@ Argument START, END, and LENGTH specify the bounds of the change." (setq semantic-unmatched-syntax-cache-check t) (let ((inhibit-point-motion-hooks t) ) - (run-hook-with-args 'semantic-change-hooks start end length) + (run-hook-with-args 'semantic-change-functions start end length) )) (defun semantic-changes-in-region (start end &optional buffer) @@ -168,7 +176,7 @@ Argument START, END, and LENGTH specify the bounds of the change." ;; function will be removed from the list of active change ;; functions. (condition-case nil - (run-hook-with-args 'semantic-edits-new-change-hooks o) + (run-hook-with-args 'semantic-edits-new-change-functions o) (error nil))) (let ((tmp changes-in-change)) ;; Find greatest bounds of all changes @@ -188,7 +196,7 @@ Argument START, END, and LENGTH specify the bounds of the change." ;; Delete other changes. They are now all bound here. (while changes-in-change (condition-case nil - (run-hook-with-args 'semantic-edits-delete-change-hooks + (run-hook-with-args 'semantic-edits-delete-change-functions (car changes-in-change)) (error nil)) (semantic-overlay-delete (car changes-in-change)) @@ -198,7 +206,7 @@ Argument START, END, and LENGTH specify the bounds of the change." (defsubst semantic-edits-flush-change (change) "Flush the CHANGE overlay." (condition-case nil - (run-hook-with-args 'semantic-edits-delete-change-hooks + (run-hook-with-args 'semantic-edits-delete-change-functions change) (error nil)) (semantic-overlay-delete change)) diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el index d7ab5911a67..274df355901 100644 --- a/lisp/cedet/semantic/lex.el +++ b/lisp/cedet/semantic/lex.el @@ -729,7 +729,9 @@ This is an alist of (ANCHOR . STREAM) elements where ANCHOR is the start position of the block, and STREAM is the list of tokens in that block.") -(defvar semantic-lex-reset-hooks nil +(define-obsolete-variable-alias 'semantic-lex-reset-hooks + 'semantic-lex-reset-functions "24.3") +(defvar semantic-lex-reset-functions nil "Abnormal hook used by major-modes to reset lexical analyzers. Hook functions are called with START and END values for the current lexical pass. Should be set with `add-hook', specifying @@ -771,7 +773,7 @@ analyzer which might mistake a number for as a symbol." ;; Make sure the state of block parsing starts over. (setq semantic-lex-block-streams nil) ;; Allow specialty reset items. - (run-hook-with-args 'semantic-lex-reset-hooks start end) + (run-hook-with-args 'semantic-lex-reset-functions start end) ;; Lexing state. (let* (;(starttime (current-time)) (starting-position (point)) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 579551c9a91..2279dc2bf20 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -487,7 +487,6 @@ since it could result in memory overflow and make Emacs crash." (hourglass-delay cursor number) ;; xfaces.c - (font-list-limit display integer) (scalable-fonts-allowed display boolean "22.1") ;; xfns.c (x-bitmap-file-path installation diff --git a/lisp/delsel.el b/lisp/delsel.el index a6435672201..2ed82676189 100644 --- a/lisp/delsel.el +++ b/lisp/delsel.el @@ -44,9 +44,12 @@ ;; `kill-region' is used on the selection, rather than ;; `delete-region'. (Text selected with the mouse will typically ;; be yankable anyhow.) -;; non-nil +;; t ;; The normal case: delete the active region prior to executing ;; the command which will insert replacement text. +;; +;; For commands which need to dynamically determine this behaviour. +;; The function should return one of the above values or nil. ;;; Code: @@ -71,65 +74,96 @@ any selection." (transient-mark-mode t))) (defun delete-active-region (&optional killp) + "Delete the active region. +If KILLP in not-nil, the active region is killed instead of deleted." (if killp (kill-region (point) (mark)) (delete-region (point) (mark))) t) -(defun delete-selection-pre-hook () - (when (and delete-selection-mode transient-mark-mode mark-active - (not buffer-read-only)) - (let ((type (and (symbolp this-command) - (get this-command 'delete-selection)))) - (condition-case data - (cond ((eq type 'kill) - (delete-active-region t)) - ((eq type 'yank) - ;; Before a yank command, make sure we don't yank the - ;; head of the kill-ring that really comes from the - ;; currently active region we are going to delete. - ;; That would make yank a no-op. - (when (and (string= (buffer-substring-no-properties - (point) (mark)) - (car kill-ring)) - (fboundp 'mouse-region-match) - (mouse-region-match)) - (current-kill 1)) - (delete-active-region)) - ((eq type 'supersede) - (let ((empty-region (= (point) (mark)))) - (delete-active-region) - (unless empty-region - (setq this-command 'ignore)))) - (type - (delete-active-region) - (if (and overwrite-mode - (eq this-command 'self-insert-command)) - (let ((overwrite-mode nil)) - (self-insert-command - (prefix-numeric-value current-prefix-arg)) - (setq this-command 'ignore))))) - ;; If ask-user-about-supersession-threat signals an error, - ;; stop safe_run_hooks from clearing out pre-command-hook. - (file-supersession (message "%s" (cadr data)) (ding)) - (text-read-only - ;; This signal may come either from `delete-active-region' or - ;; `self-insert-command' (when `overwrite-mode' is non-nil). - ;; To avoid clearing out `pre-command-hook' we handle this case - ;; by issuing a simple message. Note, however, that we do not - ;; handle all related problems: When read-only text ends before - ;; the end of the region, the latter is not deleted but any - ;; subsequent insertion will succeed. We could avoid this case - ;; by doing a (setq this-command 'ignore) here. This would, - ;; however, still not handle the case where read-only text ends - ;; precisely where the region starts: In that case the deletion - ;; would succeed but the subsequent insertion would fail with a - ;; text-read-only error. To handle that case we would have to - ;; investigate text properties at both ends of the region and - ;; skip the deletion when inserting text is forbidden there. - (message "Text is read-only") (ding)))))) +(defun delete-selection-helper (type) + "Delete selection according to TYPE: + `yank' + For commands which do a yank; ensures the region about to be + deleted isn't yanked. + `supersede' + Delete the active region and ignore the current command, + i.e. the command will just delete the region. + `kill' + `kill-region' is used on the selection, rather than + `delete-region'. (Text selected with the mouse will typically + be yankable anyhow.) + t + The normal case: delete the active region prior to executing + the command which will insert replacement text. + FUNCTION + For commands which need to dynamically determine this behaviour. + FUNCTION should take no argument and return one of the above values or nil." + (condition-case data + (cond ((eq type 'kill) + (delete-active-region t)) + ((eq type 'yank) + ;; Before a yank command, make sure we don't yank the + ;; head of the kill-ring that really comes from the + ;; currently active region we are going to delete. + ;; That would make yank a no-op. + (when (and (string= (buffer-substring-no-properties + (point) (mark)) + (car kill-ring)) + (fboundp 'mouse-region-match) + (mouse-region-match)) + (current-kill 1)) + (delete-active-region)) + ((eq type 'supersede) + (let ((empty-region (= (point) (mark)))) + (delete-active-region) + (unless empty-region + (setq this-command 'ignore)))) + ((functionp type) (delete-selection-helper (funcall type))) + (type + (delete-active-region) + (if (and overwrite-mode + (eq this-command 'self-insert-command)) + (let ((overwrite-mode nil)) + (self-insert-command + (prefix-numeric-value current-prefix-arg)) + (setq this-command 'ignore))))) + ;; If ask-user-about-supersession-threat signals an error, + ;; stop safe_run_hooks from clearing out pre-command-hook. + (file-supersession (message "%s" (cadr data)) (ding)) + (text-read-only + ;; This signal may come either from `delete-active-region' or + ;; `self-insert-command' (when `overwrite-mode' is non-nil). + ;; To avoid clearing out `pre-command-hook' we handle this case + ;; by issuing a simple message. Note, however, that we do not + ;; handle all related problems: When read-only text ends before + ;; the end of the region, the latter is not deleted but any + ;; subsequent insertion will succeed. We could avoid this case + ;; by doing a (setq this-command 'ignore) here. This would, + ;; however, still not handle the case where read-only text ends + ;; precisely where the region starts: In that case the deletion + ;; would succeed but the subsequent insertion would fail with a + ;; text-read-only error. To handle that case we would have to + ;; investigate text properties at both ends of the region and + ;; skip the deletion when inserting text is forbidden there. + (message "Text is read-only") (ding)))) + +(defun delete-selection-pre-hook () + "Function run before commands that delete selections are executed. +Commands which will delete the selection need a `delete-selection' +property on their symbol; commands which insert text but don't +have this property won't delete the selection. +See `delete-selection-helper'." + (when (and delete-selection-mode (use-region-p) + (not buffer-read-only)) + (delete-selection-helper (and (symbolp this-command) + (get this-command 'delete-selection))))) + +(put 'self-insert-command 'delete-selection + (lambda () + (not (run-hook-with-args-until-success + 'self-insert-uses-region-functions)))) -(put 'self-insert-command 'delete-selection t) (put 'self-insert-iso 'delete-selection t) (put 'yank 'delete-selection 'yank) diff --git a/lisp/electric.el b/lisp/electric.el index 3108a0ed4c0..abf5a72ecaf 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -301,14 +301,17 @@ This can be convenient for people who find it easier to hit ) than C-f." :version "24.1" :type 'boolean) +(defun electric-pair-syntax (command-event) + (and electric-pair-mode + (let ((x (assq command-event electric-pair-pairs))) + (cond + (x (if (eq (car x) (cdr x)) ?\" ?\()) + ((rassq command-event electric-pair-pairs) ?\)) + (t (char-syntax command-event)))))) + (defun electric-pair-post-self-insert-function () (let* ((syntax (and (eq (char-before) last-command-event) ; Sanity check. - electric-pair-mode - (let ((x (assq last-command-event electric-pair-pairs))) - (cond - (x (if (eq (car x) (cdr x)) ?\" ?\()) - ((rassq last-command-event electric-pair-pairs) ?\)) - (t (char-syntax last-command-event)))))) + (electric-pair-syntax last-command-event))) ;; FIXME: when inserting the closer, we should maybe use ;; self-insert-command, although it may prove tricky running ;; post-self-insert-hook recursively, and we wouldn't want to trigger @@ -355,6 +358,10 @@ This can be convenient for people who find it easier to hit ) than C-f." (eq (char-syntax (following-char)) ?w))) (save-excursion (insert closer)))))) +(defun electric-pair-will-use-region () + (and (use-region-p) + (memq (electric-pair-syntax last-command-event) '(?\( ?\" ?\$)))) + ;;;###autoload (define-minor-mode electric-pair-mode "Toggle automatic parens pairing (Electric Pair mode). @@ -370,10 +377,15 @@ See options `electric-pair-pairs' and `electric-pair-skip-self'." :global t :group 'electricity (if electric-pair-mode - (add-hook 'post-self-insert-hook - #'electric-pair-post-self-insert-function) + (progn + (add-hook 'post-self-insert-hook + #'electric-pair-post-self-insert-function) + (add-hook 'self-insert-uses-region-functions + #'electric-pair-will-use-region)) (remove-hook 'post-self-insert-hook - #'electric-pair-post-self-insert-function))) + #'electric-pair-post-self-insert-function) + (remove-hook 'self-insert-uses-region-functions + #'electric-pair-will-use-region))) ;; Automatically add newlines after/before/around some chars. diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index ee8cbd2c3bc..ffa42e97221 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -124,7 +124,7 @@ ;; Adding your own checks: ;; ;; You can experiment with adding your own checks by setting the -;; hooks `checkdoc-style-hooks' and `checkdoc-comment-style-hooks'. +;; hooks `checkdoc-style-functions' and `checkdoc-comment-style-hooks'. ;; Return a string which is the error you wish to report. The cursor ;; position should be preserved. ;; @@ -274,17 +274,21 @@ made in the style guide relating to order." :type 'boolean) ;;;###autoload(put 'checkdoc-arguments-in-order-flag 'safe-local-variable 'booleanp) -(defvar checkdoc-style-hooks nil - "Hooks called after the standard style check is completed. -All hooks must return nil or a string representing the error found. +(define-obsolete-variable-alias 'checkdoc-style-hooks + 'checkdoc-style-functions "24.3") +(defvar checkdoc-style-functions nil + "Hook run after the standard style check is completed. +All functions must return nil or a string representing the error found. Useful for adding new user implemented commands. Each hook is called with two parameters, (DEFUNINFO ENDPOINT). DEFUNINFO is the return value of `checkdoc-defun-info'. ENDPOINT is the location of end of the documentation string.") -(defvar checkdoc-comment-style-hooks nil - "Hooks called after the standard comment style check is completed. +(define-obsolete-variable-alias 'checkdoc-comment-style-hooks + 'checkdoc-comment-style-functions "24.3") +(defvar checkdoc-comment-style-functions nil + "Hook run after the standard comment style check is completed. Must return nil if no errors are found, or a string describing the problem discovered. This is useful for adding additional checks.") @@ -1843,7 +1847,7 @@ Replace with \"%s\"? " original replace) ;; and reliance on the Ispell program. (checkdoc-ispell-docstring-engine e) ;; User supplied checks - (save-excursion (checkdoc-run-hooks 'checkdoc-style-hooks fp e)) + (save-excursion (checkdoc-run-hooks 'checkdoc-style-functions fp e)) ;; Done! ))) @@ -2353,7 +2357,7 @@ Code:, and others referenced in the style guide." err (or ;; Generic Full-file checks (should be comment related) - (checkdoc-run-hooks 'checkdoc-comment-style-hooks) + (checkdoc-run-hooks 'checkdoc-comment-style-functions) err)) ;; Done with full file comment checks err))) diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index 939fab78942..26a1fce2309 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -44,110 +44,101 @@ menus, turn this variable off, otherwise it is probably better to keep it on.") ;;;###autoload (defmacro easy-menu-define (symbol maps doc menu) - "Define a menu bar submenu in maps MAPS, according to MENU. + "Define a pop-up menu and/or menu bar menu specified by MENU. +If SYMBOL is non-nil, define SYMBOL as a function to pop up the +submenu defined by MENU, with DOC as its doc string. -If SYMBOL is non-nil, store the menu keymap in the value of SYMBOL, -and define SYMBOL as a function to pop up the menu, with DOC as its doc string. -If SYMBOL is nil, just store the menu keymap into MAPS. +MAPS, if non-nil, should be a keymap or a list of keymaps; add +the submenu defined by MENU to the keymap or each of the keymaps, +as a top-level menu bar item. -The first element of MENU must be a string. It is the menu bar item name. -It may be followed by the following keyword argument pairs +The first element of MENU must be a string. It is the menu bar +item name. It may be followed by the following keyword argument +pairs: - :filter FUNCTION + :filter FUNCTION + FUNCTION must be a function which, if called with one + argument---the list of the other menu items---returns the + items to actually display. -FUNCTION is a function with one argument, the rest of menu items. -It returns the remaining items of the displayed menu. + :visible INCLUDE + INCLUDE is an expression. The menu is visible if the + expression evaluates to a non-nil value. `:included' is an + alias for `:visible'. - :visible INCLUDE + :active ENABLE + ENABLE is an expression. The menu is enabled for selection + if the expression evaluates to a non-nil value. `:enable' is + an alias for `:active'. -INCLUDE is an expression; this menu is only visible if this -expression has a non-nil value. `:included' is an alias for `:visible'. +The rest of the elements in MENU are menu items. +A menu item can be a vector of three elements: - :active ENABLE - -ENABLE is an expression; the menu is enabled for selection whenever -this expression's value is non-nil. `:enable' is an alias for `:active'. - -The rest of the elements in MENU, are menu items. - -A menu item is usually a vector of three elements: [NAME CALLBACK ENABLE] + [NAME CALLBACK ENABLE] NAME is a string--the menu item name. -CALLBACK is a command to run when the item is chosen, -or a list to evaluate when the item is chosen. +CALLBACK is a command to run when the item is chosen, or an +expression to evaluate when the item is chosen. -ENABLE is an expression; the item is enabled for selection -whenever this expression's value is non-nil. +ENABLE is an expression; the item is enabled for selection if the +expression evaluates to a non-nil value. Alternatively, a menu item may have the form: - [ NAME CALLBACK [ KEYWORD ARG ] ... ] + [ NAME CALLBACK [ KEYWORD ARG ]... ] -Where KEYWORD is one of the symbols defined below. +where NAME and CALLBACK have the same meanings as above, and each +optional KEYWORD and ARG pair should be one of the following: - :keys KEYS + :keys KEYS + KEYS is a string; a keyboard equivalent to the menu item. + This is normally not needed because keyboard equivalents are + usually computed automatically. KEYS is expanded with + `substitute-command-keys' before it is used. -KEYS is a string; a complex keyboard equivalent to this menu item. -This is normally not needed because keyboard equivalents are usually -computed automatically. -KEYS is expanded with `substitute-command-keys' before it is used. + :key-sequence KEYS + KEYS is a hint for speeding up Emacs's first display of the + menu. It should be nil if you know that the menu item has no + keyboard equivalent; otherwise it should be a string or + vector specifying a keyboard equivalent for the menu item. - :key-sequence KEYS + :active ENABLE + ENABLE is an expression; the item is enabled for selection + whenever this expression's value is non-nil. `:enable' is an + alias for `:active'. -KEYS is nil, a string or a vector; nil or a keyboard equivalent to this -menu item. -This is a hint that will considerably speed up Emacs's first display of -a menu. Use `:key-sequence nil' when you know that this menu item has no -keyboard equivalent. + :visible INCLUDE + INCLUDE is an expression; this item is only visible if this + expression has a non-nil value. `:included' is an alias for + `:visible'. - :active ENABLE + :label FORM + FORM is an expression that is dynamically evaluated and whose + value serves as the menu item's label (the default is NAME). -ENABLE is an expression; the item is enabled for selection whenever -this expression's value is non-nil. `:enable' is an alias for `:active'. + :suffix FORM + FORM is an expression that is dynamically evaluated and whose + value is concatenated with the menu entry's label. - :visible INCLUDE + :style STYLE + STYLE is a symbol describing the type of menu item; it should + be `toggle' (a checkbox), or `radio' (a radio button), or any + other value (meaning an ordinary menu item). -INCLUDE is an expression; this item is only visible if this -expression has a non-nil value. `:included' is an alias for `:visible'. + :selected SELECTED + SELECTED is an expression; the checkbox or radio button is + selected whenever the expression's value is non-nil. - :label FORM + :help HELP + HELP is a string, the help to display for the menu item. -FORM is an expression that will be dynamically evaluated and whose -value will be used for the menu entry's text label (the default is NAME). +Alternatively, a menu item can be a string. Then that string +appears in the menu as unselectable text. A string consisting +solely of dashes is displayed as a menu separator. - :suffix FORM - -FORM is an expression that will be dynamically evaluated and whose -value will be concatenated to the menu entry's label. - - :style STYLE - -STYLE is a symbol describing the type of menu item. The following are -defined: - -toggle: A checkbox. - Prepend the name with `(*) ' or `( ) ' depending on if selected or not. -radio: A radio button. - Prepend the name with `[X] ' or `[ ] ' depending on if selected or not. -button: Surround the name with `[' and `]'. Use this for an item in the - menu bar itself. -anything else means an ordinary menu item. - - :selected SELECTED - -SELECTED is an expression; the checkbox or radio button is selected -whenever this expression's value is non-nil. - - :help HELP - -HELP is a string, the help to display for the menu item. - -A menu item can be a string. Then that string appears in the menu as -unselectable text. A string consisting solely of hyphens is displayed -as a solid horizontal line. - -A menu item can be a list with the same format as MENU. This is a submenu." +Alternatively, a menu item can be a list with the same format as +MENU. This is a submenu." (declare (indent defun) (debug (symbolp body))) `(progn ,(if symbol `(defvar ,symbol nil ,doc)) diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 5f8cbea7c27..608134bd54f 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -2066,7 +2066,9 @@ Keys are a number representing :before, :primary, and :after methods.") During executions, the list is first generated, then as each next method is called, the next method is popped off the stack.") -(defvar eieio-pre-method-execution-hooks nil +(define-obsolete-variable-alias 'eieio-pre-method-execution-hooks + 'eieio-pre-method-execution-functions "24.3") +(defvar eieio-pre-method-execution-functions nil "Abnormal hook run just before an EIEIO method is executed. The hook function must accept one argument, the list of forms about to be executed.") @@ -2172,7 +2174,7 @@ This should only be called from a generic function." (eieiomt-method-list method method-primary nil))) ) - (run-hook-with-args 'eieio-pre-method-execution-hooks + (run-hook-with-args 'eieio-pre-method-execution-functions primarymethodlist) ;; Now loop through all occurrences forms which we must execute @@ -2277,7 +2279,7 @@ for this common case to improve performance." ;; Do the regular implementation here. - (run-hook-with-args 'eieio-pre-method-execution-hooks + (run-hook-with-args 'eieio-pre-method-execution-functions lambdas) (setq lastval (apply (car lambdas) newargs)) diff --git a/lisp/faces.el b/lisp/faces.el index 08aa800c067..f5ef88d08b0 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2572,6 +2572,12 @@ also the same size as FACE on FRAME, or fail." (car fonts)) (cdr (assq 'font (frame-parameters (selected-frame)))))) +(defcustom font-list-limit 100 + "This variable is obsolete and has no effect." + :type 'integer + :group 'display) +(make-obsolete-variable 'font-list-limit nil "24.3") + (provide 'faces) ;;; faces.el ends here diff --git a/lisp/filesets.el b/lisp/filesets.el index a91d8cf0fcb..7f695cf33dd 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el @@ -403,8 +403,10 @@ Don't forget to check out `filesets-menu-ensure-use-cached'." (sexp :tag "Other" :value nil))) :group 'filesets) -(defcustom filesets-cache-fill-content-hooks nil - "Hooks to run when writing the contents of filesets' cache file. +(define-obsolete-variable-alias 'filesets-cache-fill-content-hooks + 'filesets-cache-fill-content-hook "24.3") +(defcustom filesets-cache-fill-content-hook nil + "Hook run when writing the contents of filesets' cache file. The hook is called with the cache file as current buffer and the cursor at the last position. I.e. each hook has to make sure that the cursor is @@ -2414,7 +2416,7 @@ fileset thinks this is necessary or not." (when filesets-cache-hostname-flag (insert (format "(setq filesets-cache-hostname %S)" (system-name))) (newline 2)) - (run-hooks 'filesets-cache-fill-content-hooks) + (run-hooks 'filesets-cache-fill-content-hook) (write-file filesets-menu-cache-file)) (setq filesets-has-changed-flag nil) (setq filesets-update-cache-file-flag nil))) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index dade2b4bbe5..8cb53de85fa 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,11 @@ +2012-10-23 Stefan Monnier + + * nndiary.el (nndiary-request-create-group-functions) + (nndiary-request-update-info-functions) + (nndiary-request-accept-article-functions): + * gnus-start.el (gnus-subscribe-newsgroup-functions): Don't use + "-hooks" suffix. + 2012-10-17 Kazuhiro Ito (tiny change) * starttls.el (starttls-extra-arguments): Doc fix. @@ -110,7 +118,7 @@ 2012-09-05 Martin Stjernholm - * gnus-demon.el (gnus-demon-init): Fixed regression when IDLE is t and + * gnus-demon.el (gnus-demon-init): Fix regression when IDLE is t and TIME is set. 2012-09-05 Juri Linkov @@ -571,7 +579,7 @@ * gnus.el: Register gnus-registry functions. * gnus-registry.el (gnus-try-warping-via-registry): - Moved here and indent. + Move here and indent. * gnus-int.el (gnus-warp-to-article): Check whether the registry is enabled before warping. @@ -703,7 +711,7 @@ (message-multi-smtp-send-mail): Respect the X-Message-SMTP-Method header to implement multi-SMTP functionality. - * gnus-agent.el (gnus-agent-send-mail-function): Removed. + * gnus-agent.el (gnus-agent-send-mail-function): Remove. (gnus-agentize): Don't set it. (gnus-agent-send-mail): Don't use it. @@ -844,8 +852,8 @@ 2012-06-10 Lars Magne Ingebrigtsen - * gnus-group.el (gnus-group-get-new-news): Respect - `gnus-group-use-permanent-levels', as documented (bug#11638). + * gnus-group.el (gnus-group-get-new-news): + Respect `gnus-group-use-permanent-levels', as documented (bug#11638). 2012-06-10 Dave Abrahams @@ -985,7 +993,7 @@ (shr-insert): Allow the natural width to be computed for tables again. (shr-tag-table-1): Rework how the natural widths are computed by rendering the table a third time. - (shr-natural-width): Removed. + (shr-natural-width): Remove. (shr-buffer-width): New function. (shr-expand-newlines): Use it. @@ -1396,8 +1404,8 @@ 2012-01-04 Wolfgang Jenkner (tiny change) - * gnus-agent.el (gnus-agent-load-local): Recompute - gnus-agent-article-local on changing method. + * gnus-agent.el (gnus-agent-load-local): + Recompute gnus-agent-article-local on changing method. 2012-01-04 Lars Magne Ingebrigtsen @@ -1689,8 +1697,8 @@ 2011-09-27 Daiki Ueno - * plstore.el (plstore-select-keys, plstore-encrypt-to): Clarify - documentation. + * plstore.el (plstore-select-keys, plstore-encrypt-to): + Clarify documentation. 2011-09-27 Lars Magne Ingebrigtsen diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 40ee78bb695..eaf17d9e579 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -291,7 +291,9 @@ claim them." function (repeat function))) -(defcustom gnus-subscribe-newsgroup-hooks nil +(define-obsolete-variable-alias 'gnus-subscribe-newsgroup-hooks + 'gnus-subscribe-newsgroup-functions "24.3") +(defcustom gnus-subscribe-newsgroup-functions nil "*Hooks run after you subscribe to a new group. The hooks will be called with new group's name as argument." :version "22.1" @@ -639,7 +641,7 @@ the first newsgroup." gnus-level-killed (gnus-group-entry (or next "dummy.group"))) (gnus-request-update-group-status newsgroup 'subscribe) (gnus-message 5 "Subscribe newsgroup: %s" newsgroup) - (run-hook-with-args 'gnus-subscribe-newsgroup-hooks newsgroup) + (run-hook-with-args 'gnus-subscribe-newsgroup-functions newsgroup) t)) (defun gnus-read-active-file-p () diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el index 8752972c3c8..73dd2921b68 100644 --- a/lisp/gnus/nndiary.el +++ b/lisp/gnus/nndiary.el @@ -179,22 +179,28 @@ In order to make this clear, here are some examples: :group 'nndiary) -(defcustom nndiary-request-create-group-hooks nil - "*Hooks to run after `nndiary-request-create-group' is executed. -The hooks will be called with the full group name as argument." +(define-obsolete-variable-alias 'nndiary-request-create-group-hooks + 'nndiary-request-create-group-functions "24.3") +(defcustom nndiary-request-create-group-functions nil + "*Hook run after `nndiary-request-create-group' is executed. +The hook functions will be called with the full group name as argument." :group 'nndiary :type 'hook) -(defcustom nndiary-request-update-info-hooks nil - "*Hooks to run after `nndiary-request-update-info-group' is executed. -The hooks will be called with the full group name as argument." +(define-obsolete-variable-alias 'nndiary-request-update-info-hooks + 'nndiary-request-update-info-functions "24.3") +(defcustom nndiary-request-update-info-functions nil + "*Hook run after `nndiary-request-update-info-group' is executed. +The hook functions will be called with the full group name as argument." :group 'nndiary :type 'hook) -(defcustom nndiary-request-accept-article-hooks nil - "*Hooks to run before accepting an article. +(define-obsolete-variable-alias 'nndiary-request-accept-article-hooks + 'nndiary-request-accept-article-functions "24.3") +(defcustom nndiary-request-accept-article-functions nil + "*Hook run before accepting an article. Executed near the beginning of `nndiary-request-accept-article'. -The hooks will be called with the article in the current buffer." +The hook functions will be called with the article in the current buffer." :group 'nndiary :type 'hook) @@ -541,7 +547,7 @@ all. This may very well take some time.") (setcar active (apply 'min articles)) (setcdr active (apply 'max articles)))) (nnmail-save-active nndiary-group-alist nndiary-active-file) - (run-hook-with-args 'nndiary-request-create-group-hooks + (run-hook-with-args 'nndiary-request-create-group-functions (gnus-group-prefixed-name group (list "nndiary" server))) t)) @@ -633,7 +639,7 @@ all. This may very well take some time.") (deffoo nndiary-request-accept-article (group &optional server last) (nndiary-possibly-change-directory group server) (nnmail-check-syntax) - (run-hooks 'nndiary-request-accept-article-hooks) + (run-hooks 'nndiary-request-accept-article-functions) (when (nndiary-schedule) (let (result) (when nnmail-cache-accepted-message-ids @@ -804,7 +810,7 @@ all. This may very well take some time.") (gnus-info-set-read info (gnus-update-read-articles (gnus-info-group info) unread t))) )) - (run-hook-with-args 'nndiary-request-update-info-hooks + (run-hook-with-args 'nndiary-request-update-info-functions (gnus-info-group info)) t)) diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index b0bc5b6b3b3..a1853a6e04b 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -249,7 +249,8 @@ when not running under a window system." :tag "init-kludge-hooks" :type '(hook)) -(defcustom hfy-post-html-hooks nil +(define-obsolete-variable-alias 'hfy-post-html-hooks 'hfy-post-html-hook "24.3") +(defcustom hfy-post-html-hook nil "List of functions to call after creating and filling the HTML buffer. These functions will be called with the HTML buffer as the current buffer." :group 'htmlfontify @@ -1786,7 +1787,7 @@ FILE, if set, is the file name." ;;(message "inserting footer") (insert (funcall hfy-page-footer file))) ;; call any post html-generation hooks: - (run-hooks 'hfy-post-html-hooks) + (run-hooks 'hfy-post-html-hook) ;; return the html buffer (set-buffer-modified-p nil) html-buffer)) diff --git a/lisp/image.el b/lisp/image.el index 72dc654757a..aef44fc3701 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -308,8 +308,17 @@ be determined." "Determine the type of image file FILE from its name. Value is a symbol specifying the image type, or nil if type cannot be determined." - (assoc-default file image-type-file-name-regexps 'string-match-p)) - + (let (type first) + (or + (catch 'found + (dolist (elem image-type-file-name-regexps) + (when (string-match-p (car elem) file) + (setq type (cdr elem)) + (or first (setq first type)) + (if (image-type-available-p type) + (throw 'found type))))) + ;; If nothing seems to be supported, return the first type that matched. + first))) ;;;###autoload (defun image-type (source &optional type data-p) @@ -798,7 +807,7 @@ to enable all types that ImageMagick supports. The variable `imagemagick-types-inhibit' overrides this variable. -If you change this without outside of Customize, you must call +If you change this without using customize, you must call `imagemagick-register-types' afterwards. If Emacs is compiled without ImageMagick support, this variable diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 331754fb1b5..afa13fe4e04 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -243,15 +243,14 @@ Used by `mail-yank-original' via `mail-indent-citation'." :type 'integer :group 'sendmail) -;; FIXME make it really obsolete. (defvar mail-yank-hooks nil "Obsolete hook for modifying a citation just inserted in the mail buffer. Each hook function can find the citation between (point) and (mark t). And each hook function should leave point and mark around the citation text as modified. - This is a normal hook, misnamed for historical reasons. -It is semi-obsolete and mail agents should no longer use it.") +It is obsolete and mail agents should no longer use it.") +(make-obsolete-variable 'mail-yank-hooks 'mail-citation-hook "19.34") ;;;###autoload (defcustom mail-citation-hook nil diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index 6eedef1980e..adc8707f011 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog @@ -1,3 +1,7 @@ +2012-10-23 Stefan Monnier + + * mh-letter.el (mh-yank-hooks): Use make-obsolete-variable. + 2012-04-25 Stefan Monnier * mh-utils.el (minibuffer-completing-file-name): Don't declare, unused. diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index 2723fb5e684..705c92b0b4c 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -3189,7 +3189,9 @@ function used to insert the signature with :group 'mh-letter :package-version '(MH-E . "8.0")) -(defcustom-mh mh-kill-folder-suppress-prompt-hooks '(mh-search-p) +(define-obsolete-variable-alias 'mh-kill-folder-suppress-prompt-hooks + 'mh-kill-folder-suppress-prompt-functions "24.3") +(defcustom-mh mh-kill-folder-suppress-prompt-functions '(mh-search-p) "Abnormal hook run at the beginning of \\\\[mh-kill-folder]. The hook functions are called with no arguments and should return diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index 8aed1873348..490bfc07560 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -66,8 +66,9 @@ Each hook function can find the citation between point and mark. And each hook function should leave point and mark around the citation text as modified. -This is a normal hook, misnamed for historical reasons. It is -semi-obsolete and is only used if `mail-citation-hook' is nil.") +This is a normal hook, misnamed for historical reasons. +It is obsolete and is only used if `mail-citation-hook' is nil.") +(make-obsolete-variable 'mh-yank-hooks 'mail-citation-hook "19.34") diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index f865a0269d4..27050042b83 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -871,6 +871,7 @@ completion candidates than this number." (defvar completion-all-sorted-completions nil) (make-variable-buffer-local 'completion-all-sorted-completions) +(defvar-local completion--all-sorted-completions-location nil) (defvar completion-cycling nil) (defvar completion-fail-discreetly nil @@ -1048,14 +1049,19 @@ scroll the window of possible completions." (defun completion--cache-all-sorted-completions (comps) (add-hook 'after-change-functions - 'completion--flush-all-sorted-completions nil t) + 'completion--flush-all-sorted-completions nil t) + (setq completion--all-sorted-completions-location + (cons (copy-marker (field-beginning)) (copy-marker (field-end)))) (setq completion-all-sorted-completions comps)) -(defun completion--flush-all-sorted-completions (&rest _ignore) - (remove-hook 'after-change-functions - 'completion--flush-all-sorted-completions t) - (setq completion-cycling nil) - (setq completion-all-sorted-completions nil)) +(defun completion--flush-all-sorted-completions (&optional start end _len) + (unless (and start end + (or (> start (cdr completion--all-sorted-completions-location)) + (< end (car completion--all-sorted-completions-location)))) + (remove-hook 'after-change-functions + 'completion--flush-all-sorted-completions t) + (setq completion-cycling nil) + (setq completion-all-sorted-completions nil))) (defun completion--metadata (string base md-at-point table pred) ;; Like completion-metadata, but for the specific case of getting the @@ -1758,7 +1764,10 @@ exit." (when completion-in-region-mode-predicate (completion-in-region-mode 1) (setq completion-in-region--data - (list (current-buffer) start end collection))) + (list (if (markerp start) start (copy-marker start)) + (copy-marker end) collection))) + ;; FIXME: `minibuffer-complete' should call `completion-in-region' rather + ;; than the other way around! (unwind-protect (call-interactively 'minibuffer-complete) (delete-overlay ol))))) @@ -1782,12 +1791,12 @@ exit." (or unread-command-events ;Don't pop down the completions in the middle of ;mouse-drag-region/mouse-set-point. (and completion-in-region--data - (and (eq (car completion-in-region--data) + (and (eq (marker-buffer (nth 0 completion-in-region--data)) (current-buffer)) - (>= (point) (nth 1 completion-in-region--data)) + (>= (point) (nth 0 completion-in-region--data)) (<= (point) (save-excursion - (goto-char (nth 2 completion-in-region--data)) + (goto-char (nth 1 completion-in-region--data)) (line-end-position))) (funcall completion-in-region-mode--predicate))) (completion-in-region-mode -1))) @@ -1892,17 +1901,19 @@ The completion method is determined by `completion-at-point-functions'." (let ((res (run-hook-wrapped 'completion-at-point-functions #'completion--capf-wrapper 'all))) (pcase res - (`(,_ . ,(and (pred functionp) f)) (funcall f)) - (`(,hookfun . (,start ,end ,collection . ,plist)) - (let* ((completion-extra-properties plist) - (completion-in-region-mode-predicate - (lambda () - ;; We're still in the same completion field. - (eq (car-safe (funcall hookfun)) start)))) - (completion-in-region start end collection - (plist-get plist :predicate)))) - ;; Maybe completion already happened and the function returned t. - (_ (cdr res))))) + (`(,_ . ,(and (pred functionp) f)) (funcall f)) + (`(,hookfun . (,start ,end ,collection . ,plist)) + (unless (markerp start) (setq start (copy-marker start))) + (let* ((completion-extra-properties plist) + (completion-in-region-mode-predicate + (lambda () + ;; We're still in the same completion field. + (let ((newstart (car-safe (funcall hookfun)))) + (and newstart (= newstart start)))))) + (completion-in-region start end collection + (plist-get plist :predicate)))) + ;; Maybe completion already happened and the function returned t. + (_ (cdr res))))) (defun completion-help-at-point () "Display the completions on the text around point. @@ -1914,32 +1925,34 @@ The completion method is determined by `completion-at-point-functions'." (pcase res (`(,_ . ,(and (pred functionp) f)) (message "Don't know how to show completions for %S" f)) - (`(,hookfun . (,start ,end ,collection . ,plist)) - (let* ((minibuffer-completion-table collection) - (minibuffer-completion-predicate (plist-get plist :predicate)) - (completion-extra-properties plist) - (completion-in-region-mode-predicate - (lambda () - ;; We're still in the same completion field. - (eq (car-safe (funcall hookfun)) start))) - (ol (make-overlay start end nil nil t))) - ;; FIXME: We should somehow (ab)use completion-in-region-function or - ;; introduce a corresponding hook (plus another for word-completion, - ;; and another for force-completion, maybe?). - (overlay-put ol 'field 'completion) - (overlay-put ol 'priority 100) - (completion-in-region-mode 1) - (setq completion-in-region--data - (list (current-buffer) start end collection)) - (unwind-protect - (call-interactively 'minibuffer-completion-help) - (delete-overlay ol)))) - (`(,hookfun . ,_) - ;; The hook function already performed completion :-( - ;; Not much we can do at this point. - (message "%s already performed completion!" hookfun) - nil) - (_ (message "Nothing to complete at point"))))) + (`(,hookfun . (,start ,end ,collection . ,plist)) + (unless (markerp start) (setq start (copy-marker start))) + (let* ((minibuffer-completion-table collection) + (minibuffer-completion-predicate (plist-get plist :predicate)) + (completion-extra-properties plist) + (completion-in-region-mode-predicate + (lambda () + ;; We're still in the same completion field. + (let ((newstart (car-safe (funcall hookfun)))) + (and newstart (= newstart start))))) + (ol (make-overlay start end nil nil t))) + ;; FIXME: We should somehow (ab)use completion-in-region-function or + ;; introduce a corresponding hook (plus another for word-completion, + ;; and another for force-completion, maybe?). + (overlay-put ol 'field 'completion) + (overlay-put ol 'priority 100) + (completion-in-region-mode 1) + (setq completion-in-region--data + (list start (copy-marker end) collection)) + (unwind-protect + (call-interactively 'minibuffer-completion-help) + (delete-overlay ol)))) + (`(,hookfun . ,_) + ;; The hook function already performed completion :-( + ;; Not much we can do at this point. + (message "%s already performed completion!" hookfun) + nil) + (_ (message "Nothing to complete at point"))))) ;;; Key bindings. diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 772a0a9c626..c95e901c39d 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -152,7 +152,9 @@ Otherwise, return result of last form in BODY, or all other errors." (dbus-error (when dbus-debug (signal (car err) (cdr err)))))) (font-lock-add-keywords 'emacs-lisp-mode '("\\")) -(defvar dbus-event-error-hooks nil +(define-obsolete-variable-alias 'dbus-event-error-hooks + 'dbus-event-error-functions "24.3") +(defvar dbus-event-error-functions nil "Functions to be called when a D-Bus error happens in the event handler. Every function must accept two arguments, the event and the error variable caught in `condition-case' by `dbus-error'.") @@ -947,7 +949,7 @@ If the HANDLER returns a `dbus-error', it is propagated as return message." (dbus-method-error-internal (nth 1 event) (nth 4 event) (nth 3 event) (cadr err)))) ;; Propagate D-Bus error messages. - (run-hook-with-args 'dbus-event-error-hooks event err) + (run-hook-with-args 'dbus-event-error-functions event err) (when (or dbus-debug (= dbus-message-type-error (nth 2 event))) (signal (car err) (cdr err)))))) diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index dd345630b9b..e9828c5f813 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -300,7 +300,9 @@ See `rcirc-dim-nick' face." :type '(repeat string) :group 'rcirc) -(defcustom rcirc-print-hooks nil +(define-obsolete-variable-alias 'rcirc-print-hooks + 'rcirc-print-functions "24.3") +(defcustom rcirc-print-functions nil "Hook run after text is printed. Called with 5 arguments, PROCESS, SENDER, RESPONSE, TARGET and TEXT." :type 'hook @@ -647,7 +649,9 @@ is non-nil." "] " text))))) -(defvar rcirc-sentinel-hooks nil +(define-obsolete-variable-alias 'rcirc-sentinel-hooks + 'rcirc-sentinel-functions "24.3") +(defvar rcirc-sentinel-functions nil "Hook functions called when the process sentinel is called. Functions are called with PROCESS and SENTINEL arguments.") @@ -664,7 +668,7 @@ Functions are called with PROCESS and SENTINEL arguments.") sentinel (process-status process)) (not rcirc-target)) (rcirc-disconnect-buffer))) - (run-hook-with-args 'rcirc-sentinel-hooks process sentinel)))) + (run-hook-with-args 'rcirc-sentinel-functions process sentinel)))) (defun rcirc-disconnect-buffer (&optional buffer) (with-current-buffer (or buffer (current-buffer)) @@ -684,7 +688,9 @@ Functions are called with PROCESS and SENTINEL arguments.") (process-list)) ps)) -(defvar rcirc-receive-message-hooks nil +(define-obsolete-variable-alias 'rcirc-receive-message-hooks + 'rcirc-receive-message-functions "24.3") +(defvar rcirc-receive-message-functions nil "Hook functions run when a message is received from server. Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") (defun rcirc-filter (process output) @@ -738,7 +744,7 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") (if (not (fboundp handler)) (rcirc-handler-generic process cmd sender args text) (funcall handler process sender args text)) - (run-hook-with-args 'rcirc-receive-message-hooks + (run-hook-with-args 'rcirc-receive-message-functions process cmd sender args text))) (message "UNHANDLED: %s" text))) @@ -1625,7 +1631,7 @@ record activity." (rcirc-log process sender response target text)) (sit-for 0) ; displayed text before hook - (run-hook-with-args 'rcirc-print-hooks + (run-hook-with-args 'rcirc-print-functions process sender response target text))))) (defun rcirc-generate-log-filename (process target) @@ -1927,7 +1933,9 @@ With prefix ARG, go to the next low priority buffer with activity." (key-description (this-command-keys)) " for low priority activity.")))))))) -(defvar rcirc-activity-hooks nil +(define-obsolete-variable-alias 'rcirc-activity-hooks + 'rcirc-activity-functions "24.3") +(defvar rcirc-activity-functions nil "Hook to be run when there is channel activity. Functions are called with a single argument, the buffer with the @@ -1950,7 +1958,7 @@ activity. Only run if the buffer is not visible and (unless (and (equal rcirc-activity old-activity) (member type old-types)) (rcirc-update-activity-string))))) - (run-hook-with-args 'rcirc-activity-hooks buffer)) + (run-hook-with-args 'rcirc-activity-functions buffer)) (defun rcirc-clear-activity (buffer) "Clear the BUFFER activity." diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 567f8f2969a..f52129919cc 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -1677,11 +1677,11 @@ If ARGUMENT is non-nil, use it as argument for (tramp-set-connection-property vec "smbserver-version" smbserver-version)))) - ;; Set chunksize. Otherwise, `tramp-send-string' might - ;; try it itself. + ;; Set chunksize to 1. smbclient reads its input + ;; character by character; if we send the string + ;; at once, it is read painfully slow. (tramp-set-connection-property p "smb-share" share) - (tramp-set-connection-property - p "chunksize" tramp-chunksize)) + (tramp-set-connection-property p "chunksize" 1)) ;; Check for the error reason. If it was due to wrong ;; password, reestablish the connection. We cannot @@ -1717,7 +1717,7 @@ Returns nil if an error message has appeared." (while (and (not found) (not err) (memq (process-status p) '(run open))) ;; Accept pending output. - (tramp-accept-process-output p) + (tramp-accept-process-output p 0.1) ;; Search for prompt. (goto-char (point-min)) @@ -1731,7 +1731,7 @@ Returns nil if an error message has appeared." (while (and (not found) (memq (process-status p) '(run open))) ;; Accept pending output. - (tramp-accept-process-output p) + (tramp-accept-process-output p 0.1) ;; Search for prompt. (goto-char (point-min)) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index a754c89c4ae..2ddfb2439af 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -24,7 +24,13 @@ ;;; Commentary: -;; A replacement for simple.el's comment-related functions. +;; This library contains functions and variables for commenting and +;; uncommenting source code. + +;; Prior to calling any `comment-*' function, you should ensure that +;; `comment-normalize-vars' is first called to set up the appropriate +;; variables; except for the `comment-*' commands, which call +;; `comment-normalize-vars' automatically as a subroutine. ;;; Bugs: @@ -326,10 +332,11 @@ terminated by the end of line (i.e. `comment-end' is empty)." ;;;###autoload (defun comment-normalize-vars (&optional noerror) - "Check and setup the variables needed by other commenting functions. -Any command calling functions from newcomment.el should call this function -before any other, so the rest of the code can assume that the variables are -properly set." + "Check and set up variables needed by other commenting functions. +All the `comment-*' commands call this function to set up various +variables, like `comment-start', to ensure that the commenting +functions work correctly. Lisp callers of any other `comment-*' +function should first call this function explicitly." (unless (and (not comment-start) noerror) (unless comment-start (let ((cs (read-string "No comment syntax is defined. Use: "))) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 2a000957589..50eaebe4dec 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1703,7 +1703,9 @@ Key bindings: (message "Using CC Mode version %s" c-version) (c-keep-region-active)) -(defvar c-prepare-bug-report-hooks nil) +(define-obsolete-variable-alias 'c-prepare-bug-report-hooks + 'c-prepare-bug-report-hook "24.3") +(defvar c-prepare-bug-report-hook nil) ;; Dynamic variables used by reporter. (defvar reporter-prompt-for-summary-p) @@ -1770,7 +1772,7 @@ Key bindings: lookup-syntax-properties)) vars) (lambda () - (run-hooks 'c-prepare-bug-report-hooks) + (run-hooks 'c-prepare-bug-report-hook) (insert (format "Buffer Style: %s\nc-emacs-features: %s\n" style c-features))))))) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 10fd7a75eaa..06525b354b1 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1568,12 +1568,20 @@ Returns the compilation buffer created." ;; Then evaluate a cd command if any, but don't perform it yet, else ;; start-command would do it again through the shell: (cd "..") AND ;; sh -c "cd ..; make" - (cd (if (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]" - command) - (if (match-end 1) - (substitute-env-vars (match-string 1 command)) - "~") - default-directory)) + (cd (cond + ((not (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\|'[^']*'\\|\"\\(?:[^\"`$\\]\\|\\\\.\\)*\"\\)\\)?\\s *[;&\n]" + command)) + default-directory) + ((not (match-end 1)) "~") + ((eq (aref command (match-beginning 1)) ?\') + (substring command (1+ (match-beginning 1)) + (1- (match-end 1)))) + ((eq (aref command (match-beginning 1)) ?\") + (replace-regexp-in-string + "\\\\\\(.\\)" "\\1" + (substring command (1+ (match-beginning 1)) + (1- (match-end 1))))) + (t (substitute-env-vars (match-string 1 command))))) (erase-buffer) ;; Select the desired mode. (if (not (eq mode t)) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 719471278a8..13eac8392a2 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -148,7 +148,8 @@ Used to gray out relevant toolbar icons.") ([run] menu-item "Run" gud-run :enable (not gud-running) :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) - ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go + ([go] menu-item (if (bound-and-true-p gdb-active-process) + "Continue" "Run") gud-go :visible (and (eq gud-minor-mode 'gdbmi) (gdb-show-run-p))) ([stop] menu-item "Stop" gud-stop-subjob @@ -178,7 +179,7 @@ Used to gray out relevant toolbar icons.") '(gdbmi gdb dbx xdb jdb pdb))) ([pp] menu-item "Print S-expression" gud-pp :enable (and (not gud-running) - gdb-active-process) + (bound-and-true-p gdb-active-process)) :visible (and (string-equal (buffer-local-value 'gud-target-name gud-comint-buffer) "emacs") diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 4819149bdf6..c2ce12b6ad4 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -182,7 +182,8 @@ and you want to simplify them for the mode line (defconst which-func-current '(:eval (replace-regexp-in-string "%" "%%" - (gethash (selected-window) which-func-table which-func-unknown)))) + (or (gethash (selected-window) which-func-table) + which-func-unknown)))) ;;;###autoload (put 'which-func-current 'risky-local-variable t) (defvar which-func-mode nil diff --git a/lisp/repeat.el b/lisp/repeat.el index e38442a434b..a6c803ae773 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -289,6 +289,10 @@ recently executed command not bound to an input event\"." (interactive) (let ((repeat-message-function fun)) (setq this-command 'repeat) + ;; Beware: messing with `real-this-command' is *bad*, but we + ;; need it so `last-repeatable-command' can be recognized + ;; later (bug#12232). + (setq real-this-command 'repeat) (call-interactively 'repeat)))))) map))))) diff --git a/lisp/startup.el b/lisp/startup.el index bd75abe5b35..56281a6b164 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -971,7 +971,6 @@ Amongst another things, it parses the command-line arguments." (not (eq 0 (cdr tool-bar-lines))))))) (let ((old-scalable-fonts-allowed scalable-fonts-allowed) - (old-font-list-limit font-list-limit) (old-face-ignored-fonts face-ignored-fonts)) ;; Run the site-start library if it exists. The point of this file is @@ -1162,7 +1161,6 @@ the `--debug-init' option to view a complete error backtrace." ;; face realization, clear the face cache so that new faces will ;; be realized. (unless (and (eq scalable-fonts-allowed old-scalable-fonts-allowed) - (eq font-list-limit old-font-list-limit) (eq face-ignored-fonts old-face-ignored-fonts)) (clear-face-cache))) diff --git a/lisp/subr.el b/lisp/subr.el index ec2d16e6529..94012fc47de 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1260,12 +1260,10 @@ is converted into a string by expressing it in decimal." (define-obsolete-variable-alias 'executing-macro 'executing-kbd-macro "before 19.34") -(defvaralias 'x-lost-selection-hooks 'x-lost-selection-functions) -(make-obsolete-variable 'x-lost-selection-hooks - 'x-lost-selection-functions "22.1") -(defvaralias 'x-sent-selection-hooks 'x-sent-selection-functions) -(make-obsolete-variable 'x-sent-selection-hooks - 'x-sent-selection-functions "22.1") +(define-obsolete-variable-alias 'x-lost-selection-hooks + 'x-lost-selection-functions "22.1") +(define-obsolete-variable-alias 'x-sent-selection-hooks + 'x-sent-selection-functions "22.1") ;; This was introduced in 21.4 for pre-unicode unification. That ;; usage was rendered obsolete in 23.1 which uses Unicode internally. @@ -3151,7 +3149,7 @@ in which case `save-window-excursion' cannot help." (unwind-protect (progn ,@body) (set-window-configuration ,c))))) -(defun temp-output-buffer-show (buffer) +(defun internal-temp-output-buffer-show (buffer) "Internal function for `with-output-to-temp-buffer'." (with-current-buffer buffer (set-buffer-modified-p nil) @@ -3235,7 +3233,7 @@ if it uses `temp-buffer-show-function'." (run-hooks 'temp-buffer-setup-hook))))) (standard-output ,buf)) (prog1 (progn ,@body) - (temp-output-buffer-show ,buf))))) + (internal-temp-output-buffer-show ,buf))))) (defmacro with-temp-file (file &rest body) "Create a new buffer, evaluate BODY there, and write the buffer to FILE. diff --git a/lisp/term/sun.el b/lisp/term/sun.el index 4bd22c1d8da..dfe7a63ac1b 100644 --- a/lisp/term/sun.el +++ b/lisp/term/sun.el @@ -123,6 +123,7 @@ (defvar sun-raw-prefix-hooks nil "List of forms to evaluate after setting sun-raw-prefix.") +(make-obsolete-variable 'sun-raw-prefix-hooks 'term-setup-hook "21.1") diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 0e79c962b47..cdcc7ca4745 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -581,8 +581,9 @@ next hunk if TRY-HARDER is non-nil; otherwise signal an error." (with-local-quit (when (buffer-live-p buffer) (with-current-buffer buffer - (goto-char point) - (diff-refine-hunk)))))))))) + (save-excursion + (goto-char point) + (diff-refine-hunk))))))))))) (easy-mmode-define-navigation diff-file diff-file-header-re "file" diff-end-of-file) diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el index 9e6f5769c8f..5c471664fdc 100644 --- a/lisp/vc/ediff-mult.el +++ b/lisp/vc/ediff-mult.el @@ -217,8 +217,9 @@ This can be toggled with `ediff-toggle-filename-truncation'." :type 'hook :group 'ediff-mult) -(defcustom ediff-before-session-group-setup-hooks nil - "Hooks to run before Ediff arranges the window for group-level operations. +(defcustom ediff-before-session-group-setup-hooks + nil ;FIXME: Bad name (should be -hook or -functions) and never run?? + "Hook run before Ediff arranges the window for group-level operations. It is used by commands such as `ediff-directories'. This hook can be used to save the previous window config, which can be restored on `ediff-quit', `ediff-suspend', or `ediff-quit-session-group-hook'." diff --git a/lisp/window.el b/lisp/window.el index a17e0adcdfe..fa7b08375ce 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -5828,7 +5828,7 @@ buffer with the name BUFFER-OR-NAME and return that buffer." "If non-nil, `switch-to-buffer' tries to preserve `window-point'. If this is nil, `switch-to-buffer' displays the buffer at that buffer's `point'. If this is `already-displayed', it tries to -display the buffer at its pevious position in the selected +display the buffer at its previous position in the selected window, provided the buffer is currently displayed in some other window on any visible or iconified frame. If this is t, it unconditionally tries to display the buffer at its previous diff --git a/src/ChangeLog b/src/ChangeLog index 1a309066703..e59a286110d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,50 @@ +2012-10-23 Kenichi Handa + + The following change is to make face-font-rescale-alist work + correctly for non-ASCII fonts. + + * font.c (font_open_entity): Don't handle Vface_font_rescale_alist. + (font_open_for_lface): Handle Vface_font_rescale_alist. + +2012-10-23 Chong Yidong + + * xfaces.c (Vfont_list_limit): Move unused variable to faces.el. + +2012-10-21 Jan Djärv + + * nsfont.m (nsfont_open, ns_glyph_metrics): Force integer advancement + for screen font. + (nsfont_draw): Turn off LCD-smoothing (Bug#11484). + + * xterm.c (x_focus_changed): Check if daemonp when sending focus in + event (Bug#12681). + +2012-10-21 Glenn Morris + + * lisp.mk (lisp): Add cp51932.el and eucjp-ms.el. + +2012-10-20 Paul Eggert + + Port to OpenBSD 5.1. + * frame.c (Fmouse_position, Fmouse_pixel_position): + * xdisp.c (produce_stretch_glyph): + Declare local vars only when they're needed. + This is clearer and avoids a warning on OpenBSD about unused vars. + * frame.h (FRAME_WINDOW_P): Always evaluate its argument. + This is safer, and avoids OpenBSD warnings about unused vars. + * keyboard.c (record_menu_key): Remove unnecessary decl. + (poll_timer): Define only if POLL_FOR_INPUT is defined. + * unexelf.c (ELFSIZE) [!ElfW]: Do not define if already defined, + as our definition clashes with OpenBSD's. + * xfaces.c (load_face_colors, check_lface_attrs) + (get_lface_attributes_no_remap, get_lface_attributes) + (lface_fully_specified_p, x_supports_face_attributes_p) + (tty_supports_face_attributes_p, face_fontset, realize_face) + (realize_x_face, realize_tty_face): + Declare parameters to be Lisp_Object[LFACE_VECTOR_SIZE], not + merely Lisp_Object *. This is more informative and avoids + a warning on OpenBSD about accessing beyond an object's size. + 2012-10-20 Chong Yidong * lread.c (Fload): Doc fix (Bug#12592). diff --git a/src/font.c b/src/font.c index 7cb4149ac4e..bff2356d6ca 100644 --- a/src/font.c +++ b/src/font.c @@ -2816,14 +2816,11 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) Lisp_Object objlist, size, val, font_object; struct font *font; int min_width, height; - int scaled_pixel_size = pixel_size; eassert (FONT_ENTITY_P (entity)); size = AREF (entity, FONT_SIZE_INDEX); if (XINT (size) != 0) - scaled_pixel_size = pixel_size = XINT (size); - else if (CONSP (Vface_font_rescale_alist)) - scaled_pixel_size = pixel_size * font_rescale_ratio (entity); + pixel_size = XINT (size); val = AREF (entity, FONT_TYPE_INDEX); for (driver_list = f->font_driver_list; @@ -2845,7 +2842,7 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) } } - font_object = driver_list->driver->open (f, entity, scaled_pixel_size); + font_object = driver_list->driver->open (f, entity, pixel_size); if (!NILP (font_object)) ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); FONT_ADD_LOG ("open", entity, font_object); @@ -3230,31 +3227,36 @@ font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_O if (INTEGERP (AREF (entity, FONT_SIZE_INDEX)) && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) size = XINT (AREF (entity, FONT_SIZE_INDEX)); - else if (FONT_SPEC_P (spec) && ! NILP (AREF (spec, FONT_SIZE_INDEX))) - size = font_pixel_size (f, spec); else { - double pt; - if (INTEGERP (attrs[LFACE_HEIGHT_INDEX])) - pt = XINT (attrs[LFACE_HEIGHT_INDEX]); + if (FONT_SPEC_P (spec) && ! NILP (AREF (spec, FONT_SIZE_INDEX))) + size = font_pixel_size (f, spec); else { - struct face *def = FACE_FROM_ID (f, DEFAULT_FACE_ID); - Lisp_Object height = def->lface[LFACE_HEIGHT_INDEX]; - eassert (INTEGERP (height)); - pt = XINT (height); - } + double pt; + if (INTEGERP (attrs[LFACE_HEIGHT_INDEX])) + pt = XINT (attrs[LFACE_HEIGHT_INDEX]); + else + { + struct face *def = FACE_FROM_ID (f, DEFAULT_FACE_ID); + Lisp_Object height = def->lface[LFACE_HEIGHT_INDEX]; + eassert (INTEGERP (height)); + pt = XINT (height); + } - pt /= 10; - size = POINT_TO_PIXEL (pt, f->resy); + pt /= 10; + size = POINT_TO_PIXEL (pt, f->resy); #ifdef HAVE_NS - if (size == 0) - { - Lisp_Object ffsize = get_frame_param (f, Qfontsize); - size = NUMBERP (ffsize) ? POINT_TO_PIXEL (XINT (ffsize), f->resy) : 0; - } + if (size == 0) + { + Lisp_Object ffsize = get_frame_param (f, Qfontsize); + size = NUMBERP (ffsize) ? POINT_TO_PIXEL (XINT (ffsize), f->resy) : 0; + } #endif + } + size *= font_rescale_ratio (entity); } + return font_open_entity (f, entity, size); } diff --git a/src/frame.c b/src/frame.c index 017d051fc1d..6478ad1e06f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1501,10 +1501,7 @@ and returns whatever that function returns. */) { FRAME_PTR f; Lisp_Object lispy_dummy; - enum scroll_bar_part party_dummy; Lisp_Object x, y, retval; - int col, row; - Time long_dummy; struct gcpro gcpro1; f = SELECTED_FRAME (); @@ -1513,14 +1510,19 @@ and returns whatever that function returns. */) #if defined (HAVE_MOUSE) || defined (HAVE_GPM) /* It's okay for the hook to refrain from storing anything. */ if (FRAME_TERMINAL (f)->mouse_position_hook) - (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1, - &lispy_dummy, &party_dummy, - &x, &y, - &long_dummy); + { + enum scroll_bar_part party_dummy; + Time time_dummy; + (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1, + &lispy_dummy, &party_dummy, + &x, &y, + &time_dummy); + } + if (! NILP (x)) { - col = XINT (x); - row = XINT (y); + int col = XINT (x); + int row = XINT (y); pixel_to_glyph_coords (f, col, row, &col, &row, NULL, 1); XSETINT (x, col); XSETINT (y, row); @@ -1547,9 +1549,7 @@ and nil for X and Y. */) { FRAME_PTR f; Lisp_Object lispy_dummy; - enum scroll_bar_part party_dummy; Lisp_Object x, y; - Time long_dummy; f = SELECTED_FRAME (); x = y = Qnil; @@ -1557,10 +1557,15 @@ and nil for X and Y. */) #if defined (HAVE_MOUSE) || defined (HAVE_GPM) /* It's okay for the hook to refrain from storing anything. */ if (FRAME_TERMINAL (f)->mouse_position_hook) - (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1, - &lispy_dummy, &party_dummy, - &x, &y, - &long_dummy); + { + enum scroll_bar_part party_dummy; + Time time_dummy; + (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, -1, + &lispy_dummy, &party_dummy, + &x, &y, + &time_dummy); + } + #endif XSETFRAME (lispy_dummy, f); return Fcons (lispy_dummy, Fcons (x, y)); diff --git a/src/frame.h b/src/frame.h index 7bf76c21c56..f8c3d99fedd 100644 --- a/src/frame.h +++ b/src/frame.h @@ -646,7 +646,7 @@ typedef struct frame *FRAME_PTR; #define FRAME_WINDOW_P(f) FRAME_NS_P(f) #endif #ifndef FRAME_WINDOW_P -#define FRAME_WINDOW_P(f) (0) +#define FRAME_WINDOW_P(f) ((void) (f), 0) #endif /* Return a pointer to the structure holding information about the diff --git a/src/keyboard.c b/src/keyboard.c index 010bd6c72ef..2f751d0ec72 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -368,7 +368,6 @@ static Lisp_Object command_loop (void); static Lisp_Object Qextended_command_history; EMACS_TIME timer_check (void); -static void record_menu_key (Lisp_Object c); static void echo_now (void); static ptrdiff_t echo_length (void); @@ -1966,13 +1965,13 @@ safe_run_hooks (Lisp_Object hook) int poll_suppress_count; + +#ifdef POLL_FOR_INPUT + /* Asynchronous timer for polling. */ static struct atimer *poll_timer; - -#ifdef POLL_FOR_INPUT - /* Poll for input, so that we catch a C-g if it comes in. This function is called from x_make_frame_visible, see comment there. */ diff --git a/src/lisp.h b/src/lisp.h index e0611e19ff1..17a9e5c1f6a 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -308,7 +308,7 @@ enum Lisp_Fwd_Type First, there are already a couple of Lisp types that can be used if your new type does not need to be exposed to Lisp programs nor displayed to users. These are Lisp_Save_Value, a Lisp_Misc - subtype, and PVEC_OTHER, a kind of vectorlike object. The former + subtype; and PVEC_OTHER, a kind of vectorlike object. The former is suitable for temporarily stashing away pointers and integers in a Lisp object (see the existing uses of make_save_value and XSAVE_VALUE). The latter is useful for vector-like Lisp objects @@ -322,7 +322,7 @@ enum Lisp_Fwd_Type To define a new data type, add one more Lisp_Misc subtype or one more pseudovector subtype. Pseudovectors are more suitable for objects with several slots that need to support fast random access, - whil Lisp_Misc types are foreverything else. A pseudovector object + while Lisp_Misc types are for everything else. A pseudovector object provides one or more slots for Lisp objects, followed by struct members that are accessible only from C. A Lisp_Misc object is a wrapper for a C struct that can contain anything you like. diff --git a/src/lisp.mk b/src/lisp.mk index 3d60e07dea3..1f459d4d5f1 100644 --- a/src/lisp.mk +++ b/src/lisp.mk @@ -35,7 +35,8 @@ ## no-byte-compile ones. ## Confusingly, term/internal is not in loadup, but is unconditionally -## loaded by pc-win, which is. +## loaded by pc-win, which is. Ditto for international/cp51932 and +## international/eucjp-ms, loaded from language/japanese. ## Note that this list should not include lisp files which might not ## be present, like site-load.el and site-init.el; this makefile @@ -94,6 +95,8 @@ lisp = \ $(lispsource)/language/greek.elc \ $(lispsource)/language/hebrew.elc \ $(lispsource)/language/japanese.elc \ + $(lispsource)/international/cp51932.el \ + $(lispsource)/international/eucjp-ms.el \ $(lispsource)/language/korean.elc \ $(lispsource)/language/lao.elc \ $(lispsource)/language/tai-viet.elc \ diff --git a/src/nsfont.m b/src/nsfont.m index 7c9f05aa0bb..4f29d1d54a9 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -797,7 +797,13 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) block_input (); /* for metrics */ +#ifdef NS_IMPL_COCOA + sfont = [nsfont screenFontWithRenderingMode: + NSFontAntialiasedIntegerAdvancementsRenderingMode]; +#else sfont = [nsfont screenFont]; +#endif + if (sfont == nil) sfont = nsfont; @@ -1229,6 +1235,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, else CGContextSetShouldAntialias (gcontext, 1); + CGContextSetShouldSmoothFonts (gcontext, NO); CGContextSetTextMatrix (gcontext, fliptf); if (bgCol != nil) @@ -1372,7 +1379,12 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) #endif block_input (); - sfont = [font_info->nsfont screenFont]; +#ifdef NS_IMPL_COCOA + sfont = [font_info->nsfont screenFontWithRenderingMode: + NSFontAntialiasedIntegerAdvancementsRenderingMode]; +#else + sfont = [font_info->nsfont screenFont]; +#endif font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics)); if (!(font_info->metrics[block])) diff --git a/src/unexelf.c b/src/unexelf.c index f35b53aeab3..121e6042fc9 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -507,10 +507,12 @@ typedef struct { #ifndef ElfW # define ElfBitsW(bits, type) Elf##bits##_##type -# ifdef _LP64 -# define ELFSIZE 64 -# else -# define ELFSIZE 32 +# ifndef ELFSIZE +# ifdef _LP64 +# define ELFSIZE 64 +# else +# define ELFSIZE 32 +# endif # endif /* This macro expands `bits' before invoking ElfBitsW. */ # define ElfExpandBitsW(bits, type) ElfBitsW (bits, type) diff --git a/src/w32fns.c b/src/w32fns.c index 8dd3eb83c60..28e8ea02e05 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -211,7 +211,7 @@ static void w32_show_hourglass (struct frame *); static void w32_hide_hourglass (void); #ifdef WINDOWSNT -/* From w32inevet.c */ +/* From w32inevt.c */ extern int faked_key; #endif /* WINDOWSNT */ @@ -7711,4 +7711,3 @@ emacs_abort (void) break; } } - diff --git a/src/xdisp.c b/src/xdisp.c index f597e40bbd5..109aca9051c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -24318,17 +24318,16 @@ produce_stretch_glyph (struct it *it) Lisp_Object prop, plist; int width = 0, height = 0, align_to = -1; int zero_width_ok_p = 0; - int ascent = 0; double tem; - struct face *face = NULL; struct font *font = NULL; #ifdef HAVE_WINDOW_SYSTEM + int ascent = 0; int zero_height_ok_p = 0; if (FRAME_WINDOW_P (it->f)) { - face = FACE_FROM_ID (it->f, it->face_id); + struct face *face = FACE_FROM_ID (it->f, it->face_id); font = face->font ? face->font : FRAME_FONT (it->f); PREPARE_FACE_FOR_DISPLAY (it->f, face); } diff --git a/src/xfaces.c b/src/xfaces.c index 3e6e9dc8ec0..221387c4b6d 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -371,8 +371,6 @@ Lisp_Object Vface_alternative_font_registry_alist; static Lisp_Object Qscalable_fonts_allowed; -#define DEFAULT_FONT_LIST_LIMIT 100 - /* The symbols `foreground-color' and `background-color' which can be used as part of a `face' property. This is for compatibility with Emacs 20.2. */ @@ -1323,7 +1321,8 @@ load_color (struct frame *f, struct face *face, Lisp_Object name, try to emulate gray colors with a stipple from Vface_default_stipple. */ static void -load_face_colors (struct frame *f, struct face *face, Lisp_Object *attrs) +load_face_colors (struct frame *f, struct face *face, + Lisp_Object attrs[LFACE_VECTOR_SIZE]) { Lisp_Object fg, bg; @@ -1802,7 +1801,7 @@ the WIDTH times as wide as FACE on FRAME. */) /* Check consistency of Lisp face attribute vector ATTRS. */ static void -check_lface_attrs (Lisp_Object *attrs) +check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE]) { eassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX]) || IGNORE_DEFFACE_P (attrs[LFACE_FAMILY_INDEX]) @@ -2049,7 +2048,8 @@ lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p) static int get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, - Lisp_Object *attrs, int signal_p) + Lisp_Object attrs[LFACE_VECTOR_SIZE], + int signal_p) { Lisp_Object lface; @@ -2071,7 +2071,7 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, static int get_lface_attributes (struct frame *f, Lisp_Object face_name, - Lisp_Object *attrs, int signal_p, + Lisp_Object attrs[LFACE_VECTOR_SIZE], int signal_p, struct named_merge_point *named_merge_points) { Lisp_Object face_remapping; @@ -2108,7 +2108,7 @@ get_lface_attributes (struct frame *f, Lisp_Object face_name, specified, i.e. are non-nil. */ static int -lface_fully_specified_p (Lisp_Object *attrs) +lface_fully_specified_p (Lisp_Object attrs[LFACE_VECTOR_SIZE]) { int i; @@ -4760,7 +4760,8 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, \(2) `close in spirit' to what the attributes specify, if not exact. */ static int -x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, +x_supports_face_attributes_p (struct frame *f, + Lisp_Object attrs[LFACE_VECTOR_SIZE], struct face *def_face) { Lisp_Object *def_attrs = def_face->lface; @@ -4862,7 +4863,8 @@ x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, substitution of a `dim' face for italic. */ static int -tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, +tty_supports_face_attributes_p (struct frame *f, + Lisp_Object attrs[LFACE_VECTOR_SIZE], struct face *def_face) { int weight, slant; @@ -5245,7 +5247,7 @@ be found. Value is ALIST. */) attribute of ATTRS doesn't name a fontset. */ static int -face_fontset (Lisp_Object *attrs) +face_fontset (Lisp_Object attrs[LFACE_VECTOR_SIZE]) { Lisp_Object name; @@ -5474,7 +5476,8 @@ realize_named_face (struct frame *f, Lisp_Object symbol, int id) face. Value is a pointer to the newly created realized face. */ static struct face * -realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id) +realize_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE], + int former_face_id) { struct face *face; @@ -5551,7 +5554,7 @@ realize_non_ascii_face (struct frame *f, Lisp_Object font_object, created realized face. */ static struct face * -realize_x_face (struct face_cache *cache, Lisp_Object *attrs) +realize_x_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]) { struct face *face = NULL; #ifdef HAVE_WINDOW_SYSTEM @@ -5878,7 +5881,8 @@ map_tty_color (struct frame *f, struct face *face, Value is a pointer to the newly created realized face. */ static struct face * -realize_tty_face (struct face_cache *cache, Lisp_Object *attrs) +realize_tty_face (struct face_cache *cache, + Lisp_Object attrs[LFACE_VECTOR_SIZE]) { struct face *face; int weight, slant; @@ -6594,12 +6598,6 @@ syms_of_xfaces (void) defsubr (&Sdump_colors); #endif - DEFVAR_LISP ("font-list-limit", Vfont_list_limit, - doc: /* Limit for font matching. -If an integer > 0, font matching functions won't load more than -that number of fonts when searching for a matching font. */); - Vfont_list_limit = make_number (DEFAULT_FONT_LIST_LIMIT); - DEFVAR_LISP ("face-new-frame-defaults", Vface_new_frame_defaults, doc: /* List of global face definitions (for internal use only.) */); Vface_new_frame_defaults = Qnil; diff --git a/src/xterm.c b/src/xterm.c index 23685ee8ae6..a52a113ccda 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3457,7 +3457,8 @@ x_focus_changed (int type, int state, struct x_display_info *dpyinfo, struct fra /* Don't stop displaying the initial startup message for a switch-frame event we don't need. */ - if (NILP (Vterminal_frame) + /* When run as a deamon, Vterminal_frame is always NIL. */ + if ((NILP (Vterminal_frame) || EQ (Fdaemonp(), Qt)) && CONSP (Vframe_list) && !NILP (XCDR (Vframe_list))) {