unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8802: cperl-write-tags function in cperl-mode.el hard coded tags-file-name
@ 2011-06-05  3:36 Dove Young
  2011-07-06 17:14 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Dove Young @ 2011-06-05  3:36 UTC (permalink / raw)
  To: 8802

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

The original code reads like this


(defun cperl-write-tags (&optional file erase recurse dir inbuffer noxs
topdir)
  ;; If INBUFFER, do not select buffer, and do not save
  ;; If ERASE is `ignore', do not erase, and do not try to delete old info.
  (require 'etags)
  (if file nil
    (setq file (if dir default-directory (buffer-file-name)))
    (if (and (not dir) (buffer-modified-p)) (error "Save buffer first!")))
  (or topdir
      (setq topdir default-directory))
  (let ((tags-file-name "TAGS")
    (case-fold-search (eq system-type 'emx))
    xs rel tm)
... ... ... ...

This line (let ((tags-file-name "TAGS") hard coded the tags-file-name to
"TAGS".  This way is very bad. It prevents any users to customise their own
tags files. For example in my environment I have to customise tags file
names.

I use pde-mode (Perl Development Environment) in my daily work. it leverage
cperl-mode but would generate tags files base on Perl syntax. It is quite
different than what etags would do. This kind of tags file cannot be used in
any other features, such as speedbar, etc. So the reasonable way is to store
this kind of tags into separate files. But it cannot because of the hard
code in cperl-mode.el .


So would I suggest to re-factory cperl-mode.el and change "TAGS" to a
variable? Like following:

(defvar cperl-tags-file-name "TAGS" "TAGS file name"

(defun cperl-write-tags (&optional file erase recurse dir inbuffer noxs
topdir)
  ;; If INBUFFER, do not select buffer, and do not save
  ;; If ERASE is `ignore', do not erase, and do not try to delete old info.
  (require 'etags)
  (if file nil
    (setq file (if dir default-directory (buffer-file-name)))
    (if (and (not dir) (buffer-modified-p)) (error "Save buffer first!")))
  (or topdir
      (setq topdir default-directory))
  (let ((tags-file-name cperl-tags-file-name)
    (case-fold-search (eq system-type 'emx))
    xs rel tm)
... ... ... ...

In this way, I can customise it by set cperl-tags-file-name in other value
to avoid to break any other features:

(setq cperl-tags-file-name "PDE-TAGS")

-- 
M-x Thinks

[-- Attachment #2: Type: text/html, Size: 2402 bytes --]

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

end of thread, other threads:[~2020-11-19  5:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-05  3:36 bug#8802: cperl-write-tags function in cperl-mode.el hard coded tags-file-name Dove Young
2011-07-06 17:14 ` Lars Magne Ingebrigtsen
2011-07-06 18:15   ` Stefan Monnier
2011-07-06 18:21     ` Lars Magne Ingebrigtsen
2011-07-06 19:35       ` Glenn Morris
2011-07-06 19:51         ` Stefan Monnier
2011-07-06 19:54           ` Lars Magne Ingebrigtsen
2020-11-19  5:19     ` Stefan Kangas

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