emu-18.el(generate-new-buffer-name), emu-mule.el(write-region-as-raw-text-CRLF):...
authoryamaoka <yamaoka>
Mon, 10 Aug 1998 23:20:51 +0000 (23:20 +0000)
committeryamaoka <yamaoka>
Mon, 10 Aug 1998 23:20:51 +0000 (23:20 +0000)
ChangeLog
emu-18.el
emu-mule.el

index 40266d5..4002c07 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+1998-08-11  Katsumi Yamaoka   <yamaoka@jpl.org>
+
+       * emu-mule.el (write-region-as-raw-text-CRLF): New function.
+
+       * emu-18.el (generate-new-buffer-name): New function.
+       (Emacs 19 mulating function).
+
 1998-08-10  MORIOKA Tomohiko  <morioka@jaist.ac.jp>
 
        * emu-nemacs.el, emu-latin1.el (write-region-as-raw-text-CRLF):
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
 ;;;
 
index 9821aec..6be3828 100644 (file)
@@ -210,6 +210,20 @@ find-file-hooks, etc.
       ))
   )
 
+(defun write-region-as-raw-text-CRLF (start end filename
+                                           &optional append visit lockname)
+  "Like `write-region', q.v., but don't code conversion."
+  (let ((the-buf (current-buffer)))
+    (with-temp-buffer
+      (insert-buffer-substring the-buf start end)
+      (goto-char (point-min))
+      (while (re-search-forward "\\(\\=\\|[^\r]\\)\n" nil t)
+       (replace-match "\\1\r\n")
+       )
+      (let ((file-coding-system *noconv*))
+       (write-region (point-min)(point-max) filename append visit)
+       ))))
+
 
 ;;; @ MIME charset
 ;;;