Package: emacs;
Reported by: "Phil Sainty" <psainty <at> orcon.net.nz>
Date: Fri, 6 Dec 2013 06:20:01 UTC
Severity: minor
Found in version 24.3
Fixed in version 24.4
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: "Phil Sainty" <psainty <at> orcon.net.nz> To: 16067 <at> debbugs.gnu.org Subject: bug#16067: 24.3; Documentation bug: Example code in (elisp) Anonymous Functions Date: Fri, 6 Dec 2013 19:18:53 +1300 (NZDT)
Re: Info node (elisp) Anonymous Functions The final piece of code is prefixed with "This would not happen if, say, you had constructed the anonymous function by quoting it as a list", but the code then fails to actually do that. It is actually identical to the initial version of the function: > In the following example, we define a `change-property' function > that takes a function as its third argument, followed by a > `double-property' function that makes use of `change-property' by > passing it an anonymous function: > > (defun change-property (symbol prop function) > (let ((value (get symbol prop))) > (put symbol prop (funcall function value)))) > > (defun double-property (symbol prop) > (change-property symbol prop (lambda (x) (* 2 x)))) > > Note that we do not quote the `lambda' form. > > If you compile the above code, the anonymous function is also > compiled. This would not happen if, say, you had constructed the > anonymous function by quoting it as a list: > > (defun double-property (symbol prop) > (change-property symbol prop (lambda (x) (* 2 x)))) > > In that case, the anonymous function is kept as a lambda expression in > the compiled code. The byte-compiler cannot assume this list is a > function, even though it looks like one, since it does not know that > `change-property' intends to use it as a function. In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) of 2013-12-06 on scmp-qa Windowing system distributor `The X.Org Foundation', version 11.0.11103000 System Description: Ubuntu 10.04.4 LTS Configured using: `configure '--prefix=/var/data/emacs/emacs24/emacs-24.3/usr/local' '--without-sound'' Important settings: value of $LANG: en_NZ.UTF-8 locale-coding-system: utf-8 default enable-multibyte-characters: t Major mode: Info Minor modes in effect: my-keys-minor-mode: t yas/global-mode: t savehist-mode: t global-smart-tab-mode: t show-paren-mode: t cua-mode: t minibuffer-depth-indicate-mode: t winner-mode: t global-subword-mode: t subword-mode: t global-hl-line-mode: t display-time-mode: t keep-buffers-mode: t auto-compile-on-load-mode: t auto-compile-on-save-mode: t tooltip-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Recent input: <down-mouse-1> <mouse-1> C-a C-h i g ( e l i s p ) SPC A n o n y m o u s SPC F u n c t i o n s <return> <C-end> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> C-s C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-w C-s C-s C-s C-s C-s C-s C-a <down> <down> <down> <down> <down> <down> <down> <down> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> C-SPC <C-end> M-w <C-home> <C-end> M-x r e p o r t <tab> <return> Recent messages: Loading /root/.emacs.d/.mc-lists.el (source)...done Waiting for `el-get' to complete... done post-merge git hook not installed. Init file loaded in 24.09s For information about GNU Emacs and the GNU system, type <f1> C-a. Package assoc is obsolete! Composing main Info directory...done Mark set Mark saved where search started byte-code: End of buffer [2 times] Load-path shadows: /root/.emacs.d/el-get/scratch/el-get hides /root/.emacs.d/el-get/el-get/el-get /root/.emacs.d/lisp/python hides /var/data/emacs/emacs24/emacs-24.3/usr/local/share/emacs/24.3/lisp/progmodes/python /root/.emacs.d/el-get/magit/.dir-locals hides /var/data/emacs/emacs24/emacs-24.3/usr/local/share/emacs/24.3/lisp/gnus/.dir-locals /root/.emacs.d/lisp/sym-comp hides /var/data/emacs/emacs24/emacs-24.3/usr/local/share/emacs/24.3/lisp/obsolete/sym-comp Features: (shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils misearch multi-isearch lexbind-mode disp-table whitespace eldoc rainbow-delimiters idle-highlight etags-select-autoloads idle-highlight-autoloads project-local-variables-autoloads wtf-autoloads yasnippet-bundle-autoloads yasnippet-bundle dropdown-list yasnippet assoc my-projects my-session savehist desktop my-theme hl-sexp zenburn-theme my-libraries sudo framemove windmove my-version-control my-images my-text my-programming my-python my-whitespace ws-trim my-indentation smart-tab my-rectangles my-utilities browse-kill-ring derived my-configuration dired-details dired-x uniquify highlight-parentheses paren delsel cua-base ffap url-parse auth-source eieio gnus-util mm-util mail-prsvr password-cache url-vars mb-depth winner ring subword hl-line time cus-edit cus-start cus-load wid-edit my-externals .loaddefs dtrt-indent multiple-cursors mc-separate-operations rectangular-region-mode mc-mark-pop mc-mark-more thingatpt mc-cycle-cursors mc-edit-lines multiple-cursors-core rect sauron windcycle iedit transpose-frame rainbow-mode mo-git-blame info notify dbus xml keep-buffers el-get cl-macs gv help-mode easymenu autoload cl dired my-elpa package my-local my-keybindings easy-mmode edmacro kmacro jka-compr byte-opt warnings auto-compile advice help-fns advice-preload packed cl-lib bytecomp byte-compile cconv time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.