unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12413: 24.2.50; M-j should be bound to default-indent-new-line
@ 2012-09-11  9:35 Dmitry Gutov
  2016-02-24  6:11 ` Lars Ingebrigtsen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dmitry Gutov @ 2012-09-11  9:35 UTC (permalink / raw)
  To: 12413

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

Tags: patch

A major mode can change the value of comment-line-break-function, but
currently it's only used from `do-auto-fill'. I think that doesn't make
sense, the value should affect the M-j command, too.

default-indent-new-line does pretty much that. The function could use a
better name, though - it isn't used in any variables as default value.

Inspired by bugs 6806 and 10367.

In GNU Emacs 24.2.50.1 (i386-mingw-nt6.1.7601)
  of 2012-09-11 on SOL
Bzr revision: 109973 eggert@cs.ucla.edu-20120911012056-kegco8vmanqs0kpg
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
  `configure --with-gcc (3.4) --cflags -IJ:/Apps/system/gnuwin32/include'

[-- Attachment #2: m-j.diff --]
[-- Type: text/plain, Size: 2233 bytes --]

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-09-10 19:22:53 +0000
+++ lisp/ChangeLog	2012-09-11 09:25:45 +0000
@@ -1,3 +1,12 @@
+2012-09-11  Dmitry Gutov  <dgutov@yandex.ru>
+
+	* simple.el (default-indent-new-line): Fix the doctring.
+	* bindings.el (esc-map): Rebind M-j and C-M-j to
+	default-indent-new-line.
+	* textmodes/refill.el (refill-post-command-function): Replace
+	indent-new-comment-line with default-indent-new-line in the
+	special cases list.
+
 2012-09-10  Michael R. Mauger  <mmaug@yahoo.com>
 
 	* progmodes/sql.el: Version 3.1

=== modified file 'lisp/bindings.el'
--- lisp/bindings.el	2012-08-15 16:29:11 +0000
+++ lisp/bindings.el	2012-09-11 06:35:54 +0000
@@ -1105,8 +1105,8 @@
 (define-key ctl-x-map "\C-t" 'transpose-lines)
 
 (define-key esc-map ";" 'comment-dwim)
-(define-key esc-map "j" 'indent-new-comment-line)
-(define-key esc-map "\C-j" 'indent-new-comment-line)
+(define-key esc-map "j" 'default-indent-new-line)
+(define-key esc-map "\C-j" 'default-indent-new-line)
 (define-key ctl-x-map ";" 'comment-set-column)
 (define-key ctl-x-map "f" 'set-fill-column)
 (define-key ctl-x-map "$" 'set-selective-display)

=== modified file 'lisp/simple.el'
--- lisp/simple.el	2012-09-07 08:58:31 +0000
+++ lisp/simple.el	2012-09-11 06:34:40 +0000
@@ -5501,7 +5501,7 @@
 
 (defun default-indent-new-line (&optional soft)
   "Break line at point and indent.
-If a comment syntax is defined, call `comment-indent-new-line'.
+If a comment syntax is defined, call `comment-line-break-function'.
 
 The inserted newline is marked hard if variable `use-hard-newlines' is true,
 unless optional argument SOFT is non-nil."

=== modified file 'lisp/textmodes/refill.el'
--- lisp/textmodes/refill.el	2012-07-11 23:13:41 +0000
+++ lisp/textmodes/refill.el	2012-09-11 06:50:28 +0000
@@ -179,7 +179,7 @@
 	 (refill-fill-paragraph-at refill-doit)
 	 (setq refill-doit nil)))
       ((or `quoted-insert `fill-paragraph `fill-region) nil)
-      ((or `newline `newline-and-indent `open-line `indent-new-comment-line
+      ((or `newline `newline-and-indent `open-line `default-indent-new-line
            `reindent-then-newline-and-indent)
        ;; Don't zap what was just inserted.
        (save-excursion


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

* bug#12413: 24.2.50; M-j should be bound to default-indent-new-line
  2012-09-11  9:35 bug#12413: 24.2.50; M-j should be bound to default-indent-new-line Dmitry Gutov
@ 2016-02-24  6:11 ` Lars Ingebrigtsen
  2016-02-24 15:04   ` Dmitry Gutov
  2016-02-25  5:43 ` Lars Ingebrigtsen
  2019-06-27 14:58 ` Lars Ingebrigtsen
  2 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-24  6:11 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 12413

Dmitry Gutov <dgutov@yandex.ru> writes:

> A major mode can change the value of comment-line-break-function, but
> currently it's only used from `do-auto-fill'. I think that doesn't make
> sense, the value should affect the M-j command, too.
>
> default-indent-new-line does pretty much that. The function could use a
> better name, though - it isn't used in any variables as default value.

[...]

I think this makes sense, but it wasn't applied at the time (three years
ago).  Is this still an issue?

>  (define-key esc-map ";" 'comment-dwim)
> -(define-key esc-map "j" 'indent-new-comment-line)
> -(define-key esc-map "\C-j" 'indent-new-comment-line)
> +(define-key esc-map "j" 'default-indent-new-line)
> +(define-key esc-map "\C-j" 'default-indent-new-line)
>  (define-key ctl-x-map ";" 'comment-set-column)
>  (define-key ctl-x-map "f" 'set-fill-column)
>  (define-key ctl-x-map "$" 'set-selective-display)
>
> === modified file 'lisp/simple.el'
> --- lisp/simple.el	2012-09-07 08:58:31 +0000
> +++ lisp/simple.el	2012-09-11 06:34:40 +0000
> @@ -5501,7 +5501,7 @@
>  
>  (defun default-indent-new-line (&optional soft)
>    "Break line at point and indent.
> -If a comment syntax is defined, call `comment-indent-new-line'.
> +If a comment syntax is defined, call `comment-line-break-function'.
>  
>  The inserted newline is marked hard if variable `use-hard-newlines' is true,
>  unless optional argument SOFT is non-nil."
>
> === modified file 'lisp/textmodes/refill.el'
> --- lisp/textmodes/refill.el	2012-07-11 23:13:41 +0000
> +++ lisp/textmodes/refill.el	2012-09-11 06:50:28 +0000
> @@ -179,7 +179,7 @@
>  	 (refill-fill-paragraph-at refill-doit)
>  	 (setq refill-doit nil)))
>        ((or `quoted-insert `fill-paragraph `fill-region) nil)
> -      ((or `newline `newline-and-indent `open-line `indent-new-comment-line
> +      ((or `newline `newline-and-indent `open-line `default-indent-new-line
>             `reindent-then-newline-and-indent)
>         ;; Don't zap what was just inserted.
>         (save-excursion
>

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#12413: 24.2.50; M-j should be bound to default-indent-new-line
  2016-02-24  6:11 ` Lars Ingebrigtsen
@ 2016-02-24 15:04   ` Dmitry Gutov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Gutov @ 2016-02-24 15:04 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 12413

On 02/24/2016 08:11 AM, Lars Ingebrigtsen wrote:

> I think this makes sense, but it wasn't applied at the time (three years
> ago).  Is this still an issue?

Yup!

Apparently, it's not very urgent. In the meantime, I've worked around 
this in js2-mode by binding comment-line-break-function's value directly 
to M-j.






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

* bug#12413: 24.2.50; M-j should be bound to default-indent-new-line
  2012-09-11  9:35 bug#12413: 24.2.50; M-j should be bound to default-indent-new-line Dmitry Gutov
  2016-02-24  6:11 ` Lars Ingebrigtsen
@ 2016-02-25  5:43 ` Lars Ingebrigtsen
  2019-06-27 14:58 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-25  5:43 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 12413

Dmitry Gutov <dgutov@yandex.ru> writes:

> A major mode can change the value of comment-line-break-function, but
> currently it's only used from `do-auto-fill'. I think that doesn't make
> sense, the value should affect the M-j command, too.

[...]

> -(define-key esc-map "j" 'indent-new-comment-line)
> -(define-key esc-map "\C-j" 'indent-new-comment-line)
> +(define-key esc-map "j" 'default-indent-new-line)
> +(define-key esc-map "\C-j" 'default-indent-new-line)

[...]

> -      ((or `newline `newline-and-indent `open-line `indent-new-comment-line
> +      ((or `newline `newline-and-indent `open-line `default-indent-new-line

I think this makes sense...  probably...  does anybody want to weigh in
on this?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#12413: 24.2.50; M-j should be bound to default-indent-new-line
  2012-09-11  9:35 bug#12413: 24.2.50; M-j should be bound to default-indent-new-line Dmitry Gutov
  2016-02-24  6:11 ` Lars Ingebrigtsen
  2016-02-25  5:43 ` Lars Ingebrigtsen
@ 2019-06-27 14:58 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-27 14:58 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 12413

Dmitry Gutov <dgutov@yandex.ru> writes:

> A major mode can change the value of comment-line-break-function, but
> currently it's only used from `do-auto-fill'. I think that doesn't make
> sense, the value should affect the M-j command, too.
>
> default-indent-new-line does pretty much that. The function could use a
> better name, though - it isn't used in any variables as default value.

Makes sense to me.  I've now applied the patch to the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2019-06-27 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11  9:35 bug#12413: 24.2.50; M-j should be bound to default-indent-new-line Dmitry Gutov
2016-02-24  6:11 ` Lars Ingebrigtsen
2016-02-24 15:04   ` Dmitry Gutov
2016-02-25  5:43 ` Lars Ingebrigtsen
2019-06-27 14:58 ` Lars Ingebrigtsen

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