GNU bug report logs - #15069
Introduction to Elisp 14.3: Function 'count-words-defun' does not work as described.

Previous Next

Package: emacs;

Reported by: Sian Mountbatten <poenikatu <at> fastmail.co.uk>

Date: Sun, 11 Aug 2013 11:34:01 UTC

Severity: minor

Tags: easy

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15069 in the body.
You can then email your comments to 15069 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15069; Package emacs. (Sun, 11 Aug 2013 11:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sian Mountbatten <poenikatu <at> fastmail.co.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 11 Aug 2013 11:34:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sian Mountbatten <poenikatu <at> fastmail.co.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: Introduction to Elisp 14.3: Function 'count-words-defun' does not
 work as described.
Date: Sun, 11 Aug 2013 12:32:34 +0100
[Message part 1 (text/plain, inline)]
From: Sian Mountbatten <poenikatu <at> fastmail.co.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; Introduction to Elisp 14.3: count-words-defun misbehaves
--text follows this line--
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgment at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

I used C-xC-e to evaluate the functions count-words-in-defun and
count-words-defun as displayed in the Info section 14.3 of the
Introduction. I then used C-xC-e to set the key sequence C-c= to invoke
the latter function. I then positioned point in the sample function
provided to see whether the two count-words functions were correct.
Instead of reporting that there were 10 words or symbols in the
function, Emacs reported that there were 1 word or symbol and point was
moved to the beginning of section 14.3. Point should not have been moved
in that fashion, according to the Introduction.


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/24.3/etc/DEBUG.


In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.2)
 of 2013-06-25 on sochi, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
System Description:    Debian GNU/Linux unstable (sid)

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-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/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'LDFLAGS=-Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: eo.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
SPC e m SPC SPC <return> 1 <backspace> I n t o <backspace>
r o d u c t i o n SPC t o SPC E l i s p SPC 1 4 . 3
: SPC c o u n t - w o r d s - d e f u n SPC d <backspace>
n o t SPC w o r k i n g SPC a s SPC d e s c r i b e
d <return> C-y <up> <down> C-x 2 C-x C-f * m e s <tab>
<return> C-SPC <down> <down> <down> <down> <down> <down>
<down> <down> <down> M-w C-x k <return> C-y C-x 0 <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <backspace> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
M-d M-d p o e n i k a t u @ f a s t m a i l . c o .
u k <right> <right> C-c C-c y e s <return> m a i l
SPC c l i e n t <return> <help-echo> <down-mouse-1>
<mouse-1> C-x o <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <menu-bar> <buffer> C-a C-x
k <return> C-x 1 C-x C-f * m e s <tab> <return> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <S-down> <S-down>
<S-down> <S-down> <S-down> <S-down> <S-down> <S-down>
<S-down> M-w C-x k <return> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <menu-bar>
<help-menu> <emacs-manual-bug> <help-echo> <tab> <tab>
<tab> <return> SPC q M-x r e p o r t SPC e m SPC SPC
<return>

Recent messages:
Mark set [2 times]
Auto-saving...done
byte-code: Beginning of buffer [9 times]
Mark set
Saving file /home/sian/.emacs...
Wrote /home/sian/.emacs [2 times]
Sending...
Mark set [2 times]
Sending via mail...
Sending...done

Load-path shadows:
/usr/share/emacs/24.3/site-lisp/debian-startup hides 
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides 
/usr/share/emacs/24.3/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides 
/usr/share/emacs/24.3/lisp/textmodes/flyspell

Features:
(jka-compr info mailalias mailclient browse-url cus-edit cus-start
cus-load wid-edit help-mode shadow sort gnus-util mail-extr emacsbug
message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils server
saveplace 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 system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

-- 
Sian Mountbatten (home web-site http://www.poenikatu.co.uk/>)
Learning C++11 from the C++ Primer 5th edition.
I'm an associate FSF member (no. 10888).
Help us support software freedom! http://www.fsf.org/jf?referrer=10888

[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15069; Package emacs. (Sun, 11 Aug 2013 11:49:01 GMT) Full text and rfc822 format available.

Message #8 received at 15069 <at> debbugs.gnu.org (full text, mbox):

From: Sian Mountbatten <poenikatu <at> fastmail.co.uk>
To: 15069 <at> debbugs.gnu.org
Subject: Bug: 15069: Correct functioning in the *scratch* buffer
Date: Sun, 11 Aug 2013 12:47:49 +0100
[Message part 1 (text/plain, inline)]
The commands C-xC-e were issued within the *info* buffer.
After positioning point within the sample function definition,
and issuing C-c=, the erroneous behaviour, as described, occurred.

However, copying the two functions and the global key setting and
the sample function to the *scratch* buffer and then setting point
into the sample function definition and keying C-c= produced the
correct result: There are 10 words or symbols... Point was set to the
character beyond the function definition.

-- 
Sian Mountbatten (home web-site http://www.poenikatu.co.uk/>)
Learning C++11 from the C++ Primer 5th edition.
I'm an associate FSF member (no. 10888).
Help us support software freedom! http://www.fsf.org/jf?referrer=10888

[Message part 2 (text/html, inline)]

Added tag(s) easy. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 28 Oct 2020 08:32:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15069; Package emacs. (Fri, 21 May 2021 19:41:01 GMT) Full text and rfc822 format available.

Message #13 received at 15069 <at> debbugs.gnu.org (full text, mbox):

From: pillule <pillule <at> riseup.net>
To: 15069 <at> debbugs.gnu.org
Cc: Sian Mountbatten <poenikatu <at> fastmail.co.uk>,
 Stefan Kangas <stefan <at> marxist.se>
Subject: [PATCH] Bug: 15069: Correct functioning in the *scratch* buffer
Date: Fri, 21 May 2021 19:39:37 +0000
[Message part 1 (text/plain, inline)]
Hi,

Is that correct that it is a documentation bug (need to specify to 
the user to evaluate `count-words-in-defun' in eg, a *scratch* 
buffer) rather than an implementation bug (fixing the behavior of 
beginning-of-defun in Info-mode) ?

If so I attached a small patch there, and verified it after a 
`make docs`
[0001-Clarify-page-14.3-of-eintr-manual-bug-15069.patch (text/x-diff, attachment)]
[Message part 3 (text/plain, inline)]
I remember I especially liked to be able to evaluate sexp in place 
in the eintr manual, that is fitting so well the interpreted 
nature of elisp, but here the situation is out of my mind :
- 1. the norm seems to *not* use the column 0 to declare top 
level sexp in Info manuals even if 
`open-paren-in-column-0-is-defun-start' is set to t.
- 2. there is many opened sexp given as exemple, which will 
confuse the syntaxe tree.

Have a nice day, or, night, I don't know.
-- 

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15069; Package emacs. (Sat, 22 May 2021 06:35:02 GMT) Full text and rfc822 format available.

Message #16 received at 15069 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: pillule <pillule <at> riseup.net>
Cc: poenikatu <at> fastmail.co.uk, stefan <at> marxist.se, 15069 <at> debbugs.gnu.org
Subject: Re: bug#15069: [PATCH] Bug: 15069: Correct functioning in the
 *scratch* buffer
Date: Sat, 22 May 2021 09:34:19 +0300
> From: pillule <pillule <at> riseup.net>
> Date: Fri, 21 May 2021 19:39:37 +0000
> Cc: Sian Mountbatten <poenikatu <at> fastmail.co.uk>,
>  Stefan Kangas <stefan <at> marxist.se>
> 
> It has been pointed the instructions for `count-words-in-defun` are
> ambiguous : One can expect to evaluate the sexp in the Info manual but
> that would not work, so this commit explicit that it must be done in a
> clean buffer (= with a valid syntaxe tree).
> 
> Copyright-paperwork-exempt: yes
> ---
>  doc/lispintro/emacs-lisp-intro.texi | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi
> index fade4096e3..ba5fae4ff0 100644
> --- a/doc/lispintro/emacs-lisp-intro.texi
> +++ b/doc/lispintro/emacs-lisp-intro.texi
> @@ -14650,7 +14650,8 @@ Let's re-use @kbd{C-c =} as a convenient keybinding:
>  
>  Now we can try out @code{count-words-defun}: install both
>  @code{count-words-in-defun} and @code{count-words-defun}, and set the
> -keybinding, and then place the cursor within the following definition:
> +keybinding, and then place the cursor within the following definition,
> +in a clean scratch buffer:

It says "install the functions", which means they should be evaluated
or loaded, and that tells you the Lisp code should already be
available in some Lisp buffer, whether it's *scratch* or some *.el
file.

So why did you think it speaks about the text in the Info buffer?
That's not the intent of the text, and the text says as much.

So I'm not sure we should install this fix.  Any other opinions?

In any case:

  . just talking about *scratch* is too restrictive
  . the commit log message is not according to our conventions (see
    CONTRIBUTE)

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15069; Package emacs. (Mon, 24 May 2021 15:49:01 GMT) Full text and rfc822 format available.

Message #19 received at 15069 <at> debbugs.gnu.org (full text, mbox):

From: pillule <pillule <at> riseup.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: pillule <pillule <at> riseup.net>, poenikatu <at> fastmail.co.uk, stefan <at> marxist.se,
 15069 <at> debbugs.gnu.org
Subject: Re: bug#15069: [PATCH] Bug: 15069: Correct functioning in the
 *scratch* buffer
Date: Mon, 24 May 2021 15:48:20 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

> It says "install the functions", which means they should be 
> evaluated
> or loaded, and that tells you the Lisp code should already be
> available in some Lisp buffer, whether it's *scratch* or some 
> *.el
> file.
>
> So why did you think it speaks about the text in the Info 
> buffer?
> That's not the intent of the text, and the text says as much.

That is what I have done when studying this manual, I don't 
remember well,
but I may have been comforted in this habit by the following 
sections :

(info "(eintr) How to Evaluate")
«   In addition to typing keyboard commands, we have seen a second 
way to
evaluate an expression: by positioning the cursor after a list and
typing ‘C-x C-e’.  This is what we will do in the rest of this 
section.
There are other ways to evaluate an expression as well; these will 
be
described as we come to them.»

(info "(eintr) Buffer Names")
«   If you are reading this in Info inside of GNU Emacs, you can 
evaluate
each of the following expressions by positioning the cursor after 
it and
typing ‘C-x C-e’.»

Finally the section :

(info "(eintr) count-words-in-defun")
«   Now we can try out ‘count-words-defun’: install both
‘count-words-in-defun’ and ‘count-words-defun’, and set the 
keybinding,
and then place the cursor within the following definition:»
                         ^_____________________________^

So I can understand one may be confused to discover that in this 
case,
he or she must instead copy the following definition in a separate 
file,
then call the command `count-words-in-defun' within it.

> So I'm not sure we should install this fix.  Any other opinions?
>
> In any case:
>
>   . just talking about *scratch* is too restrictive
>   . the commit log message is not according to our conventions 
>   (see
>     CONTRIBUTE)

Yes please don't.
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15069; Package emacs. (Sat, 21 Aug 2021 13:46:01 GMT) Full text and rfc822 format available.

Message #22 received at 15069 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: pillule <pillule <at> riseup.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, poenikatu <at> fastmail.co.uk, stefan <at> marxist.se,
 15069 <at> debbugs.gnu.org
Subject: Re: bug#15069: Introduction to Elisp 14.3: Function
 'count-words-defun' does not work as described.
Date: Sat, 21 Aug 2021 15:44:50 +0200
pillule <pillule <at> riseup.net> writes:

>> So why did you think it speaks about the text in the Info buffer?
>> That's not the intent of the text, and the text says as much.

[...]

> (info "(eintr) Buffer Names")
> «   If you are reading this in Info inside of GNU Emacs, you can
> evaluate
> each of the following expressions by positioning the cursor after it
> and
> typing ‘C-x C-e’.»
>
> Finally the section :
>
> (info "(eintr) count-words-in-defun")
> «   Now we can try out ‘count-words-defun’: install both
> ‘count-words-in-defun’ and ‘count-words-defun’, and set the
> keybinding,
> and then place the cursor within the following definition:»
>                          ^_____________________________^
>
> So I can understand one may be confused to discover that in this case,
> he or she must instead copy the following definition in a separate
> file,
> then call the command `count-words-in-defun' within it.

I agree -- I read the section now, and `C-x C-e'-d the definitions as
expected (in the *info* buffer), and then I naturally tried the `C-c ='
command in the *info* buffer too -- which failed.

So I've installed a clarification along the lines suggested by pillule
in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 15069 <at> debbugs.gnu.org and Sian Mountbatten <poenikatu <at> fastmail.co.uk> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 21 Aug 2021 13:46:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15069; Package emacs. (Mon, 30 Aug 2021 20:04:01 GMT) Full text and rfc822 format available.

Message #27 received at 15069 <at> debbugs.gnu.org (full text, mbox):

From: Trust me I am a Doctor <pillule <at> riseup.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, poenikatu <at> fastmail.co.uk, stefan <at> marxist.se,
 15069 <at> debbugs.gnu.org
Subject: Re: bug#15069: Introduction to Elisp 14.3: Function
 'count-words-defun' does not work as described.
Date: Mon, 30 Aug 2021 22:02:16 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I agree -- I read the section now, and `C-x C-e'-d the definitions as
> expected (in the *info* buffer), and then I naturally tried the `C-c ='
> command in the *info* buffer too -- which failed.

Thanks Lars to find the right words and to take care of that old bug :)

--




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Sep 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 267 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.