GNU bug report logs - #11476
23.1; which-func-cleanup-function call and documentation mismatch

Previous Next

Package: emacs;

Reported by: Jack Duthen <duthen.mac.01 <at> gmail.com>

Date: Tue, 15 May 2012 15:09:02 UTC

Severity: minor

Tags: moreinfo, unreproducible

Found in version 23.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 11476 in the body.
You can then email your comments to 11476 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#11476; Package emacs. (Tue, 15 May 2012 15:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jack Duthen <duthen.mac.01 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 15 May 2012 15:09:02 GMT) Full text and rfc822 format available.

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

From: Jack Duthen <duthen.mac.01 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; which-func-cleanup-function call and documentation mismatch
Date: Tue, 15 May 2012 17:07:13 +0200
--text follows this line--

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs <at> gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Hi!

I'm using "which-func" and I find it very convenient!

I tried to use a customized "which-func-cleanup-function"
and found that its doc string says:
  "Function to transform a string before displaying it in the mode line.
The function is called with one argument, the string to display..."

It seems that the argument given to "which-func-cleanup-function"
can also be a list with one string.

Using this test function:

;;; -------------------
;;; To help see the bug
(defun jd-test-which-func-cleanup-function (fun-name)
  (message "Type of fun-name '%s' is %s" fun-name (type-of fun-name))
  (when (consp fun-name)
    (message "Type of (car fun-name) '%s' is %s" (car fun-name)
(type-of (car fun-name))))
  (setq jd-ielm-fun-name fun-name)          ; to explore it using ielm
  fun-name)

;;; (setq which-func-cleanup-function 'jd-test-which-func-cleanup-function)
;;; (setq which-func-cleanup-function ())
;;; -------------------

I got the messages (while editing the file "which-func.el"):
Type of fun-name '(which-function)' is cons
Type of (car fun-name) 'which-function' is string

So, either the doc string of "which-func-cleanup-function" is wrong,
either "which-function" should return the "car" of the value it returns.

Since the code of "which-function" is not that simple, I can't clearly
and surely tell which one is wrong and fix the bug by myself.

I noticed that the function "which-function" contains the following lines:
    ;; Try using add-log support.
    (when (null name)
      (setq name (add-log-current-defun)))

And it seems that "add-log-current-defun" returns a string.
So, maybe, "which-function" should return the "car" of "name"
when it is a list.

Can you fix it?

)jack(


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'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.22.0)
 of 2011-03-04 on roseapple, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10900000
configured using `configure  '--build=i686-linux-gnu'
'--host=i686-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.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim'
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=i686-linux-gnu' 'host_alias=i686-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: fr_FR.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  eldoc-mode: t
  which-function-mode: t
  show-paren-mode: t
  recentf-mode: t
  desktop-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
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: (only . t)

Recent input:
C-v C-u C-v C-u C-v <help-echo> <help-echo> <help-echo>
<down-mouse-1> <mouse-1> C-x b <return> M-x b u r r
<tab> <backspace> <tab> <return> C-x b j M-p <return>
<switch-frame> <switch-frame> <switch-frame> <switch-frame>
<help-echo> <help-echo> <down-mouse-5> <mouse-5> <double-down-mouse-5>
<double-mouse-5> <down-mouse-5> <mouse-5> <down-mouse-1>
<mouse-1> C-s C-w C-w C-w C-w C-x o C-s C-s C-s <down-mouse-1>
<mouse-1> C-s C-w C-r C-r C-r C-r C-r C-r C-r C-r C-r
C-r C-r C-r C-u C-u M-v <down-mouse-4> <mouse-4> <down-mouse-4>
<mouse-4> <down-mouse-4> <mouse-4> <down-mouse-1> <mouse-1>
C-h f <return> <down-mouse-1> <mouse-1> <double-down-mouse-1>
<double-mouse-1> M-w M-: C-y <return> <down-mouse-5>
<mouse-5> <down-mouse-1> <mouse-movement> <mouse-movement>
<drag-mouse-1> <down-mouse-5> <mouse-5> <down-mouse-5>
<mouse-5> <down-mouse-1> <mouse-1> C-x C-e <down-mouse-1>
<mouse-1> C-x C-e <down-mouse-1> <mouse-1> C-x b <return>
C-x b j <tab> M-p <return> <help-echo> <down-mouse-1>
<mouse-1> M-d e x p l o r e M-f M-f <M-backspace> u
s i n g <down-mouse-1> <mouse-1> SPC h e l p C-x C-s
C-p - - - - - C-x C-s <help-echo> <down-mouse-1> <mouse-1>
C-h f <return> <down-mouse-1> <mouse-1> <double-down-mouse-1>
<double-mouse-1> M-w <switch-frame> C-v C-v C-v C-v
C-v M-: C-y <return> C-u M-v C-u M-v M-: M-p <return>
<switch-frame> C-x o <help-echo> <down-mouse-1> <mouse-2>
<help-echo> <down-mouse-5> <mouse-5> <down-mouse-5>
<mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5>
<down-mouse-5> <mouse-5> <double-down-mouse-5> <double-mouse-5>
<down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5>
<mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5>
<switch-frame> <up> <up> <up> <up> <up> <right> <left>
<down> <down> <down> <down> <down> <switch-frame> C-x
C-g M-x M-p <return> C-x o q <down-mouse-1> <mouse-movement>
<mouse-1> C-M-x <down-mouse-1> <mouse-1> C-M-b C-M-SPC
M-w C-x o M-: C-y <return> M-: M-p C-e C-b C-M-b C-b
C-k ( ) ) <return> <down-mouse-5> <mouse-5> <down-mouse-5>
<mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5>
<down-mouse-4> <mouse-4> <down-mouse-5> <mouse-5> <help-echo>
<down-mouse-1> <mouse-1> C-s C-w C-x o C-s C-s C-s
C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-a <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<menu-bar> <help-menu> <send-emacs-bug-report>

Recent messages:
uncompressing add-log.el.gz...done
Note: file is write protected
jd-test-which-func-cleanup-function
Mark set
jd-test-which-func-cleanup-function
Type of fun-name '(which-function)' is cons
Type of (car fun-name) 'which-function' is string
nil
Mark saved where search started [2 times]
/usr/bin/mail is not an executable.  Setting mail-interactive to t.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11476; Package emacs. (Tue, 15 May 2012 15:45:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jack Duthen <duthen.mac.01 <at> gmail.com>
Cc: 11476 <at> debbugs.gnu.org
Subject: Re: bug#11476: 23.1; which-func-cleanup-function call and
	documentation mismatch
Date: Tue, 15 May 2012 11:44:36 -0400
> It seems that the argument given to "which-func-cleanup-function"
> can also be a list with one string.

That is a bug.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11476; Package emacs. (Tue, 15 May 2012 19:31:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jack Duthen <duthen.mac.01 <at> gmail.com>
Cc: 11476 <at> debbugs.gnu.org
Subject: Re: bug#11476: 23.1; which-func-cleanup-function call and
	documentation mismatch
Date: Tue, 15 May 2012 15:30:33 -0400
>> It seems that the argument given to "which-func-cleanup-function"
>> can also be a list with one string.
> That is a bug.

Can you give a recipe or at least describe a case where it happens?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11476; Package emacs. (Wed, 16 May 2012 08:31:02 GMT) Full text and rfc822 format available.

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

From: Jack Duthen <duthen.mac.01 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#11476: 23.1; which-func-cleanup-function call and
	documentation mismatch
Date: Wed, 16 May 2012 10:29:20 +0200
As I explained in my first mail, it always happens with imenu and which-func.
Here is a short recipe to get it:

emacs -Q
open any emacs-lisp file and move point inside any function
M-x imenu-add-menubar-index
M-x which-func-mode
M-:
(defun jd-test-which-func-cleanup-function (fun-name)
  (message "Type of fun-name '%s' is %s" fun-name (type-of fun-name))
  (when (consp fun-name)
    (message "Type of (car fun-name) '%s' is %s" (car fun-name)
(type-of (car fun-name))))
  (setq jd-ielm-fun-name fun-name)          ; to explore it using ielm
  fun-name)
M-: (setq which-func-cleanup-function 'jd-test-which-func-cleanup-function)

2012/5/15 Stefan Monnier <monnier <at> iro.umontreal.ca>:
>>> It seems that the argument given to "which-func-cleanup-function"
>>> can also be a list with one string.
>> That is a bug.
>
> Can you give a recipe or at least describe a case where it happens?
>
>
>        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11476; Package emacs. (Tue, 26 Jun 2012 21:50:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Jack Duthen <duthen.mac.01 <at> gmail.com>
Cc: 11476 <at> debbugs.gnu.org
Subject: Re: bug#11476: 23.1;
	which-func-cleanup-function call and documentation mismatch
Date: Tue, 26 Jun 2012 17:45:09 -0400
Jack Duthen wrote:

> emacs -Q
> open any emacs-lisp file and move point inside any function
> M-x imenu-add-menubar-index
> M-x which-func-mode
> M-:
> (defun jd-test-which-func-cleanup-function (fun-name)
>   (message "Type of fun-name '%s' is %s" fun-name (type-of fun-name))
>   (when (consp fun-name)
>     (message "Type of (car fun-name) '%s' is %s" (car fun-name)
> (type-of (car fun-name))))
>   (setq jd-ielm-fun-name fun-name)          ; to explore it using ielm
>   fun-name)
> M-: (setq which-func-cleanup-function 'jd-test-which-func-cleanup-function)

I cannot reproduce a problem with this, in either 23.1 or current trunk.
The type remains resolutely a string, never a cons. If it were not a
string, I would think that the which-function mode line would break.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11476; Package emacs. (Thu, 06 Feb 2014 00:55:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 11476 <at> debbugs.gnu.org, Jack Duthen <duthen.mac.01 <at> gmail.com>
Subject: Re: bug#11476: 23.1;
 which-func-cleanup-function call and documentation mismatch
Date: Wed, 05 Feb 2014 16:52:51 -0800
Glenn Morris <rgm <at> gnu.org> writes:

> Jack Duthen wrote:
>
>> emacs -Q
>> open any emacs-lisp file and move point inside any function
>> M-x imenu-add-menubar-index
>> M-x which-func-mode
>> M-:
>> (defun jd-test-which-func-cleanup-function (fun-name)
>>   (message "Type of fun-name '%s' is %s" fun-name (type-of fun-name))
>>   (when (consp fun-name)
>>     (message "Type of (car fun-name) '%s' is %s" (car fun-name)
>> (type-of (car fun-name))))
>>   (setq jd-ielm-fun-name fun-name)          ; to explore it using ielm
>>   fun-name)
>> M-: (setq which-func-cleanup-function 'jd-test-which-func-cleanup-function)
>
> I cannot reproduce a problem with this, in either 23.1 or current trunk.
> The type remains resolutely a string, never a cons. If it were not a
> string, I would think that the which-function mode line would break.

More information was requested a year ago, but no further progress seems
to have been made.  I'm closing this bug report now, but if this problem
still persists, please reopen it.

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




bug closed, send any further explanations to 11476 <at> debbugs.gnu.org and Jack Duthen <duthen.mac.01 <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 06 Feb 2014 00:55:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 06 Mar 2014 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 113 days ago.

Previous Next


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