[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: paragraph-start and fill-paragraph in texinfo-mode
From: |
Stefan Monnier |
Subject: |
Re: paragraph-start and fill-paragraph in texinfo-mode |
Date: |
Mon, 12 Sep 2005 14:17:16 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> I define my own programming styles and use c-add-style to add them to
> c-style-alist. If I set the &optional set-p in the application of
> c-add-style, then c-setup-paragraph-style sets paragraph-start as if
> it were not a buffer local variable. Thus, all buffers henceforth
> have comment-line-prefix and c-paragraph-start appended to their
> paragraph-start.
Would the patch below do the trick?
I always hate it when the make-local-variable is separated from the setq,
precisely because of the risk of introducing the kind of bug above.
Stefan
Index: lisp/progmodes/cc-styles.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-styles.el,v
retrieving revision 1.35
diff -u -r1.35 cc-styles.el
--- lisp/progmodes/cc-styles.el 1 Aug 2005 08:37:49 -0000 1.35
+++ lisp/progmodes/cc-styles.el 12 Sep 2005 18:15:36 -0000
@@ -498,17 +498,19 @@
(let ((comment-line-prefix
(concat "[ \t]*\\(" c-current-comment-prefix "\\)[ \t]*")))
- (setq paragraph-start (concat comment-line-prefix
+ (set (make-local-variable 'paragraph-start)
+ (concat comment-line-prefix
c-paragraph-start
"\\|"
- page-delimiter)
- paragraph-separate (concat comment-line-prefix
+ page-delimiter))
+ (set (make-local-variable 'paragraph-separate)
+ (concat comment-line-prefix
c-paragraph-separate
"\\|"
- page-delimiter)
- paragraph-ignore-fill-prefix t
- adaptive-fill-mode t
- adaptive-fill-regexp
+ page-delimiter))
+ (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
+ (set (make-local-variable 'adaptive-fill-mode) t)
+ (set (make-local-variable 'adaptive-fill-regexp)
(concat comment-line-prefix
(if (default-value 'adaptive-fill-regexp)
(concat "\\("
@@ -518,8 +520,7 @@
(when (boundp 'adaptive-fill-first-line-regexp)
;; XEmacs (20.x) adaptive fill mode doesn't have this.
- (make-local-variable 'adaptive-fill-first-line-regexp)
- (setq adaptive-fill-first-line-regexp
+ (set (make-local-variable 'adaptive-fill-first-line-regexp)
(concat "\\`" comment-line-prefix
;; Maybe we should incorporate the old value here,
;; but then we have to do all sorts of kludges to
@@ -626,5 +627,5 @@
(cc-provide 'cc-styles)
-;;; arch-tag: c764f61a-96ba-484a-a68f-101c0e9d5d2c
+;; arch-tag: c764f61a-96ba-484a-a68f-101c0e9d5d2c
;;; cc-styles.el ends here
Index: lisp/progmodes/cc-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-mode.el,v
retrieving revision 1.42
diff -u -r1.42 cc-mode.el
--- lisp/progmodes/cc-mode.el 1 Aug 2005 08:37:49 -0000 1.42
+++ lisp/progmodes/cc-mode.el 12 Sep 2005 18:15:36 -0000
@@ -395,11 +395,6 @@
(make-local-variable 'comment-end)
(make-local-variable 'comment-start-skip)
(make-local-variable 'comment-multi-line)
- (make-local-variable 'paragraph-start)
- (make-local-variable 'paragraph-separate)
- (make-local-variable 'paragraph-ignore-fill-prefix)
- (make-local-variable 'adaptive-fill-mode)
- (make-local-variable 'adaptive-fill-regexp)
;; now set their values
(setq parse-sexp-ignore-comments t
@@ -1179,5 +1174,5 @@
(cc-provide 'cc-mode)
-;;; arch-tag: 7825e5c4-fd09-439f-a04d-4c13208ba3d7
+;; arch-tag: 7825e5c4-fd09-439f-a04d-4c13208ba3d7
;;; cc-mode.el ends here