Gnus development mailing list
 help / color / mirror / Atom feed
* Evaluate local variables in buffer
@ 1997-08-18  5:49 Matt Simmons
  1997-08-18 21:43 ` Colin Rafferty
  1997-08-20 18:25 ` Mark Eichin
  0 siblings, 2 replies; 5+ messages in thread
From: Matt Simmons @ 1997-08-18  5:49 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1150 bytes --]

I wrote a perl script that turns rdist output into a format suitable
for emacs outline-mode.  However, to kick XEmacs into outline-mode, I
had to add Local Variables stuff to the end of the output.  Much to my 
surprise, Gnus didn't eval the local variables stuff by default, so I
set about making it do so.

I had to make a modification to hack-one-local-variable in
prim/files.el, since the default hack-one-local-variable is coded to
expect a buffer associated with a file.  This is obviously not the
case with *Article*, so I added an if to check for buffers without
files.

I also had to add hack-local-variables to
gnus-article-display-hook. My question is this: Does GNU Emacs use a
different function for local variables evaluation?  If so, could
something like gnus-article-eval-local-variables be created that would 
call the appropriate function?  I would write it myself, but I'm out
of easy range of Emacs sources for the next week or so.

Thanks

Matt

-- 
The difference between a bug and  |  
a feature is documentation.       |  Matt Simmons
           -- Ben Duncan          |  simmonmt@acm.org
              bend@ali.intop.net  |


[-- Attachment #2: files.diff --]
[-- Type: application/octet-stream, Size: 1051 bytes --]

*** /p/local/xemacs-20.2/lib/xemacs-20.2/lisp/prim/files.el	Wed Apr 23 23:00:09 1997
--- files.el	Mon Aug 18 00:47:31 1997
***************
*** 1550,1557 ****
  			       (beginning-of-line)
  			       (set-window-start (selected-window) (point)))
  			     (setq enable-local-eval
! 				   (y-or-n-p (format "Process `eval' or hook local variables in file %s? "
! 						     (file-name-nondirectory buffer-file-name))))))))
  	     (if (eq var 'eval)
  		 (save-excursion (eval val))
  	       (make-local-variable var)
--- 1550,1560 ----
  			       (beginning-of-line)
  			       (set-window-start (selected-window) (point)))
  			     (setq enable-local-eval
! 				   (if buffer-file-name
! 				       (y-or-n-p (format "Process `eval' or hook local variables in file %s? "
! 							 (file-name-nondirectory buffer-file-name)))
! 				     (y-or-n-p (format "Process `eval' or hook local variables in buffer %s? "
! 						       (buffer-name)))))))))
  	     (if (eq var 'eval)
  		 (save-excursion (eval val))
  	       (make-local-variable var)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Evaluate local variables in buffer
  1997-08-18  5:49 Evaluate local variables in buffer Matt Simmons
@ 1997-08-18 21:43 ` Colin Rafferty
  1997-08-20  6:25   ` Matt Simmons
  1997-08-20 18:25 ` Mark Eichin
  1 sibling, 1 reply; 5+ messages in thread
From: Colin Rafferty @ 1997-08-18 21:43 UTC (permalink / raw)


Matt Simmons writes:

> I wrote a perl script that turns rdist output into a format suitable
> for emacs outline-mode.  However, to kick XEmacs into outline-mode, I
> had to add Local Variables stuff to the end of the output.  Much to my 
> surprise, Gnus didn't eval the local variables stuff by default, so I
> set about making it do so.

I really don't think that you want to have GNUS eval the local variables
of your email.  That would basically put your emacs at the mercy of
whomever sends you mail.  It would also generally be wrong.

Kind of like the Word Macro "feature".

-- 
;; Local Variables:
;; enable-local-eval:t
;; eval:(message "See what I mean?")
;; End:


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Evaluate local variables in buffer
  1997-08-18 21:43 ` Colin Rafferty
@ 1997-08-20  6:25   ` Matt Simmons
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Simmons @ 1997-08-20  6:25 UTC (permalink / raw)
  Cc: GNUS Mailing List

Colin Rafferty <craffert@ml.com> writes:
> Matt Simmons writes:
> > I wrote a perl script that turns rdist output into a format suitable
> > for emacs outline-mode.  However, to kick XEmacs into outline-mode, I
> > had to add Local Variables stuff to the end of the output.  Much to my 
> > surprise, Gnus didn't eval the local variables stuff by default, so I
> > set about making it do so.
> I really don't think that you want to have GNUS eval the local variables
> of your email.  That would basically put your emacs at the mercy of
> whomever sends you mail.  It would also generally be wrong.
> Kind of like the Word Macro "feature".
Actually, I really do.  However, unlike Word, I'd like it disabled by
default.  That way people who wanted to use it could set
enable-local-[variables|eval] to query, and users who didn't need it
and who didn't know about it wouldn't have to have anything to be
afraid of.

-- 
The difference between a bug and  |  
a feature is documentation.       |  Matt Simmons
           -- Ben Duncan          |  simmonmt@acm.org
              bend@ali.intop.net  |


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Evaluate local variables in buffer
  1997-08-18  5:49 Evaluate local variables in buffer Matt Simmons
  1997-08-18 21:43 ` Colin Rafferty
@ 1997-08-20 18:25 ` Mark Eichin
  1997-08-21  7:13   ` Matt Simmons
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Eichin @ 1997-08-20 18:25 UTC (permalink / raw)
  Cc: ding

it makes more sense to have some hook recognize the type of message
(by folder, by header field, whatever) and wash it appropriately.
Permitting local-variables in email are *dangerous*. 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Evaluate local variables in buffer
  1997-08-20 18:25 ` Mark Eichin
@ 1997-08-21  7:13   ` Matt Simmons
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Simmons @ 1997-08-21  7:13 UTC (permalink / raw)
  Cc: ding

Mark Eichin <eichin@cygnus.com> writes:
> it makes more sense to have some hook recognize the type of message
> (by folder, by header field, whatever) and wash it appropriately.
> Permitting local-variables in email are *dangerous*. 
That's fine too.  I'm mainly looking for a Gnus wrapper that knows
internally which function it should call based on the Emacs flavor so
I don't have to add yet another

(if xemacs (...) (...))

to my .emacs file.

Matt

-- 
The difference between a bug and  |  
a feature is documentation.       |  Matt Simmons
           -- Ben Duncan          |  simmonmt@acm.org
              bend@ali.intop.net  |


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-08-21  7:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-18  5:49 Evaluate local variables in buffer Matt Simmons
1997-08-18 21:43 ` Colin Rafferty
1997-08-20  6:25   ` Matt Simmons
1997-08-20 18:25 ` Mark Eichin
1997-08-21  7:13   ` Matt Simmons

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 NNTP newsgroup(s).