unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook
@ 2011-12-27 22:29 Bruno Félix Rezende Ribeiro
  2012-01-11 20:40 ` Glenn Morris
  2012-01-16  9:21 ` bug#10384: [Bruno Félix Rezende Ribeiro] " Bruno Félix Rezende Ribeiro
  0 siblings, 2 replies; 6+ messages in thread
From: Bruno Félix Rezende Ribeiro @ 2011-12-27 22:29 UTC (permalink / raw)
  To: 10384

In GNU Emacs Lisp Reference Manual, edition 3.0, bundled with GNU Emacs
23.2, section 21.1 (entitled "Command Loop Overview") which documents
hooks `pre-command-hook' and `post-command-hook' describes them as
follow:

 -- Variable: pre-command-hook
     The editor command loop runs this normal hook before each command.
     At that time, `this-command' contains the command that is about to
     run, and `last-command' describes the previous command.  *Note
     Command Loop Info::.

 -- Variable: post-command-hook
     The editor command loop runs this normal hook after each command
     (including commands terminated prematurely by quitting or by
     errors), and also when the command loop is first entered.  At that
     time, `this-command' refers to the command that just ran, and
     `last-command' refers to the command before that.

But the same manual defines `command', in section 21.3 "Interactive
Call", as follow:

 -- Function: commandp object &optional for-call-interactively
     Returns `t' if OBJECT is suitable for calling interactively; that
     is, if OBJECT is a command.  Otherwise, returns `nil'.

     Interactively-callable objects include strings and vectors (which
     are treated as keyboard macros), lambda expressions that contain a
     top-level `interactive' form (*note Using Interactive::),
     byte-code function objects made from such lambda expressions,
     autoload objects that are declared as interactive (non-`nil' fourth
     argument to `autoload'), and some primitive functions.

     A symbol satisfies `commandp' if it has a non-`nil'
     `interactive-form' property, or if its function definition
     satisfies `commandp'.  Keys and keymaps are not commands.  Rather,
     they are used to look up commands (*note Keymaps::).

     If FOR-CALL-INTERACTIVELY is non-`nil', then `commandp' returns
     `t' only for objects that `call-interactively' could call--thus,
     not for keyboard macros.

     See `documentation' in *note Accessing Documentation::, for a
     realistic example of using `commandp'.

Assume there are two interactively callable functions, `foo' and `bar'
such that the former calls the last, and only the last, and the last
don't calls anything else.  When you call interactively `foo'
pre-command-hook and post-command-hook, despite my expectation, runs
only once.  When I read the documentation I was pretty sure that it will
run twice, one time to each command being called.  The manual don't make
clear that the above mentioned hooks only runs to interactive calls, but
they says, in general manner, that it will run to every command.
Unless this behavior is justified by the expression "The editor command
loop runs", I guess there is a contradiction.  But, in both cases,
the manual seems unclear to me.  The same occur to documentation of
these variables.  When I press `C-h v pre-command-hook <RET>' I get

Documentation:
Normal hook run before each command is executed.
If an unhandled error happens in running this hook,
the hook value is set to nil, since otherwise the error
might happen repeatedly and make Emacs nonfunctional.

Already, when I press `C-h v post-command-hook <RET>' I get

Documentation:
Normal hook run after each command is executed.
If an unhandled error happens in running this hook,
the hook value is set to nil, since otherwise the error
might happen repeatedly and make Emacs nonfunctional.

What makes you think these hooks runs even to commands called from
interactively called commands, what isn't true.



In GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
 of 2010-12-11 on raven, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: pt_BR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Info

Minor modes in effect:
  server-mode: t
  display-time-mode: t
  display-battery-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
d <tab> SPC l o o <tab> <return> <tab> <return> C-v 
C-n C-n C-n C-n C-n C-n C-n C-e C-a M-< C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-p C-p M-{ M-{ M-{ M-} <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <up> <up> <up> <up> 
<down> <up> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> M-< <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <up> <up> 
<up> <up> <up> <up> <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> u <return> C-h C-g M-> C-h v p 
r e - c o m m a n d - h o o k <return> C-x 1 M-< M-> 
M-{ M-{ M-{ M-{ M-{ M-{ M-{ M-} M-{ t C-s p r e - c 
o m m a n d - h o o k C-s C-s C-s C-s C-s C-s C-s <return> 
M-< M-< M-> M-> M-{ M-{ M-{ M-{ M-{ M-} C-x b <return> 
C-x b <return> C-x b * <backspace> C-g M-x m a k <tab> 
- <backspace> <backspace> <backspace> <backspace> <backspace> 
r e p o <tab> r t <tab> <return>

Recent messages:
Mark saved where search started
Mark set [4 times]
Quit
Making completion list...
Checking spelling of WHETER...
ispell-overlay-window: Attempt to split minibuffer window
Checking spelling of WHETER...
ispell-overlay-window: Attempt to split minibuffer window
Checking spelling of INVOCATION...
INVOCATION is correct

Load-path shadows:
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ft-server hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-ft-server
/usr/share/emacs23/site-lisp/emacs-jabber/jabber hides /usr/share/emacs/site-lisp/emacs-jabber/jabber
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-sasl hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-sasl
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-version hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-version
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-history hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-history
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-activity hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-activity
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-export hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-export
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ahc-presence hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-ahc-presence
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-screen hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-screen
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-iq hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-iq
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ft-common hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-ft-common
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-avatar hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-avatar
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ahc hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-ahc
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-si-common hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-si-common
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-conn hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-conn
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-muc hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-muc
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-truncate hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-truncate
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-alert hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-alert
/usr/share/emacs23/site-lisp/emacs-jabber/srv hides /usr/share/emacs/site-lisp/emacs-jabber/srv
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-widget hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-widget
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-chatbuffer hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-chatbuffer
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-wmii hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-wmii
/usr/share/emacs23/site-lisp/emacs-jabber/fsm hides /usr/share/emacs/site-lisp/emacs-jabber/fsm
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-socks5 hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-socks5
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-roster hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-roster
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-vcard hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-vcard
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-newdisco hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-newdisco
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-chatstates hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-chatstates
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-private hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-private
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ourversion hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-ourversion
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-awesome hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-awesome
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-menu hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-menu
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-chat hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-chat
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-sawfish hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-sawfish
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-time hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-time
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-xml hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-xml
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-watch hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-watch
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-disco hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-disco
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-osd hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-osd
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-keymap hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-keymap
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-keepalive hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-keepalive
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-browse hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-browse
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-register hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-register
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-gmail hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-gmail
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-xmessage hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-xmessage
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-feature-neg hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-feature-neg
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-search hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-search
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-vcard-avatars hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-vcard-avatars
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-si-server hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-si-server
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-festival hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-festival
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ft-client hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-ft-client
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-autoaway hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-autoaway
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-compose hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-compose
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-modeline hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-modeline
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ratpoison hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-ratpoison
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-logon hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-logon
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-events hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-events
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-si-client hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-si-client
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-core hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-core
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-presence hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-presence
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-muc-nick-completion hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-muc-nick-completion
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-bookmarks hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-bookmarks
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-util hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-util
/usr/share/emacs/site-lisp/debian-startup hides /usr/share/emacs/23.2/site-lisp/debian-startup
/usr/share/emacs23/site-lisp/cedet-common/ezimage hides /usr/share/emacs/23.2/lisp/ezimage
/usr/share/emacs23/site-lisp/speedbar/dframe hides /usr/share/emacs/23.2/lisp/dframe
/usr/share/emacs23/site-lisp/speedbar/speedbar hides /usr/share/emacs/23.2/lisp/speedbar
/usr/share/emacs23/site-lisp/flim/md4 hides /usr/share/emacs/23.2/lisp/md4
/usr/share/emacs23/site-lisp/flim/sha1 hides /usr/share/emacs/23.2/lisp/sha1
/usr/share/emacs23/site-lisp/flim/hex-util hides /usr/share/emacs/23.2/lisp/hex-util
/usr/share/emacs23/site-lisp/speedbar/sb-image hides /usr/share/emacs/23.2/lisp/sb-image
/usr/share/emacs23/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/23.2/lisp/textmodes/ispell
/usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/23.2/lisp/textmodes/flyspell
/usr/share/emacs23/site-lisp/flim/ntlm hides /usr/share/emacs/23.2/lisp/net/ntlm
/usr/share/emacs23/site-lisp/flim/hmac-def hides /usr/share/emacs/23.2/lisp/net/hmac-def
/usr/share/emacs23/site-lisp/flim/sasl-cram hides /usr/share/emacs/23.2/lisp/net/sasl-cram
/usr/share/emacs23/site-lisp/flim/sasl hides /usr/share/emacs/23.2/lisp/net/sasl
/usr/share/emacs23/site-lisp/flim/sasl-digest hides /usr/share/emacs/23.2/lisp/net/sasl-digest
/usr/share/emacs23/site-lisp/flim/hmac-md5 hides /usr/share/emacs/23.2/lisp/net/hmac-md5
/usr/share/emacs23/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/23.2/lisp/net/sasl-ntlm
/usr/share/emacs23/site-lisp/eieio/chart hides /usr/share/emacs/23.2/lisp/emacs-lisp/chart
/usr/share/emacs23/site-lisp/eieio/eieio hides /usr/share/emacs/23.2/lisp/emacs-lisp/eieio
/usr/share/emacs23/site-lisp/emms/tq hides /usr/share/emacs/23.2/lisp/emacs-lisp/tq
/usr/share/emacs23/site-lisp/eieio/eieio-comp hides /usr/share/emacs/23.2/lisp/emacs-lisp/eieio-comp
/usr/share/emacs23/site-lisp/eieio/eieio-opt hides /usr/share/emacs/23.2/lisp/emacs-lisp/eieio-opt
/usr/share/emacs23/site-lisp/eieio/eieio-base hides /usr/share/emacs/23.2/lisp/emacs-lisp/eieio-base
/usr/share/emacs23/site-lisp/eieio/eieio-speedbar hides /usr/share/emacs/23.2/lisp/emacs-lisp/eieio-speedbar
/usr/share/emacs23/site-lisp/eieio/eieio-custom hides /usr/share/emacs/23.2/lisp/emacs-lisp/eieio-custom
/usr/share/emacs23/site-lisp/semantic/semantic hides /usr/share/emacs/23.2/lisp/cedet/semantic
/usr/share/emacs23/site-lisp/cedet-common/cedet hides /usr/share/emacs/23.2/lisp/cedet/cedet
/usr/share/emacs/23.2/site-lisp/ede/ede hides /usr/share/emacs/23.2/lisp/cedet/ede
/usr/share/emacs23/site-lisp/cedet-common/inversion hides /usr/share/emacs/23.2/lisp/cedet/inversion
/usr/share/emacs23/site-lisp/cedet-common/mode-local hides /usr/share/emacs/23.2/lisp/cedet/mode-local
/usr/share/emacs23/site-lisp/cedet-common/cedet-files hides /usr/share/emacs/23.2/lisp/cedet/cedet-files

Features:
(gnus-fun starttls mailalias smtpmail sendmail dictionary link
connection newcomment ispell shadow bookmark pp emacsbug multi-isearch
eieio-opt help-mode view flow-fill gnus-cite smiley ansi-color mail-extr
gnus-async gnus-bcklg byte-opt bytecomp byte-compile gnus-ml disp-table
parse-time utf-7 utf7 nnimap imap nndraft nnmh auth-source gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu
mml2015 epg-config mm-view smime dig nntp gnus-cache gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source format-spec gnus-start gnus-spec
gnus-int gnus-range message ecomplete rfc822 mml mml-sec password-cache
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 qp
ietf-drums mailabbrev gmm-utils mailheader canlock sha1 sha1-el hex-util
hashcash gnus-win semantic-edit semantic-el semantic-bovine bovine-debug
semantic-debug jka-compr sb-info info w3-auto espeak-key-bindings
espeak-core espeak-customize espeak-elisp-facilities espeak joystick
emms-lastfm emms-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-util url-parse timezone url-vars mailcap
emms-browser sort emms-playlist-sort emms-score emms-player-xine
emms-player-mpd tq emms-playing-time emms-lyrics emms-streams
emms-mode-line emms-cache emms-info-ogginfo emms-info-mp3info emms-info
later-do emms-playlist-mode emms-player-mplayer emms-player-simple
emms-source-playlist emms-source-file dired regexp-opt emms-setup emms
emms-compat edmacro kmacro windmove server gnus gnus-ems nnheader
gnus-util netrc time-date mail-utils mm-util mail-prsvr time battery
desktop cus-start cus-load cedet cedet-contrib-load speedbar-load
semantic-load semantic-ia-sb semantic-analyze semantic-ctxt
semantic-format semantic-cb semantic-sort semanticdb-find semanticdb-el
semanticdb-search semantic-find semanticdb semantic-util-modes
semantic-util semantic semantic-lex semantic-tag working fame
semantic-fw mode-local find-func derived eieio-load ede-speedbar ede
ede-load eieio-speedbar speedbar sb-image ezimage dframe easymenu assoc
eieio-custom wid-edit ede-source eieio-base eieio cl cl-19 cogre-load
cedet-load inversion ecb-autoloads debian-el debian-el-loaddefs w3m-wget
w3m-load emms-auto jabber-autoloads emacs-goodies-el
emacs-goodies-custom emacs-goodies-loaddefs easy-mmode cedet-autogen
advice advice-preload autoload help-fns tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag 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 loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)

-- 
Bruno Félix Rezende Ribeiro (oitofelix)

Ps: Please, let me know my english errors





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook
  2011-12-27 22:29 bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook Bruno Félix Rezende Ribeiro
@ 2012-01-11 20:40 ` Glenn Morris
  2012-01-11 22:40   ` Glenn Morris
  2012-01-16  9:21 ` bug#10384: [Bruno Félix Rezende Ribeiro] " Bruno Félix Rezende Ribeiro
  1 sibling, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2012-01-11 20:40 UTC (permalink / raw)
  To: Bruno Félix Rezende Ribeiro; +Cc: 10384

Bruno Félix Rezende Ribeiro wrote:

> Unless this behavior is justified by the expression "The editor command
> loop runs", I guess there is a contradiction.

Yes, it's implicit in the phrase "editor command loop".

If you think about it, the alternative interpretation doesn't make
sense. When called non-interactively, a command is just any old Lisp
function. So for it work the way you thought it might, Emacs would have
to check every single Lisp function call to see if that function was a
command, and if so run a hook before and after it. This would be pretty
impractical. Also what if a hook function called a function that
happened to be a command? :)

> When I press `C-h v pre-command-hook <RET>' I get
>
> Documentation:
> Normal hook run before each command is executed.

I could perhaps change this to say:

   Normal hook run before any command is executed interactively.

and similarly for post-command-hook.


I don't know what else to change. Perhaps add a note somewhere
(commandp?) that when a command is called non-interactively, it behaves
like any other Lisp function, and gets no special treatment.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook
  2012-01-11 20:40 ` Glenn Morris
@ 2012-01-11 22:40   ` Glenn Morris
  2012-01-12  1:24     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2012-01-11 22:40 UTC (permalink / raw)
  To: Bruno Félix Rezende Ribeiro; +Cc: 10384

Glenn Morris wrote:

>> Normal hook run before each command is executed.
>
> I could perhaps change this to say:
>
>    Normal hook run before any command is executed interactively.

This probably isn't an improvement though, because it might suggest that
call-interactively runs these hooks, when it doesn't.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook
  2012-01-11 22:40   ` Glenn Morris
@ 2012-01-12  1:24     ` Stefan Monnier
  2012-01-27  8:36       ` Chong Yidong
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-01-12  1:24 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 10384, Bruno Félix Rezende Ribeiro

>>> Normal hook run before each command is executed.
>> 
>> I could perhaps change this to say:
>> 
>> Normal hook run before any command is executed interactively.

> This probably isn't an improvement though, because it might suggest that
> call-interactively runs these hooks, when it doesn't.

Agreed.  If we want to be more careful we'd have to say something like
"Hook run before the command loop executes a command".


        Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10384: [Bruno Félix Rezende Ribeiro] Re: bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook
  2011-12-27 22:29 bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook Bruno Félix Rezende Ribeiro
  2012-01-11 20:40 ` Glenn Morris
@ 2012-01-16  9:21 ` Bruno Félix Rezende Ribeiro
  1 sibling, 0 replies; 6+ messages in thread
From: Bruno Félix Rezende Ribeiro @ 2012-01-16  9:21 UTC (permalink / raw)
  To: rgm, 10384

[-- Attachment #1: Type: message/rfc822, Size: 1550 bytes --]

From: oitofelix@gmail.com (Bruno Félix Rezende Ribeiro)
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Subject: Re: bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook
Date: Sun, 15 Jan 2012 16:45:24 -0200
Message-ID: <87wr8sst2z.fsf@felix-laptop.gnung>


All these suggestions looks great.  Any of these would help avoid that
nonsense thought described in the bug report and I think it don't will
generate any further problem with the definition and inter-description
relation, taking in account yours considerations.

Thanks.
-- 
Bruno Félix Rezende Ribeiro (oitofelix)

Uns o chamam de super-vaca...
Outros de hyper-touro...
Eu o chamo simplesmente: meta-gnu!

!A ilha não se curva!

[-- Attachment #2: Type: text/plain, Size: 172 bytes --]



-- 
Bruno Félix Rezende Ribeiro (oitofelix)

Uns o chamam de super-vaca...
Outros de hyper-touro...
Eu o chamo simplesmente: meta-gnu!

!A ilha não se curva!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook
  2012-01-12  1:24     ` Stefan Monnier
@ 2012-01-27  8:36       ` Chong Yidong
  0 siblings, 0 replies; 6+ messages in thread
From: Chong Yidong @ 2012-01-27  8:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 10384, Bruno Félix Rezende Ribeiro

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>>>> Normal hook run before each command is executed.
>>> 
>>> I could perhaps change this to say:
>>> 
>>> Normal hook run before any command is executed interactively.
>
>> This probably isn't an improvement though, because it might suggest that
>> call-interactively runs these hooks, when it doesn't.
>
> Agreed.  If we want to be more careful we'd have to say something like
> "Hook run before the command loop executes a command".

I've clarified the Lisp manual along these lines.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-27  8:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-27 22:29 bug#10384: 23.2; Emacs Lisp Reference Manual - incorrect or unclear documentation about invocation condition of hooks pre-command-hook and post-command-hook Bruno Félix Rezende Ribeiro
2012-01-11 20:40 ` Glenn Morris
2012-01-11 22:40   ` Glenn Morris
2012-01-12  1:24     ` Stefan Monnier
2012-01-27  8:36       ` Chong Yidong
2012-01-16  9:21 ` bug#10384: [Bruno Félix Rezende Ribeiro] " Bruno Félix Rezende Ribeiro

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).