unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5477: 23.1.91; diary-unhide-everything sometimes doesn't
@ 2010-01-25 21:38 Stephen Berman
  2010-01-26 20:21 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Berman @ 2010-01-25 21:38 UTC (permalink / raw)
  To: 5477

If diary-list-entries applies to a narrowed buffer, it widens it before
making it invisible (due to bug#5093).  However, it can happen that
narrowing is restored before diary-unhide-everything applies, with the
result that only the narrowed portion of the buffer becomes visible
again.  The simplest reproducible recipe I could find may seem
contrived, but it makes strictly legitimate use of Emacs libraries (I
have more complex local changes to Todo mode that also suffer from it):

1. Save the following text as ~/.todo-do:

    -*- mode: todo; todo-categories: ("test" "Todo"); -*-
     --- test
     January 25, 2010 19:47 steve: another item
    --- End
     ---------------------------------------------------------------------------
     --- Todo
     January 25, 2010 19:48 steve: todo item
    --- End
     ---------------------------------------------------------------------------

   What matters is that there are at least two Todo categories and
   todo-prefix is not interpretable by diary-lib, e.g. here it is just
   the empty string (the following space is required by Todo mode).

2. emacs -Q
3. M-x todo-show, answer y to apply the local variable list.  A "search
   failed" error occurs because the value of todo-prefix is (still) the
   default "*/*".  So kill the Todo buffer, do M-x customize-variable
   RET todo-prefix, make it match the string in the above ~/.todo-do
   file (the empty string), save for the current session, and call
   todo-show again.  The Todo buffer shows the item in category "test",
   and pressing + or - will show the item in category "Todo". 
4. Save the following as ~/diary:

    #include "~/.todo-do"
    
    Jan 25, 2010 diary item

5. M-: (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
6. M-x calendar, then type `d' on Jan 25 (the actual date is probably
   irrelevant).
=> Now todo-show only displays one category (whichever was current
before doing the step 6), the other category is invisible.

The patch below fixes this bug.

In GNU Emacs 23.1.91.2 (i686-pc-linux-gnu, GTK+ Version 2.18.1)
 of 2010-01-25 on escher
Windowing system distributor `The X.Org Foundation', version 11.0.10605000
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_US.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t


2010-01-25  Stephen Berman  <stephen.berman@gmx.net>

	* diary-lib.el (diary-unhide-everything): Widen before removing
        overlays (bug#XXXX). 


*** /tmp/ediff16825Y0s	2010-01-25 22:16:53.000000000 +0100
--- /data/steve/bzr/emacs/quickfixes/lisp/calendar/diary-lib.el	2010-01-25 22:13:51.000000000 +0100
***************
*** 804,810 ****
  (defun diary-unhide-everything ()
    "Show all invisible text in the diary."
    (kill-local-variable 'diary-selective-display)
!   (remove-overlays (point-min) (point-max) 'invisible 'diary)
    (kill-local-variable 'mode-line-format))
  
  (defvar original-date)                  ; bound in diary-list-entries
--- 804,813 ----
  (defun diary-unhide-everything ()
    "Show all invisible text in the diary."
    (kill-local-variable 'diary-selective-display)
!   (save-excursion
!     (save-restriction
!       (widen)
!       (remove-overlays (point-min) (point-max) 'invisible 'diary)))
    (kill-local-variable 'mode-line-format))
  
  (defvar original-date)                  ; bound in diary-list-entries







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

* bug#5477: 23.1.91; diary-unhide-everything sometimes doesn't
  2010-01-25 21:38 bug#5477: 23.1.91; diary-unhide-everything sometimes doesn't Stephen Berman
@ 2010-01-26 20:21 ` Glenn Morris
  2010-01-26 21:05   ` Stephen Berman
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2010-01-26 20:21 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 5477

Stephen Berman wrote:

>   (defun diary-unhide-everything ()
>     "Show all invisible text in the diary."
>     (kill-local-variable 'diary-selective-display)
> !   (save-excursion
> !     (save-restriction
> !       (widen)
> !       (remove-overlays (point-min) (point-max) 'invisible 'diary)))
>     (kill-local-variable 'mode-line-format))

This seems fine. Is your save-excursion really necessary?






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

* bug#5477: 23.1.91; diary-unhide-everything sometimes doesn't
  2010-01-26 20:21 ` Glenn Morris
@ 2010-01-26 21:05   ` Stephen Berman
  2010-01-26 21:14     ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Berman @ 2010-01-26 21:05 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 5477

On Tue, 26 Jan 2010 15:21:32 -0500 Glenn Morris <rgm@gnu.org> wrote:

> Stephen Berman wrote:
>
>>   (defun diary-unhide-everything ()
>>     "Show all invisible text in the diary."
>>     (kill-local-variable 'diary-selective-display)
>> !   (save-excursion
>> !     (save-restriction
>> !       (widen)
>> !       (remove-overlays (point-min) (point-max) 'invisible 'diary)))
>>     (kill-local-variable 'mode-line-format))
>
> This seems fine. Is your save-excursion really necessary?

No, it's superfluous, sorry.  That nesting is so common, I didn't stop
to think.  Thanks for the heads up.

Steve Berman

*** /tmp/ediff3766uVW	2010-01-26 21:56:24.000000000 +0100
--- /home/steve/bzr/emacs/quickfixes/lisp/calendar/diary-lib.el	2010-01-26 21:55:19.000000000 +0100
***************
*** 804,810 ****
  (defun diary-unhide-everything ()
    "Show all invisible text in the diary."
    (kill-local-variable 'diary-selective-display)
!   (remove-overlays (point-min) (point-max) 'invisible 'diary)
    (kill-local-variable 'mode-line-format))
  
  (defvar original-date)                  ; bound in diary-list-entries
--- 804,812 ----
  (defun diary-unhide-everything ()
    "Show all invisible text in the diary."
    (kill-local-variable 'diary-selective-display)
!   (save-restriction
!     (widen)
!     (remove-overlays (point-min) (point-max) 'invisible 'diary))
    (kill-local-variable 'mode-line-format))
  
  (defvar original-date)                  ; bound in diary-list-entries






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

* bug#5477: 23.1.91; diary-unhide-everything sometimes doesn't
  2010-01-26 21:05   ` Stephen Berman
@ 2010-01-26 21:14     ` Glenn Morris
  0 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2010-01-26 21:14 UTC (permalink / raw)
  To: 5477-done


Thanks, I will install this later.

I'm closing this now to test some debbugs changes I have made.






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

end of thread, other threads:[~2010-01-26 21:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-25 21:38 bug#5477: 23.1.91; diary-unhide-everything sometimes doesn't Stephen Berman
2010-01-26 20:21 ` Glenn Morris
2010-01-26 21:05   ` Stephen Berman
2010-01-26 21:14     ` Glenn Morris

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