[Top][All Lists]

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

Re: [AUCTeX-devel] reftex patch to support resolved labels

From: Tim Toolan
Subject: Re: [AUCTeX-devel] reftex patch to support resolved labels
Date: Mon, 27 Oct 2008 07:22:43 -0400
User-agent: Internet Messaging Program (IMP) H3 (4.2)

Quoting "Ralf Angeli" <address@hidden>:

* Tim Toolan (2008-10-21) writes:

Attached is a patch which adds support for resolved labels as they
appear the typeset document to the reftex-reference command.  It
places them where the counter used to be, and enables interactive
filtering based on these resolved labels.  It makes selecting labels
significantly more efficient when looking at typeset document.

I finally had some time to look into your patch.

This looks like an interesting feature.  Something like that might also
be useful when displaying labels in the table of contents (`C-c =').

It could be useful there, but one thing to consider is that labels are not "required" for anything, and the only things that can be resolved are things that have a label. For instance, if there is a section 3, but it is not referenced in the document, and the writer decided not to label it, there will be no resolved label for it.

To reference a label, run reftex-reference "C-c )", then enter the
number as it appears in the typeset document (ie. "1.2", "IV", "123").  If
there is more than one exact match, such as section 3, equation 3, and
figure 3, press tab to cycle between these choices.

While the display of typeset label numbers might be a good hint when
trying to identify the right label, I think the primary way to select
them should still be based on labels as they are written in the LaTeX
sources.  First, a user should not be required to run LaTeX or look at
the typeset document to identify a label,

True. Maybe when the .aux files are not present, instead of presenting question marks for all labels, it should not display anything at all.

second, the label name in the
sources often carries more information than the typeset one and

That is true, but I am thinking of how I write, and when I reference an equation, I am almost always looking at in the typeset document, and my mind says something like
  "combining (17) and (18), we get"
instead of
  "combining (\ref{eq:blah1}) and (\ref{eq:blah2}), we get".

the selection from a list (<n>, <p>, <RET> or point and click) is mostly
more convenient than having to type a string with completion.  (The
latter argument is obviously subjective and represents my personal
preference.)  In the label selection process at it is now one can
activate a prompt for typing a label name with completion by pressing
<TAB>.  One could either allow completion on typeset labels here as well
or provide a key to activate a dedicated prompt for asking for the
typeset label name.

That is actually exactly how the patch behaves if `reftex-ref-start-in-filter-mode' is set to nil.

When in this filtering mode, any special commands that are printable
characters (like "f" to toggle follow mode) must be preceded by a
"C-c" prefix.  At any time, press the delete key to toggle between
filter mode and the previous behavior for reftex-reference.

As hinted at above, such a change of behavior might be too drastic.  A
lot of people already have the selection process in their muscle memory.

This is true.

It is currently setup to disable prompting for reference macro type
and label type by default, and going directly to the filter selection
process.  To revert to the old behavior, set the variables:
   (setq reftex-ref-type-prompt t)
   (setq reftex-ref-start-in-filter-mode nil)
   (setq reftex-ref-macro-prompt t)

Why would you want to change these defaults?

The main reason I changed them was to illustrate the changes introduced by this patch. As you said, changing a mature user interface is not a great idea because people do have emacs muscle memory, so they should probably be left alone.

The patch also contained some changes where I am not sure if they are
necessary or good, like commented `message' calls or `defvar' statements
to silence the byte compiler.  But before talking about those (and me
looking deeper into the code) we should agree on the user interface.

I agree about the defvar statements. I saw in reftex-sel.el that the same thing was done for the same reason, so I duplicated it, but it was probably a bad idea. The reason for the commented message calls could be discussed later as you say, after a revised version of the patch is worked out.

One additional thing that must be addressed before this patch can be applied is the compatibility with preview-latex. The reason for this is that I made the assumption that the .aux files will be consistent with the output that the user is looking at. Normally, it is very unusual that the .aux files will not be consistent, but in the case of preview-latex they will never be consistent because preview-latex doesn't seem to create .aux files. The .aux file information must be available in some way for this to work with it.


reply via email to

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