From: yamaoka Date: Mon, 10 Aug 1998 23:20:51 +0000 (+0000) Subject: emu-18.el(generate-new-buffer-name), emu-mule.el(write-region-as-raw-text-CRLF):... X-Git-Tag: apel-8_16~31 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=6b04fb836a847fd6a049aafc930741577d4aaf22;hp=40b0de25724facc957e87f705acb7c004ab5eced;p=elisp%2Fapel.git emu-18.el(generate-new-buffer-name), emu-mule.el(write-region-as-raw-text-CRLF): New functions. --- diff --git a/ChangeLog b/ChangeLog index 40266d5..4002c07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1998-08-11 Katsumi Yamaoka + + * 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 * emu-nemacs.el, emu-latin1.el (write-region-as-raw-text-CRLF): diff --git a/emu-18.el b/emu-18.el index 8261107..8ee121a 100644 --- 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 `', 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 ;;; diff --git a/emu-mule.el b/emu-mule.el index 9821aec..6be3828 100644 --- a/emu-mule.el +++ b/emu-mule.el @@ -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 ;;;