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

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

[nongnu] elpa/drupal-mode 5d4558342b 187/308: Added better paragraph fil


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode 5d4558342b 187/308: Added better paragraph filling.
Date: Tue, 25 Jan 2022 10:59:46 -0500 (EST)

branch: elpa/drupal-mode
commit 5d4558342b8a2f630d7ba20486cde37552cec113
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>

    Added better paragraph filling.
    
    Text fills better around Doxygen @param et al. and text in comments now
    do auto-fill.
    
    Fixes #5.
---
 drupal-mode.el | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/drupal-mode.el b/drupal-mode.el
index b085286d3c..2c84391532 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -163,6 +163,36 @@ Include path to the executable if it is not in your $PATH."
   :type '(repeat symbol)
   :group 'drupal)
 
+(defcustom drupal-enable-auto-fill-mode t
+  "Whether to use `auto-fill-mode' Drupal PHP buffers.
+Drupal mode will only do auto fill in comments (auto filling code
+is not nice).
+
+If `Yes' enable `auto-fill-mode' in Drupal PHP mode buffers.
+If `No' don't enable `auto-fill-mode' in Drupal PHP mode buffers 
(`auto-fill-mode' can still be enabled by other settings)."
+  :type `(choice
+          :tag "Enable `auto-fill-mode'."
+          (const :tag "Yes" t)
+          (const :tag "No" nil))
+  :link '(variable-link comment-auto-fill-only-comments)
+  :group 'drupal)
+
+(defcustom drupal-paragraph-separate "^[ 
\t]*\\(\\(/[/\\*]+\\)\\|\\(\\*+/\\)\\|\\(\\*?\\)\\|\\(\\*?[ 
\t]*@[[:alpha:]]+\\([ \t]+.*\\)?\\)\\)[ \t]*$"
+  "Regexp for beginning of a line that separates paragraphs.
+In Drupal mode we extend the regular `paragraph-separate' so we
+will get better filling in Doxygen comments."
+  :type 'regexp
+  :link '(variable-link paragraph-separate)
+  :group 'drupal)
+
+(defcustom drupal-paragraph-start (default-value 'drupal-paragraph-separate)
+  "Regexp for beginning of a line that starts OR separates paragraphs.
+In Drupal mode we extend the regular `paragraph-start' so we will
+get better filling in Doxygen comments."
+  :type 'regexp
+  :link '(variable-link paragraph-start)
+  :group 'drupal)
+
 
 
 (defvar drupal-version nil "Drupal version as auto detected.")
@@ -273,7 +303,16 @@ function arguments.")
     ;; Setup cc-mode style stuff.
     (when (derived-mode-p 'c-mode)
       (c-add-language 'drupal-mode 'c-mode)
-      (c-set-style "drupal"))))
+      (c-set-style "drupal"))
+
+    ;; Use `auto-fill' only in comments.
+    (when drupal-enable-auto-fill-mode
+      (set (make-local-variable 'comment-auto-fill-only-comments) t)
+      (auto-fill-mode 1))
+
+    ;; Improve filling in Doxygen comments.
+    (set (make-local-variable 'paragraph-separate) drupal-paragraph-separate)
+    (set (make-local-variable 'paragraph-start) drupal-paragraph-start)))
 
 
 



reply via email to

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