bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8802: cperl-write-tags function in cperl-mode.el hard coded tags-fil


From: Dove Young
Subject: bug#8802: cperl-write-tags function in cperl-mode.el hard coded tags-file-name
Date: Sun, 5 Jun 2011 11:36:10 +0800

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]