unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#3862: 23.1.50; error calling `documentation' on calendar-mode
@ 2009-07-15 23:50 ` Kevin Ryde
  2009-07-16  1:40   ` Stefan Monnier
  2009-07-19  0:45   ` bug#3862: marked as done (23.1.50; error calling `documentation' on calendar-mode) Emacs bug Tracking System
  0 siblings, 2 replies; 6+ messages in thread
From: Kevin Ryde @ 2009-07-15 23:50 UTC (permalink / raw)
  To: emacs-pretest-bug

In a recent cvs starting "emacs -Q" and evaluating

    (progn
      (require 'calendar)
      (documentation 'calendar-mode))

gets the error and backtrace below.

For what it's worth it works fine from the actual calendar buffer, but I
was trying in some program code where that wasn't the case.  I hoped I
could generally get the docs for any function from anywhere.

Also incidentally I tried a condition-case around it like

    (condition-case nil
        (documentation 'calendar-mode)
      (error nil))

and was surprised it still went to the debugger.  But maybe that's a
separate problem.



Debugger entered--Lisp error: (void-variable displayed-month)
  calendar-cursor-to-date(t 24)
  cal-menu-set-date-title(("--" ["Holidays" calendar-cursor-holidays] ["Mark date" calendar-set-mark] ["Sunrise/sunset" calendar-sunrise-sunset] ["Other calendars" calendar-print-other-dates] ("Prepare LaTeX buffer" ["Daily (1 page)" cal-tex-cursor-day] ["Weekly (1 page)" cal-tex-cursor-week] ["Weekly (2 pages)" cal-tex-cursor-week2] ["Weekly (other style; 1 page)" cal-tex-cursor-week-iso] ["Weekly (yet another style; 1 page)" cal-tex-cursor-week-monday] ["Monthly" cal-tex-cursor-month] ["Monthly (landscape)" cal-tex-cursor-month-landscape] ["Yearly" cal-tex-cursor-year] ["Yearly (landscape)" cal-tex-cursor-year-landscape] ("Filofax styles" ["Filofax Daily (one-day-per-page)" cal-tex-cursor-filofax-daily] ["Filofax Weekly (2-weeks-at-a-glance)" cal-tex-cursor-filofax-2week] ["Filofax Weekly (week-at-a-glance)" cal-tex-cursor-filofax-week] ["Filofax Yearly" cal-tex-cursor-filofax-year])) ("Write HTML calendar" ["For selected month" cal-html-cursor-month] ["For selected year" cal-html-cursor-year]) ["Diary entries" calendar-mouse-view-diary-entries :keys "d"] ["Insert diary entry" diary-insert-entry] ["Other diary file entries" calendar-mouse-view-other-diary-entries :keys "D"]))
  (easy-menu-filter-return (cal-menu-set-date-title menu) "cal-menu-mouse2")
  (lambda (menu) (easy-menu-filter-return (cal-menu-set-date-title menu) "cal-menu-mouse2"))(("--" ["Holidays" calendar-cursor-holidays] ["Mark date" calendar-set-mark] ["Sunrise/sunset" calendar-sunrise-sunset] ["Other calendars" calendar-print-other-dates] ("Prepare LaTeX buffer" ["Daily (1 page)" cal-tex-cursor-day] ["Weekly (1 page)" cal-tex-cursor-week] ["Weekly (2 pages)" cal-tex-cursor-week2] ["Weekly (other style; 1 page)" cal-tex-cursor-week-iso] ["Weekly (yet another style; 1 page)" cal-tex-cursor-week-monday] ["Monthly" cal-tex-cursor-month] ["Monthly (landscape)" cal-tex-cursor-month-landscape] ["Yearly" cal-tex-cursor-year] ["Yearly (landscape)" cal-tex-cursor-year-landscape] ("Filofax styles" ["Filofax Daily (one-day-per-page)" cal-tex-cursor-filofax-daily] ["Filofax Weekly (2-weeks-at-a-glance)" cal-tex-cursor-filofax-2week] ["Filofax Weekly (week-at-a-glance)" cal-tex-cursor-filofax-week] ["Filofax Yearly" cal-tex-cursor-filofax-year])) ("Write HTML calendar" ["For selected month" cal-html-cursor-month] ["For selected year" cal-html-cursor-year]) ["Diary entries" calendar-mouse-view-diary-entries :keys "d"] ["Insert diary entry" diary-insert-entry] ["Other diary file entries" calendar-mouse-view-other-diary-entries :keys "D"]))
  documentation(calendar-mode)
  (progn (require (quote calendar)) (documentation (quote calendar-mode)))
  eval-region(1 63 t (lambda (ignore) (goto-char 63) (quote (progn ... ...))))  ; Reading at buffer position 8
  apply(eval-region (1 63 t (lambda (ignore) (goto-char 63) (quote ...))))
  eval-defun-2()
  eval-defun(nil)
  call-interactively(eval-defun nil nil)




In GNU Emacs 23.1.50.1 (i586-pc-linux-gnu, GTK+ Version 2.16.4)
 of 2009-07-12 on blah.blah
configured using `configure  'CFLAGS=-O -g' '--prefix=/down/emacs/b/inst' '--with-x-toolkit=gtk''

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: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t





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

* bug#3862: 23.1.50; error calling `documentation' on calendar-mode
  2009-07-15 23:50 ` bug#3862: 23.1.50; error calling `documentation' on calendar-mode Kevin Ryde
@ 2009-07-16  1:40   ` Stefan Monnier
  2009-07-17  1:02     ` Glenn Morris
  2009-07-19  0:45   ` bug#3862: marked as done (23.1.50; error calling `documentation' on calendar-mode) Emacs bug Tracking System
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2009-07-16  1:40 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: 3862

>     (progn
>       (require 'calendar)
>       (documentation 'calendar-mode))

> gets the error and backtrace below.

The docstring gets passed through substitute-command-keys which can run
arbitrary code via menu-item :filters (as well as via autoloaded
keymaps, actually).

> For what it's worth it works fine from the actual calendar buffer, but I
> was trying in some program code where that wasn't the case.  I hoped I
> could generally get the docs for any function from anywhere.

In the present case, there's a subtle bug in the :filter of the
calendar-mode-map (more specially in the menu-bar part of the map).

> Also incidentally I tried a condition-case around it like

>     (condition-case nil
>         (documentation 'calendar-mode)
>       (error nil))

> and was surprised it still went to the debugger.  But maybe that's a
> separate problem.

Indeed it's a separate problem: when the filter is run, it is presumed
it is "at top level" and so the error gets turned into a backtrace
without paying attention to surrounding condition-cases.  It's clearly
a bug, but it might be delicate to fix without introducing risks of
nasty crashes.


        Stefan






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

* bug#3862: 23.1.50; error calling `documentation' on calendar-mode
  2009-07-16  1:40   ` Stefan Monnier
@ 2009-07-17  1:02     ` Glenn Morris
  2009-07-17  5:12       ` Glenn Morris
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2009-07-17  1:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Kevin Ryde, 3862

Stefan Monnier wrote:

> In the present case, there's a subtle bug in the :filter of the
> calendar-mode-map (more specially in the menu-bar part of the map).

Could you explain what the bug is? The error is coming from
cal-menu-set-date-title in a mouse-binding, which calls
calendar-cursor-to-date.

This has always assumed it is called from a calendar buffer, which
seems reasonable, and gives an error if it is not.

Also, why does C-h f calendar-mode work fine?


On a related note, I notice that the Emacs 22 behaviour, where it
displays an explicit error message "Not on a date" if called in the
calendar with point not a date, has been lost - now it is just silent.
I would like to get this back, but I can't figure out the Easymenu-Way
to do it.


Anyway, the following hack will suppress the original issue.


*** calendar.el	8 Jul 2009 02:48:13 -0000	1.283
--- calendar.el	17 Jul 2009 00:53:33 -0000
***************
*** 1811,1816 ****
--- 1811,1817 ----
    (with-current-buffer
        (if event (window-buffer (posn-window (event-start event)))
          (current-buffer))
+     (or (boundp 'displayed-month) (error "Not on a date!"))
      (save-excursion
        (and event (setq event (event-start event))
             (goto-char (posn-point event)))





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

* bug#3862: 23.1.50; error calling `documentation' on calendar-mode
  2009-07-17  1:02     ` Glenn Morris
@ 2009-07-17  5:12       ` Glenn Morris
  2009-07-17 15:58         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2009-07-17  5:12 UTC (permalink / raw)
  To: 3862; +Cc: Kevin Ryde


Perhaps something like this is better:

*** cal-menu.el.~1.114.~	2009-01-07 20:13:09.000000000 -0800
--- cal-menu.el	2009-07-16 22:08:54.000000000 -0700
***************
*** 202,210 ****
  
  (defun cal-menu-set-date-title (menu)
    "Convert date of last event to title suitable for MENU."
!   (easy-menu-filter-return
!    menu (calendar-date-string (calendar-cursor-to-date t last-input-event)
!                               t nil)))
  
  (easy-menu-define cal-menu-context-mouse-menu nil
    "Pop up menu for Mouse-2 for selected date in the calendar window."
--- 202,212 ----
  
  (defun cal-menu-set-date-title (menu)
    "Convert date of last event to title suitable for MENU."
!   (let ((date (ignore-errors (calendar-cursor-to-date nil last-input-event))))
!     (if date
!         (easy-menu-filter-return menu (calendar-date-string date t nil))
!       (message "Not on a date!")
!       nil)))
  
  (easy-menu-define cal-menu-context-mouse-menu nil
    "Pop up menu for Mouse-2 for selected date in the calendar window."





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

* bug#3862: 23.1.50; error calling `documentation' on calendar-mode
  2009-07-17  5:12       ` Glenn Morris
@ 2009-07-17 15:58         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2009-07-17 15:58 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Kevin Ryde, 3862

> Perhaps something like this is better:

That seems OK, tho I'd rather return the menu in either case and use
some default string (e.g. "today") for the date when
calendar-cursor-to-date signals an error.


        Stefan





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

* bug#3862: marked as done (23.1.50; error calling `documentation' on calendar-mode)
  2009-07-15 23:50 ` bug#3862: 23.1.50; error calling `documentation' on calendar-mode Kevin Ryde
  2009-07-16  1:40   ` Stefan Monnier
@ 2009-07-19  0:45   ` Emacs bug Tracking System
  1 sibling, 0 replies; 6+ messages in thread
From: Emacs bug Tracking System @ 2009-07-19  0:45 UTC (permalink / raw)
  To: Glenn Morris

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]


Your message dated Sat, 18 Jul 2009 20:37:04 -0400
with message-id <6dfxct1pan.fsf@fencepost.gnu.org>
and subject line Re: bug#3862: 23.1.50; error calling `documentation' on calendar-mode
has caused the Emacs bug report #3862,
regarding 23.1.50; error calling `documentation' on calendar-mode
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
3862: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3862
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 6604 bytes --]

From: Kevin Ryde <user42@zip.com.au>
To: emacs-pretest-bug@gnu.org
Subject: 23.1.50; error calling `documentation' on calendar-mode
Date: Thu, 16 Jul 2009 09:50:38 +1000
Message-ID: <87tz1da4kx.fsf@blah.blah>

In a recent cvs starting "emacs -Q" and evaluating

    (progn
      (require 'calendar)
      (documentation 'calendar-mode))

gets the error and backtrace below.

For what it's worth it works fine from the actual calendar buffer, but I
was trying in some program code where that wasn't the case.  I hoped I
could generally get the docs for any function from anywhere.

Also incidentally I tried a condition-case around it like

    (condition-case nil
        (documentation 'calendar-mode)
      (error nil))

and was surprised it still went to the debugger.  But maybe that's a
separate problem.



Debugger entered--Lisp error: (void-variable displayed-month)
  calendar-cursor-to-date(t 24)
  cal-menu-set-date-title(("--" ["Holidays" calendar-cursor-holidays] ["Mark date" calendar-set-mark] ["Sunrise/sunset" calendar-sunrise-sunset] ["Other calendars" calendar-print-other-dates] ("Prepare LaTeX buffer" ["Daily (1 page)" cal-tex-cursor-day] ["Weekly (1 page)" cal-tex-cursor-week] ["Weekly (2 pages)" cal-tex-cursor-week2] ["Weekly (other style; 1 page)" cal-tex-cursor-week-iso] ["Weekly (yet another style; 1 page)" cal-tex-cursor-week-monday] ["Monthly" cal-tex-cursor-month] ["Monthly (landscape)" cal-tex-cursor-month-landscape] ["Yearly" cal-tex-cursor-year] ["Yearly (landscape)" cal-tex-cursor-year-landscape] ("Filofax styles" ["Filofax Daily (one-day-per-page)" cal-tex-cursor-filofax-daily] ["Filofax Weekly (2-weeks-at-a-glance)" cal-tex-cursor-filofax-2week] ["Filofax Weekly (week-at-a-glance)" cal-tex-cursor-filofax-week] ["Filofax Yearly" cal-tex-cursor-filofax-year])) ("Write HTML calendar" ["For selected month" cal-html-cursor-month] ["For selected year" cal-html-cursor-year]) ["Diary entries" calendar-mouse-view-diary-entries :keys "d"] ["Insert diary entry" diary-insert-entry] ["Other diary file entries" calendar-mouse-view-other-diary-entries :keys "D"]))
  (easy-menu-filter-return (cal-menu-set-date-title menu) "cal-menu-mouse2")
  (lambda (menu) (easy-menu-filter-return (cal-menu-set-date-title menu) "cal-menu-mouse2"))(("--" ["Holidays" calendar-cursor-holidays] ["Mark date" calendar-set-mark] ["Sunrise/sunset" calendar-sunrise-sunset] ["Other calendars" calendar-print-other-dates] ("Prepare LaTeX buffer" ["Daily (1 page)" cal-tex-cursor-day] ["Weekly (1 page)" cal-tex-cursor-week] ["Weekly (2 pages)" cal-tex-cursor-week2] ["Weekly (other style; 1 page)" cal-tex-cursor-week-iso] ["Weekly (yet another style; 1 page)" cal-tex-cursor-week-monday] ["Monthly" cal-tex-cursor-month] ["Monthly (landscape)" cal-tex-cursor-month-landscape] ["Yearly" cal-tex-cursor-year] ["Yearly (landscape)" cal-tex-cursor-year-landscape] ("Filofax styles" ["Filofax Daily (one-day-per-page)" cal-tex-cursor-filofax-daily] ["Filofax Weekly (2-weeks-at-a-glance)" cal-tex-cursor-filofax-2week] ["Filofax Weekly (week-at-a-glance)" cal-tex-cursor-filofax-week] ["Filofax Yearly" cal-tex-cursor-filofax-year])) ("Write HTML calendar" ["For selected month" cal-html-cursor-month] ["For selected year" cal-html-cursor-year]) ["Diary entries" calendar-mouse-view-diary-entries :keys "d"] ["Insert diary entry" diary-insert-entry] ["Other diary file entries" calendar-mouse-view-other-diary-entries :keys "D"]))
  documentation(calendar-mode)
  (progn (require (quote calendar)) (documentation (quote calendar-mode)))
  eval-region(1 63 t (lambda (ignore) (goto-char 63) (quote (progn ... ...))))  ; Reading at buffer position 8
  apply(eval-region (1 63 t (lambda (ignore) (goto-char 63) (quote ...))))
  eval-defun-2()
  eval-defun(nil)
  call-interactively(eval-defun nil nil)




In GNU Emacs 23.1.50.1 (i586-pc-linux-gnu, GTK+ Version 2.16.4)
 of 2009-07-12 on blah.blah
configured using `configure  'CFLAGS=-O -g' '--prefix=/down/emacs/b/inst' '--with-x-toolkit=gtk''

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: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t


[-- Attachment #3: Type: message/rfc822, Size: 1760 bytes --]

From: Glenn Morris <rgm@gnu.org>
To: 3862-done@emacsbugs.donarmstrong.com
Subject: Re: bug#3862: 23.1.50; error calling `documentation' on calendar-mode
Date: Sat, 18 Jul 2009 20:37:04 -0400
Message-ID: <6dfxct1pan.fsf@fencepost.gnu.org>


  * calendar/cal-menu.el (cal-menu-set-date-title): Handle calls
  from non-calendar buffers (Bug#3862).

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

end of thread, other threads:[~2009-07-19  0:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <6dfxct1pan.fsf@fencepost.gnu.org>
2009-07-15 23:50 ` bug#3862: 23.1.50; error calling `documentation' on calendar-mode Kevin Ryde
2009-07-16  1:40   ` Stefan Monnier
2009-07-17  1:02     ` Glenn Morris
2009-07-17  5:12       ` Glenn Morris
2009-07-17 15:58         ` Stefan Monnier
2009-07-19  0:45   ` bug#3862: marked as done (23.1.50; error calling `documentation' on calendar-mode) Emacs bug Tracking System

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).