all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* hide local variables in enriched mode
@ 2005-01-11 13:26 Sébastien Kirche
  2005-01-11 16:53 ` Pascal Bourguignon
  0 siblings, 1 reply; 5+ messages in thread
From: Sébastien Kirche @ 2005-01-11 13:26 UTC (permalink / raw)


Hi,  I wonder if/how I could hide  the local variables definitions 
in an enriched text file.   e.g : i have the following  ;;; Local 
Variables: *** ;;; mode: filladapt; *** ;;; End: ***

that i would like to hide for ps-printing it.

I  tried to put  some definitions  at the  beginning of  the file  after the
content-type and text-width settings without success.

Is it possible ?

Thanks for pointers.

Sébastien Kirche

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

* Re: hide local variables in enriched mode
  2005-01-11 13:26 hide local variables in enriched mode Sébastien Kirche
@ 2005-01-11 16:53 ` Pascal Bourguignon
  2005-01-12  3:18   ` drkm
  2005-01-12  9:00   ` Sébastien Kirche
  0 siblings, 2 replies; 5+ messages in thread
From: Pascal Bourguignon @ 2005-01-11 16:53 UTC (permalink / raw)


Sébastien Kirche <sebastien.kirche.no@spam.free.fr.invalid> writes:

> Hi,  I wonder if/how I could hide  the local variables definitions in
> an enriched text file.   e.g : i have the following  ;;; Local
> Variables: *** ;;; mode: filladapt; *** ;;; End: ***
> 
> that i would like to hide for ps-printing it.
> 
> I  tried to put  some definitions  at the  beginning of  the file  after the
> content-type and text-width settings without success.
> 
> Is it possible ?
> 
> Thanks for pointers.
> 
> Sébastien Kirche

I'd try to narrow the region before ps-printing.
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:

(Of course, you could define a function in ~/.emacs and use it in
eval: in place of this complex expression.)

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

This is a signature virus.  Add me to your signature and help me to live

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

* Re: hide local variables in enriched mode
  2005-01-11 16:53 ` Pascal Bourguignon
@ 2005-01-12  3:18   ` drkm
  2005-01-12  9:02     ` Sébastien Kirche
  2005-01-12  9:00   ` Sébastien Kirche
  1 sibling, 1 reply; 5+ messages in thread
From: drkm @ 2005-01-12  3:18 UTC (permalink / raw)


Pascal Bourguignon <spam@mouse-potato.com> 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 ;-)

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

* Re: hide local variables in enriched mode
  2005-01-11 16:53 ` Pascal Bourguignon
  2005-01-12  3:18   ` drkm
@ 2005-01-12  9:00   ` Sébastien Kirche
  1 sibling, 0 replies; 5+ messages in thread
From: Sébastien Kirche @ 2005-01-12  9:00 UTC (permalink / raw)


Le 11 Jan 2005, Pascal Bourguignon a dit :

> I'd try to narrow the region before ps-printing.
> 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:
> 
> (Of course, you could define a function in ~/.emacs and use it in
> eval: in place of this complex expression.)

Thank you for your contribution Pascal,  but i don't like much that embedded
eval...

I think i will take a closer look  to the code provided by drkm, as it seems
that feature is not built-in.

Sébastien Kirche

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

* Re: hide local variables in enriched mode
  2005-01-12  3:18   ` drkm
@ 2005-01-12  9:02     ` Sébastien Kirche
  0 siblings, 0 replies; 5+ messages in thread
From: Sébastien Kirche @ 2005-01-12  9:02 UTC (permalink / raw)


Le 12 Jan 2005, drkm a formulé :

> What do you think about this?

Wow, nice lesson about function advising :)
I will try it.

> 
> --drkm, que, finalement, fcae est chouette, aussi ;-)

Je crois que je vais sonder par là aussi ;)

Sébastien Kirche

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

end of thread, other threads:[~2005-01-12  9:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-11 13:26 hide local variables in enriched mode Sébastien Kirche
2005-01-11 16:53 ` Pascal Bourguignon
2005-01-12  3:18   ` drkm
2005-01-12  9:02     ` Sébastien Kirche
2005-01-12  9:00   ` Sébastien Kirche

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.