all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Support variable-unquoting syntax in bat-mode
@ 2018-03-14  8:37 Jostein Kjønigsen
  2018-03-14 14:15 ` Vladimir Panteleev
  2018-03-14 16:22 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Jostein Kjønigsen @ 2018-03-14  8:37 UTC (permalink / raw)
  To: emacs-devel, Vladimir Panteleev, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 1645 bytes --]

Hey everyone.

For those of us still stuck meddling with Windows batch-files, these
scripts are definitely not getting cleaner or smaller with time.
In such batch-files there are various ways to extract script-parameters
provided by the script/function caller. The most common syntax is
percentage + a numeral, that is %1 represents the first script/function
parameter. Etc.
But when parameters contains spaces, they have to be quoted by the
caller. The variable/parameter then contains the quote, and to
further process them inside your script, they typically need to be
unquoted first.
To do unquoting, you typically use the variable unquote syntax: %~1

In latest Emacs this syntax is not correctly highlighted.  Applying the
following patch seems to fix this:
diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el
index 102c318..b2edf64 100644
--- a/lisp/progmodes/bat-mode.el
+++ b/lisp/progmodes/bat-mode.el
@@ -84,7 +84,7 @@ bat-font-lock-keywords
          . 'bat-label-face)
         ("\\_<\\(defined\\|set\\)\\_>[ \t]*\\(\\(\\sw\\|\\s_\\)+\\)"
          (2 font-lock-variable-name-face))
-        ("%\\([^%~ \n]+\\)%?"
+        ("%\\([^% \n]+\\)%?"
          (1 font-lock-variable-name-face))

That seems to work for me, but ~ seems like a odd special case to put in
there in the first place, so I would assume it was intentionally put
there. Anyone have any background on this?
If not, does anyone object to this change? And if not, how do I get it
merged into master? :)
--
Regards
Jostein Kjønigsen

jostein@kjonigsen.net 🍵 jostein@gmail.com
https://jostein.kjonigsen.net


[-- Attachment #2: Type: text/html, Size: 2891 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-15 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-14  8:37 Support variable-unquoting syntax in bat-mode Jostein Kjønigsen
2018-03-14 14:15 ` Vladimir Panteleev
2018-03-14 16:22 ` Eli Zaretskii
2018-03-14 20:48   ` Jostein Kjønigsen
2018-03-15 13:25     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.