From: Dove Young <dove.young@gmail.com>
To: 8802@debbugs.gnu.org
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 [thread overview]
Message-ID: <BANLkTinpuToorjX_OLbEBBTfa=gzk32sVA@mail.gmail.com> (raw)
[-- 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 --]
next reply other threads:[~2011-06-05 3:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-05 3:36 Dove Young [this message]
2011-07-06 17:14 ` bug#8802: cperl-write-tags function in cperl-mode.el hard coded tags-file-name 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTinpuToorjX_OLbEBBTfa=gzk32sVA@mail.gmail.com' \
--to=dove.young@gmail.com \
--cc=8802@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).