unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix
@ 2008-08-21 15:15 Chong Yidong
  2008-08-21 20:43 ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2008-08-21 15:15 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 684, emacs-devel

> > Text-Mode redefines the new search-map prefix "\es" with
> > center-line. Maybe this needs to be changed too.
>
> Instead of removing these useful commands from key bindings,
> I think we should find a good replacement.
>
> Starting from Emacs 22 we dedicated a special prefix map M-o
> just for such formatting commands.  So I propose to move these
> commands to the following keys:
>
> M-o M-s    center-line
> M-o M-S    center-paragraph

Isn't the M-o prefix key used for text properties?  I don't think it's
such a good fit.  Maybe M-g would be better.  WDYT?




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

* Re: bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix
  2008-08-21 15:15 bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix Chong Yidong
@ 2008-08-21 20:43 ` Juri Linkov
  2008-08-21 22:18   ` Chong Yidong
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2008-08-21 20:43 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 684, emacs-devel

>> > Text-Mode redefines the new search-map prefix "\es" with
>> > center-line. Maybe this needs to be changed too.
>>
>> Instead of removing these useful commands from key bindings,
>> I think we should find a good replacement.
>>
>> Starting from Emacs 22 we dedicated a special prefix map M-o
>> just for such formatting commands.  So I propose to move these
>> commands to the following keys:
>>
>> M-o M-s    center-line
>> M-o M-S    center-paragraph
>
> Isn't the M-o prefix key used for text properties?  I don't think it's
> such a good fit.  Maybe M-g would be better.  WDYT?

M-g was intended for navigation commands ("goto" mnemonics), and
M-o for formatting commands (see (emacs) Formatted Text).
I think center-line and center-paragraph are more formatting
than navigation commands.

If this is ok then the following patch implements this.
It binds `M-o M-s' and `M-o M-S' globally after loading
text-mode.el.  This is perfectly fine since these bindings
have no conflicts with other modes.

Index: lisp/textmodes/text-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/text-mode.el,v
retrieving revision 1.55
diff -c -r1.55 text-mode.el
*** lisp/textmodes/text-mode.el	6 May 2008 04:33:13 -0000	1.55
--- lisp/textmodes/text-mode.el	21 Aug 2008 20:43:55 -0000
***************
*** 50,62 ****
  (defvar text-mode-map
    (let ((map (make-sparse-keymap)))
      (define-key map "\e\t" 'ispell-complete-word)
-     (define-key map "\es" 'center-line)
-     (define-key map "\eS" 'center-paragraph)
      map)
    "Keymap for `text-mode'.
  Many other modes, such as `mail-mode', `outline-mode' and `indented-text-mode',
  inherit all the commands defined in this map.")
  
  \f
  (define-derived-mode text-mode nil "Text"
    "Major mode for editing text written for humans to read.
--- 50,63 ----
  (defvar text-mode-map
    (let ((map (make-sparse-keymap)))
      (define-key map "\e\t" 'ispell-complete-word)
      map)
    "Keymap for `text-mode'.
  Many other modes, such as `mail-mode', `outline-mode' and `indented-text-mode',
  inherit all the commands defined in this map.")
  
+ (define-key facemenu-keymap "\es" 'center-line)
+ (define-key facemenu-keymap "\eS" 'center-paragraph)
+ 
  \f
  (define-derived-mode text-mode nil "Text"
    "Major mode for editing text written for humans to read.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix
  2008-08-21 20:43 ` Juri Linkov
@ 2008-08-21 22:18   ` Chong Yidong
  2008-08-25 15:45     ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2008-08-21 22:18 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 684, emacs-devel

Juri Linkov <juri@jurta.org> writes:

>>> Starting from Emacs 22 we dedicated a special prefix map M-o
>>> just for such formatting commands.  So I propose to move these
>>> commands to the following keys:
>>>
>>> M-o M-s    center-line
>>> M-o M-S    center-paragraph
>>
>> Isn't the M-o prefix key used for text properties?  I don't think it's
>> such a good fit.  Maybe M-g would be better.  WDYT?
>
> M-g was intended for navigation commands ("goto" mnemonics), and
> M-o for formatting commands (see (emacs) Formatted Text).
> I think center-line and center-paragraph are more formatting
> than navigation commands.

But center-line and center-paragraph have nothing to do with text
formatting as such -- currently, the commands in M-o all change
properties.  In contrast, center-line and center-paragraph perform
indentation.

How about C-c C-s and C-c C-S?




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

* Re: bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix
  2008-08-21 22:18   ` Chong Yidong
@ 2008-08-25 15:45     ` Juri Linkov
  2008-08-25 16:29       ` Chong Yidong
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2008-08-25 15:45 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 684, emacs-devel

> Juri Linkov <juri@jurta.org> writes:
>
>>>> Starting from Emacs 22 we dedicated a special prefix map M-o
>>>> just for such formatting commands.  So I propose to move these
>>>> commands to the following keys:
>>>>
>>>> M-o M-s    center-line
>>>> M-o M-S    center-paragraph
>>>
>>> Isn't the M-o prefix key used for text properties?  I don't think it's
>>> such a good fit.  Maybe M-g would be better.  WDYT?
>>
>> M-g was intended for navigation commands ("goto" mnemonics), and
>> M-o for formatting commands (see (emacs) Formatted Text).
>> I think center-line and center-paragraph are more formatting
>> than navigation commands.
>
> But center-line and center-paragraph have nothing to do with text
> formatting as such -- currently, the commands in M-o all change
> properties.  In contrast, center-line and center-paragraph perform
> indentation.

In word processors, formatting has a broader sense - it includes
indentation, centering, alignment, justification, bulleting, numbering.
There was an idea to develop Emacs into a word processor
with the M-o map as the starting point.

> How about C-c C-s and C-c C-S?

These are good keybindings for the text major mode.  However, I don't see
why center-line and center-paragraph should be restricted to text-mode
only.  These commands are useful in any mode, and with a global keybinding
they will be available everywhere just like other formatting commands
such as `fill-paragraph' and commands in the `M-o' map that now has
enough room for more keybindings:

M-o b           facemenu-set-bold
M-o d           facemenu-set-default
M-o i           facemenu-set-italic
M-o l           facemenu-set-bold-italic
M-o o           facemenu-set-face
M-o u           facemenu-set-underline
M-o M-o         font-lock-fontify-block

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* Re: bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix
  2008-08-25 15:45     ` Juri Linkov
@ 2008-08-25 16:29       ` Chong Yidong
  2008-08-25 20:33         ` Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2008-08-25 16:29 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 684, emacs-devel

Juri Linkov <juri@jurta.org> writes:

>>> M-g was intended for navigation commands ("goto" mnemonics), and
>>> M-o for formatting commands (see (emacs) Formatted Text).
>>> I think center-line and center-paragraph are more formatting
>>> than navigation commands.
>>
>> But center-line and center-paragraph have nothing to do with text
>> formatting as such -- currently, the commands in M-o all change
>> properties.  In contrast, center-line and center-paragraph perform
>> indentation.
>
> I don't see why center-line and center-paragraph should be restricted
> to text-mode only.  These commands are useful in any mode, and with a
> global keybinding they will be available everywhere just like other
> formatting commands such as `fill-paragraph' and commands in the `M-o'
> map that now has enough room for more keybindings:
>
> M-o b           facemenu-set-bold
> M-o d           facemenu-set-default
> M-o i           facemenu-set-italic
> M-o l           facemenu-set-bold-italic
> M-o o           facemenu-set-face
> M-o u           facemenu-set-underline
> M-o M-o         font-lock-fontify-block

Okay then.  Could please check in a couple of NEWS entry explaining this
as well?  Thanks.




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

* Re: bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix
  2008-08-25 16:29       ` Chong Yidong
@ 2008-08-25 20:33         ` Juri Linkov
  2008-08-25 20:52           ` center-line on region (was: bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix) Juri Linkov
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2008-08-25 20:33 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 684-done, emacs-devel

> Okay then.  Could please check in a couple of NEWS entry explaining this
> as well?  Thanks.

Done.

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

* center-line on region (was: bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix)
  2008-08-25 20:33         ` Juri Linkov
@ 2008-08-25 20:52           ` Juri Linkov
  0 siblings, 0 replies; 7+ messages in thread
From: Juri Linkov @ 2008-08-25 20:52 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

BTW, I noticed that `center-line' doesn't take into account the active
region like `fill-paragraph' already does.  I propose the following patch
to do exactly the same, i.e. to center each line in the active region
when center-line is called interactively and the region is active:

Index: lisp/textmodes/text-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/text-mode.el,v
retrieving revision 1.56
diff -c -w -b -r1.56 text-mode.el
*** lisp/textmodes/text-mode.el	25 Aug 2008 20:31:52 -0000	1.56
--- lisp/textmodes/text-mode.el	25 Aug 2008 20:49:17 -0000
***************
*** 153,164 ****
  
  (define-key facemenu-keymap "\es" 'center-line)
  
! (defun center-line (&optional nlines)
    "Center the line point is on, within the width specified by `fill-column'.
  This means adjusting the indentation so that it equals
  the distance between the end of the text and `fill-column'.
! The argument NLINES says how many lines to center."
!   (interactive "P")
    (if nlines (setq nlines (prefix-numeric-value nlines)))
    (while (not (eq nlines 0))
      (save-excursion
--- 153,171 ----
  
  (define-key facemenu-keymap "\es" 'center-line)
  
! (defun center-line (&optional nlines region)
    "Center the line point is on, within the width specified by `fill-column'.
  This means adjusting the indentation so that it equals
  the distance between the end of the text and `fill-column'.
! The argument NLINES says how many lines to center.
! 
! Interactively (when `region' is non-nil) in Transient Mark mode when
! the mark is active, call `center-region' to center each nonblank line
! in the active region."
!   (interactive (list current-prefix-arg t))
!   ;; Center the region if it is active when called interactively.
!   (if (and region (region-active-p))
!       (center-region (region-beginning) (region-end))
      (if nlines (setq nlines (prefix-numeric-value nlines)))
      (while (not (eq nlines 0))
        (save-excursion
***************
*** 179,185 ****
  	   (forward-line 1))
  	  ((< nlines 0)
  	   (setq nlines (1+ nlines))
! 	   (forward-line -1)))))
  
  ;; arch-tag: a07ccaad-da13-4d7b-9c61-cd04f5926aab
  ;;; text-mode.el ends here
--- 186,192 ----
  	     (forward-line 1))
  	    ((< nlines 0)
  	     (setq nlines (1+ nlines))
! 	     (forward-line -1))))))
  
  ;; arch-tag: a07ccaad-da13-4d7b-9c61-cd04f5926aab
  ;;; text-mode.el ends here

-- 
Juri Linkov
http://www.jurta.org/emacs/




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

end of thread, other threads:[~2008-08-25 20:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-21 15:15 bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix Chong Yidong
2008-08-21 20:43 ` Juri Linkov
2008-08-21 22:18   ` Chong Yidong
2008-08-25 15:45     ` Juri Linkov
2008-08-25 16:29       ` Chong Yidong
2008-08-25 20:33         ` Juri Linkov
2008-08-25 20:52           ` center-line on region (was: bug#684: 23.0.60; text-mode redefines "\es", the new search-map prefix) Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).