From 806f7bd6d7975e99376ac7b9d994c2ec6e958acc Mon Sep 17 00:00:00 2001 From: morioka Date: Thu, 17 Sep 1998 06:17:20 +0000 Subject: [PATCH] Move constant `emacs-minor-version', Emacs 19 emulating definitions and Emacs 19.29 emulating definitions from emu.el to poe.el. --- emu.el | 58 ---------------------------------------------------------- poe.el | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 58 deletions(-) diff --git a/emu.el b/emu.el index 5b3990a..827a04f 100644 --- a/emu.el +++ b/emu.el @@ -26,12 +26,6 @@ (require 'poe) -(defconst-maybe emacs-minor-version - (string-to-int - (substring emacs-version - (string-match (format "%d\\." emacs-major-version) - emacs-version)))) - (defvar running-emacs-18 (<= emacs-major-version 18)) (defvar running-xemacs (string-match "XEmacs" emacs-version)) @@ -132,58 +126,6 @@ and `default-mime-charset'." default-mime-charset))) -;;; @ Emacs 19 emulation -;;; - -(defun-maybe minibuffer-prompt-width () - "Return the display width of the minibuffer prompt." - (save-excursion - (set-buffer (window-buffer (minibuffer-window))) - (current-column))) - - -;;; @ Emacs 19.29 emulation -;;; - -(defvar path-separator ":" - "Character used to separate concatenated paths.") - -(defun-maybe buffer-substring-no-properties (start end) - "Return the characters of part of the buffer, without the text properties. -The two arguments START and END are character positions; -they can be in either order. [Emacs 19.29 emulating function]" - (let ((string (buffer-substring start end))) - (set-text-properties 0 (length string) nil string) - string)) - -(defun-maybe match-string (num &optional string) - "Return string of text matched by last search. -NUM specifies which parenthesized expression in the last regexp. - Value is nil if NUMth pair didn't match, or there were less than NUM pairs. -Zero means the entire text matched by the whole regexp or whole string. -STRING should be given if the last search was by `string-match' on STRING. -\[Emacs 19.29 emulating function]" - (if (match-beginning num) - (if string - (substring string (match-beginning num) (match-end num)) - (buffer-substring (match-beginning num) (match-end num))))) - -(or running-emacs-19_29-or-later - running-xemacs - ;; for Emacs 19.28 or earlier - (fboundp 'si:read-string) - (progn - (fset 'si:read-string (symbol-function 'read-string)) - - (defun read-string (prompt &optional initial-input history) - "Read a string from the minibuffer, prompting with string PROMPT. -If non-nil, second arg INITIAL-INPUT is a string to insert before reading. -The third arg HISTORY, is dummy for compatibility. [emu.el] -See `read-from-minibuffer' for details of HISTORY argument." - (si:read-string prompt initial-input)) - )) - - ;;; @ Emacs 19.30 emulation ;;; diff --git a/poe.el b/poe.el index d3e4d37..4e1d88e 100644 --- a/poe.el +++ b/poe.el @@ -73,6 +73,11 @@ ))) (defconst-maybe emacs-major-version (string-to-int emacs-version)) +(defconst-maybe emacs-minor-version + (string-to-int + (substring emacs-version + (string-match (format "%d\\." emacs-major-version) + emacs-version)))) (cond ((featurep 'xemacs) (require 'poe-xemacs) @@ -89,6 +94,60 @@ )) +;;; @ Emacs 19 emulation +;;; + +(defun-maybe minibuffer-prompt-width () + "Return the display width of the minibuffer prompt." + (save-excursion + (set-buffer (window-buffer (minibuffer-window))) + (current-column))) + + +;;; @ Emacs 19.29 emulation +;;; + +(defvar path-separator ":" + "Character used to separate concatenated paths.") + +(defun-maybe buffer-substring-no-properties (start end) + "Return the characters of part of the buffer, without the text properties. +The two arguments START and END are character positions; +they can be in either order. [Emacs 19.29 emulating function]" + (let ((string (buffer-substring start end))) + (set-text-properties 0 (length string) nil string) + string)) + +(defun-maybe match-string (num &optional string) + "Return string of text matched by last search. +NUM specifies which parenthesized expression in the last regexp. + Value is nil if NUMth pair didn't match, or there were less than NUM pairs. +Zero means the entire text matched by the whole regexp or whole string. +STRING should be given if the last search was by `string-match' on STRING. +\[Emacs 19.29 emulating function]" + (if (match-beginning num) + (if string + (substring string (match-beginning num) (match-end num)) + (buffer-substring (match-beginning num) (match-end num))))) + +(or (featurep 'xemacs) + (>= emacs-major-version 20) + (and (= emacs-major-version 19) + (>= emacs-minor-version 29)) + ;; for Emacs 19.28 or earlier + (fboundp 'si:read-string) + (progn + (fset 'si:read-string (symbol-function 'read-string)) + + (defun read-string (prompt &optional initial-input history) + "Read a string from the minibuffer, prompting with string PROMPT. +If non-nil, second arg INITIAL-INPUT is a string to insert before reading. +The third arg HISTORY, is dummy for compatibility. [emu.el] +See `read-from-minibuffer' for details of HISTORY argument." + (si:read-string prompt initial-input)) + )) + + ;;; @ end ;;; -- 1.7.10.4