[PATCH] lisp: drop if from lw

9 views
Skip to first unread message

Wolf

unread,
Oct 11, 2022, 4:58:02 AM10/11/22
to vim...@vim.org, Wolf
Currently if indents like:

(if #t
a
b)

That seems to be bit unusual, so this commit drops if from the default
lw, leading to expected indentation of:

(if #t
a
b)

Old behavior can be restored by putting if back into lw.
---
This can be changed in .vimrc, so arguable not a necessary change. But
as a newcomer to lisp it took me a while to figure out why vim formats
it differently compared to literally any textbook or tutorial I've
managed to found.

src/option.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/option.h b/src/option.h
index ebbf94b06..2eae89db4 100644
--- a/src/option.h
+++ b/src/option.h
@@ -376,7 +376,7 @@ typedef enum {
#define CULOPT_SCRLINE 0x02 // Highlight screen line
#define CULOPT_NBR 0x04 // Highlight Number column

-#define LISPWORD_VALUE "defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object"
+#define LISPWORD_VALUE "defun,define,defmacro,set!,lambda,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object"

/*
* The following are actual variables for the options
--
2.36.2

Bram Moolenaar

unread,
Oct 11, 2022, 6:39:19 AM10/11/22
to vim...@googlegroups.com, Wolf, vim...@vim.org

> Currently if indents like:
>
> (if #t
> a
> b)
>
> That seems to be bit unusual, so this commit drops if from the default
> lw, leading to expected indentation of:
>
> (if #t
> a
> b)
>
> Old behavior can be restored by putting if back into lw.
> ---
> This can be changed in .vimrc, so arguable not a necessary change. But
> as a newcomer to lisp it took me a while to figure out why vim formats
> it differently compared to literally any textbook or tutorial I've
> managed to found.

I hesitate to change an option value that has been like this for 20
years. It used to be built into the code until it was made an option,
so that you can change it to your liking.

Any other Lisp users have an opinion?

--
WOMAN: I didn't know we had a king. I thought we were an autonomous
collective.
DENNIS: You're fooling yourself. We're living in a dictatorship. A
self-perpetuating autocracy in which the working classes--
WOMAN: Oh there you go, bringing class into it again.
DENNIS: That's what it's all about if only people would--
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

ben.k...@gmail.com

unread,
Oct 12, 2022, 11:31:11 AM10/12/22
to vim_dev
Don't change it; it's (relatively) easy to `:setlocal lispwords-=if` for any relevant filetypes.
Reply all
Reply to author
Forward
0 new messages