1 ;;; poe.el --- Portable Outfit for Emacsen; -*-byte-compile-dynamic: t;-*-
3 ;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <tomo@m17n.org>
6 ;; Keywords: emulation, compatibility, NEmacs, MULE, Emacs/mule, XEmacs
8 ;; This file is part of APEL (A Portable Emacs Library).
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; This modules does not includes MULE related features.
28 ;; MULE related features are supported by `poem'.
34 (put 'defun-maybe 'lisp-indent-function 'defun)
35 (defmacro defun-maybe (name &rest everything-else)
36 "Define NAME as a function if NAME is not defined.
37 See also the function `defun'."
38 (or (and (fboundp name)
39 (not (get name 'defun-maybe)))
40 (` (or (fboundp (quote (, name)))
42 (defun (, name) (,@ everything-else))
43 (put (quote (, name)) 'defun-maybe t))))))
45 (put 'defmacro-maybe 'lisp-indent-function 'defun)
46 (defmacro defmacro-maybe (name &rest everything-else)
47 "Define NAME as a macro if NAME is not defined.
48 See also the function `defmacro'."
49 (or (and (fboundp name)
50 (not (get name 'defmacro-maybe)))
51 (` (or (fboundp (quote (, name)))
53 (defmacro (, name) (,@ everything-else))
54 (put (quote (, name)) 'defmacro-maybe t))))))
56 (put 'defsubst-maybe 'lisp-indent-function 'defun)
57 (defmacro defsubst-maybe (name &rest everything-else)
58 "Define NAME as an inline function if NAME is not defined.
59 See also the macro `defsubst'."
60 (or (and (fboundp name)
61 (not (get name 'defsubst-maybe)))
62 (` (or (fboundp (quote (, name)))
64 (defsubst (, name) (,@ everything-else))
65 (put (quote (, name)) 'defsubst-maybe t))))))
67 (defmacro defalias-maybe (symbol definition)
68 "Define SYMBOL as an alias for DEFINITION if SYMBOL is not defined.
69 See also the function `defalias'."
70 (setq symbol (eval symbol))
71 (or (and (fboundp symbol)
72 (not (get symbol 'defalias-maybe)))
73 (` (or (fboundp (quote (, symbol)))
75 (defalias (quote (, symbol)) (, definition))
76 (put (quote (, symbol)) 'defalias-maybe t))))))
78 (defmacro defvar-maybe (name &rest everything-else)
79 "Define NAME as a variable if NAME is not defined.
80 See also the function `defvar'."
81 (or (and (boundp name)
82 (not (get name 'defvar-maybe)))
83 (` (or (boundp (quote (, name)))
85 (defvar (, name) (,@ everything-else))
86 (put (quote (, name)) 'defvar-maybe t))))))
88 (defmacro defconst-maybe (name &rest everything-else)
89 "Define NAME as a constant variable if NAME is not defined.
90 See also the function `defconst'."
91 (or (and (boundp name)
92 (not (get name 'defconst-maybe)))
93 (` (or (boundp (quote (, name)))
95 (defconst (, name) (,@ everything-else))
96 (put (quote (, name)) 'defconst-maybe t))))))
98 (defmacro defun-maybe-cond (name args &optional doc &rest everything-else)
100 (setq everything-else (cons doc everything-else)
102 (or (and (fboundp name)
103 (not (get name 'defun-maybe)))
104 (` (or (fboundp (quote (, name)))
106 (cond (,@ (mapcar (function
110 (` (defun (, name) (, args)
113 (` (defun (, name) (, args)
114 (,@ (cdr case))))))))
116 (put (quote (, name)) 'defun-maybe t))))))
118 (defmacro defmacro-maybe-cond (name args &optional doc &rest everything-else)
120 (setq everything-else (cons doc everything-else)
122 (or (and (fboundp name)
123 (not (get name 'defmacro-maybe)))
124 (` (or (fboundp (quote (, name)))
126 (cond (,@ (mapcar (function
130 (` (defmacro (, name) (, args)
133 (` (defmacro (, name) (, args)
134 (,@ (cdr case))))))))
136 (put (quote (, name)) 'defmacro-maybe t))))))
138 (defun subr-fboundp (symbol)
139 "Return t if SYMBOL's function definition is a built-in function."
140 (and (fboundp symbol)
141 (subrp (symbol-function symbol))))
143 (defconst-maybe emacs-major-version (string-to-int emacs-version))
144 (defconst-maybe emacs-minor-version
146 (substring emacs-version
147 (string-match (format "%d\\." emacs-major-version)
150 (cond ((featurep 'xemacs)
151 (require 'poe-xemacs)
153 ((string-match "XEmacs" emacs-version)
155 (require 'poe-xemacs)
157 ((> emacs-major-version 20))
158 ((= emacs-major-version 20)
159 (cond ((subr-fboundp 'string)
160 ;; Emacs 20.3 or later
162 ((subr-fboundp 'concat-chars)
163 ;; Emacs 20.1 or later
164 (defalias 'string 'concat-chars)
167 ((= emacs-major-version 19)
168 ;; XXX: should do compile-time and load-time check before loading
169 ;; "localhook". But, it is difficult since "localhook" is
170 ;; already loaded via "install" at compile-time. any idea?
171 (if (< emacs-minor-version 29)
172 (require 'localhook)))
175 ;; XXX: should do compile-time and load-time check before loading
176 ;; "localhook". But, it is difficult since "localhook" is
177 ;; already loaded via "install" at compile-time. any idea?
185 (defmacro def-edebug-spec (symbol spec)
186 (` (put (quote (, symbol)) 'edebug-form-spec (quote (, spec)))))
191 (def-edebug-spec defun-maybe defun)
192 (def-edebug-spec defmacro-maybe defmacro)
193 (def-edebug-spec defsubst-maybe defun)
195 ;;; Emacs 20.1 emulation
197 ;; imported from emacs-20.3/lisp/subr.el.
198 (defmacro-maybe when (cond &rest body)
199 "If COND yields non-nil, do BODY, else return nil."
200 (list 'if cond (cons 'progn body)))
202 ;; imported from emacs-20.3/lisp/subr.el.
203 (defmacro-maybe unless (cond &rest body)
204 "If COND yields nil, do BODY, else return nil."
205 (cons 'if (cons cond (cons nil body))))
208 ;;; @ Emacs 19.23 emulation
211 (defun-maybe minibuffer-prompt-width ()
212 "Return the display width of the minibuffer prompt."
214 (set-buffer (window-buffer (minibuffer-window)))
218 ;;; @ Emacs 19.29 emulation
221 (defvar-maybe path-separator ":"
222 "The directory separator in search paths, as a string.")
224 (defun-maybe buffer-substring-no-properties (start end)
225 "Return the characters of part of the buffer, without the text properties.
226 The two arguments START and END are character positions;
227 they can be in either order.
228 \[Emacs 19.29 emulating function]"
229 (let ((string (buffer-substring start end)))
230 (set-text-properties 0 (length string) nil string)
233 ;; imported from emacs-19.34/lisp/subr.el.
234 (defun-maybe match-string (num &optional string)
235 "Return string of text matched by last search.
236 NUM specifies which parenthesized expression in the last regexp.
237 Value is nil if NUMth pair didn't match, or there were less than NUM pairs.
238 Zero means the entire text matched by the whole regexp or whole string.
239 STRING should be given if the last search was by `string-match' on STRING.
240 \[Emacs 19.29 emulating function]"
241 (if (match-beginning num)
243 (substring string (match-beginning num) (match-end num))
244 (buffer-substring (match-beginning num) (match-end num)))))
246 (static-unless (or (featurep 'xemacs)
247 (>= emacs-major-version 20)
248 (and (= emacs-major-version 19)
249 (>= emacs-minor-version 29)))
250 ;; for Emacs 19.28 or earlier
251 (unless (fboundp 'si:read-string)
252 (fset 'si:read-string (symbol-function 'read-string))
253 (defun read-string (prompt &optional initial-input history)
254 "Read a string from the minibuffer, prompting with string PROMPT.
255 If non-nil, second arg INITIAL-INPUT is a string to insert before reading.
256 The third arg HISTORY, is dummy for compatibility.
257 See `read-from-minibuffer' for details of HISTORY argument."
258 (si:read-string prompt initial-input))
261 (defun-maybe rassoc (key list)
262 "Return non-nil if KEY is `equal' to the cdr of an element of LIST.
263 The value is actually the element of LIST whose cdr equals KEY.
264 \[Emacs 19.29 emulating function]"
267 (if (equal (cdr (car list)) key)
268 (throw 'found (car list)))
269 (setq list (cdr list)))))
271 ;; imported from emacs-19.34/lisp/files.el.
272 (defun-maybe file-name-sans-extension (filename)
273 "Return FILENAME sans final \"extension\".
274 The extension, in a file name, is the part that follows the last `.'.
275 \[Emacs 19.29 emulating function]"
277 (let ((file (file-name-sans-versions (file-name-nondirectory filename)))
279 (if (string-match "\\.[^.]*\\'" file)
280 (if (setq directory (file-name-directory filename))
281 (expand-file-name (substring file 0 (match-beginning 0))
283 (substring file 0 (match-beginning 0)))
287 ;;; @ Emacs 19.30 emulation
290 ;; imported from emacs-19.34/lisp/subr.el.
291 (defun-maybe add-to-list (list-var element)
292 "Add to the value of LIST-VAR the element ELEMENT if it isn't there yet.
293 The test for presence of ELEMENT is done with `equal'.
294 If you want to use `add-to-list' on a variable that is not defined
295 until a certain package is loaded, you should put the call to `add-to-list'
296 into a hook function that will be run only after loading the package.
297 `eval-after-load' provides one way to do this. In some cases
298 other hooks, such as major mode hooks, can do the job.
299 \[Emacs 19.30 emulating function]"
300 (or (member element (symbol-value list-var))
301 (set list-var (cons element (symbol-value list-var)))))
303 (cond ((fboundp 'insert-file-contents-literally))
304 ((boundp 'file-name-handler-alist)
305 (defun insert-file-contents-literally
306 (filename &optional visit beg end replace)
307 "Like `insert-file-contents', q.v., but only reads in the file.
308 A buffer may be modified in several ways after reading into the buffer due
309 to advanced Emacs features, such as file-name-handlers, format decoding,
310 find-file-hooks, etc.
311 This function ensures that none of these modifications will take place.
312 \[Emacs 19.30 emulating function]"
313 (let (file-name-handler-alist)
314 (insert-file-contents filename visit beg end replace)))
317 (defalias 'insert-file-contents-literally 'insert-file-contents)
321 ;;; @ Emacs 19.31 emulation
324 (defun-maybe buffer-live-p (object)
325 "Return non-nil if OBJECT is a buffer which has not been killed.
326 Value is nil if OBJECT is not a buffer or if it has been killed.
327 \[Emacs 19.31 emulating function]"
330 (buffer-name (get-buffer object))
333 ;; imported from emacs-19.34/lisp/window.el.
334 (defmacro-maybe save-selected-window (&rest body)
335 "Execute BODY, then select the window that was selected before BODY.
336 \[Emacs 19.31 emulating function]"
338 '((save-selected-window-window (selected-window)))
339 (list 'unwind-protect
341 (list 'select-window 'save-selected-window-window))))
344 ;;; @ Emacs 20.1 emulation
347 ;; imported from emacs-20.3/lisp/subr.el.
348 (defsubst-maybe caar (x)
349 "Return the car of the car of X."
352 ;; imported from emacs-20.3/lisp/subr.el.
353 (defsubst-maybe cadr (x)
354 "Return the car of the cdr of X."
357 ;; imported from emacs-20.3/lisp/subr.el.
358 (defsubst-maybe cdar (x)
359 "Return the cdr of the car of X."
362 ;; imported from emacs-20.3/lisp/subr.el.
363 (defsubst-maybe cddr (x)
364 "Return the cdr of the cdr of X."
367 ;; imported from emacs-20.3/lisp/subr.el.
368 (defun-maybe last (x &optional n)
369 "Return the last link of the list X. Its car is the last element.
370 If X is nil, return nil.
371 If N is non-nil, return the Nth-to-last link of X.
372 If N is bigger than the length of X, return X."
376 (setq m (1+ m) p (cdr p)))
378 (if (< n m) (nthcdr (- m n) x) x)))
383 ;; In Emacs 20.3, save-current-buffer is defined in src/editfns.c.
384 (defmacro-maybe save-current-buffer (&rest body)
385 "Save the current buffer; execute BODY; restore the current buffer.
386 Executes BODY just like `progn'."
387 (` (let ((orig-buffer (current-buffer)))
390 (if (buffer-live-p orig-buffer)
391 (set-buffer orig-buffer))))))
393 ;; imported from emacs-20.3/lisp/subr.el. (with macro style change)
394 (defmacro-maybe with-current-buffer (buffer &rest body)
395 "Execute the forms in BODY with BUFFER as the current buffer.
396 The value returned is the value of the last form in BODY.
397 See also `with-temp-buffer'."
398 (` (save-current-buffer
399 (set-buffer (, buffer))
402 ;; imported from emacs-20.3/lisp/subr.el. (with macro style change)
403 (defmacro-maybe with-temp-file (file &rest forms)
404 "Create a new buffer, evaluate FORMS there, and write the buffer to FILE.
405 The value of the last form in FORMS is returned, like `progn'.
406 See also `with-temp-buffer'."
407 (let ((temp-file (make-symbol "temp-file"))
408 (temp-buffer (make-symbol "temp-buffer")))
409 (` (let (((, temp-file) (, file))
411 (get-buffer-create (generate-new-buffer-name " *temp file*"))))
414 (with-current-buffer (, temp-buffer)
416 (with-current-buffer (, temp-buffer)
418 (write-region (point-min) (point-max) (, temp-file) nil 0)))
419 (and (buffer-name (, temp-buffer))
420 (kill-buffer (, temp-buffer))))))))
422 ;; imported from emacs-20.3/lisp/subr.el. (with macro style change)
423 (defmacro-maybe with-temp-buffer (&rest forms)
424 "Create a temporary buffer, and evaluate FORMS there like `progn'.
425 See also `with-temp-file' and `with-output-to-string'."
426 (let ((temp-buffer (make-symbol "temp-buffer")))
427 (` (let (((, temp-buffer)
428 (get-buffer-create (generate-new-buffer-name " *temp*"))))
430 (with-current-buffer (, temp-buffer)
432 (and (buffer-name (, temp-buffer))
433 (kill-buffer (, temp-buffer))))))))
435 (defmacro-maybe combine-after-change-calls (&rest body)
439 ;; imported from emacs-20.3/lisp/subr.el.
440 (defun-maybe functionp (object)
441 "Non-nil if OBJECT is a type of object that can be called as a function."
442 (or (subrp object) (byte-code-function-p object)
443 (eq (car-safe object) 'lambda)
444 (and (symbolp object) (fboundp object))))
446 ;; imported from emacs-20.3/lisp/emacs-lisp/cl.el.
447 (defun-maybe butlast (x &optional n)
448 "Returns a copy of LIST with the last N elements removed."
449 (if (and n (<= n 0)) x
450 (nbutlast (copy-sequence x) n)))
452 ;; imported from emacs-20.3/lisp/emacs-lisp/cl.el.
453 (defun-maybe nbutlast (x &optional n)
454 "Modifies LIST to remove the last N elements."
455 (let ((m (length x)))
459 (if (> n 0) (setcdr (nthcdr (- (1- m) n) x) nil))
462 ;; imported from XEmacs 21.
463 (defun-maybe split-string (string &optional pattern)
464 "Return a list of substrings of STRING which are separated by PATTERN.
465 If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
467 (setq pattern "[ \f\t\n\r\v]+"))
468 ;; The FSF version of this function takes care not to cons in case
469 ;; of infloop. Maybe we should synch?
470 (let (parts (start 0))
471 (while (string-match pattern string start)
472 (setq parts (cons (substring string start (match-beginning 0)) parts)
473 start (match-end 0)))
474 (nreverse (cons (substring string start) parts))))
476 ;; emulating char-before of Emacs 20.
477 (static-condition-case nil
478 ;; compile-time check.
480 ;; XXX: current make process requires this file at compile-time,
481 ;; so this test will be always success at compile-time.
483 ;; If our definition is found at compile-time, signal an error.
484 ;; XXX: should signal more specific error.
485 (if (get 'char-before 'defun-maybe)
487 (wrong-number-of-arguments ; Mule 1.*, 2.*.
489 (or (fboundp 'si:char-before)
491 (fset 'si:char-before (symbol-function 'char-before))
492 (put 'char-before 'defun-maybe t)
493 ;; takes IGNORED for backward compatibility.
494 (defun char-before (&optional pos ignored)
496 Return character in current buffer preceding position POS.
497 POS is an integer or a buffer pointer.
498 If POS is out of range, the value is nil."
499 (si:char-before (or pos (point)))))))
500 (void-function ; non-Mule.
502 (defun-maybe char-before (&optional pos)
504 Return character in current buffer preceding position POS.
505 POS is an integer or a buffer pointer.
506 If POS is out of range, the value is nil."
509 (and (= (goto-char pos) (point))
514 (error ; found our definition at compile-time.
518 (wrong-number-of-arguments ; Mule 1.*, 2.*.
519 (or (fboundp 'si:char-before)
521 (fset 'si:char-before (symbol-function 'char-before))
522 (put 'char-before 'defun-maybe t)
523 ;; takes IGNORED for backward compatibility.
524 (defun char-before (&optional pos ignored)
526 Return character in current buffer preceding position POS.
527 POS is an integer or a buffer pointer.
528 If POS is out of range, the value is nil."
529 (si:char-before (or pos (point)))))))
530 (void-function ; non-Mule.
531 (defun-maybe char-before (&optional pos)
533 Return character in current buffer preceding position POS.
534 POS is an integer or a buffer pointer.
535 If POS is out of range, the value is nil."
538 (and (= (goto-char pos) (point))
542 (preceding-char))))))))
544 ;; emulating char-after of Emacs 20.
545 (static-condition-case nil
546 ;; compile-time check.
548 ;; XXX: current make process requires this file at compile-time,
549 ;; so this test will be always success at compile-time.
551 ;; If our definition is found at compile-time, signal an error.
552 ;; XXX: should signal more specific error.
553 (if (get 'char-after 'defun-maybe)
555 (wrong-number-of-arguments ; v18, v19
557 (or (fboundp 'si:char-after)
559 (fset 'si:char-after (symbol-function 'char-after))
560 (put 'char-after 'defun-maybe t)
561 (defun char-after (&optional pos)
563 Return character in current buffer at position POS.
564 POS is an integer or a buffer pointer.
565 If POS is out of range, the value is nil."
566 (si:char-after (or pos (point)))))))
567 (void-function ; NEVER happen?
569 (defun-maybe char-after (&optional pos)
571 Return character in current buffer at position POS.
572 POS is an integer or a buffer pointer.
573 If POS is out of range, the value is nil."
576 (and (= (goto-char pos) (point))
581 (error ; found our definition at compile-time.
585 (wrong-number-of-arguments ; v18, v19
586 (or (fboundp 'si:char-after)
588 (fset 'si:char-after (symbol-function 'char-after))
589 (put 'char-after 'defun-maybe t)
590 (defun char-after (&optional pos)
592 Return character in current buffer at position POS.
593 POS is an integer or a buffer pointer.
594 If POS is out of range, the value is nil."
595 (si:char-after (or pos (point)))))))
596 (void-function ; NEVER happen?
597 (defun-maybe char-after (&optional pos)
599 Return character in current buffer at position POS.
600 POS is an integer or a buffer pointer.
601 If POS is out of range, the value is nil."
604 (and (= (goto-char pos) (point))
608 (following-char))))))))
611 ;;; @ Emacs 20.3 emulation
614 ;; imported from emacs-20.3/lisp/files.el.
615 (defvar-maybe temporary-file-directory
616 (file-name-as-directory
617 (cond ((memq system-type '(ms-dos windows-nt))
618 (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp"))
619 ((memq system-type '(vax-vms axp-vms))
620 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "SYS$SCRATCH:"))
622 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp"))))
623 "The directory for writing temporary files.")
625 (defun-maybe line-beginning-position (&optional n)
626 "Return the character position of the first character on the current line.
627 With argument N not nil or 1, move forward N - 1 lines first.
628 If scan reaches end of buffer, return that position.
629 This function does not move point."
631 (forward-line (1- (or n 1)))
634 (defun-maybe line-end-position (&optional n)
635 "Return the character position of the last character on the current line.
636 With argument N not nil or 1, move forward N - 1 lines first.
637 If scan reaches end of buffer, return that position.
638 This function does not move point."
640 (end-of-line (or n 1))
643 (defun-maybe string (&rest chars)
644 "Concatenate all the argument characters and make the result a string."
645 (mapconcat (function char-to-string) chars ""))
648 ;;; @ XEmacs emulation
651 (defun-maybe find-face (face-or-name)
652 "Retrieve the face of the given name.
653 If FACE-OR-NAME is a face object, it is simply returned.
654 Otherwise, FACE-OR-NAME should be a symbol. If there is no such face,
655 nil is returned. Otherwise the associated face object is returned.
656 \[XEmacs emulating function]"
657 (car (memq face-or-name (face-list))))
659 (defun-maybe point-at-bol (&optional n buffer)
660 "Return the character position of the first character on the current line.
661 With argument N not nil or 1, move forward N - 1 lines first.
662 If scan reaches end of buffer, return that position.
663 This function does not move point.
664 \[XEmacs emulating function]"
666 (if buffer (set-buffer buffer))
667 (forward-line (1- (or n 1)))
670 (defun-maybe point-at-eol (&optional n buffer)
671 "Return the character position of the last character on the current line.
672 With argument N not nil or 1, move forward N - 1 lines first.
673 If scan reaches end of buffer, return that position.
674 This function does not move point.
675 \[XEmacs emulating function]"
677 (if buffer (set-buffer buffer))
678 (end-of-line (or n 1))
681 (defsubst-maybe define-obsolete-function-alias (oldfun newfun)
682 "Define OLDFUN as an obsolete alias for function NEWFUN.
683 This makes calling OLDFUN equivalent to calling NEWFUN and marks OLDFUN
685 \[XEmacs emulating function]"
686 (defalias oldfun newfun)
687 (make-obsolete oldfun newfun))
689 (when (subr-fboundp 'read-event)
690 ;; for Emacs 19 or later
692 (defun-maybe-cond next-command-event (&optional event prompt)
693 "Read an event object from the input stream.
694 If EVENT is non-nil, it should be an event object and will be filled
695 in and returned; otherwise a new event object will be created and
697 If PROMPT is non-nil, it should be a string and will be displayed in
698 the echo area while this function is waiting for an event.
699 \[XEmacs emulating function]"
700 ((subr-fboundp 'string)
701 ;; for Emacs 20.3 or later
702 (read-event prompt t)
705 (if prompt (message prompt))
709 (defsubst-maybe character-to-event (ch)
710 "Convert keystroke CH into an event structure, replete with bucky bits.
711 Note that CH (the keystroke specifier) can be an integer, a character
712 or a symbol such as 'clear. [XEmacs emulating function]"
715 (defun-maybe event-to-character (event)
716 "Return the character approximation to the given event object.
717 If the event isn't a keypress, this returns nil.
718 \[XEmacs emulating function]"
719 (cond ((symbolp event)
720 ;; mask is (BASE-TYPE MODIFIER-BITS) or nil.
721 (let ((mask (get event 'event-symbol-element-mask)))
723 (let ((base (get (car mask) 'ascii-character)))
725 (logior base (car (cdr mask)))
727 ((integerp event) event)
732 ;;; @ MULE 2 emulation
735 (defun-maybe-cond cancel-undo-boundary ()
736 "Cancel undo boundary. [MULE 2.3 emulating function]"
737 ((boundp 'buffer-undo-list)
738 ;; for Emacs 19.7 or later
739 (if (and (consp buffer-undo-list)
741 (null (car buffer-undo-list)))
742 (setq buffer-undo-list (cdr buffer-undo-list))
745 ;; for anything older than Emacs 19.7.