Trent W. Buck <trentb...@gmail.com> wrote:

> On Mon, Feb 23, 2009 at 11:56:03AM -0500, Peter S Galbraith wrote:
> > I'm sorry that this bug is almost a year old now.  I can no longer
> > find the upstream author of apt-sources.el.  If he is off the grid,
> > I make simply take over the file.  :-(
> 
> I started on this, but lost interest before getting it completely
> right.  See attached.

I think fontification of commments should be done through the syntax
table, which apt-sources.el lacked.  Attached patch is a start but other
fontification code will have to be modified.

Peter
*** /usr/share/emacs/site-lisp/debian-el/apt-sources.el	2003-12-11 15:27:43.000000000 -0500
--- /home/psg/apt-sources.el	2009-03-02 10:23:36.000000000 -0500
***************
*** 73,78 ****
--- 73,80 ----
  
  ;;; History:
  
+ ;; 0.9.9 Peter S. Galbraith <p...@debian.org>
+ ;;       -- Create syntax table and add comments.
  ;; 0.9.8 -- Remove dependancy to autoinsert, because it's no longer required.
  ;;           (suggested by Peter S. Galbraith <p...@debian.org>)
  ;; 0.9.7 -- Converted relevant defvar statements to defcustom, and added
***************
*** 155,160 ****
--- 157,172 ----
    :type 'string
    :group 'apt-sources)  
  
+ (defvar apt-sources-mode-syntax-table nil
+   "Syntax table used in apt-sources-mode buffers.")
+ (if apt-sources-mode-syntax-table
+     ()
+   (setq apt-sources-mode-syntax-table (make-syntax-table))
+ 
+   ;; Support # style comments
+   (modify-syntax-entry ?#  "<"  apt-sources-mode-syntax-table)
+   (modify-syntax-entry ?\n "> " apt-sources-mode-syntax-table))
+ 
  ;;Regexps for identifying source line parts for font-lock.
  (defvar apt-sources-font-lock-deb-regexp "\\(deb \\|deb-src \\)"
    "A regexp that matches 'deb' or 'deb-src' at the begining of line.")
***************
*** 258,263 ****
--- 270,276 ----
    ;;
    (set (make-local-variable 'comment-start) "#")
    (set (make-local-variable 'comment-start-skip) "#+ *")
+   (set-syntax-table apt-sources-mode-syntax-table)
    ;;
    (make-local-variable 'font-lock-defaults)
    (setq font-lock-defaults '(apt-sources-font-lock-keywords))

Reply via email to