Abolish function `compile-apel-package'.
[elisp/apel.git] / emu-18.el
index 8261107..8ee121a 100644 (file)
--- a/emu-18.el
+++ b/emu-18.el
@@ -358,6 +358,25 @@ With optional non-nil ALL, force redisplay of all mode-lines.
   )
 
 
+;;; @ buffer
+;;;
+
+(defun-maybe generate-new-buffer-name (name &optional ignore)
+  "Return a string that is the name of no existing buffer based on NAME.
+If there is no live buffer named NAME, then return NAME.
+Otherwise modify name by appending `<NUMBER>', incrementing NUMBER
+until an unused name is found, and then return that name.
+Optional second argument IGNORE specifies a name that is okay to use
+\(if it is in the sequence to be tried)
+even if a buffer with that name exists."
+  (if (get-buffer name)
+      (let ((n 2) new)
+       (while (get-buffer (setq new (format "%s<%d>" name n)))
+         (setq n (1+ n)))
+       new)
+    name))
+
+
 ;;; @ end
 ;;;