X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fsubr.el;h=94a607141ce2c9a6895e85cd43155704beccbf50;hb=19f3d076b847b61fae1f8313d588207cc0d41ab0;hp=e1a2a29499bf057927ca07004f38b21dc900e9a7;hpb=77dcef404dc78635f6ffa8f71a803d2bc7cc8921;p=chise%2Fxemacs-chise.git diff --git a/lisp/subr.el b/lisp/subr.el index e1a2a29..94a6071 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -294,10 +294,14 @@ Otherwise treat \\ in NEWTEXT string as special: If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (or pattern (setq pattern "[ \f\t\n\r\v]+")) - ;; The FSF version of this function takes care not to cons in case - ;; of infloop. Maybe we should synch? - (let (parts (start 0)) - (while (string-match pattern string start) + (let (parts (start 0) (len (length string))) + (if (string-match pattern string) + (setq parts (cons (substring string 0 (match-beginning 0)) parts) + start (match-end 0))) + (while (and (< start len) + (string-match pattern string (if (> start (match-beginning 0)) + start + (1+ start)))) (setq parts (cons (substring string start (match-beginning 0)) parts) start (match-end 0))) (nreverse (cons (substring string start) parts)))) @@ -614,6 +618,28 @@ If FUNCTION is not interactive, nil will be returned." (t (error "Non-funcallable object: %s" function)))) +;; This function used to be an alias to `buffer-substring', except +;; that FSF Emacs 20.4 added a BUFFER argument in an incompatible way. +;; The new FSF's semantics makes more sense, but we try to support +;; both for backward compatibility. +(defun buffer-string (&optional buffer old-end old-buffer) + "Return the contents of the current buffer as a string. +If narrowing is in effect, this function returns only the visible part +of the buffer. + +If BUFFER is specified, the contents of that buffer are returned. + +The arguments OLD-END and OLD-BUFFER are supported for backward +compatibility with pre-21.2 XEmacsen times when arguments to this +function were (buffer-string &optional START END BUFFER)." + (if (or (null buffer) + (bufferp buffer) + (stringp buffer)) + ;; The new way + (buffer-substring nil nil buffer) + ;; The old way + (buffer-substring buffer old-end old-buffer))) + ;; This was not present before. I think Jamie had some objections ;; to this, so I'm leaving this undefined for now. --ben @@ -656,6 +682,16 @@ FILE should be the name of a library, with no directory name." (eval-after-load file (read))) (make-compatible 'eval-next-after-load "") +(unless (featurep 'mule) + (defun make-char (charset &optional arg1 arg2) + "Make a character from CHARSET and octets ARG1 and ARG2. +This function is available for compatibility with Mule-enabled XEmacsen. +When CHARSET is `ascii', return (int-char ARG1). Otherwise, return +that value with the high bit set. ARG2 is always ignored." + (int-char (if (eq charset 'ascii) + arg1 + (logior arg1 #x80))))) + ; alternate names (not obsolete) (if (not (fboundp 'mod)) (define-function 'mod '%)) (define-function 'move-marker 'set-marker) @@ -667,6 +703,5 @@ FILE should be the name of a library, with no directory name." (define-function 'remove-directory 'delete-directory) (define-function 'set-match-data 'store-match-data) (define-function 'send-string-to-terminal 'external-debugging-output) -(define-function 'buffer-string 'buffer-substring) ;;; subr.el ends here