unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bob Rogers <rogers-emacs@rgrjr.dyndns.org>
To: Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>,
	martin rudalics <rudalics@gmx.at>
Cc: emacs-devel@gnu.org
Subject: change-log-goto-source: recognising . within tag names
Date: Sat, 21 Mar 2009 22:49:41 -0400	[thread overview]
Message-ID: <18885.42821.907043.840826@rgr.rgrjr.com> (raw)
In-Reply-To: <20806.1237544562@maps>

   From: martin rudalics <rudalics@gmx.at>
   Date: Fri, 20 Mar 2009 20:48:47 +0100

   . . .

   I'm afraid `change-log-search-tag-name' is too clever when trying to
   find a suitable tag.  Usually, it seems sufficient to search for the
   previous and next property change of the `change-log-list' text property
   near `point' and return the corresponding string.  Maybe we should
   provide a `change-log-search-tag-name-function' people could set to do
   the job.  Or, simply set the `syntax-table' text property to `symbol'
   for periods preceded _and_ followed by word/symbol characters.

   martin

A simple fix would be to find the file name first, read it into a buffer
(since we'll need it anyway), and then use its syntax table to parse the
tag name.  The code below is a start at this; it seems to work.  But it
would have to be integrated with the change-log-goto-source logic that
finds both the file at point and the file near the tag and then picks
the best one.  The logic seems rather obscure; I suspect I would break
it if I tried to change it.  ;-}

   ================
   From: Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk>
   Date: Fri, 20 Mar 2009 10:22:42 +0000

   . . .

   This is also a problem in lisp, as it seems . can be used within lisp
   defuns (but not used in practice I think) . . .

As a matter of fact, lisp/ChangeLog.12 (and probably others) contain
elisp names with dots such as newsticker--parse-rss-1.0, which is why I
used this particular change log for testing.

   For Lisp in particular, the problem is actually fairly broad, as
people often use "+", "*", "$", "%", etc., to distinguish certain
definition names.  A better solution might be to ask the language mode
itself to do the name parsing, in order to handle such things as name
quoting conventions.  But, of course, that's a much bigger job.

					-- Bob Rogers
					   http://www.rgrjr.com/

------------------------------------------------------------------------
(defun change-log-file-and-tag ()
  ;; Find the nearest file first, then use that file's syntax table to
  ;; find the tag.
  (interactive)
  (let ((file (change-log-search-file-name (point))))
    (if file
	(let* ((buffer (find-file-noselect file))
	       (tag (with-syntax-table (with-current-buffer buffer
					 (syntax-table))
		      (change-log-search-tag-name))))
	  (message "file %S tag %S" file tag)
	  (list file tag)))))




  reply	other threads:[~2009-03-22  2:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-20 10:22 change-log-goto-source: recognising . within tag names Stephen Eglen
2009-03-20 19:48 ` martin rudalics
2009-03-22  2:49   ` Bob Rogers [this message]
2009-03-22  9:10     ` martin rudalics

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=18885.42821.907043.840826@rgr.rgrjr.com \
    --to=rogers-emacs@rgrjr.dyndns.org \
    --cc=S.J.Eglen@damtp.cam.ac.uk \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /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).