* makefile-mode makefile-fill-paragraph
@ 2006-05-25 9:56 Karl Chen
2006-05-25 14:11 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Karl Chen @ 2006-05-25 9:56 UTC (permalink / raw)
Hello, M-q in comments in makefile-mode currently destroys spaces
after the comment start.
Example:
emacs -q /tmp/Makefile
# Foo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# Bar
M-q
==>
# Foo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#Bar
This patch works for me.
--- make-mode.el 25 May 2006 02:52:02 -0700 1.115
+++ make-mode.el 25 May 2006 02:52:19 -0700
@@ -1302,7 +1302,7 @@
(save-excursion
(beginning-of-line)
(cond
- ((looking-at "^#+")
+ ((looking-at "^#+\\s-*")
;; Found a comment. Set the fill prefix, and find the paragraph
;; boundaries by searching for lines that look like comment-only
;; lines.
--
Karl 2006-05-25 02:52
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: makefile-mode makefile-fill-paragraph
2006-05-25 9:56 makefile-mode makefile-fill-paragraph Karl Chen
@ 2006-05-25 14:11 ` Stefan Monnier
2006-05-25 22:14 ` Karl Chen
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2006-05-25 14:11 UTC (permalink / raw)
Cc: Emacs Developement List
> Hello, M-q in comments in makefile-mode currently destroys spaces
> after the comment start.
Does the patch below fix it as well?
Stefan
--- orig/lisp/progmodes/make-mode.el
+++ mod/lisp/progmodes/make-mode.el
@@ -1304,29 +1304,8 @@
(beginning-of-line)
(cond
((looking-at "^#+")
- ;; Found a comment. Set the fill prefix, and find the paragraph
- ;; boundaries by searching for lines that look like comment-only
- ;; lines.
- (let ((fill-prefix (match-string-no-properties 0))
- (fill-paragraph-function nil))
- (save-excursion
- (save-restriction
- (narrow-to-region
- ;; Search backwards.
- (save-excursion
- (while (and (zerop (forward-line -1))
- (looking-at "^#")))
- ;; We may have gone too far. Go forward again.
- (or (looking-at "^#")
- (forward-line 1))
- (point))
- ;; Search forwards.
- (save-excursion
- (while (looking-at "^#")
- (forward-line))
- (point)))
- (fill-paragraph nil)
- t))))
+ ;; Found a comment. Return nil to let normal filling take place.
+ nil)
;; Must look for backslashed-region before looking for variable
;; assignment.
@@ -1355,7 +1334,9 @@
(makefile-backslash-region (point-min) (point-max) nil)
(goto-char (point-max))
(if (< (skip-chars-backward "\n") 0)
- (delete-region (point) (point-max))))))
+ (delete-region (point) (point-max)))))
+ ;; Return non-nil to indicate it's been filled.
+ t)
((looking-at makefile-macroassign-regex)
;; Have a macro assign. Fill just this line, and then backslash
@@ -1364,10 +1345,13 @@
(narrow-to-region (point) (line-beginning-position 2))
(let ((fill-paragraph-function nil))
(fill-paragraph nil))
- (makefile-backslash-region (point-min) (point-max) nil)))))
-
- ;; Always return non-nil so we don't fill anything else.
- t)
+ (makefile-backslash-region (point-min) (point-max) nil))
+ ;; Return non-nil to indicate it's been filled.
+ t)
+
+ (t
+ ;; Return non-nil so we don't fill anything else.
+ t))))
\f
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: makefile-mode makefile-fill-paragraph
2006-05-25 14:11 ` Stefan Monnier
@ 2006-05-25 22:14 ` Karl Chen
2006-05-28 20:56 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Karl Chen @ 2006-05-25 22:14 UTC (permalink / raw)
Cc: Emacs Developement List
>>>>> On 2006-05-25 07:11 PDT, Stefan Monnier writes:
>> Hello, M-q in comments in makefile-mode currently destroys
>> spaces after the comment start.
Stefan> Does the patch below fix it as well?
Yes, that works, and it's better because it would work with
filladapt and such. Thanks!
--
Karl 2006-05-25 15:13
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: makefile-mode makefile-fill-paragraph
2006-05-25 22:14 ` Karl Chen
@ 2006-05-28 20:56 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2006-05-28 20:56 UTC (permalink / raw)
Cc: Emacs Developement List
>>> Hello, M-q in comments in makefile-mode currently destroys
>>> spaces after the comment start.
Stefan> Does the patch below fix it as well?
> Yes, that works, and it's better because it would work with
> filladapt and such. Thanks!
Thanks, installed,
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-05-28 20:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-25 9:56 makefile-mode makefile-fill-paragraph Karl Chen
2006-05-25 14:11 ` Stefan Monnier
2006-05-25 22:14 ` Karl Chen
2006-05-28 20:56 ` Stefan Monnier
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.