--- Begin Message ---
Subject: |
Re: tiny inefficieny in `beginning-of-defun-raw', lisp.el |
Date: |
Fri, 09 Oct 2009 12:05:36 +0900 |
David Kastrup writes:
> prv-xemacs.el:
>
> ;;; [Courtesy Stephen J. Turnbull, with some modifications
> ;;; Message-ID: <address@hidden>
> ;;; I could not have figured this out for the world]
> ;;; Hm, there really ought to be a way to get the spec that would be
> ;;; instantiated in a given domain
> (when preview-tb-icon
> (let ((tb (cdadar (or (specifier-spec-list default-toolbar
> (current-buffer))
> (specifier-spec-list default-toolbar 'global)))))
> (unless (member preview-tb-icon tb)
> (set-specifier default-toolbar
> (append tb (list preview-tb-icon))
> (current-buffer)))))
David, when you later showed me the actual code, I realized that you
didn't need that, and I told you that `specifier-instance' was
sufficient. I guess that
(when preview-tb-icon
(set-specifier default-toolbar
(append (remove preview-tb-icon
(specifier-instance default-toolbar))
(list preview-tb-icon))
(current-buffer)
nil
'remove-locale))
which is much more intelligible, would DTRT. It's probably possible
to simplify it even further, to
(when preview-tb-icon
(set-specifier default-toolbar
(cons preview-tb-icon (specifier-instance default-toolbar))
(current-buffer))
which is suddenly looking almost civilized.
You should also consider that it's not surprising that the original
version was clumsy. I went from knowing nothing about specifiers *or*
toolbars to knowing almost as much as I do now in the space of two or
three days, including rewriting the whole Info node on specifiers.[1]
As far as I know, you still have never read the improved version. :-(
> > > I think it is still impossible to use a :file specification for
> > > image specifiers of binary formats (jpg, png and binary pnm
> > > formats) in XEmacs once you have loaded dired.el.
> >
> > Could be. I don't recall it specifically, but dired does install a
> > bunch of handlers so it sounds plausible. If you recall about when
> > and where you previously reported it that would help.
>
> Basically about 2005 or so.
>
> The original reports on xemacs-beta seem to be under the subject "Coding
> bug in insert-file-contents-internal".
IIRC some bug was identified and fixed as a result of that thread.
But I think the relevant API is `insert-file-contents-literally', not
`insert-file-contents-internal', so it's quite possible a bug
involving use of the wrong API was involved too. Ie, the original
problem was not solved by the bugfix applied. Anyway, thank you for
the reference!
Footnotes:
[1] And in case you're tempted to take that as a putdown, don't. I
just happened to have time and interest to do the work then.
--- End Message ---