all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: miles@gnu.org, teirllm@dms.auburn.edu,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	rms@gnu.org, emacs-devel@gnu.org
Subject: Re: file-name-shadow-mode
Date: Mon, 21 Mar 2005 16:47:17 +0100	[thread overview]
Message-ID: <x5eke9f1bu.fsf@lola.goethe.zz> (raw)
In-Reply-To: <x5sm2pf2tq.fsf@lola.goethe.zz> (David Kastrup's message of "Mon, 21 Mar 2005 16:14:57 +0100")

David Kastrup <dak@gnu.org> writes:

> Miles Bader <snogglethorpe@gmail.com> writes:
>
>> On Mon, 21 Mar 2005 08:24:38 -0500, Stefan Monnier
>> <monnier@iro.umontreal.ca> wrote:
>>> How 'bout the patch below which makes no assumption (that I know of) about
>>> substitute-in-file-name, and will thus correctly even with weird
>>> magic file name handlers.
>>
>> Um, I should note that the original code was designed to be fast and
>> not cons unnecessarily, because it runs on every keystroke -- that's
>> the reason it uses just a regexp match and a move-overlay.  Your
>> suggested replacement looks ... less careful.
>
> substitute-in-file-name is a built-in function in `C source code'.
> (substitute-in-file-name FILENAME &optional PARSEINFO)
>
> Substitute environment variables referred to in FILENAME.
> `$FOO' where FOO is an environment variable name means to substitute
> the value of that variable.  The variable name should be terminated
> with a character not a letter, digit or underscore; otherwise, enclose
> the entire variable name in braces.
> If `/~' appears, all of FILENAME through that `/' is discarded.
>
> On VMS, `$' substitution is not done; this function does little and only
> duplicates what `expand-file-name' does.
>
> If PARSEINFO is not NIL, it is a list used or reused for storing
> parsing information (it is extended as necessary).
>
> Elements 2N point to positions in the original string, Elements 2N+1
> to corresponding positions in the substituted string.

Add to that: if the source element does not have a corresponding
position in the output (i.e., because a later element reintroduces an
absolute path element), the corresponding element 2N+1 is nil.

> [...]

Now we can just do

(let ((shadowlist (list nil)) p shadowpos)

   [start some input loop, inside have:]

   (substitute-in-filename filename shadowlist)
   (setq p shadowlist shadowpos 0)
   (while (setq p (memq nil p))
     (setq shadowpos (car (setq p (cdr p)))))

> No consing done except when the syntax changes on entry.

This holds the same.  Is the proposed data structure unnecessary
complicated (as in "nobody will ever need that") or too simple (as in
"it requires extra work to check that a given source piece is verbatim
in the output)?

Should there be a possibility to actually reuse already scanned
strings in case that only stuff gets appended at the end?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  reply	other threads:[~2005-03-21 15:47 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-17  9:16 file-name-shadow-mode David Kastrup
2005-03-17 12:16 ` file-name-shadow-mode Matt Hodges
2005-03-18  1:56   ` file-name-shadow-mode Miles Bader
2005-03-18  1:59 ` file-name-shadow-mode Miles Bader
2005-03-18  2:17   ` file-name-shadow-mode Nick Roberts
2005-03-18  4:35   ` file-name-shadow-mode Luc Teirlinck
2005-03-18  4:47     ` file-name-shadow-mode Stefan Monnier
2005-03-18  4:55       ` file-name-shadow-mode Luc Teirlinck
2005-03-18  5:18       ` file-name-shadow-mode Luc Teirlinck
2005-03-18  5:37       ` file-name-shadow-mode Luc Teirlinck
2005-03-18 18:20       ` file-name-shadow-mode Richard Stallman
2005-03-19 15:21         ` file-name-shadow-mode Luc Teirlinck
2005-03-19 15:45           ` file-name-shadow-mode David Kastrup
2005-03-19 16:45           ` file-name-shadow-mode Stefan Monnier
2005-03-20  2:14             ` file-name-shadow-mode Luc Teirlinck
2005-03-20 14:13               ` file-name-shadow-mode Stefan Monnier
2005-03-20 16:02                 ` file-name-shadow-mode Luc Teirlinck
2005-03-20 16:18                 ` file-name-shadow-mode Luc Teirlinck
2005-03-20  2:30             ` file-name-shadow-mode Luc Teirlinck
2005-03-20  3:33               ` file-name-shadow-mode Miles Bader
2005-03-20  4:28                 ` file-name-shadow-mode David Kastrup
2005-03-20 17:30                 ` file-name-shadow-mode Luc Teirlinck
2005-03-20 18:10                   ` file-name-shadow-mode David Kastrup
2005-03-21  1:19                   ` file-name-shadow-mode Richard Stallman
2005-03-20 18:01                 ` file-name-shadow-mode Richard Stallman
2005-03-20 18:24                   ` file-name-shadow-mode Luc Teirlinck
2005-03-20 18:47                     ` file-name-shadow-mode David Kastrup
2005-03-20 21:11                   ` file-name-shadow-mode Luc Teirlinck
2005-03-20 21:25                     ` file-name-shadow-mode Luc Teirlinck
2005-03-21 13:44                       ` file-name-shadow-mode Stefan Monnier
2005-03-21 22:24                         ` file-name-shadow-mode Luc Teirlinck
2005-03-21 23:00                           ` file-name-shadow-mode Stefan Monnier
2005-03-22 20:44                             ` file-name-shadow-mode Richard Stallman
2005-03-28 21:32                               ` file-name-shadow-mode Stefan Monnier
2005-03-21 13:24                   ` file-name-shadow-mode Stefan Monnier
2005-03-21 14:05                     ` file-name-shadow-mode David Kastrup
2005-03-21 16:48                       ` file-name-shadow-mode Stefan Monnier
2005-03-22  3:34                       ` file-name-shadow-mode Richard Stallman
2005-03-21 14:26                     ` file-name-shadow-mode Miles Bader
2005-03-21 15:14                       ` file-name-shadow-mode David Kastrup
2005-03-21 15:47                         ` David Kastrup [this message]
2005-03-21 16:58                       ` file-name-shadow-mode Stefan Monnier
2005-03-21 23:57                     ` file-name-shadow-mode Luc Teirlinck
2005-03-23 22:55                     ` file-name-shadow-mode Stefan Monnier
2005-03-24  0:04                       ` file-name-shadow-mode David Kastrup
2005-03-25  6:42                         ` file-name-shadow-mode Richard Stallman
2005-03-25  8:45                           ` file-name-shadow-mode David Kastrup
2005-03-18  5:23 ` file-name-shadow-mode Richard Stallman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x5eke9f1bu.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@gnu.org \
    --cc=teirllm@dms.auburn.edu \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.