From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dove Young Newsgroups: gmane.emacs.bugs 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 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cd56a1a45e02404a4eeb1cc X-Trace: dough.gmane.org 1307277091 30583 80.91.229.12 (5 Jun 2011 12:31:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 5 Jun 2011 12:31:31 +0000 (UTC) To: 8802@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 05 14:31:27 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QTCUG-0002Nz-RM for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Jun 2011 14:31:25 +0200 Original-Received: from localhost ([::1]:60927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTCUF-0002AX-Nv for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 Jun 2011 08:31:23 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:43900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTCTy-0002A0-4X for bug-gnu-emacs@gnu.org; Sun, 05 Jun 2011 08:31:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTCTw-0005Fg-0N for bug-gnu-emacs@gnu.org; Sun, 05 Jun 2011 08:31:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTCTv-0005Fa-PC for bug-gnu-emacs@gnu.org; Sun, 05 Jun 2011 08:31:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QTCTu-0004GB-MR; Sun, 05 Jun 2011 08:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dove Young Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Jun 2011 12:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8802 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.130727700816307 (code B ref -1); Sun, 05 Jun 2011 12:31:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Jun 2011 12:30:08 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QTCT1-0004Ex-JZ for submit@debbugs.gnu.org; Sun, 05 Jun 2011 08:30:08 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QT48o-00009D-Db for submit@debbugs.gnu.org; Sat, 04 Jun 2011 23:36:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QT48h-0006xF-JK for submit@debbugs.gnu.org; Sat, 04 Jun 2011 23:36:36 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:60236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QT48h-0006wp-7w for submit@debbugs.gnu.org; Sat, 04 Jun 2011 23:36:35 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QT48f-0001LC-Iy for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2011 23:36:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QT48d-0006t0-OM for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2011 23:36:33 -0400 Original-Received: from mail-gx0-f169.google.com ([209.85.161.169]:40449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QT48d-0006r0-AL for bug-gnu-emacs@gnu.org; Sat, 04 Jun 2011 23:36:31 -0400 Original-Received: by gxk23 with SMTP id 23so1463927gxk.0 for ; Sat, 04 Jun 2011 20:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=KUOVW+Lb9TSgb3SkG1+pJBk2mI1XaB5SWjqDctJFzAw=; b=pVOHW5RJ0ilDGZ/1rv1yr4LcLXN+K/k4GScCDcjGiWOHO+NMklD/rGQqUJ6srTc7Rg 4IqH13ZdZF+KFu1OdnygjczkNyMNR2ztgeawS8C9YIxqq31jPZAyKOUyHXCNklLRsvRq hiOUrhpgec2xkTVCay1OvzxWgdWqGrkoO2o9M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=NB/8OAu7tJy3LNmIWqGQCbcX8QOwdyFL9yHri7JR4zW8rCp4OIa0DV6psMo/+tNQ2M L+6HKn7puHX2fcr7TwyD37iZQqWFudTHlP+tUc1d8CkDbj5g6HaIKMTYWoYwCf5S3Fvq 3NExsrgrioZPaFo7tx0LzhKg/CFlNyRzUE+tA= Original-Received: by 10.150.138.9 with SMTP id l9mr3068715ybd.236.1307244990160; Sat, 04 Jun 2011 20:36:30 -0700 (PDT) Original-Received: by 10.151.156.1 with HTTP; Sat, 4 Jun 2011 20:36:10 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Sun, 05 Jun 2011 08:30:06 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 05 Jun 2011 08:31:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:46973 Archived-At: --000e0cd56a1a45e02404a4eeb1cc Content-Type: text/plain; charset=ISO-8859-1 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 --000e0cd56a1a45e02404a4eeb1cc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The original code reads like this


(defun cperl-write-tags (&= optional file erase recurse dir inbuffer noxs topdir)
=A0 ;; If INBUFFER= , do not select buffer, and do not save
=A0 ;; If ERASE is `ignore',= do not erase, and do not try to delete old info.
=A0 (require 'etags)
=A0 (if file nil
=A0=A0=A0 (setq file (if di= r default-directory (buffer-file-name)))
=A0=A0=A0 (if (and (not dir) (b= uffer-modified-p)) (error "Save buffer first!")))
=A0 (or topd= ir
=A0=A0=A0=A0=A0 (setq topdir default-directory))
=A0 (let ((tags-file-name "TAGS")
=A0=A0=A0 (case-fold-search = (eq system-type 'emx))
=A0=A0=A0 xs rel tm)
... ... ... ...
This line (let ((tags-file-name "TAGS") hard coded the tags-fi= le-name to "TAGS".=A0 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 leve= rage cperl-mode but would generate tags files base on Perl syntax. It is qu= ite different than what etags would do. This kind of tags file cannot be us= ed in any other features, such as speedbar, etc. So the reasonable way is t= o 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 "TAG= S" 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)
=A0 ;; If INBUFFER, do not select buffer, and do not save
=A0 ;; If ERAS= E is `ignore', do not erase, and do not try to delete old info.
=A0 = (require 'etags)
=A0 (if file nil
=A0=A0=A0 (setq file (if dir de= fault-directory (buffer-file-name)))
=A0=A0=A0 (if (and (not dir) (buffer-modified-p)) (error "Save buffer = first!")))
=A0 (or topdir
=A0=A0=A0=A0=A0 (setq topdir default-d= irectory))
=A0 (let ((tags-file-name cperl-tags-file-name)
=A0=A0=A0 = (case-fold-search (eq system-type 'emx))
=A0=A0=A0 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

--000e0cd56a1a45e02404a4eeb1cc--