all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Macro to fold References header in news or mail onto multiple lines?
@ 2006-10-25  9:36 Adam Funk
  2006-10-25 11:47 ` Peter Dyballa
  2006-10-25 12:22 ` Markus Triska
  0 siblings, 2 replies; 4+ messages in thread
From: Adam Funk @ 2006-10-25  9:36 UTC (permalink / raw)


I'm looking for an emacs macro to fold the References header in a news
or mail message that I'm editing onto mulitple lines.  I want a
command that will reformat the following line, for example,

References: <37029@invalid> <3203A@example.com> <BB6D1@invalid> <5DFF1@example.org>

into this sequence of lines

References: <37029@invalid>
	<3203A@example.com>
	<BB6D1@invalid>
	<5DFF1@example.org>

which still constitutes one header (I've used tabs at the beginning of
the subsequent lines in my example, but spaces are OK too).

(If the macro finds the References: line near the top of the current
buffer on its own, that would be nice too.)

I'm sure someone must have already done this (and I hope so, because
my elisp skills are *very* limited), but I haven't been able to find
anything relevant by googling (probably because "fold" in the Emacs
context is often used to mean hide part of a buffer from view).  I'd
appreciate a pointer to such a macro or just some more precise
terminology for googling for it.

Thanks,
Adam

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

* Re: Macro to fold References header in news or mail onto multiple lines?
  2006-10-25  9:36 Macro to fold References header in news or mail onto multiple lines? Adam Funk
@ 2006-10-25 11:47 ` Peter Dyballa
  2006-10-25 12:22 ` Markus Triska
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2006-10-25 11:47 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 25.10.2006 um 11:36 schrieb Adam Funk:

> I want a command that will reformat the following line, for example,
>
> References: <37029@invalid> <3203A@example.com> <BB6D1@invalid>  
> <5DFF1@example.org>
>
> into this sequence of lines
>
> References: <37029@invalid>
> 	<3203A@example.com>
> 	<BB6D1@invalid>
> 	<5DFF1@example.org>

M-x replace-string RET > SPC < RET > C-q C-j C-q TAB < RET

--
Mit friedvollen Grüßen

   Pete                           <]
              o        __o         |__    o       HPV, the real
     ___o    /I       -\<,         |o \  -\),-%     high speed!
___/\ /\___./ \___...O/ O____.....`-O-'-()--o_________________

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

* Re: Macro to fold References header in news or mail onto multiple lines?
  2006-10-25  9:36 Macro to fold References header in news or mail onto multiple lines? Adam Funk
  2006-10-25 11:47 ` Peter Dyballa
@ 2006-10-25 12:22 ` Markus Triska
  2006-10-25 18:31   ` Adam Funk
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Triska @ 2006-10-25 12:22 UTC (permalink / raw)


Adam Funk <a24061@yahoo.com> writes:  > > References: 
<37029@invalid> <3203A@example.com> <BB6D1@invalid>...  > > into 
this sequence of lines > > References: <37029@invalid> > 
<3203A@example.com> > 	<BB6D1@invalid> > 
<5DFF1@example.org> 
 

(defun fold-references () (interactive)
  (save-excursion
    (goto-char (point-min))
    (search-forward "References: ") (while (looking-at "<.*?>")
      (goto-char (match-end 0))
      (insert "\n")
      (delete-horizontal-space)
      (insert "\t"))
    (delete-char -2))) ; remove tab & newline


Best wishes! -- Markus Triska

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

* Re: Macro to fold References header in news or mail onto multiple lines?
  2006-10-25 12:22 ` Markus Triska
@ 2006-10-25 18:31   ` Adam Funk
  0 siblings, 0 replies; 4+ messages in thread
From: Adam Funk @ 2006-10-25 18:31 UTC (permalink / raw)


On 2006-10-25, Markus Triska <triska@gmx.at> wrote:

> (defun fold-references () (interactive)
>   (save-excursion
>     (goto-char (point-min))
>     (search-forward "References: ") (while (looking-at "<.*?>")
>       (goto-char (match-end 0))
>       (insert "\n")
>       (delete-horizontal-space)
>       (insert "\t"))
>     (delete-char -2))) ; remove tab & newline

I honestly wasn't trying to get someone to *write* it for me --- but
that's brilliant, thanks.  And I can understand how it works.  Maybe
someday I'll be able to write elisp too.   ;-)

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

end of thread, other threads:[~2006-10-25 18:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-25  9:36 Macro to fold References header in news or mail onto multiple lines? Adam Funk
2006-10-25 11:47 ` Peter Dyballa
2006-10-25 12:22 ` Markus Triska
2006-10-25 18:31   ` Adam Funk

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.