The customization turned out to be not so difficult. Thanks for the
nudge and the (off-list) hints.
Patch attached.
On Fri, 2014-08-01 at 10:48 +0800, Elias Mårtenson wrote:
> Thank you. It's been applied.
>
>
> I would like to see the indentation amounts be a bit more
> configurable. I think designating multiple variables using defcustom
> for this is a better option.
>
>
> That said, isn't there another way in which a set of numbers can be
> edited from "customize"? What is your opinion?
>
>
> Regards,
> Elias
>
>
> On 1 August 2014 10:17, David B. Lamkins <[email protected]> wrote:
> Elias,
>
> I took the liberty of rewriting `gnu-apl--indent-this'.
>
> The function now takes indentation amounts from
> `gnu-apl--indent-amounts'; this variable specifies the
> indentation for
> header (between del and the first nonblank character; del is
> still
> flush-left), comment, label and other within a function.
>
> Everything outside a function is still flush-left.
>
> Patch attached.
>
>
>
diff --git a/gnu-apl-mode.el b/gnu-apl-mode.el
index 1a7a44b..765cd83 100644
--- a/gnu-apl-mode.el
+++ b/gnu-apl-mode.el
@@ -103,6 +103,17 @@ Enabling this option requires the use of at least GNU APL version 1.4
or the latest version from the subversion repository.")
;;;###autoload
+(defcustom gnu-apl-indent-amounts '(0 1 1 2)
+ "The amounts by which to indent lines within APL functions.
+The ∇s are always flush-left, as are all lines outside of functions."
+ :type '(list (integer :tag "Number of spaces after ∇ on header line")
+ (integer :tag "Number of spaces before comment line ")
+ (integer :tag "Number of spaces before label ")
+ (integer :tag "Number of space before other lines ")
+ )
+ :group 'gnu-apl)
+
+;;;###autoload
(defface gnu-apl-default
()
"Face used for APL buffers"
@@ -455,9 +466,6 @@ function or nil if the function could not be parsed."
(user-error "Incorrectly formatted function header"))
parsed)))
-(defvar gnu-apl--indent-amounts '(0 1 1 2)
- "Ident amount for header, comment, label and other.")
-
(defun gnu-apl--indent-this ()
"Indent a function, controlled by `gnu-apl--indent-amounts'.
Anything outside a function definition is not indented."
@@ -466,7 +474,7 @@ Anything outside a function definition is not indented."
(when (re-search-forward "\\=[ \t]*" nil t)
(replace-match "" nil nil)))
(destructuring-bind (i-header i-comment i-label i-other)
- gnu-apl--indent-amounts
+ gnu-apl-indent-amounts
(cond ((looking-at "∇")
(indent-to-column 0)
(re-search-forward "∇[ \t]*" nil t)