emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sweeprolog e38825d0e2 066/166: ENHANCED: use a distinct fa


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog e38825d0e2 066/166: ENHANCED: use a distinct face for structured comments
Date: Fri, 30 Sep 2022 04:59:26 -0400 (EDT)

branch: elpa/sweeprolog
commit e38825d0e2dba7f89d34693ee5733011df6f6edb
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    ENHANCED: use a distinct face for structured comments
---
 README.org | 18 ++++++++++++++++++
 sweep.el   | 12 +++++++++---
 sweep.pl   |  3 +++
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index a72e9b2186..03c7b6afb2 100644
--- a/README.org
+++ b/README.org
@@ -261,6 +261,24 @@ Prolog terms to Elisp objects]]) and passed as a sole 
argument to the
 invoked Elisp function.  The =sweep_funcall/2= variant invokes the Elisp
 function without any arguments.
 
+* Editing Prolog code
+:PROPERTIES:
+:CUSTOM_ID: editing-prolog-code
+:END:
+
+#+CINDEX: sweep-mode
+#+FINDEX: sweep-mode
+#+VINDEX: sweep-mode
+=sweep= includes a dedicated major mode for reading and editing Prolog
+code, called =sweep-mode=.  To activate this mode in a buffer, type =M-x
+sweep-mode=.  To instruct Emacs to always open Prolog files in
+=sweep-mode=, modify the Emacs variable =auto-mode-alist= like so:
+
+#+begin_src emacs-lisp
+  (add-to-list 'auto-mode-alist '("\\.pl\\'"   . sweep-mode))
+  (add-to-list 'auto-mode-alist '("\\.plt\\'"  . sweep-mode))
+#+end_src
+
 * The Prolog top-level
 :PROPERTIES:
 :CUSTOM_ID: prolog-top-level
diff --git a/sweep.el b/sweep.el
index d081839c38..f71c3d4af4 100644
--- a/sweep.el
+++ b/sweep.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Eshel Yaron <me(at)eshelyaron(dot)com>
 ;; Keywords: prolog languages extensions
 ;; URL: https://git.sr.ht/~eshel/sweep
-;; Package-Version: 0.1.0
+;; Package-Version: 0.1.1
 ;; Package-Requires: ((emacs "27"))
 
 ;; This file is NOT part of GNU Emacs.
@@ -561,6 +561,11 @@ module name, F is a functor name and N is its arity."
          (arg (cddr args)))
     (with-silent-modifications
       (pcase arg
+        (`("comment" . ,k)
+         (put-text-property beg end 'font-lock-face
+                            (pcase k
+                              ("structured" sweep-structured-comment-face)
+                              (_ sweep-comment-face))))
         (`("head" . ,h)
          (put-text-property beg end 'font-lock-face
                             (pcase h
@@ -607,7 +612,6 @@ module name, F is a functor name and N is its arity."
         ("string"              (put-text-property beg end 'font-lock-face 
sweep-string-face))
         ("module"              (put-text-property beg end 'font-lock-face 
sweep-module-face))
         ("neck"                (put-text-property beg end 'font-lock-face 
sweep-neck-face))
-        ("comment"             (put-text-property beg end 'font-lock-face 
sweep-comment-face))
         ("hook"                (put-text-property beg end 'font-lock-face 
sweep-hook-face))
         ("qq_type"             (put-text-property beg end 'font-lock-face 
sweep-qq-type-face))
         ("qq_sep"              (put-text-property beg end 'font-lock-face 
sweep-qq-sep-face))
@@ -855,7 +859,9 @@ Interactively, a prefix arg means to prompt for BUFFER."
 
 (defvar-keymap sweep-mode-map
   :doc "Keymap for `sweep-mode'."
-  "C-c C-c" #'sweep-colourise-buffer)
+;;"C-c C-l" #'sweep-load-buffer
+  "C-c C-c" #'sweep-colourise-buffer
+  "C-c C-t" #'sweep-top-level)
 
 (defun sweep-indent-line ()
   (interactive)
diff --git a/sweep.pl b/sweep.pl
index a856240e57..a8e53b6aba 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -332,6 +332,9 @@ sweep_color_normalized_(Offset, syntax_error, 
[Message0,Start0-End0|_], ["syntax
     Start is Start0 + Offset,
     End   is End0   + Offset,
     atom_string(Message0, Message).
+sweep_color_normalized_(Offset, comment, [Kind0|_], ["comment"|Kind]) :-
+    !,
+    atom_string(Kind0, Kind).
 sweep_color_normalized_(_, Nom0, _, Nom) :-
     atom_string(Nom0, Nom).
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]