From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: drkm Newsgroups: gmane.emacs.help Subject: Re: hide local variables in enriched mode Date: Wed, 12 Jan 2005 04:18:29 +0100 Organization: None Message-ID: References: <876523gb4p.fsf@thalassa.informatimago.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1105500208 30287 80.91.229.6 (12 Jan 2005 03:23:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Jan 2005 03:23:28 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 12 04:23:22 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CoZ6Q-00005U-00 for ; Wed, 12 Jan 2005 04:23:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CoZI0-00069D-Ar for geh-help-gnu-emacs@m.gmane.org; Tue, 11 Jan 2005 22:35:20 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!feed.news.tiscali.de!newsfeed01.sul.t-online.de!t-online.de!gatel-ffm!gatel-ffm!213.73.255.4.MISMATCH!newsfeed.multikabel.nl!skynet.be!newspost001!tjb!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:JMS+GVvxkpbhJ8SWUTeDcEotyiE= Original-Lines: 92 Original-NNTP-Posting-Host: ad499389.news.skynet.be Original-X-Trace: 1105499914 news.skynet.be 323 81.242.252.6:1724 Original-X-Complaints-To: usenet-abuse@skynet.be Original-Xref: shelby.stanford.edu gnu.emacs.help:127813 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:23291 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:23291 Pascal Bourguignon writes: > I'd try to narrow the region before ps-printing. Yes. > This could be done automatically with something like: > -*- mode: fileadapt -*- > blah blah blah > Local Variables: > eval: (let ((start (progn (beginning-of-buffer) (forward-line 2) (point))) (end ((end-of-buffer) (re-search-backward "Local Variables") (forward-line -1) (point)))) (narrow-to-region start end)) > End: You forgot a "progn" before "end-of-buffer", I guess. > (Of course, you could define a function in ~/.emacs and use it in > eval: in place of this complex expression.) I think the "eval" pseudo-local variable is annoying. Because Emacs ask you every time you open the file. What do you think about something like this: (defun sk:hide-local-variables () (narrow-to-region (point-min) (progn (end-of-buffer) ;; TODO: Set the BOUND arg. (re-search-backward "Local Variables" nil t) (forward-line -1) (point)))) (defadvice ps-print-buffer (around sk:ps-print-buffer activate) "FIXME:..." (save-excursion (save-restriction (sk:hide-local-variables) ad-do-it))) (defadvice ps-print-buffer-with-faces (around sk:ps-print-buffer-with-faces activate) "FIXME:..." (save-excursion (save-restriction (sk:hide-local-variables) ad-do-it))) (defadvice ps-spool-buffer (around sk:ps-spool-buffer activate) "FIXME:..." (save-excursion (save-restriction (sk:hide-local-variables) ad-do-it))) (defadvice ps-spool-buffer-with-faces (around sk:ps-spool-buffer-with-faces activate) "FIXME:..." (save-excursion (save-restriction (sk:hide-local-variables) ad-do-it))) If you want to say with a local variables to narrow or not, you can change the advices like this: (defvar sk:ps-hide-local-variables nil "FIXME:...") (defadvice ps-print-buffer (around sk:ps-print-buffer activate) "FIXME:..." (save-excursion (save-restriction (when sk:ps-hide-local-variables (sk:hide-local-variables)) ad-do-it))) ;; and the like ... and put this in your file: ;; Local Variables ;; sk:ps-hide-local-variables: t ;; End What do you think about this? --drkm, que, finalement, fcae est chouette, aussi ;-)