Richard Stallman <[EMAIL PROTECTED]> writes:

>     Is there a way to tell whether a function was called via process filter?
>
> Not currently.

Doesn't the following work?

(defvar in-my-filter-p nil)

(defun my-filter (proc text)
  (let ((in-my-filter-p t))
    ...))

(defun my-after-change-function ()
  (if in-my-filter-p
    ...


>
> We could envision making the code that calls process filters
> bind this-command to the process that sent the output.
> That is an incompatible change, but your arguments show
> that probably the code that runs in filters would not want
> to test this-command, so it probably won't break anything.

Binding a non-command object (a process) to this-command looks quite
obscure and unclean to me.

Lots of commands look at this-command (and internally we copy it to
last-command etc).  I could envision this change breaking code in
mysterious ways.


If really needed, the filter can do it

(defun my-filter (proc text)
  (let ((this-command proc))
    ...))


>
> We could also create a new variable, perhaps this-process,
> and bind that instead.  I think the former is more elegant.

Again, the filter can do that itself if needed:

(defun my-filter (proc text)
  (let ((this-process proc))
    ...))


I don't think we need to provide a more general approach, at least not
before the release.


-- 
Kim F. Storm <[EMAIL PROTECTED]> http://www.cua.dk



_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to