GNU bug report logs - #7025
Viper's `viper-deflocalvar' macro doesn't indent properly

Previous Next

Package: emacs;

Reported by: Vegard Øye <vegard_oye <at> hotmail.com>

Date: Sun, 12 Sep 2010 15:38:03 UTC

Severity: wishlist

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7025 in the body.
You can then email your comments to 7025 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7025; Package emacs. (Sun, 12 Sep 2010 15:38:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vegard Øye <vegard_oye <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 12 Sep 2010 15:38:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vegard Øye <vegard_oye <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Viper's `viper-deflocalvar' macro doesn't indent properly
Date: Sun, 12 Sep 2010 15:46:46 +0200
The `viper-deflocalvar' macro in viper-init.el is used for defining
buffer-local variables. However, it doesn't indent properly:

    (viper-deflocalvar foo nil
                       "Docstring")

The following patch adds a `declare' statement to fix the indentation:

    (viper-deflocalvar foo nil
      "Docstring")

`viper-loop' suffers from the same problem, and is also fixed by the
patch. Furthermore, the patch adds syntax highlighting for
`viper-deflocalvar' and `viper-loop', so that they blend in with
`defvar' and `loop'.

Vegard

--- viper-init.el         2010-09-12 15:22:42.000000000 +0200
+++ viper-init-patched.el 2010-09-12 15:32:35.000000000 +0200
@@ -95,6 +95,10 @@
 ;;; Macros
 
 (defmacro viper-deflocalvar (var default-value &optional documentation)
+  "Define VAR as a buffer-local variable.
+DEFAULT-VALUE is the default value and DOCUMENTATION is the
+docstring. The variable becomes buffer-local whenever set."
+  (declare (indent defun))
   `(progn
     (defvar ,var ,default-value
       ,(format "%s\n\(buffer local\)" documentation))
@@ -102,11 +106,20 @@
 
 ;; (viper-loop COUNT BODY) Execute BODY COUNT times.
 (defmacro viper-loop (count &rest body)
+  (declare (indent defun))
   `(let ((count ,count))
     (while (> count 0)
       ,@body
       (setq count (1- count)))))
 
+(when (fboundp 'font-lock-add-keywords)
+  (font-lock-add-keywords
+   'emacs-lisp-mode
+   '(("(\\(viper-deflocalvar\\)\\>[ \f\t\n\r\v]*\\(\\sw+\\)?"
+      (1 font-lock-keyword-face)
+      (2 font-lock-variable-name-face nil t))
+     ("(\\(viper-loop\\)\\>" 1 font-lock-keyword-face))))
+
 (defmacro viper-buffer-live-p (buf)
   `(and ,buf (get-buffer ,buf) (buffer-name (get-buffer ,buf))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#7025; Package emacs. (Sun, 05 Aug 2012 09:02:02 GMT) Full text and rfc822 format available.

Message #8 received at 7025 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Vegard Øye <vegard_oye <at> hotmail.com>
Cc: 7025 <at> debbugs.gnu.org
Subject: Re: bug#7025: Viper's `viper-deflocalvar' macro doesn't indent
	properly
Date: Sun, 05 Aug 2012 16:53:47 +0800
Vegard Øye <vegard_oye <at> hotmail.com> writes:

> The `viper-deflocalvar' macro in viper-init.el is used for defining
> buffer-local variables. However, it doesn't indent properly:
>
>     (viper-deflocalvar foo nil
>                        "Docstring")
>
> The following patch adds a `declare' statement to fix the indentation

Thanks.  I've committed your patch to trunk, except for the font-lock
stuff (we don't generally provide font lock support for such
package-specific compatibility macros).




bug closed, send any further explanations to 7025 <at> debbugs.gnu.org and Vegard Øye <vegard_oye <at> hotmail.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 05 Aug 2012 09:02:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 02 Sep 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.