On Wed, Aug 07, 2013 at 07:57:53AM -0400, Peter Eisentraut wrote:
> On 7/2/13 8:42 PM, Peter Eisentraut wrote:
> > Updated files with changes:
> > 
> > - adjusted fill-column to 78, per Noah
> > - added c-file-style, per Andrew
> > - support both "postgresql" and "postgres" directory names
> > - use defun instead of lambda, per Dimitri
> > - put Perl configuration back into emacs.samples, for Tom
> > 
> > I also added configuration of c-auto-align-backslashes as well as label
> > and statement-case-open to c-offsets-alist.  With those changes, the
> > result of indent-region is now very very close to pgindent, with the
> > main exception of the end-of-line de-indenting that pgindent does, which
> > nobody likes anyway.
> Did anyone have any outstanding concerns about this latest version?  I
> thought it looked ready to commit.

After upgrading to GNU Emacs 23.4.1 from a version predating directory-local
variables, I saw switch/case indentation go on the fritz.  My hooks were
issuing (c-set-style "postgresql"), but ".dir-locals.el" set it back to plain
"bsd" style.  The most-reasonable fix I found was to locally add c-file-style
to ignored-local-variables.  c-file-style is the only setting appearing in
both emacs.samples and .dir-locals.el with non-identical values, so it alone
calls for this treatment.  Behavior looks sane in both Emacs 21.4.1 and Emacs
24.3.1, the version extrema I have at hand.  Emacs 24.3.1 is fine without this
due to recent c-before-hack-hook changes, but this does no harm.  Shall I add
this workaround to emacs.samples?

Noah Misch
EnterpriseDB                                 http://www.enterprisedb.com
diff --git a/src/tools/editors/emacs.samples b/src/tools/editors/emacs.samples
index e469d55..a510afd 100644
--- a/src/tools/editors/emacs.samples
+++ b/src/tools/editors/emacs.samples
@@ -30,7 +30,12 @@
 (add-hook 'c-mode-hook
           (defun postgresql-c-mode-hook ()
             (when (string-match "/postgres\\(ql\\)?/" buffer-file-name)
-              (c-set-style "postgresql"))))
+              (c-set-style "postgresql")
+              ;; Don't override the style we just set with the style in
+              ;; `dir-locals-file'.  Emacs 23.4.1 needs this; it is obsolete,
+              ;; albeit harmless, by Emacs 24.3.1.
+              (set (make-local-variable 'ignored-local-variables)
+                   (append '(c-file-style) ignored-local-variables)))))
 ;;; Perl files
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to