all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#14770: 24.3.50; error in y-or-n-p
@ 2013-07-02 17:13 Shigeru Fukaya
  2013-07-02 19:07 ` Juanma Barranquero
  2013-07-03  3:14 ` Glenn Morris
  0 siblings, 2 replies; 3+ messages in thread
From: Shigeru Fukaya @ 2013-07-02 17:13 UTC (permalink / raw)
  To: 14770

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


y-or-n-p causes error when prompt argument is a null string.

Regards,
Shigeru

[-- Attachment #2: byte-opt.patch --]
[-- Type: application/octet-stream, Size: 1704 bytes --]

*** byte-opt.el	Fri Jun 14 19:32:39 2013
--- byte-opt.new.el	Wed Jul  3 01:48:29 2013
***************
*** 562,568 ****
  	     (if (and (get fn 'pure)
  		      (byte-optimize-all-constp args))
  		   (list 'quote (apply fn (mapcar #'eval args)))
! 	       (cons fn args)))))))
  
  (defun byte-optimize-all-constp (list)
    "Non-nil if all elements of LIST satisfy `macroexp-const-p"
--- 562,572 ----
  	     (if (and (get fn 'pure)
  		      (byte-optimize-all-constp args))
  		   (list 'quote (apply fn (mapcar #'eval args)))
! 	       (if (eq fn 'concat)
! 		   ;; Not all arguments are literals.
! 		   (cons fn (byte-optimize-concat-args args))
! 		 ;; Other than `concat'.
! 		 (cons fn args))))))))
  
  (defun byte-optimize-all-constp (list)
    "Non-nil if all elements of LIST satisfy `macroexp-const-p"
***************
*** 573,578 ****
--- 577,605 ----
        (setq list (cdr list)))
      constant))
  
+ (defun byte-optimize-concat-args (args)
+   ;;
+   ;; Convert arguments of `concat' such that adjacent successive
+   ;; literal arguments to one string, and remove null strings.
+   ;;
+   (let (newargs)
+     (while args
+       ;; loop for literals
+       (let (l)
+ 	(while (and args (macroexp-const-p (car args)))
+ 	  (push (car args) l)
+ 	  (setq args (cdr args)))
+ 	(when l
+ 	  (let ((s (apply #'concat (mapcar #'eval (nreverse l)))))
+ 	    ;; keep non-null string
+ 	    (unless (equal s "")
+ 	      (push s newargs)))))
+       ;; non-literal argument
+       (when args
+ 	(push (car args) newargs)
+ 	(setq args (cdr args))))
+     (nreverse newargs)))
+ 
  (defun byte-optimize-form (form &optional for-effect)
    "The source-level pass of the optimizer."
    ;;

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

end of thread, other threads:[~2013-07-03  3:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-02 17:13 bug#14770: 24.3.50; error in y-or-n-p Shigeru Fukaya
2013-07-02 19:07 ` Juanma Barranquero
2013-07-03  3:14 ` Glenn Morris

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.