unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Harald Hanche-Olsen <hanche@math.ntnu.no>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 20386@debbugs.gnu.org
Subject: bug#20386: 25.0.50; error when calling sgml-attributes and sgml-tag
Date: Fri, 24 Jul 2015 10:41:48 +0200	[thread overview]
Message-ID: <55B1FA4C.4040404@math.ntnu.no> (raw)
In-Reply-To: <55B1958F.8020806@yandex.ru>

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

Dmitry Gutov wrote:
>
> The changes look okay to me, but please resend them as an attachment,
> and make sure the patch is against the current master. I couldn't easily
> apply this one.

Okay. I did it that way because I wasn't sure if the bug tracker 
accepted attachments.

The attached patch is against the current master at this commit:

commit de576a55d8c47ffd2e24fca2d48ed99f298d4334
Author: Eli Zaretskii <eliz@gnu.org>
Date:   Fri Jul 24 10:47:05 2015 +0300

(Created with git format-patch.)
I hope it will work better.

– Harald

[-- Attachment #2: 0001-Fix-bug-20386.patch --]
[-- Type: text/plain, Size: 3658 bytes --]

From 196a5a1f1e1c48482b5a173add374e4c1a5471c8 Mon Sep 17 00:00:00 2001
From: Harald Hanche-Olsen <hanche@math.ntnu.no>
Date: Thu, 23 Jul 2015 18:09:44 +0200
Subject: [PATCH] Fix bug #20386

---
 lisp/skeleton.el            | 17 ++++++++++-------
 lisp/textmodes/sgml-mode.el | 14 +++++++++-----
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/lisp/skeleton.el b/lisp/skeleton.el
index d23488b..2c017dd 100644
--- a/lisp/skeleton.el
+++ b/lisp/skeleton.el
@@ -277,7 +277,8 @@ When done with skeleton, but before going back to `_'-point call
 (defun skeleton-read (prompt &optional initial-input recursive)
   "Function for reading a string from the minibuffer within skeletons.
 
-PROMPT must be a string or a form that evaluates to a string.
+PROMPT must be a string or a function that evaluates to a string.
+It may also be a form that evaluates to a string (deprecated).
 It may contain a `%s' which will be replaced by `skeleton-subprompt'.
 If non-nil second arg INITIAL-INPUT or variable `input' is a string or
 cons with index to insert before reading.  If third arg RECURSIVE is non-nil
@@ -306,12 +307,14 @@ automatically, and you are prompted to fill in the variable parts.")))
 	;; before point.
         (save-excursion (insert "\n")))
     (unwind-protect
-	(setq prompt (if (stringp prompt)
-			 (read-string (format prompt skeleton-subprompt)
-				      (setq initial-input
-					    (or initial-input
-						(symbol-value 'input))))
-		       (eval prompt)))
+	(setq prompt (cond ((stringp prompt)
+                            (read-string (format prompt skeleton-subprompt)
+                                         (setq initial-input
+                                               (or initial-input
+                                                   (symbol-value 'input)))))
+                           ((functionp prompt)
+                            (funcall prompt))
+                           (t (eval prompt))))
       (or eolp
 	  (delete-char 1))))
   (if (and recursive
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 2ffe9c1..6a14b52 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -759,9 +759,10 @@ If QUIET, do not print a message when there are no attributes for TAG."
 	    (insert ?\s)
 	    (insert (funcall skeleton-transformation-function
 			     (setq attribute
-				   (skeleton-read '(completing-read
-						    "Attribute: "
-						    alist)))))
+				   (skeleton-read (lambda ()
+                                                    (completing-read
+                                                     "Attribute: "
+                                                     alist))))))
 	    (if (string= "" attribute)
 		(setq i 0)
 	      (sgml-value (assoc (downcase attribute) alist))
@@ -1177,13 +1178,16 @@ See `sgml-tag-alist' for info about attribute rules."
     (if (and (eq (car alist) t) (not sgml-xml-mode))
 	(when (cdr alist)
 	  (insert "=\"")
-	  (setq alist (skeleton-read '(completing-read "Value: " (cdr alist))))
+	  (setq alist (skeleton-read (lambda ()
+                                       (completing-read
+                                        "Value: " (cdr alist)))))
 	  (if (string< "" alist)
 	      (insert alist ?\")
 	    (delete-char -2)))
       (insert "=\"")
       (if (cdr alist)
-          (insert (skeleton-read '(completing-read "Value: " alist)))
+          (insert (skeleton-read (lambda ()
+                                   (completing-read "Value: " alist))))
         (when (null alist)
           (insert (skeleton-read '(read-string "Value: ")))))
       (insert ?\"))))
-- 
2.4.5


  reply	other threads:[~2015-07-24  8:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-20 19:15 bug#20386: 25.0.50; error when calling sgml-attributes and sgml-tag Matt Lundin
2015-04-20 19:58 ` Dmitry Gutov
2015-04-27  5:00   ` Stefan Monnier
2015-04-27 21:58     ` Dmitry Gutov
2015-04-27 22:55       ` Stefan Monnier
2015-07-23 16:28 ` Harald Hanche-Olsen
2015-07-24  1:31   ` Dmitry Gutov
2015-07-24  8:41     ` Harald Hanche-Olsen [this message]
2015-07-24 16:30       ` Dmitry Gutov
2015-07-24 16:55         ` Harald Hanche-Olsen
2015-07-24 18:28           ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B1FA4C.4040404@math.ntnu.no \
    --to=hanche@math.ntnu.no \
    --cc=20386@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).