diff options
author | psg <> | 2005-11-23 02:05:01 +0000 |
---|---|---|
committer | psg <> | 2005-11-23 02:05:01 +0000 |
commit | d9bffa79e333105305953014bc9f84daf2872cee (patch) | |
tree | 4551b5b2104616a92af1e4769df4603e1a7f2f30 | |
parent | 6b4e1f7b202d1de184dcd811f3ca2c7c8aa6fb2d (diff) |
dpkg-dev-el:
debian-control-mode.el: Make # the comment character.
Thanks to Romain Francoise for the suggestion (Closes: #339868).
-rw-r--r-- | debian-control-mode.el | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/debian-control-mode.el b/debian-control-mode.el index 53d075f..d46456e 100644 --- a/debian-control-mode.el +++ b/debian-control-mode.el @@ -1,12 +1,12 @@ ;;; debian-control-mode.el --- major mode for Debian control files ;; Copyright (C) 2001, 2003 Free Software Foundation, Inc. -;; Copyright (C) 2003, 2004 Peter S Galbraith <psg@debian.org> +;; Copyright (C) 2003, 2004, 2005 Peter S Galbraith <psg@debian.org> ;; Author: Colin Walters <walters@debian.org> ;; Maintainer: Peter S Galbraith <psg@debian.org> ;; Created: 29 Nov 2001 -;; Version: 0.8 +;; Version: 0.9 ;; X-RCS: $Id$ ;; Keywords: convenience @@ -32,6 +32,9 @@ ;;; Change Log: +;; V0.9 (2005-11-22) Peter S Galbraith <psg@debian.org> +;; - Make # the comment character. (Closes: #339868) + ;; V0.8 (2005-02-07) Peter S Galbraith <psg@debian.org> ;; - Change mouse-2 binding to C-mouse-2 (Closes: #293629) ;; - Fix debian-control-mode-bugs-mouse-click to create correct @@ -128,6 +131,16 @@ :type 'face :group 'debian-control) +(defvar debian-control-syntax-table nil + "Syntax table used in debian-control-mode buffers.") + +(if debian-control-syntax-table + () + (setq debian-control-syntax-table (make-syntax-table)) + ;; Support # style comments + (modify-syntax-entry ?# "<" debian-control-syntax-table) + (modify-syntax-entry ?\n "> " debian-control-syntax-table)) + ;; FIXME: As of policy 3.5.6.0, the allowed characters in a field name ;; are not specified. So we just go with "word constituent" or '-' ;; characters before a colon. @@ -195,8 +208,23 @@ (if (< emacs-major-version 21) (message "debian-control-mode only supports emacsen version >= 21; disabling features") (progn - (set (make-local-variable 'font-lock-defaults) - '((debian-control-font-lock-keywords) t)) + (set-syntax-table debian-control-syntax-table) + ;; Comments + (make-local-variable 'comment-start-skip) ;Need this for font-lock... + (setq comment-start-skip "\\(^\\|\\s-\\);?#+ *") ;;From perl-mode + (make-local-variable 'comment-start) + (make-local-variable 'comment-end) + (setq comment-start "#" + comment-end "") + + (make-local-variable 'font-lock-defaults) + (setq font-lock-defaults + '(debian-control-font-lock-keywords) + nil ;;; Keywords only? No, let it do syntax via table. + nil ;;; case-fold? + nil ;;; Local syntax table. + nil ;;; Use `backward-paragraph' ? No + ) (set (make-local-variable 'fill-paragraph-function) #'debian-control-mode-fill-paragraph) (make-local-variable 'after-change-functions) |