Subject: 24.2; org-agenda-include-diary doesn't work while using diary-file-name-prefix and diary-file-name-prefix-function elsewhere / FIX included

From: Andreas Merziger <[email-masked]>
Date: Wed, 09 Jan 2013 11:17:31 +0100

To reproduce the bug:

Start with:
emacs -Q.

The contents of my "~/diary" is the single line:
*/*/* Dummy-Entry

In *scratch* - buffer evalute:

(setq org-agenda-include-diary t)
(setq diary-file-name-prefix t)

(setq diary-file-name-prefix-function
      (lambda (strng) 
        (format "%1.1s"
		(capitalize
		 (file-name-nondirectory strng)))))

(org-agenda)

Now hit the key 'a'.

This SHOULD have resulted in the display of the agenda-buffer with
matching diary-entries included.

INSTEAD I get the following error-message in the minibuffer:

Symbol's function definition is void: nil

And the *Messages* - buffer says:
Preparing diary...
diary-add-to-list: Symbol's function definition is void: nil

--- END of Bug-Description ---

I found the following FIX of this unexpected behaviour:

In function `org-get-entries-from-diary' of file `PATH_TO_EMACS/lisp/org/org-agenda.el'
replace the line

(diary-file-name-prefix-function nil) ; turn this feature off

by the line

(diary-file-name-prefix nil) ; turn this feature off

After this change (and recompilation-of course) I could not observe the unexpected behaviour anymore.

COMMENT: (setq diary-file-name-prefix t)  is not used by org-mode by its own, 
but it's needed if one wants to use a diary-file-name-prefix-function in the stand-alone version of the diary file when used by calendar.

In my opinion the bug is caused by the fact, that the function
`diary-add-to-list' checks the flag `diary-file-name-prefix' not `diary-file-name-prefix-function'!

I'm SENDING this report with emacs-version 23.1 as my mail-setup with gnus is rather lengthy
an I didn't want to interfere this with the reproduction of the bug.
The bug report was GENERATED within emacs-24.2.

----- END of Bug-Report -------

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/local/share/emacs/24.2/etc/DEBUG.

In GNU Emacs 24.2.2 (i686-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2013-01-09 on filista
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  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: de_DE.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

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
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
i n c l u d e - d i a r y C-g C-s d i a r y - f i l 
e C-x C-b <help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-2> C-x 1 <C-home> C-s d i a r y - f i e l e 
l e <backspace> <backspace> <backspace> <backspace> 
<backspace> l e - n a m e - p r e f i x - f u n c t 
i o n <help-echo> C-x C-f <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> s r <tab> <tab> <tab> <tab> o r <tab> <backspace> 
<backspace> C-g C-x C-b <help-echo> <help-echo> <down-mouse-1> 
<mouse-2> C-g C-x C-f <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> ~ / l i s <tab> 
e l i <tab> c a l <tab> <return> C-x 1 C-s p r i e 
f <backspace> <backspace> <backspace> e f i x f - <backspace> 
<backspace> - f u <down-mouse-1> <mouse-movement> <mouse-movement> 
<drag-mouse-1> M-w C-x b * s c <tab> <return> C-y C-x 
C-e C-x C-b <help-echo> <help-echo> <down-mouse-1> 
<mouse-2> <down-mouse-1> <mouse-movement> <mouse-movement> 
<drag-mouse-1> M-w <help-echo> <down-mouse-1> <mouse-1> 
<return> C-y C-x C-e <down-mouse-1> <mouse-1> C-x C-e 
<return> <return> <down-mouse-1> <mouse-1> C-x C-e 
<down-mouse-1> <mouse-1> C-x C-e <down-mouse-1> <mouse-1> 
<return> <return> M-x o r - <backspace> r <backspace> 
g - a g e n <tab> - <backspace> - <backspace> <tab> 
<tab> <return> a C-x b C-g C-x b * M e w <tab> <backspace> 
s <tab> <return> <up> <up> <up> C-x o <up> <up> <up> 
<up> <up> <up> <up> <backspace> C-e <return> <down-mouse-1> 
<mouse-1> <return> <return> M-x r e j p o <tab> <backspace> 
<backspace> <backspace> p o <tab> r <tab> <return>

Recent messages:
Mark set
t
(lambda (strng) (format "%1.1s" (capitalize (file-name-nondirectory strng)))) [2 times]
t
Making completion list...
Press key for agenda command:
Preparing diary...
diary-add-to-list: Symbol's function definition is void: nil
Quit
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message rfc822 mml 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 jka-compr mule-util cal-china lunar solar cal-dst cal-bahai
cal-islam cal-hebrew holidays hol-loaddefs diary-lib diary-loaddefs
cal-iso org-agenda org byte-opt warnings bytecomp byte-compile cconv
macroexp advice advice-preload ob-emacs-lisp ob-tangle ob-ref ob-lob
ob-table org-footnote org-src ob-comint ob-keys ob ob-eval org-pcomplete
pcomplete comint ansi-color ring org-list org-faces org-compat
org-entities org-macs noutline outline easy-mmode format-spec regexp-opt
cal-menu calendar cal-loaddefs help-mode easymenu view misearch
multi-isearch help-fns time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe
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 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)