[PATCH] Add emacs-vala-mode

  • Done
  • quality assurance status badge
Details
2 participants
  • Liliana Marie Prikler
  • Vivien Kraus
Owner
unassigned
Submitted by
Vivien Kraus
Severity
normal
V
V
Vivien Kraus wrote on 15 Nov 2021 15:05
(address . bug-guix@gnu.org)
87pmr14ipx.fsf@planete-kraus.eu
Dear guix,

There’s a vala mode for emacs. It is not very useful, but it registers a
major mode that is then used as a placeholder for the Emacs Language
Server Protocol client. In fact, it’s not possible to activate Vala
support for LSP on emacs without a vala mode, and this is the only
implementation I know.

This is the result of importing from MELPA. The project is not very well
maintained, so it fails to build on a recent emacs (see
solution to fix this issue, I went away and reverted the multiline
support. It builds and is useful enough for LSP to kick in, so I
consider it fixed.

What do you think? Do you have a better fix?

Best regards,

Vivien
From 7c382e721c74c319abadb65eb9f0942a7cfe24e1 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Mon, 15 Nov 2021 13:57:18 +0000
Subject: [PATCH] gnu: Add emacs-vala-mode.

* gnu/packages/emacs-xyz (emacs-vala-mode): New variable.
* gnu/packages/patches/vala-mode-fix.patch: Add a vala-mode patch to disable
multiline string support.
* gnu/local.mk (dist_patch_DATA): Register the patch to disable multiline
string support.
---
gnu/local.mk | 1 +
gnu/packages/emacs-xyz.scm | 25 ++++++++++++
gnu/packages/patches/vala-mode-fix.patch | 48 ++++++++++++++++++++++++
3 files changed, 74 insertions(+)
create mode 100644 gnu/packages/patches/vala-mode-fix.patch

Toggle diff (101 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 5b21a6ee1b..139325c10b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1886,6 +1886,7 @@ dist_patch_DATA = \
%D%/packages/patches/ustr-fix-build-with-gcc-5.patch \
%D%/packages/patches/util-linux-tests.patch \
%D%/packages/patches/upower-builddir.patch \
+ %D%/packages/patches/vala-mode-fix.patch \
%D%/packages/patches/valgrind-enable-arm.patch \
%D%/packages/patches/vboot-utils-fix-format-load-address.patch \
%D%/packages/patches/vboot-utils-fix-tests-show-contents.patch \
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index ec0376442b..ac15d412c5 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -29989,3 +29989,28 @@ (define-public emacs-global-tags
wraps GNU Global calls and integration to editor using this API with
project.el and xref.el.")
(license license:gpl3+))))
+
+(define-public emacs-vala-mode
+ (package
+ (name "emacs-vala-mode")
+ (version "20201218.2109")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/rrthomas/vala-mode.git")
+ (commit "d696a8177e94c81ea557ad364a3b3dcc3abbc50f")))
+ (sha256
+ (base32 "0g5pdq757z9d8rk489n5ilhqipdc4i4sfkjwwrxyvgjlapjc04c0"))
+ (patches
+ (search-patches "vala-mode-fix.patch"))))
+ (build-system emacs-build-system)
+ (home-page "https://github.com/rrthomas/vala-mode")
+ (synopsis "Vala mode for Emacs")
+ (description
+ "This package provides a major mode for editing .vala and .vapi files in
+Emacs. See @url{http://live.gnome.org/Vala} for details about Vala language.
+
+This mode was based on Dylan Moonfire's @samp{csharp-mode}.
+")
+ (license license:gpl2+)))
diff --git a/gnu/packages/patches/vala-mode-fix.patch b/gnu/packages/patches/vala-mode-fix.patch
new file mode 100644
index 0000000000..0a50b0e362
--- /dev/null
+++ b/gnu/packages/patches/vala-mode-fix.patch
@@ -0,0 +1,48 @@
+From 68db3ae7410a7d89e606e1916240193b96ab335e Mon Sep 17 00:00:00 2001
+From: Vivien <vivien@pruneau.lan>
+Date: Mon, 15 Nov 2021 13:55:58 +0000
+Subject: [PATCH] Revert "vala-mode: support multiline strings"
+
+This reverts commit 671c287ba9cb81dcf6e9485e6ccc60bc2b7aba14.
+---
+ vala-mode.el | 17 -----------------
+ 1 file changed, 17 deletions(-)
+
+diff --git a/vala-mode.el b/vala-mode.el
+index 8c4da4c..22c6e49 100644
+--- a/vala-mode.el
++++ b/vala-mode.el
+@@ -259,14 +259,6 @@ casts and declarations are fontified. Used on level 2 and higher."
+ (c-lang-defconst c-opt-cpp-prefix
+ vala "\\s *#\\s *")
+
+-;; Support multiline strings
+-;;
+-;; FIXME: This allows any string to be multiline. Currently, c-mode only
+-;; supports a single-character prefix to denote a multiline string, so the
+-;; real fix will be harder.
+-(c-lang-defconst c-multiline-string-start-char
+- vala vala-multiline-strings)
+-
+ ;; Vala uses the following assignment operators
+ (c-lang-defconst c-assignment-operators
+ vala '("=" "*=" "/=" "%=" "+=" "-=" ">>=" "<<="
+@@ -428,15 +420,6 @@ casts and declarations are fontified. Used on level 2 and higher."
+ :type 'hook
+ :group 'c)
+
+-(defcustom vala-multiline-strings nil
+- "Whether to enable support for multiline strings.
+-
+-It can conflict with some other Emacs functionality, such as the
+-automatic insertion of closing quotes `electric-pair-mode'."
+- :type 'bool
+- :group 'vala)
+-
+-
+ ;;; The entry point into the mode
+ ;;;###autoload
+ (defun vala-mode ()
+--
+2.33.1
+
--
2.33.1
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCAAdFiEEq4yIHjMvkliPpwQnO7C8EjLYuCwFAmGSaToACgkQO7C8EjLY
uCz1AAwAndlr8i6KRkCD+9CK4Vb5FFVhdnyj9t8kQN0NYtX+Ov8PPab7imAj1pRV
NzBZ8Cfl6Az6n1bzpXb8cpaHL86JdRxXyejoBS7j9mGDMC6QAIbb8d5wb1o6AfnM
kwPs8BHsgtq5i4XnTvlmkAaXiLKmXhGaAHM9FOr5roukDuyvQ2sXUBdcAISGabRR
SLPVWjNMKqfgFcT1GhDNOQVyciHrxVzLVzKeGOJLrd8FmoaUfJm50SU496LMhPvC
lUMrltGst9byt/RW7n4U0OXjs2wkM3CV+oW0zEywWWAlt9bS6ODxXWbgsy25q/xf
XKy8HfaokU2DyPx/ox9dOURenYmwL9jdYpyupXCzP8QrCN1+J4Lks/+ZJTjgZSvA
jZyZ+hyfIgZ4fr28K0l3bQJbG76sD770HHZQQK51xK/2mvai6ux/nhT5kpzGoIJh
1KxXJmS0fn6iFP7r0EtC5lpv+nx5RO3lmBnV6GGbsRGkYeDSlTgYd9Ka7B/FwiAM
ntYTnMsg
=Zxjf
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 15 Nov 2021 20:42
93b000a9d4d893e23e7b55d306aa385eeca19c78.camel@gmail.com
Hi Vivien,

Am Montag, den 15.11.2021, 14:05 +0000 schrieb Vivien Kraus:
Toggle quote (3 lines)
> Dear guix,
>
> There’s a vala mode for emacs. It is not very useful
I'd beg to differ. Not opening Vala files in fundamental-mode is very
useful.

Toggle quote (1 lines)
> The project is not very well maintained
I've experienced the same. I previously used the melpa importer, so as
to not pollute upstream with it, but given that a patch is needed, we
might as well add it properly.

Toggle quote (5 lines)
> Since I don’t have a solution to fix this issue, I went away and
> reverted the multiline support. It builds and is useful enough for
> LSP to kick in, so I consider it fixed.
>
> What do you think? Do you have a better fix?
Given my superior knowledge of Emacs Lisp (just kidding), I'd guess the
order of declarations is wrong. Pull the defcustom before the other
thing and it ought to work.

Toggle quote (7 lines)
> + (version "20201218.2109")
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/rrthomas/vala-mode.git")
> + (commit "d696a8177e94c81ea557ad364a3b3dcc3abbc50f")))
Use the (let ((revision ...) (commit ...)) (package ...)) convention,
adding a note that upstream has no tagged release. Base version
appears to be "0.1"

Cheers
V
V
Vivien Kraus wrote on 15 Nov 2021 21:48
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 51869@debbugs.gnu.org)
878rxp3yuk.fsf@planete-kraus.eu
Hi!

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
Toggle quote (8 lines)
>> Since I don’t have a solution to fix this issue, I went away and
>> reverted the multiline support. It builds and is useful enough for
>> LSP to kick in, so I consider it fixed.
>>
>> What do you think? Do you have a better fix?
> Given my superior knowledge of Emacs Lisp (just kidding), I'd guess the
> order of declarations is wrong. Pull the defcustom before the other
> thing and it ought to work.
Unfortunately, it does not. I tried it, but it gives the same error
message. I’m a bit surprised, but reading the help entry for
c-lang-defconst, I see there is a lot of information about when things
are evaluated, so maybe someone smart can parse it and understand why we
can’t use the custom variable value.

Toggle quote (10 lines)
>> + (version "20201218.2109")
>> + (source
>> + (origin
>> + (method git-fetch)
>> + (uri (git-reference
>> + (url "https://github.com/rrthomas/vala-mode.git")
>> + (commit "d696a8177e94c81ea557ad364a3b3dcc3abbc50f")))
> Use the (let ((revision ...) (commit ...)) (package ...)) convention,
> adding a note that upstream has no tagged release. Base version
> appears to be "0.1"
I didn’t know that convention, so here is the updated patch, still
waiting for a convincing fix for the multiline strings issue.

Vivien
From 2912a84d86372cac6944f7661a028b108484c556 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Mon, 15 Nov 2021 13:57:18 +0000
Subject: [PATCH] gnu: Add emacs-vala-mode.

* gnu/packages/emacs-xyz (emacs-vala-mode): New variable.
* gnu/packages/patches/vala-mode-fix.patch: Add a vala-mode patch to disable
multiline string support.
* gnu/local.mk (dist_patch_DATA): Register the patch to disable multiline
string support.
---
gnu/local.mk | 1 +
gnu/packages/emacs-xyz.scm | 29 +++++++++++
.../patches/emacs-vala-mode-fix.patch | 48 +++++++++++++++++++
3 files changed, 78 insertions(+)
create mode 100644 gnu/packages/patches/emacs-vala-mode-fix.patch

Toggle diff (105 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 5b21a6ee1b..4a73e7cee1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1033,6 +1033,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-source-date-epoch.patch \
%D%/packages/patches/emacs-telega-path-placeholder.patch \
%D%/packages/patches/emacs-telega-test-env.patch \
+ %D%/packages/patches/emacs-vala-mode-fix.patch \
%D%/packages/patches/emacs-wordnut-require-adaptive-wrap.patch \
%D%/packages/patches/enjarify-setup-py.patch \
%D%/packages/patches/enlightenment-fix-setuid-path.patch \
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index ec0376442b..ff42b4d4d6 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -29989,3 +29989,32 @@ (define-public emacs-global-tags
wraps GNU Global calls and integration to editor using this API with
project.el and xref.el.")
(license license:gpl3+))))
+
+(define-public emacs-vala-mode
+ ;; Upstream has no tagged release.
+ (let ((commit "d696a8177e94c81ea557ad364a3b3dcc3abbc50f")
+ (revision "0"))
+ (package
+ (name "emacs-vala-mode")
+ (version (git-version "0.1" revision commit))
+ (home-page "https://github.com/rrthomas/vala-mode")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url home-page)
+ (commit commit)))
+ (sha256
+ (base32 "0g5pdq757z9d8rk489n5ilhqipdc4i4sfkjwwrxyvgjlapjc04c0"))
+ (patches
+ (search-patches "emacs-vala-mode-fix.patch"))))
+ (build-system emacs-build-system)
+ (synopsis "Vala mode for Emacs")
+ (description
+ "This package provides a major mode for editing .vala and .vapi files
+in Emacs. See @url{http://live.gnome.org/Vala} for details about Vala
+language.
+
+This mode was based on Dylan Moonfire's @samp{csharp-mode}.
+")
+ (license license:gpl2+))))
diff --git a/gnu/packages/patches/emacs-vala-mode-fix.patch b/gnu/packages/patches/emacs-vala-mode-fix.patch
new file mode 100644
index 0000000000..0a50b0e362
--- /dev/null
+++ b/gnu/packages/patches/emacs-vala-mode-fix.patch
@@ -0,0 +1,48 @@
+From 68db3ae7410a7d89e606e1916240193b96ab335e Mon Sep 17 00:00:00 2001
+From: Vivien <vivien@pruneau.lan>
+Date: Mon, 15 Nov 2021 13:55:58 +0000
+Subject: [PATCH] Revert "vala-mode: support multiline strings"
+
+This reverts commit 671c287ba9cb81dcf6e9485e6ccc60bc2b7aba14.
+---
+ vala-mode.el | 17 -----------------
+ 1 file changed, 17 deletions(-)
+
+diff --git a/vala-mode.el b/vala-mode.el
+index 8c4da4c..22c6e49 100644
+--- a/vala-mode.el
++++ b/vala-mode.el
+@@ -259,14 +259,6 @@ casts and declarations are fontified. Used on level 2 and higher."
+ (c-lang-defconst c-opt-cpp-prefix
+ vala "\\s *#\\s *")
+
+-;; Support multiline strings
+-;;
+-;; FIXME: This allows any string to be multiline. Currently, c-mode only
+-;; supports a single-character prefix to denote a multiline string, so the
+-;; real fix will be harder.
+-(c-lang-defconst c-multiline-string-start-char
+- vala vala-multiline-strings)
+-
+ ;; Vala uses the following assignment operators
+ (c-lang-defconst c-assignment-operators
+ vala '("=" "*=" "/=" "%=" "+=" "-=" ">>=" "<<="
+@@ -428,15 +420,6 @@ casts and declarations are fontified. Used on level 2 and higher."
+ :type 'hook
+ :group 'c)
+
+-(defcustom vala-multiline-strings nil
+- "Whether to enable support for multiline strings.
+-
+-It can conflict with some other Emacs functionality, such as the
+-automatic insertion of closing quotes `electric-pair-mode'."
+- :type 'bool
+- :group 'vala)
+-
+-
+ ;;; The entry point into the mode
+ ;;;###autoload
+ (defun vala-mode ()
+--
+2.33.1
+
--
2.33.1
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCAAdFiEEq4yIHjMvkliPpwQnO7C8EjLYuCwFAmGSzdMACgkQO7C8EjLY
uCznoAwAx+cQL25KM6ILyRbvdNDsveEVlhziBz3T7XXejIWKMxPBOKwwUZuOCfp1
DBFC64lSi4vRR6HvmLiB8nfFAwHlgg2Ez2Mw61sWSKMtaselZIFHDuTy5fANEWOh
ryLF+8mMoxGm+GcQ2g5UaeI7FYddvN6A2967RALc31AiTrmwMFB93DQ14vsV6akL
45pERrp7BbbJcDsEAj6yjWnkTbEpxS5AzgdaCYVN2HjoZk1Z+MNI9H1oHLV4h5Bm
RvvlLNF+9vYVLMcPsKTfO0npHV9U2tTRu1pzYXy3FqCECRXevoV9O5JNGoOUtVDk
6/X6BdpyNuBQct+/tpTqwqN4ulorIwS2vMn7YSFLRhEk2+VAKF/MXhPvJ07Ljs0w
SXsPbpSIC+heUlWLPl89DTCKrDtZ8ubv5ocKL+8xP+9vtI8wkkOtmtftlodFtWUj
4+9Wvh8isEofB656DX2facwtwjT/1oWy+APXKnbrO9afHScb+RmV7muG5udoaRBD
Mz5hR1d0
=Mh2T
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 16 Nov 2021 18:49
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)(address . 51869@debbugs.gnu.org)
b156e1627ae90851f49bb6c4e016cfa4b7566829.camel@gmail.com
Hi,

Am Montag, den 15.11.2021, 20:48 +0000 schrieb Vivien Kraus:
Toggle quote (14 lines)
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> > > Since I don’t have a solution to fix this issue, I went away and
> > > reverted the multiline support. It builds and is useful enough
> > > for LSP to kick in, so I consider it fixed.
> > >
> > > What do you think? Do you have a better fix?
> > Given my superior knowledge of Emacs Lisp (just kidding), I'd guess
> > the order of declarations is wrong. Pull the defcustom before the
> > other thing and it ought to work.
> Unfortunately, it does not. I tried it, but it gives the same error
> message. I’m a bit surprised, but reading the help entry for
> c-lang-defconst, I see there is a lot of information about when
> things are evaluated, so maybe someone smart can parse it and
> understand why we can’t use the custom variable value.
I investigated further and the thing at hand (multiline string support)
is currently buggy in CC-Mode anyway. There are plans to support all
kinds of multiline strings with a new API in an upcoming version,
however vala-mode is not yet written with that in mind. Given this
knowledge, I'd second your decision to disable multiline strings for
now.

Toggle quote (14 lines)
> > > + (version "20201218.2109")
> > > + (source
> > > + (origin
> > > + (method git-fetch)
> > > + (uri (git-reference
> > > + (url "https://github.com/rrthomas/vala-mode.git")
> > > + (commit
> > > "d696a8177e94c81ea557ad364a3b3dcc3abbc50f")))
> > Use the (let ((revision ...) (commit ...)) (package ...))
> > convention,
> > adding a note that upstream has no tagged release. Base version
> > appears to be "0.1"
> I didn’t know that convention, so here is the updated patch, still
> waiting for a convincing fix for the multiline strings issue.
I'd use our emacs sexp substitution tools to erase these defconsts and
defcustoms rather than a patch. Other than that LGTM.

Cheers
V
V
Vivien Kraus wrote on 16 Nov 2021 19:12
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 51869@debbugs.gnu.org)
874k8ct16t.fsf@planete-kraus.eu
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
Toggle quote (3 lines)
> I'd use our emacs sexp substitution tools to erase these defconsts and
> defcustoms rather than a patch. Other than that LGTM.

I didn’t know about this great macro! Here is an updated version.

Vivien
From 759b0437e5016e7c558a5a99e2831f419a3b0802 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Mon, 15 Nov 2021 13:57:18 +0000
Subject: [PATCH] gnu: Add emacs-vala-mode.

* gnu/packages/emacs-xyz (emacs-vala-mode): New variable.
---
gnu/packages/emacs-xyz.scm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)

Toggle diff (47 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 113471ae14..dadfa67ccf 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -29993,3 +29993,40 @@ (define-public emacs-global-tags
wraps GNU Global calls and integration to editor using this API with
project.el and xref.el.")
(license license:gpl3+))))
+
+(define-public emacs-vala-mode
+ ;; Upstream has no tagged release.
+ (let ((commit "d696a8177e94c81ea557ad364a3b3dcc3abbc50f")
+ (revision "0"))
+ (package
+ (name "emacs-vala-mode")
+ (version (git-version "0.1" revision commit))
+ (home-page "https://github.com/rrthomas/vala-mode")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url home-page)
+ (commit commit)))
+ (sha256
+ (base32 "0g5pdq757z9d8rk489n5ilhqipdc4i4sfkjwwrxyvgjlapjc04c0"))))
+ (build-system emacs-build-system)
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'disable-multiline-support
+ (lambda* (#:key inputs #:allow-other-keys)
+ (make-file-writable "vala-mode.el")
+ (emacs-substitute-sexps "vala-mode.el"
+ (";; Support multiline strings" 'disabled.)
+ ("(defcustom vala-multiline-strings nil"
+ "This variable is ignored.")))))))
+ (synopsis "Vala mode for Emacs")
+ (description
+ "This package provides a major mode for editing .vala and .vapi files
+in Emacs. See @url{http://live.gnome.org/Vala} for details about Vala
+language.
+
+This mode was based on Dylan Moonfire's @samp{csharp-mode}.
+")
+ (license license:gpl2+))))
--
2.33.1
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCAAdFiEEq4yIHjMvkliPpwQnO7C8EjLYuCwFAmGT9boACgkQO7C8EjLY
uCwKCwv/amZ/8cgRI4r3ypCW3FGKKJYPHtJdlG9nzfCY/dvYOxZdU7VWvca9/f8/
4Qh+9Op8CbdwKIVNGxpuJ+dA5WVO5DOkiQpR5RzhrnKZMKMP07ogXY1dsCPsTHPb
WHdAAzWK0bQUAp3fh5poOgxGyDDZTd6Yzpoq1iHtgbVkh2sCMIEdHc+rl6e7455i
dfMWCgmYgcQpFq4jrDSDPZ6+w6iZ9RLMJ0LLt+Ta1Dub6JKDcLCyjKm8GumYtZUJ
TUuuhb0LEssVOimARAmAbq6o1NkPju8noGJ+AQDDjKlayWGyRM2tRwSWpmF/Y7cx
viyxCARvFC5TvP/Eag1twI/irH63nzZV7xLz7L2UHgsYEHJT37WSgqDVVQBWoNi4
WYaNc2H+gBAym9F89h/ofvBvGUTIhUu8PJoH4ATa2dxY6M1VMHzcldMsgeRiJjM1
zQPK6R0NoW+Nxaz5hss42q8AGjsTGjdZh86h/TgBQz/iXw5RvcVn4cXe0h+zLsEV
4lJnn3w8
=/o9i
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 16 Nov 2021 20:41
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)(address . 51869@debbugs.gnu.org)
8490cb54de7cc4b18ff7a66f36b0a226826ebbbb.camel@gmail.com
Hi,

Am Dienstag, den 16.11.2021, 18:12 +0000 schrieb Vivien Kraus:
Toggle quote (7 lines)
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url home-page)
> + (commit commit)))
Sorry, I didn't look close enough. Please avoid pulling home-page up,
it's not meant to be used as git-reference url.

Toggle quote (4 lines)
> + (emacs-substitute-sexps "vala-mode.el"
> + (";; Support multiline strings" 'disabled.)
> + ("(defcustom vala-multiline-strings nil"
> + "This variable is ignored.")))))))
This inserts mostly bogus into the file rather than killing the sexps
as it should. The payload for just killing the entire sexp which
starts with leading-regexp would be (if I constructed this correctly,
untested):
(progn (goto-char (point-min))
(re-search-forward ,leading-regexp)
(goto-char (match-beginning 0))
(kill-sexp))

Don't forget to basic-save-buffer :)

Cheers
V
V
Vivien Kraus wrote on 16 Nov 2021 20:48
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 51869@debbugs.gnu.org)
87zgq3svut.fsf@planete-kraus.eu
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
Toggle quote (2 lines)
> Please avoid pulling home-page up, it's not meant to be used as
> git-reference url.
OK.

Toggle quote (7 lines)
>> + (emacs-substitute-sexps "vala-mode.el"
>> + (";; Support multiline strings" 'disabled.)
>> + ("(defcustom vala-multiline-strings nil"
>> + "This variable is ignored.")))))))
> This inserts mostly bogus into the file rather than killing the sexps
> as it should.

The first substitution fully kills the whole sexp (and inserts a comment
that reads "Support for multiline strings disabled." if you don’t read
too closely ^^). It’s true that the second does not kill the defcustom
expansion, but since it’s part of the intended public API, I’m not so
sure we should remove it altogether. I think it’s clearer for the user
that way, because the two modifications are kind of documented in the
source.

Also, it’s shorter.

Anyway, Here are the two versions, you decide.

Vivien
From c0726be413991eab7b16ca0bebf42cc8eab616e1 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Mon, 15 Nov 2021 13:57:18 +0000
Subject: [PATCH] gnu: Add emacs-vala-mode.

* gnu/packages/emacs-xyz (emacs-vala-mode): New variable.
---
gnu/packages/emacs-xyz.scm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)

Toggle diff (47 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 113471ae14..61d780c72b 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -29993,3 +29993,40 @@ (define-public emacs-global-tags
wraps GNU Global calls and integration to editor using this API with
project.el and xref.el.")
(license license:gpl3+))))
+
+(define-public emacs-vala-mode
+ ;; Upstream has no tagged release.
+ (let ((commit "d696a8177e94c81ea557ad364a3b3dcc3abbc50f")
+ (revision "0"))
+ (package
+ (name "emacs-vala-mode")
+ (version (git-version "0.1" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/rrthomas/vala-mode")
+ (commit commit)))
+ (sha256
+ (base32 "0g5pdq757z9d8rk489n5ilhqipdc4i4sfkjwwrxyvgjlapjc04c0"))))
+ (build-system emacs-build-system)
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'disable-multiline-support
+ (lambda* (#:key inputs #:allow-other-keys)
+ (make-file-writable "vala-mode.el")
+ (emacs-substitute-sexps "vala-mode.el"
+ (";; Support multiline strings" 'disabled.)
+ ("(defcustom vala-multiline-strings nil"
+ "This variable is ignored.")))))))
+ (home-page "https://github.com/rrthomas/vala-mode")
+ (synopsis "Vala mode for Emacs")
+ (description
+ "This package provides a major mode for editing .vala and .vapi files
+in Emacs. See @url{http://live.gnome.org/Vala} for details about Vala
+language.
+
+This mode was based on Dylan Moonfire's @samp{csharp-mode}.
+")
+ (license license:gpl2+))))
--
2.33.1
From f1d594081881e42a273dfd0d857f0af41615270d Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Mon, 15 Nov 2021 13:57:18 +0000
Subject: [PATCH] gnu: Add emacs-vala-mode.

* gnu/packages/emacs-xyz (emacs-vala-mode): New variable.
---
gnu/packages/emacs-xyz.scm | 43 ++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)

Toggle diff (53 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 113471ae14..9be6a306e1 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -29993,3 +29993,46 @@ (define-public emacs-global-tags
wraps GNU Global calls and integration to editor using this API with
project.el and xref.el.")
(license license:gpl3+))))
+
+(define-public emacs-vala-mode
+ ;; Upstream has no tagged release.
+ (let ((commit "d696a8177e94c81ea557ad364a3b3dcc3abbc50f")
+ (revision "0"))
+ (package
+ (name "emacs-vala-mode")
+ (version (git-version "0.1" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/rrthomas/vala-mode")
+ (commit commit)))
+ (sha256
+ (base32 "0g5pdq757z9d8rk489n5ilhqipdc4i4sfkjwwrxyvgjlapjc04c0"))))
+ (build-system emacs-build-system)
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'disable-multiline-support
+ (lambda* (#:key inputs #:allow-other-keys)
+ (make-file-writable "vala-mode.el")
+ (emacs-batch-edit-file "vala-mode.el"
+ '(progn
+ (goto-char (point-min))
+ (re-search-forward ";; Support multiline strings")
+ (move-beginning-of-line 1)
+ (kill-sexp)
+ (re-search-forward "vala-multiline-strings")
+ (backward-up-list)
+ (kill-sexp)
+ (basic-save-buffer))))))))
+ (home-page "https://github.com/rrthomas/vala-mode")
+ (synopsis "Vala mode for Emacs")
+ (description
+ "This package provides a major mode for editing .vala and .vapi files
+in Emacs. See @url{http://live.gnome.org/Vala} for details about Vala
+language.
+
+This mode was based on Dylan Moonfire's @samp{csharp-mode}.
+")
+ (license license:gpl2+))))
--
2.33.1
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCAAdFiEEq4yIHjMvkliPpwQnO7C8EjLYuCwFAmGUELoACgkQO7C8EjLY
uCypJwwAys82csKgnWBdruHaBV0ApB+DZQ1D8eorpWMjyiKkW83AElytEOhuKqq/
Y/zNbwh4Jcmwy7/lOHZnzk6F/4dheIrvjOPC86B2EHyT4x95D6eDTbWdk7wyynfu
uVX8VD5FVdkV+X23G9pdLZ1n1gCQ2ZkOAfgSLpJyWr62uVtMoqCD1QTtoUb69grw
OCEBjIv+tXym3qUr4WbGmMyZsvZzNd9qY6zOuedc4HaNI8jUugdhYm3lbd37qXH1
WAFzGyRQ9PRNbvDUUylSN384gzasoVy4Y4k00LD2lNlRNQqVs8P4s+CTfgPw/dd2
+a5UXRZJ195x7Rwrwk9+U4Y0uYr0AN93vemox4NIHcBDW1NsmWStq1bR22xZmP01
dwtDcltsLeSHM+eioW7EOpivFX4IVcaYjOT3ABg68TxRTwGC0lpED+bnHgAecDWu
WXHd62zYgURv315kExjaJX5aGFpJUEbDnXkfB8gXhR44ER8zCJkFNbctGDIJ6TzS
knUim5ac
=ZIWX
-----END PGP SIGNATURE-----

L
L
Liliana Marie Prikler wrote on 17 Nov 2021 18:09
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)(address . 51869-done@debbugs.gnu.org)
3df08e59131fca25380c16ac697ef45076257b6b.camel@gmail.com
Hi,

Am Dienstag, den 16.11.2021, 19:48 +0000 schrieb Vivien Kraus:
Toggle quote (11 lines)
> > > + (emacs-substitute-sexps "vala-mode.el"
> > > + (";; Support multiline strings" 'disabled.)
> > > + ("(defcustom vala-multiline-strings nil"
> > > + "This variable is ignored.")))))))
> > This inserts mostly bogus into the file rather than killing the
> > sexps
> > as it should.
>
> The first substitution fully kills the whole sexp (and inserts a
> comment that reads "Support for multiline strings disabled." if you
> don’t read too closely ^^).
That was too sneaky for me :P

Toggle quote (6 lines)
> It’s true that the second does not kill the defcustom expansion, but
> since it’s part of the intended public API, I’m not so sure we should
> remove it altogether. I think it’s clearer for the user that way,
> because the two modifications are kind of documented in the source.
>
> Also, it’s shorter.
I'm pretty sure you can still use vala-multiline-strings inside a
custom-set-variables form, it will just do nothing as it ought to.

Toggle quote (1 lines)
> Anyway, Here are the two versions, you decide.
I rewrote your batch-edit version to be a little clearer and to leave
documented FIXMEs in the code. I pushed the rewrite, so you should now
be able to use emacs-vala-mode, with or without lsp.

Cheers
Closed
?