emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error during redisplay with included diary file


From: Stephen Berman
Subject: Re: Error during redisplay with included diary file
Date: Wed, 07 Dec 2005 21:36:59 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

I tracked down the source of the error and it turned out, probably not
surprisingly, to be a simple mistake on my part.  I give the details
below for the record and because it may be instructive to some others
(it certainly was to me!).  Read on if you're still interested...

On Tue, 06 Dec 2005 14:14:31 +0000 Jason Rumney <address@hidden> wrote:

> Stephen Berman <address@hidden> writes:
>
>> Further, as a string it is the value of a variable used in a
>> function I wrote modelled on make-diary-entry.
>
> How exactly is it used in that function?

That function and the variable turn out to have nothing to do with the
error. 

>> Breakpoint 3, safe_eval_handler (arg=140906725) at xdisp.c:2236
>> 2236      add_to_log ("Error during redisplay: %s", arg, Qnil);
>>
>> #0  safe_eval_handler (arg=140906725) at xdisp.c:2236
>> #1  0x081508a8 in internal_condition_case_1 (bfun=0x81519c0 <Feval>,
>>     arg=139399637, handlers=137489449, hfun=0x806c440 <safe_eval_handler>)
>>     at eval.c:1496
>> #2  0x08064fad in safe_eval (sexpr=139399637) at xdisp.c:2261
>> #3  0x080773aa in display_mode_element (it=0xbf8e8e54, depth=1, 
>> field_width=0,
>>     precision=0, elt=<value optimized out>, props=137489401, risky=0)
>>     at xdisp.c:16587
>> #4  0x080779a9 in display_mode_line (w=<value optimized out>,
>>     face_id=HEADER_LINE_FACE_ID, format=139399757) at xdisp.c:16182
>
> What is your mode-line-format? Does it use that function you wrote?

This was the key to finding the source of the error; thanks for
drawing attention to it!  It's actually not the mode line where the
error arises but, as indicated by the value of face_id, the header
line.  I use David Ponce's tabbar.el, which turns the header line into
sets of tabs, e.g. for (groups of) visited buffers.  I've made various
modifications to tabbar.el to suit my needs; one was the following
modification of the function tabbar-buffer-groups (only the relevant
lines shown):

(defun srb-tabbar-buffer-groups ()
  "Return the list of group names the current buffer belongs to.
Return a list of one element based on major mode."
  (list
   (cond
    ...
    ((or ...
         ...
         (eval-after-load "~/.emacs.d/todo+cal+diary+appt.el"
           (member (buffer-file-name) (srb-diary-files))))
     "Diary")
    ...)))

This assigns the buffer tab of a visited included diary file to the
"Diary" buffer group by extracting the absolute file name from the
diary file (that's what srb-diary-files, which is defined in the file
named above, does).  This works fine for creating the tab bar.  But I
overlooked, or failed to appreciate, that the form that
eval-after-load operates on in the above is the value of `(member
(buffer-file-name) (srb-diary-files))', which is in fact the string
"/home/steve/diary-Abendessen.txt" (since that is #included in my
diary-file), and consequently, `("/home/steve/diary-Abendessen.txt")'
gets added to after-change-alist.  And the subsequent attempt to eval
this raises the error I saw in *Messages*:

Error during redisplay: (invalid-function /home/steve/diary-Abendessen.txt)

The immediate fix is simply to quote the form to be evalled, thereby
making it a valid argument.  However, while that no longer raises an
error, it wrecks the grouping of buffers into tabs, since the quoted
form is always a non-nil condition, which means the evaluation of the
cond stops there and every subsequently visited buffer is grouped in
the "Diary" tab.  Rather, what's needed is for the loading of the file
containing the definition of srb-diary-files to be conditioned on
whether that function is void, i.e., whether its symbol is fboundp.
So that's the happy end of my story.  It was an interesting learning
experience.

Steve Berman





reply via email to

[Prev in Thread] Current Thread [Next in Thread]