Gnus development mailing list
 help / color / mirror / Atom feed
* header-sensitive beginning-of-line?
@ 2001-11-09  0:47 Benjamin Rutt
  2001-11-09  5:34 ` Matt Armstrong
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Benjamin Rutt @ 2001-11-09  0:47 UTC (permalink / raw)


It might be nice if message-mode had a way to allow you to navigate
point to the beginning of the header value.  This would make it easier
to trim out values if you typed in the wrong email address, or
newsgroup, or subject line.  For example:

Subject: C-a currently moves point to beginning of line
^
^
^

Subject: WIBNI the cursor could end up after the ': '?
         ^
         ^
         ^

Maybe message-mode could have a function named message-bol which would
place point just after the ': '.  (Similar to how C-c C-a
(comint-bol-or-process-mark) operates in shell-mode.)  Maybe we could
define C-a in message-mode to run a new function `message-bol' which,
if point was in the header, would navigate to just past the ': '.  Two
consecutive invocations of `message-bol' could navigate point to the
true BOL.

Any thoughts?
-- 
Benjamin Rutt <rutt+news@cis.ohio-state.edu>



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

* Re: header-sensitive beginning-of-line?
  2001-11-09  0:47 header-sensitive beginning-of-line? Benjamin Rutt
@ 2001-11-09  5:34 ` Matt Armstrong
  2001-11-09 11:08   ` Andreas Fuchs
  2001-11-09  8:48 ` Kai Großjohann
  2001-11-09 14:31 ` Kai Großjohann
  2 siblings, 1 reply; 12+ messages in thread
From: Matt Armstrong @ 2001-11-09  5:34 UTC (permalink / raw)
  Cc: ding

Benjamin Rutt <rutt+news@cis.ohio-state.edu> writes:

> It might be nice if message-mode had a way to allow you to navigate
> point to the beginning of the header value.  This would make it easier
> to trim out values if you typed in the wrong email address, or
> newsgroup, or subject line.  For example:
>
> Subject: C-a currently moves point to beginning of line
> ^
> ^
> ^
>
> Subject: WIBNI the cursor could end up after the ': '?
>          ^
>          ^
>          ^
>
> Maybe message-mode could have a function named message-bol which would
> place point just after the ': '.  (Similar to how C-c C-a
> (comint-bol-or-process-mark) operates in shell-mode.)  Maybe we could
> define C-a in message-mode to run a new function `message-bol' which,
> if point was in the header, would navigate to just past the ': '.  Two
> consecutive invocations of `message-bol' could navigate point to the
> true BOL.
>
> Any thoughts?

I like the idea.  I'm not sure if it should be the default -- people
expect C-a to behave a certain way.  Unfortunately C-c C-a is already
taken by mml-attach-file.

But I am frequently doing C-a M-f M-f M-b to do what your message-bol
does.

Of course, if point is already at the sweet spot, message-bol should
then go to the real beginning of line.


-- 
matt



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

* Re: header-sensitive beginning-of-line?
  2001-11-09  0:47 header-sensitive beginning-of-line? Benjamin Rutt
  2001-11-09  5:34 ` Matt Armstrong
@ 2001-11-09  8:48 ` Kai Großjohann
  2001-11-11  9:17   ` Karl Eichwalder
  2001-11-09 14:31 ` Kai Großjohann
  2 siblings, 1 reply; 12+ messages in thread
From: Kai Großjohann @ 2001-11-09  8:48 UTC (permalink / raw)
  Cc: ding

On the Emacs-devel mailing list, something similar (but for shell
mode) was discussed.  Maybe it is a good idea to make shell-mode and
message-mode behave the same in this respect?

Maybe we should start a discussion across the two lists?

kai
-- 
I like BOTH kinds of music.



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

* Re: header-sensitive beginning-of-line?
  2001-11-09  5:34 ` Matt Armstrong
@ 2001-11-09 11:08   ` Andreas Fuchs
  2001-11-09 12:20     ` Colin Marquardt
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Fuchs @ 2001-11-09 11:08 UTC (permalink / raw)
  Cc: ding


[-- Attachment #1.1: Type: text/plain, Size: 1245 bytes --]

On 2001-11-08, Matt Armstrong <matt+dated+1007876070.52bd2b@lickey.com>
wrote:
> Of course, if point is already at the sweet spot, message-bol should
> then go to the real beginning of line.

This does what you want (I'm not sure if I duplicated some functionality
with message-point-in-header-p, maybe some more experienced gnus hacker
can tell me):

(defun message-point-in-header-p ()
  (let* ((point-in-header (point))
         (body-begin (progn
                       (message-goto-body)
                       (point))))
    (prog1
        (< point-in-header body-begin)
      (goto-char point-in-header))))  ; saves the save-excursion overhead

(defun message-beginning-of-line (&optional n)
  (interactive "p")
  (let ((cur-point (point)))
    (beginning-of-line n)
    (when (message-point-in-header-p)
      (let ((to-point  (save-excursion
                         (end-of-line)
                         (re-search-backward "^[^:]*: " nil t)
                         (match-end 0))))
      (unless (= cur-point to-point)
        (goto-char to-point))))))
      

(define-key message-mode-map "\C-a" 'message-beginning-of-line)

Have fun,
-- 
Andreas Fuchs, <asf@acm.org>, asf@jabber.at, antifuchs

[-- Attachment #2: Type: application/pgp-signature, Size: 231 bytes --]

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

* Re: header-sensitive beginning-of-line?
  2001-11-09 11:08   ` Andreas Fuchs
@ 2001-11-09 12:20     ` Colin Marquardt
  0 siblings, 0 replies; 12+ messages in thread
From: Colin Marquardt @ 2001-11-09 12:20 UTC (permalink / raw)


Andreas Fuchs <asf@void.at> writes:

> On 2001-11-08, Matt Armstrong <matt+dated+1007876070.52bd2b@lickey.com>
> wrote:
> > Of course, if point is already at the sweet spot, message-bol should
>> then go to the real beginning of line.
>
> This does what you want (I'm not sure if I duplicated some functionality

FWIW, I like the behavior of that function, and IMO it should go into
Gnus.

Cheers,
  Colin



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

* Re: header-sensitive beginning-of-line?
  2001-11-09  0:47 header-sensitive beginning-of-line? Benjamin Rutt
  2001-11-09  5:34 ` Matt Armstrong
  2001-11-09  8:48 ` Kai Großjohann
@ 2001-11-09 14:31 ` Kai Großjohann
  2001-11-09 14:43   ` Kai Großjohann
  2 siblings, 1 reply; 12+ messages in thread
From: Kai Großjohann @ 2001-11-09 14:31 UTC (permalink / raw)
  Cc: ding

Benjamin Rutt <rutt+news@cis.ohio-state.edu> writes:

> It might be nice if message-mode had a way to allow you to navigate
> point to the beginning of the header value.

Done.

kai
-- 
I like BOTH kinds of music.



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

* Re: header-sensitive beginning-of-line?
  2001-11-09 14:31 ` Kai Großjohann
@ 2001-11-09 14:43   ` Kai Großjohann
  2001-11-09 15:23     ` Benjamin Rutt
  0 siblings, 1 reply; 12+ messages in thread
From: Kai Großjohann @ 2001-11-09 14:43 UTC (permalink / raw)
  Cc: ding

Kai.Grossjohann@cs.uni-dortmund.de (Kai Großjohann) writes:

> Benjamin Rutt <rutt+news@cis.ohio-state.edu> writes:
>
>> It might be nice if message-mode had a way to allow you to navigate
>> point to the beginning of the header value.
>
> Done.

Oh, boy, such a simple change and so much time.  I'm sorry for the
flurry of commits.  I hope everything works now.  Please holler if I
missed something.

kai
-- 
I like BOTH kinds of music.



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

* Re: header-sensitive beginning-of-line?
  2001-11-09 14:43   ` Kai Großjohann
@ 2001-11-09 15:23     ` Benjamin Rutt
  2001-11-09 16:08       ` Kai Großjohann
  0 siblings, 1 reply; 12+ messages in thread
From: Benjamin Rutt @ 2001-11-09 15:23 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

>> Done.

Super!  It's great to find an idea that you were pondering while you
were going to bed get implemented while you were sleeping! :) Glad to
see that others felt the same way.  Thanks for your work on this, and
for everyone else's support and code.

> Oh, boy, such a simple change and so much time.  I'm sorry for the
> flurry of commits.  I hope everything works now.  Please holler if I
> missed something.

I think there may be an issue still with multi-line headers.  For
example, go to any multiline references header and type C-a and you
get the following stack trace:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  message-beginning-of-line(1)
  call-interactively(message-beginning-of-line)

Also, if you are on the line that looks like

"--text follows this line--"

there is the same problem.

The following patch to cvs should fix it (sorry for the diff -c but
the version of diff on my solaris machine doesn't support diff
-u...will have to install GNU diff):

*** message.el.~6.153.~	Fri Nov  9 09:40:34 2001
--- message.el	Fri Nov  9 10:18:07 2001
***************
*** 3973,3979 ****
  	     (eoh (re-search-forward ": *" eol t)))
  	(if (equal here eoh)
  	    (goto-char bol)
! 	  (goto-char eoh)))
      (beginning-of-line n)))
  
  (defun message-buffer-name (type &optional to group)
--- 3973,3981 ----
  	     (eoh (re-search-forward ": *" eol t)))
  	(if (equal here eoh)
  	    (goto-char bol)
! 	  (if eoh
! 	      (goto-char eoh)
! 	    (beginning-of-line n))))
      (beginning-of-line n)))
  
  (defun message-buffer-name (type &optional to group)

Thanks again,
-- 
Benjamin



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

* Re: header-sensitive beginning-of-line?
  2001-11-09 15:23     ` Benjamin Rutt
@ 2001-11-09 16:08       ` Kai Großjohann
  0 siblings, 0 replies; 12+ messages in thread
From: Kai Großjohann @ 2001-11-09 16:08 UTC (permalink / raw)


Benjamin Rutt <rutt+news@cis.ohio-state.edu> writes:

> I think there may be an issue still with multi-line headers.  For
> example, go to any multiline references header and type C-a and you
> get the following stack trace:
>
> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
>   message-beginning-of-line(1)
>   call-interactively(message-beginning-of-line)

Fixed.  I think.

kai
-- 
I like BOTH kinds of music.



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

* Re: header-sensitive beginning-of-line?
  2001-11-09  8:48 ` Kai Großjohann
@ 2001-11-11  9:17   ` Karl Eichwalder
  2001-11-11 18:12     ` Benjamin Rutt
  0 siblings, 1 reply; 12+ messages in thread
From: Karl Eichwalder @ 2001-11-11  9:17 UTC (permalink / raw)
  Cc: Benjamin Rutt, ding

Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> On the Emacs-devel mailing list, something similar (but for shell
> mode) was discussed.  Maybe it is a good idea to make shell-mode and
> message-mode behave the same in this respect?

Thought about that, too, but the matters are disjunct.  There are cases
when you want to delete the whole line in message mode (at the moment
this works best pressing `C-a C-k C-k'), but no brave soul has the need
to delete the promt in shell mode.

Please, don't change the default in message mode.

-- 
ke@suse.de (work) / keichwa@gmx.net (home):              |
http://www.suse.de/~ke/                                  |      ,__o
Free Translation Project:                                |    _-\_<,
http://www.iro.umontreal.ca/contrib/po/HTML/             |   (*)/'(*)



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

* Re: header-sensitive beginning-of-line?
  2001-11-11  9:17   ` Karl Eichwalder
@ 2001-11-11 18:12     ` Benjamin Rutt
  2001-11-11 19:28       ` Kai Großjohann
  0 siblings, 1 reply; 12+ messages in thread
From: Benjamin Rutt @ 2001-11-11 18:12 UTC (permalink / raw)


Karl Eichwalder <ke@gnu.franken.de> writes:

> Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:
>
>> On the Emacs-devel mailing list, something similar (but for shell
>> mode) was discussed.  Maybe it is a good idea to make shell-mode and
>> message-mode behave the same in this respect?
>
> Thought about that, too, but the matters are disjunct.  There are cases
> when you want to delete the whole line in message mode (at the moment
> this works best pressing `C-a C-k C-k'), but no brave soul has the need
> to delete the promt in shell mode.
>
> Please, don't change the default in message mode.

The default has already been changed in Oort CVS.  (FYI, two
successive C-a's should get you to BOL if the first one didn't).

I know that I personally delete header values much more often than I
delete entire headers.  So for me, the new key binding saves me
keystrokes.  However, for others, this may not be true.

Perhaps we need a variable which allows users to customize whether
message-bol takes them to the beginning of line or beginning of
header?  I think we have reached a point where it should be left to
the user to decide this.
-- 
Benjamin



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

* Re: header-sensitive beginning-of-line?
  2001-11-11 18:12     ` Benjamin Rutt
@ 2001-11-11 19:28       ` Kai Großjohann
  0 siblings, 0 replies; 12+ messages in thread
From: Kai Großjohann @ 2001-11-11 19:28 UTC (permalink / raw)


Benjamin Rutt <rutt+news@cis.ohio-state.edu> writes:

> Perhaps we need a variable which allows users to customize whether
> message-bol takes them to the beginning of line or beginning of
> header?  I think we have reached a point where it should be left to
> the user to decide this.

I'd have thought that (define-key message-mode-map "\C-a"
'beginning-of-line) is not so difficult to do for those people who
want it...

kai
-- 
I like BOTH kinds of music.



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

end of thread, other threads:[~2001-11-11 19:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-09  0:47 header-sensitive beginning-of-line? Benjamin Rutt
2001-11-09  5:34 ` Matt Armstrong
2001-11-09 11:08   ` Andreas Fuchs
2001-11-09 12:20     ` Colin Marquardt
2001-11-09  8:48 ` Kai Großjohann
2001-11-11  9:17   ` Karl Eichwalder
2001-11-11 18:12     ` Benjamin Rutt
2001-11-11 19:28       ` Kai Großjohann
2001-11-09 14:31 ` Kai Großjohann
2001-11-09 14:43   ` Kai Großjohann
2001-11-09 15:23     ` Benjamin Rutt
2001-11-09 16:08       ` Kai Großjohann

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).