all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5417: Patch for animate.el bugs `animate-n-steps', `animate-sequence', `animate-birthday-present'
@ 2010-01-18 23:22 MON KEY
  2011-07-03 19:36 ` Lars Magne Ingebrigtsen
  2011-07-04 11:45 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: MON KEY @ 2010-01-18 23:22 UTC (permalink / raw)
  To: bug-gnu-emacs

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

This is a bug report regarding play/animate.el for:

variable `animate-n-steps'
function `animate-sequence'
function `animate-birthday-present'

As there are not any customization options for this package the docstring of
variable `animate-n-steps':

 "Number of steps to use `animate-string'."

should get the asterisk leadin docstring asterisk as presumably

 (user-variable-p 'animate-n-steps)

should evaluate to t. It currently does not.

The function `animate-sequence' switches to the buffer "*Animation*" by default.
The user should have some way to bind an alternate destination.

The function `animate-birthday-present' uses a default buffer "Sarah".
This is not a good default.
Also, it should capitalize the name in the returned animated strring.

The patch below attempt to address some of these concerns without resorting to
defcustom forms which understandably might be overkill given this packages
directory location e.g. /lisp/play/animate.el

Note, it adds a variable `*animation*'.


;;; ==============================

--- /quickfixes/lisp/play/animate.el.~99304~	2010-01-18 17:44:04.000000000 -0500
+++ /quickfixes/lisp/play/animate.el	2010-01-18 17:13:27.000000000 -0500
@@ -90,11 +90,15 @@
   (insert-char char 1))

 (defvar animate-n-steps 10
-  "Number of steps to use `animate-string'.")
+"*Number of steps `animate-string' will place a char before its last
position.")
+
+(defvar *animation* nil
+  "*String naming the default buffer for animations.
+When null animations dipslayed in the buffer named *Animation*.")

 ;;;###autoload
 (defun animate-string (string vpos &optional hpos)
-  "Display STRING starting at position VPOS, HPOS, using animation.
+  "Display STRING animations starting at position VPOS, HPOS.
 The characters start at randomly chosen places,
 and all slide in parallel to their final positions,
 passing through `animate-n-steps' positions before the final ones.
@@ -139,14 +143,20 @@

 ;;;###autoload
 (defun animate-sequence (list-of-strings space)
-  "Display strings from LIST-OF-STRING with animation in a new buffer.
-Strings will be separated from each other by SPACE lines."
+  "Display animation strings from LIST-OF-STRING with buffer *Animation*.
+Strings will be separated from each other by SPACE lines.
+When the variable `*animation*' is non-nil display animation in the
+buffer named by variable's value creating the buffer if one does not exist."
   (let ((vpos (/ (- (window-height)
 		    1 ;; For the mode-line
 		    (* (1- (length list-of-strings)) space)
 		    (length list-of-strings))
 		 2)))
-    (switch-to-buffer (get-buffer-create "*Animation*"))
+    (switch-to-buffer (get-buffer-create
+                       (if (and (bound-and-true-p *animation*)
+                                (stringp *animation*))
+                                *animation*
+                           (capitalize (symbol-name '*animation*)))))
     (erase-buffer)
     (sit-for 0)
     (while list-of-strings
@@ -156,19 +166,24 @@

 ;;;###autoload
 (defun animate-birthday-present (&optional name)
-  "Display one's birthday present in a new buffer.
-You can specify the one's name by NAME; the default value is \"Sarah\"."
-  (interactive (list (read-string "Name (default Sarah): "
-				  nil nil "Sarah")))
+  "Return a birthday present in the buffer *Birthday-Present*.
+When optional arg NAME is non-nil or called-interactively, prompt for
+NAME of birthday present receiver and return a birthday present in
+the buffer *Birthday-Present-for-Name*."
+  (interactive (list (read-string "Birthday present for: "
+				  nil nil)))
   ;; Make a suitable buffer to display the birthday present in.
-  (switch-to-buffer (get-buffer-create (format "*%s*" name)))
+  (switch-to-buffer (get-buffer-create (if name
+                                           (concat "*A-Present-for-"
(capitalize name) "*")
+                                           "*Birthday-Present*")))
   (erase-buffer)
   ;; Display the empty buffer.
   (sit-for 0)

-  (animate-string "Happy Birthday," 6)
-  (animate-string (format "%s" name) 7)
-
+  (if name
+      (animate-string "Happy Birthday," 6)
+      (animate-string "Happy Birthday" 6))
+  (when name (animate-string (format "%s" (capitalize name)) 7))
   (sit-for 1)

   (animate-string "You are my sunshine," 10 30)

;;; ==============================

[-- Attachment #2: animate.el.diff --]
[-- Type: application/octet-stream, Size: 3289 bytes --]


--- /quickfixes/lisp/play/animate.el.~99304~	2010-01-18 17:44:04.000000000 -0500
+++ /quickfixes/lisp/play/animate.el	2010-01-18 17:13:27.000000000 -0500
@@ -90,11 +90,15 @@
   (insert-char char 1))
 
 (defvar animate-n-steps 10
-  "Number of steps to use `animate-string'.")
+"*Number of steps `animate-string' will place a char before its last position.")
+
+(defvar *animation* nil
+  "*String naming the default buffer for animations.
+When null animations dipslayed in the buffer named *Animation*.")
 
 ;;;###autoload
 (defun animate-string (string vpos &optional hpos)
-  "Display STRING starting at position VPOS, HPOS, using animation.
+  "Display STRING animations starting at position VPOS, HPOS.
 The characters start at randomly chosen places,
 and all slide in parallel to their final positions,
 passing through `animate-n-steps' positions before the final ones.
@@ -139,14 +143,20 @@
 
 ;;;###autoload
 (defun animate-sequence (list-of-strings space)
-  "Display strings from LIST-OF-STRING with animation in a new buffer.
-Strings will be separated from each other by SPACE lines."
+  "Display animation strings from LIST-OF-STRING with buffer *Animation*.
+Strings will be separated from each other by SPACE lines. 
+When the variable `*animation*' is non-nil display animation in the
+buffer named by variable's value creating the buffer if one does not exist."
   (let ((vpos (/ (- (window-height)
 		    1 ;; For the mode-line
 		    (* (1- (length list-of-strings)) space)
 		    (length list-of-strings))
 		 2)))
-    (switch-to-buffer (get-buffer-create "*Animation*"))
+    (switch-to-buffer (get-buffer-create 
+                       (if (and (bound-and-true-p *animation*)
+                                (stringp *animation*))
+                                *animation*
+                           (capitalize (symbol-name '*animation*)))))
     (erase-buffer)
     (sit-for 0)
     (while list-of-strings
@@ -156,19 +166,24 @@
 
 ;;;###autoload
 (defun animate-birthday-present (&optional name)
-  "Display one's birthday present in a new buffer.
-You can specify the one's name by NAME; the default value is \"Sarah\"."
-  (interactive (list (read-string "Name (default Sarah): "
-				  nil nil "Sarah")))
+  "Return a birthday present in the buffer *Birthday-Present*.
+When optional arg NAME is non-nil or called-interactively, prompt for
+NAME of birthday present receiver and return a birthday present in
+the buffer *Birthday-Present-for-Name*."
+  (interactive (list (read-string "Birthday present for: "
+				  nil nil)))
   ;; Make a suitable buffer to display the birthday present in.
-  (switch-to-buffer (get-buffer-create (format "*%s*" name)))
+  (switch-to-buffer (get-buffer-create (if name 
+                                           (concat "*A-Present-for-" (capitalize name) "*")
+                                           "*Birthday-Present*")))
   (erase-buffer)
   ;; Display the empty buffer.
   (sit-for 0)
 
-  (animate-string "Happy Birthday," 6)
-  (animate-string (format "%s" name) 7)
-
+  (if name 
+      (animate-string "Happy Birthday," 6)
+      (animate-string "Happy Birthday" 6))
+  (when name (animate-string (format "%s" (capitalize name)) 7))
   (sit-for 1)
 
   (animate-string "You are my sunshine," 10 30)



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

* bug#5417: Patch for animate.el bugs `animate-n-steps', `animate-sequence', `animate-birthday-present'
  2010-01-18 23:22 bug#5417: Patch for animate.el bugs `animate-n-steps', `animate-sequence', `animate-birthday-present' MON KEY
@ 2011-07-03 19:36 ` Lars Magne Ingebrigtsen
  2011-07-04  2:41   ` Chong Yidong
  2011-07-04 11:45 ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-03 19:36 UTC (permalink / raw)
  To: MON KEY; +Cc: 5417

MON KEY <monkey@sandpframing.com> writes:

> This is a bug report regarding play/animate.el for:
>
> variable `animate-n-steps'
> function `animate-sequence'
> function `animate-birthday-present'

The patch looks OK to me.

It's over 10 lines, though, so the FSF needs copyright assignment papers
on file before I can apply the patch.

Do you have such papers on file with the FSF?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#5417: Patch for animate.el bugs `animate-n-steps', `animate-sequence', `animate-birthday-present'
  2011-07-03 19:36 ` Lars Magne Ingebrigtsen
@ 2011-07-04  2:41   ` Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2011-07-04  2:41 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 5417, MON KEY

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> It's over 10 lines, though, so the FSF needs copyright assignment papers
> on file before I can apply the patch.
>
> Do you have such papers on file with the FSF?

Yes, he has an assignment.






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

* bug#5417: Patch for animate.el bugs `animate-n-steps', `animate-sequence', `animate-birthday-present'
  2010-01-18 23:22 bug#5417: Patch for animate.el bugs `animate-n-steps', `animate-sequence', `animate-birthday-present' MON KEY
  2011-07-03 19:36 ` Lars Magne Ingebrigtsen
@ 2011-07-04 11:45 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-04 11:45 UTC (permalink / raw)
  To: MON KEY; +Cc: 5417

MON KEY <monkey@sandpframing.com> writes:

> The patch below attempt to address some of these concerns without resorting to
> defcustom forms which understandably might be overkill given this packages
> directory location e.g. /lisp/play/animate.el

I've now applied your patch, and fixed up the naming to match Emacs'
conventions.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

end of thread, other threads:[~2011-07-04 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18 23:22 bug#5417: Patch for animate.el bugs `animate-n-steps', `animate-sequence', `animate-birthday-present' MON KEY
2011-07-03 19:36 ` Lars Magne Ingebrigtsen
2011-07-04  2:41   ` Chong Yidong
2011-07-04 11:45 ` Lars Magne Ingebrigtsen

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.