]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix edge case with single argument for rcirc-define-command
authorPhilip Kaludercic <philipk@posteo.net>
Tue, 15 Jun 2021 21:44:56 +0000 (23:44 +0200)
committerPhilip Kaludercic <philipk@posteo.net>
Tue, 15 Jun 2021 21:44:56 +0000 (23:44 +0200)
* rcirc.el (rcirc-define-command): Update regular expression generator

lisp/net/rcirc.el

index 4d98d65d58aa28def8d32976b48eaaa8ff2abe70..d4f0ccd47cde8b9336147e5e316aa562297767fe 100644 (file)
@@ -2403,12 +2403,12 @@ that, an interactive form can specified."
                    (insert "\\`")
                    (when arguments
                      (dotimes (_ (1- (length arguments)))
-                       (insert "\\(?:\\(.+?\\)"))
-                     (insert "\\(?:[[:space:]]+\\(.*\\)\\)")
+                       (insert "\\(?:\\(.+?\\)[[:space:]]+"))
                      (dotimes (i (1- (length arguments)))
-                       (when (< i optional)
-                         (insert "?"))
-                       (insert "\\)")))
+                       (if (< i optional)
+                           (insert "\\)?")
+                         (insert "\\)"))))
+                   (insert "\\(.*?\\)")
                    (insert "[[:space:]]*\\'")
                    (buffer-string)))
          (argument (gensym))