all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Desktop saves TAGS-LISP
@ 2005-10-17  8:05 Juri Linkov
  2005-10-17 21:57 ` Richard M. Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2005-10-17  8:05 UTC (permalink / raw)


desktop.el doesn't save TAGS files (skipped according to the current
default value of the option `desktop-buffers-not-to-save'), but saves
information about TAGS-LISP.  This causes `find-tag' (M-.) to fail after
restoring the desktop due to the attempt to call nil function:

Debugger entered--Lisp error: (void-function nil)
  nil()
  tags-included-tables()
  tags-table-extend-computed-list()
  ...

That's because when desktop.el restores TAGS-LISP, it doesn't
initialize its local variables by the function `initialize-new-tags-table',
so `tags-included-tables-function' has the value nil, and
`tags-included-tables' fails when it tries to call it.

I think desktop.el should not save TAGS-LISP and other similar files too:

Index: lisp/desktop.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/desktop.el,v
retrieving revision 1.94
diff -c -r1.94 desktop.el
*** lisp/desktop.el	12 Oct 2005 09:16:35 -0000	1.94
--- lisp/desktop.el	17 Oct 2005 08:04:59 -0000
***************
*** 295,301 ****
  ;;         (ftp) files because they require passwords and whatnot.
  ;;         TAGS files to save time (tags-file-name is saved instead).
  (defcustom desktop-buffers-not-to-save
!   "\\(^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS\\)$"
    "Regexp identifying buffers that are to be excluded from saving."
    :type 'regexp
    :group 'desktop)
--- 295,301 ----
  ;;         (ftp) files because they require passwords and whatnot.
  ;;         TAGS files to save time (tags-file-name is saved instead).
  (defcustom desktop-buffers-not-to-save
!   "\\(^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS.*\\)$"
    "Regexp identifying buffers that are to be excluded from saving."
    :type 'regexp
    :group 'desktop)

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

* Re: Desktop saves TAGS-LISP
  2005-10-17  8:05 Desktop saves TAGS-LISP Juri Linkov
@ 2005-10-17 21:57 ` Richard M. Stallman
  2005-10-19 15:52   ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Richard M. Stallman @ 2005-10-17 21:57 UTC (permalink / raw)
  Cc: emacs-devel

    I think desktop.el should not save TAGS-LISP and other similar files too:

It would be more reliable to identify tags tables through a method
other than their file names.  Could you implement that?

The clean way would be to create a major mode for tags tables,
and make `initialize-new-tags-table' put the buffer in that mode.
Then desktop could check for that mode.

Alternatively it could check for a local binding of `tags-table-files'.

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

* Re: Desktop saves TAGS-LISP
  2005-10-17 21:57 ` Richard M. Stallman
@ 2005-10-19 15:52   ` Juri Linkov
  2005-10-20  4:54     ` Richard M. Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2005-10-19 15:52 UTC (permalink / raw)
  Cc: emacs-devel

> It would be more reliable to identify tags tables through a method
> other than their file names.  Could you implement that?
>
> The clean way would be to create a major mode for tags tables,
> and make `initialize-new-tags-table' put the buffer in that mode.
> Then desktop could check for that mode.
>
> Alternatively it could check for a local binding of `tags-table-files'.

Perhaps in the long run a better way would be to read contents of
TAGS files into a special buffer with a leading space in its name,
thus hiding such buffers from many operations (e.g. from the buffer list).

But this may require considerable modifications in etags.el, so the
simplest fix is below.  The call to `initialize-new-tags-table' is placed
inside `tags-table-mode' for the case when desktop.el still saves TAGS
files in the desktop file (this may happen when .emacs overwrites
the default value of `desktop-modes-not-to-save' by removing
`tags-table-mode' from it).  The desktop file will store the major
mode for TAGS files as `tags-table-mode', so restoring the desktop
file will call `tags-table-mode' on saved TAGS files and thus
eventually will call `initialize-new-tags-table' on them.

The default value of `desktop-modes-not-to-save' is changed to contain
'(tags-table-mode), so normally TAGS files will not be saved in the
desktop file.

Index: lisp/progmodes/etags.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/etags.el,v
retrieving revision 1.190
diff -c -r1.190 etags.el
*** lisp/progmodes/etags.el	16 Oct 2005 09:31:44 -0000	1.190
--- lisp/progmodes/etags.el	19 Oct 2005 15:52:00 -0000
***************
*** 274,279 ****
--- 274,287 ----
    (run-hook-with-args-until-success 'tags-table-format-functions))
  
  ;;;###autoload
+ (defun tags-table-mode ()
+   "Major mode for tags table file buffers."
+   (interactive)
+   (setq major-mode 'tags-table-mode)
+   (setq mode-name "Tags Table")
+   (initialize-new-tags-table))
+ 
+ ;;;###autoload
  (defun visit-tags-table (file &optional local)
    "Tell tags commands to use tags table file FILE.
  FILE should be the name of a file created with the `etags' program.
***************
*** 415,421 ****
        ;; having changed since we last used it.
        (let (win)
  	(set-buffer (get-file-buffer file))
! 	(setq win (or verify-tags-table-function (initialize-new-tags-table)))
  	(if (or (verify-visited-file-modtime (current-buffer))
  		;; Decide whether to revert the file.
  		;; revert-without-query can say to revert
--- 423,429 ----
        ;; having changed since we last used it.
        (let (win)
  	(set-buffer (get-file-buffer file))
! 	(setq win (or verify-tags-table-function (tags-table-mode)))
  	(if (or (verify-visited-file-modtime (current-buffer))
  		;; Decide whether to revert the file.
  		;; revert-without-query can say to revert
***************
*** 434,440 ****
  	    (and verify-tags-table-function
  		 (funcall verify-tags-table-function))
  	  (revert-buffer t t)
! 	  (initialize-new-tags-table)))
      (and (file-exists-p file)
  	 (progn
  	   (set-buffer (find-file-noselect file))
--- 442,448 ----
  	    (and verify-tags-table-function
  		 (funcall verify-tags-table-function))
  	  (revert-buffer t t)
! 	  (tags-table-mode)))
      (and (file-exists-p file)
  	 (progn
  	   (set-buffer (find-file-noselect file))
***************
*** 446,452 ****
  		     (setcar tail buffer-file-name))
  		 (if (eq file tags-file-name)
  		     (setq tags-file-name buffer-file-name))))
! 	   (initialize-new-tags-table)))))
  
  ;; Subroutine of visit-tags-table-buffer.  Search the current tags tables
  ;; for one that has tags for THIS-FILE (or that includes a table that
--- 454,460 ----
  		     (setcar tail buffer-file-name))
  		 (if (eq file tags-file-name)
  		     (setq tags-file-name buffer-file-name))))
! 	   (tags-table-mode)))))
  
  ;; Subroutine of visit-tags-table-buffer.  Search the current tags tables
  ;; for one that has tags for THIS-FILE (or that includes a table that

Index: lisp/desktop.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/desktop.el,v
retrieving revision 1.94
diff -c -r1.94 desktop.el
*** lisp/desktop.el	12 Oct 2005 09:16:35 -0000	1.94
--- lisp/desktop.el	19 Oct 2005 15:51:23 -0000
***************
*** 293,301 ****
  
  ;; We skip .log files because they are normally temporary.
  ;;         (ftp) files because they require passwords and whatnot.
- ;;         TAGS files to save time (tags-file-name is saved instead).
  (defcustom desktop-buffers-not-to-save
!   "\\(^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS\\)$"
    "Regexp identifying buffers that are to be excluded from saving."
    :type 'regexp
    :group 'desktop)
--- 293,300 ----
  
  ;; We skip .log files because they are normally temporary.
  ;;         (ftp) files because they require passwords and whatnot.
  (defcustom desktop-buffers-not-to-save
!   "\\(^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\)$"
    "Regexp identifying buffers that are to be excluded from saving."
    :type 'regexp
    :group 'desktop)
***************
*** 307,313 ****
    :type 'regexp
    :group 'desktop)
  
! (defcustom desktop-modes-not-to-save nil
    "List of major modes whose buffers should not be saved."
    :type '(repeat symbol)
    :group 'desktop)
--- 306,314 ----
    :type 'regexp
    :group 'desktop)
  
! ;; We skip TAGS files to save time (tags-file-name is saved instead).
! (defcustom desktop-modes-not-to-save
!   '(tags-table-mode)
    "List of major modes whose buffers should not be saved."
    :type '(repeat symbol)
    :group 'desktop)

-- 
Juri Linkov
http://www.jurta.org/emacs/

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

* Re: Desktop saves TAGS-LISP
  2005-10-19 15:52   ` Juri Linkov
@ 2005-10-20  4:54     ` Richard M. Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard M. Stallman @ 2005-10-20  4:54 UTC (permalink / raw)
  Cc: emacs-devel

    Perhaps in the long run a better way would be to read contents of
    TAGS files into a special buffer with a leading space in its name,
    thus hiding such buffers from many operations (e.g. from the buffer list).

I don't think these buffers should be hidden.  For one thing, users
want to see them in the buffer list, so as to be able to kill them
easily.

So please install the patch that you sent.  Thanks.

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

end of thread, other threads:[~2005-10-20  4:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-17  8:05 Desktop saves TAGS-LISP Juri Linkov
2005-10-17 21:57 ` Richard M. Stallman
2005-10-19 15:52   ` Juri Linkov
2005-10-20  4:54     ` Richard M. Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.