diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index dc465888f44..0f149f2b061 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog @@ -1,10 +1,115 @@ +2006-02-01 Bill Wohler + + * mh-alias.el (mh-alias-gecos-name): Use + mh-replace-regexp-in-string instead of replace-regexp-in-string. + (crm, multi-prompt): Use mh-require instead of require. + (mh-goto-address-find-address-at-point): Use + mh-line-beginning-position and mh-line-end-position instead of + line-beginning-position and line-end-position. Use + mh-match-string-no-properties instead of + match-string-no-properties. + + * mh-comp.el (mh-modify-header-field): Use + mh-line-beginning-position and mh-line-end-position instead of + line-beginning-position and line-end-position. + + * mh-compat.el (mailabbrev): Use mh-require instead of require. + (mh-assoc-string, mh-display-completion-list, mh-face-foreground) + (mh-face-background): Make docstring consistent. + (mh-require, mh-cancel-timer, mh-display-color-cells) + (mh-line-beginning-position, mh-line-end-position) + (mh-match-string-no-properties, mh-replace-regexp-in-string) + (mh-view-mode-enter): Move definition here from mh-xemacs.el and + add mh- prefix since compatibility functions should have our + package prefix (mh-) by Emacs convention and to avoid messing up + checks for the same functions in other packages. + + * mh-e.el (mh-compiling-flag): Move mh-xemacs-compiling-flag here + from mh-xemacs.el and rename. + (mh-xargs): Use mh-line-beginning-position and + mh-line-end-position instead of line-beginning-position and + line-end-position. + (mh-defface-compat): Use mh-display-color-cells instead of + display-color-cells. + + * mh-folder.el (which-func): Use mh-require instead of require. + + * mh-funcs.el (mh-list-folders): Use mh-view-mode-enter instead of + view-mode-enter. + + * mh-gnus.el (gnus-util, mm-bodies, mm-decode, mm-view, mml): Use + mh-require instead of require. + + * mh-letter.el (mh-letter-header-end, mh-letter-mode) + (mh-letter-next-header-field): Use mh-line-beginning-position and + mh-line-end-position instead of line-beginning-position and + line-end-position. + + * mh-limit.el (mh-subject-to-sequence-unthreaded): Use + mh-match-string-no-properties instead of + match-string-no-properties. + (mh-narrow-to-header-field): Use mh-line-beginning-position and + mh-line-end-position instead of line-beginning-position and + line-end-position. + + * mh-mime.el (mh-mime-inline-part, mh-mm-display-part) + (mh-mh-quote-unescaped-sharp, mh-mh-directive-present-p): Use + mh-line-beginning-position and mh-line-end-position instead of + line-beginning-position and line-end-position. + + * mh-search.el (which-func): Use mh-require instead of require. + (mh-make-pick-template, mh-index-visit-folder) + (mh-pick-parse-search-buffer, mh-swish-next-result) + (mh-mairix-next-result, mh-namazu-next-result) + (mh-pick-next-result, mh-grep-next-result) + (mh-index-create-imenu-index, mh-index-match-checksum) + (mh-md5sum-parser, mh-openssl-parser, mh-index-update-maps): Use + mh-line-beginning-position and mh-line-end-position instead of + line-beginning-position and line-end-position. + + * mh-seq.el (mh-list-sequences): Use mh-view-mode-enter instead of + view-mode-enter. + (mh-folder-size-flist, mh-parse-flist-output-line) + (mh-add-sequence-notation): Use mh-line-beginning-position and + mh-line-end-position instead of line-beginning-position and + line-end-position. + + * mh-show.el (mh-show-addr): Use mh-require instead of require. + + * mh-speed.el (mh-folder-speedbar-menu-items, mh-speed-toggle) + (mh-speed-view, mh-folder-speedbar-buttons) + (mh-speed-highlight, mh-speed-goto-folder) + (mh-speed-add-buttons, mh-speed-parse-flists-output) + (mh-speed-invalidate-map, mh-speedbar-change-expand-button-char) + (mh-speed-add-folder): Use mh-line-beginning-position and + mh-line-end-position instead of line-beginning-position and + line-end-position. + (mh-speed-flists): Use mh-cancel-timer instead of cancel-timer. + + * mh-thread.el (mh-thread-find-children) + (mh-thread-parse-scan-line, mh-thread-generate): Use + mh-line-beginning-position and mh-line-end-position instead of + line-beginning-position and line-end-position. + + * mh-utils.el (mh-colors-available-p): Use mh-display-color-cells + instead of display-color-cells. + (mh-folder-list): Use mh-replace-regexp-in-string instead of + replace-regexp-in-string. + (mh-sub-folders-actual, mh-letter-toggle-header-field-display): + Use mh-line-beginning-position and mh-line-end-position instead of + line-beginning-position and line-end-position. + + * mh-comp.el (mh-send-sub): Don't find components file in current + directory--this seems to have been a side-effect of commenting out + the use of an old mh-etc variable. Improve error message. + 2006-01-31 Bill Wohler * mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument since compatibility functions should have our package prefix (mh-) by Emacs convention and to avoid messing up checks for the same functions in other packages. Use explicit argument - instead of forming name by adding mh-e prefix so that one can grep + instead of forming name by adding mh- prefix so that one can grep and find the definition. * mh-alias.el (mh-alias-local-users, mh-alias-reload) diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el index 23af886c320..9dc2871241f 100644 --- a/lisp/mh-e/mh-alias.el +++ b/lisp/mh-e/mh-alias.el @@ -125,10 +125,10 @@ COMMA-SEPARATOR is non-nil." (setq res (match-string 1 res))) ;; Replace "&" with capitalized username (if (string-match "&" res) - (setq res (replace-regexp-in-string "&" (capitalize username) res))) + (setq res (mh-replace-regexp-in-string "&" (capitalize username) res))) ;; Remove " character (if (string-match "\"" res) - (setq res (replace-regexp-in-string "\"" "" res))) + (setq res (mh-replace-regexp-in-string "\"" "" res))) ;; If empty string, use username instead (if (string-equal "" res) (setq res username)) @@ -258,8 +258,8 @@ Blind aliases or users from /etc/passwd are not expanded." (t (mh-alias-ali alias)))) -(require 'crm nil t) ; completing-read-multiple -(require 'multi-prompt nil t) +(mh-require 'crm nil t) ; completing-read-multiple +(mh-require 'multi-prompt nil t) ;;;###mh-autoload (defun mh-read-address (prompt) @@ -606,12 +606,12 @@ filing messages." Then search backwards to beginning of line for the start of an e-mail address. If no e-mail address found, return nil." - (re-search-backward "[^-_A-z0-9.@]" (line-beginning-position) 'lim) + (re-search-backward "[^-_A-z0-9.@]" (mh-line-beginning-position) 'lim) (if (or (looking-at mh-address-mail-regexp) ; already at start (and (re-search-forward mh-address-mail-regexp - (line-end-position) 'lim) + (mh-line-end-position) 'lim) (goto-char (match-beginning 0)))) - (match-string-no-properties 0))) + (mh-match-string-no-properties 0))) (defun mh-alias-apropos (regexp) "Show all aliases or addresses that match a regular expression REGEXP." diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index 2377151eeb3..5d2730f4afa 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -1031,7 +1031,7 @@ discarded." (cond ((and overwrite-flag (mh-goto-header-field (concat field ":"))) (insert " " value) - (delete-region (point) (line-end-position))) + (delete-region (point) (mh-line-end-position))) ((and (not overwrite-flag) (mh-regexp-in-field-p (concat "\\b" value "\\b") field)) ;; Already there, do nothing. diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el index c60ae20d811..d726a85a38f 100644 --- a/lisp/mh-e/mh-compat.el +++ b/lisp/mh-e/mh-compat.el @@ -37,31 +37,60 @@ ;; macros we can retire. ;; Please use mh-gnus.el when providing compatibility with different -;; versions of Gnus and mh-xemacs.el for compatibility with XEmacs. +;; versions of Gnus. -;; Items are listed alphabetically. +;; Items are listed alphabetically (except for mh-require which is +;; needed by a lesser character). + +(require 'mh-acros) + +(mh-do-in-gnu-emacs + (defalias 'mh-require 'require)) + +(mh-do-in-xemacs + (defun mh-require (feature &optional filename noerror) + "If feature FEATURE is not loaded, load it from FILENAME. +If FEATURE is not a member of the list `features', then the feature +is not loaded; so load the file FILENAME. +If FILENAME is omitted, the printname of FEATURE is used as the file name. +If the optional third argument NOERROR is non-nil, +then return nil if the file is not found instead of signaling an error. + +Simulate NOERROR argument in XEmacs which lacks it." + (if (not (featurep feature)) + (if filename + (load filename noerror t) + (load (format "%s" feature) noerror t))))) (mh-defun-compat mh-assoc-string assoc-string (key list case-fold) "Like `assoc' but specifically for strings. Case is ignored if CASE-FOLD is non-nil. -This function added by MH-E for Emacs versions that lack -`assoc-string', introduced in Emacs 22." +This function is used by Emacs versions that lack `assoc-string', +introduced in Emacs 22." (if case-fold (assoc-ignore-case key list) (assoc key list))) -(require 'mailabbrev nil t) -(mh-defun-compat mh-mail-abbrev-make-syntax-table - mail-abbrev-make-syntax-table () - "Emacs 21 and XEmacs don't have this function." - nil) +;; For XEmacs. +(defalias 'mh-cancel-timer + (if (fboundp 'cancel-timer) + 'cancel-timer + 'delete-itimer)) + +(mh-defun-compat mh-display-color-cells display-color-cells (&optional display) + "Return the number of color cells supported by DISPLAY. +This function is used by XEmacs to always return 0 when compiling +to avoid compiling errors. Otherwise uses `device-color-cells'." + (if mh-compiling-flag + 0 + (device-color-cells display))) (defmacro mh-display-completion-list (completions &optional common-substring) "Display the list of COMPLETIONS. See documentation for `display-completion-list' for a description of the arguments COMPLETIONS and perhaps COMMON-SUBSTRING. -This macro added by MH-E for Emacs versions that lack a -COMMON-SUBSTRING argument, introduced in Emacs 22." +This macro is used by Emacs versions that lack a COMMON-SUBSTRING +argument, introduced in Emacs 22." (if (< emacs-major-version 22) `(display-completion-list ,completions) `(display-completion-list ,completions ,common-substring))) @@ -70,8 +99,8 @@ COMMON-SUBSTRING argument, introduced in Emacs 22." "Return the foreground color name of FACE, or nil if unspecified. See documentation for `face-foreground' for a description of the arguments FACE, FRAME, and perhaps INHERIT. -This macro added by MH-E for Emacs versions that lack an INHERIT -argument, introduced in Emacs 22." +This macro is used by Emacs versions that lack an INHERIT argument, +introduced in Emacs 22." (if (< emacs-major-version 22) `(face-foreground ,face ,frame) `(face-foreground ,face ,frame ,inherit))) @@ -80,12 +109,48 @@ argument, introduced in Emacs 22." "Return the background color name of face, or nil if unspecified. See documentation for `back-foreground' for a description of the arguments FACE, FRAME, and INHERIT. -This macro added by MH-E for Emacs versions that lack an INHERIT -argument, introduced in Emacs 22." +This macro is used by Emacs versions that lack an INHERIT argument, +introduced in Emacs 22." (if (< emacs-major-version 22) `(face-background ,face ,frame) `(face-background ,face ,frame ,inherit))) +;; For XEmacs. +(defalias 'mh-line-beginning-position + (if (fboundp 'line-beginning-position) + 'line-beginning-position + 'point-at-bol)) + +;; For XEmacs. +(defalias 'mh-line-end-position + (if (fboundp 'line-end-position) + 'line-end-position + 'point-at-eol)) + +(mh-require 'mailabbrev nil t) +(mh-defun-compat mh-mail-abbrev-make-syntax-table + mail-abbrev-make-syntax-table () + "Emacs 21 and XEmacs don't have `mail-abbrev-make-syntax-table'. +This function does nothing on those systems." + nil) + +(mh-defun-compat mh-match-string-no-properties + match-string-no-properties (num &optional string) + "Return string of text matched by last search, without text properties. +This function is used by XEmacs that lacks `match-string-no-properties'. +The function `buffer-substring-no-properties' is used instead. +The argument STRING is ignored." + (buffer-substring-no-properties + (match-beginning num) (match-end num))) + +(mh-defun-compat mh-replace-regexp-in-string replace-regexp-in-string + (rep string &optional fixedcase literal subexp start) + "Replace REGEXP with REP everywhere in STRING and return result. +This function is used by XEmacs that lacks `replace-regexp-in-string'. +The function `replace-in-string' is used instead. +The arguments FIXEDCASE, LITERAL, SUBEXP, and START are ignored." + (replace-in-string string regexp rep)) + ;; Copy of constant from url-util.el in Emacs 22; needed by Emacs 21. (if (not (boundp 'url-unreserved-chars)) (defconst mh-url-unresrved-chars @@ -111,6 +176,17 @@ This is a copy of `url-hexify-string' from url-util.el in Emacs (char-to-string char))) str "")) +(mh-defun-compat mh-view-mode-enter + view-mode-enter (&optional return-to exit-action) + "Enter View mode. +This function is used by XEmacs that lacks `view-mode-enter'. +The function `view-mode' is used instead. +The arguments RETURN-TO and EXIT-ACTION are ignored." + ;; Shush compiler. + (if return-to nil) + (if exit-action nil) + (view-mode 1)) + (defmacro mh-write-file-functions () "Return `write-file-functions' if it exists. Otherwise return `local-write-file-hooks'. diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el index 5b738933590..3b96575b3d4 100644 --- a/lisp/mh-e/mh-e.el +++ b/lisp/mh-e/mh-e.el @@ -101,7 +101,13 @@ (eval-and-compile (defvar mh-xemacs-flag (featurep 'xemacs) - "Non-nil means the current Emacs is XEmacs.")) + "Non-nil means the current Emacs is XEmacs.") + (defvar mh-compiling-flag nil + "Non-nil means we're compiling.")) + +(eval-when (compile) + (setq mh-compiling-flag t)) + (mh-do-in-xemacs (require 'mh-xemacs)) @@ -464,7 +470,8 @@ all the strings have been used." (let ((arg-list (reverse args)) (count 0)) (while (and (not (eobp)) (< count mh-index-max-cmdline-args)) - (push (buffer-substring-no-properties (point) (line-end-position)) + (push (buffer-substring-no-properties (point) + (mh-line-end-position)) arg-list) (incf count) (forward-line)) @@ -2970,7 +2977,7 @@ entirely if the display does not support the number of specified colors." (if mh-min-colors-defined-flag spec - (let ((cells (display-color-cells)) + (let ((cells (mh-display-color-cells)) new-spec) ;; Remove entries with min-colors, or delete them if we have fewer colors ;; than they specify. diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el index 5339363df19..59526986d35 100644 --- a/lisp/mh-e/mh-folder.el +++ b/lisp/mh-e/mh-folder.el @@ -516,7 +516,7 @@ font-lock is done highlighting.") (cons (current-buffer) nil))))) ;; Register mh-folder-mode as supporting which-function-mode... -(require 'which-func nil t) +(mh-require 'which-func nil t) (when (boundp 'which-func-modes) (add-to-list 'which-func-modes 'mh-folder-mode)) diff --git a/lisp/mh-e/mh-funcs.el b/lisp/mh-e/mh-funcs.el index 0565ed42e6b..f7abb4cb389 100644 --- a/lisp/mh-e/mh-funcs.el +++ b/lisp/mh-e/mh-funcs.el @@ -154,7 +154,7 @@ Display the results only if something went wrong." "-recurse" "-norecurse")) (goto-char (point-min)) - (view-mode-enter) + (mh-view-mode-enter) (setq view-exit-action 'kill-buffer) (message "Listing folders...done"))))) diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el index 8944db89f70..970f98556e2 100644 --- a/lisp/mh-e/mh-gnus.el +++ b/lisp/mh-e/mh-gnus.el @@ -32,11 +32,11 @@ (require 'mh-e) -(require 'gnus-util nil t) -(require 'mm-bodies nil t) -(require 'mm-decode nil t) -(require 'mm-view nil t) -(require 'mml nil t) +(mh-require 'gnus-util nil t) +(mh-require 'mm-bodies nil t) +(mh-require 'mm-decode nil t) +(mh-require 'mm-view nil t) +(mh-require 'mml nil t) ;; Copy of function from gnus-util.el. (mh-defun-compat mh-gnus-local-map-property gnus-local-map-property (map) diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index a5a7af24e91..c6af5c323a9 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -267,7 +267,7 @@ searching for `mh-mail-header-separator' in the buffer." (goto-char (point-min)) (cond ((equal mh-mail-header-separator "") (point-min)) ((search-forward (format "\n%s\n" mh-mail-header-separator) nil t) - (line-beginning-position 0)) + (mh-line-beginning-position 0)) (t (point-min))))) @@ -319,7 +319,7 @@ order). (set (make-local-variable 'mh-mail-header-separator) (save-excursion (goto-char (mh-mail-header-end)) - (buffer-substring-no-properties (point) (line-end-position)))) + (buffer-substring-no-properties (point) (mh-line-end-position)))) (make-local-variable 'mail-header-separator) (setq mail-header-separator mh-mail-header-separator) ;override sendmail.el (mh-set-help mh-letter-mode-help-messages) @@ -828,7 +828,7 @@ body." ((< (point) (progn (beginning-of-line) (re-search-forward mh-letter-header-field-regexp - (line-end-position) t) + (mh-line-end-position) t) (point))) (beginning-of-line)) (t (end-of-line))) diff --git a/lisp/mh-e/mh-limit.el b/lisp/mh-e/mh-limit.el index 68ec25a9470..7a90b890cad 100644 --- a/lisp/mh-e/mh-limit.el +++ b/lisp/mh-e/mh-limit.el @@ -211,7 +211,7 @@ Return number of messages put in the sequence: (string-equal "" (match-string 3))) (progn (message "No subject line") nil) - (let ((subject (match-string-no-properties 3)) + (let ((subject (mh-match-string-no-properties 3)) (list)) (if (> (length subject) mh-limit-max-subject-size) (setq subject (substring subject 0 mh-limit-max-subject-size))) @@ -219,7 +219,7 @@ Return number of messages put in the sequence: (if all (goto-char (point-min))) (while (re-search-forward mh-scan-subject-regexp nil t) - (let ((this-subject (match-string-no-properties 3))) + (let ((this-subject (mh-match-string-no-properties 3))) (if (> (length this-subject) mh-limit-max-subject-size) (setq this-subject (substring this-subject 0 mh-limit-max-subject-size))) @@ -310,7 +310,7 @@ The MH command pick is used to do the match." (while (not (eobp)) (let ((num (ignore-errors (string-to-number - (buffer-substring (point) (line-end-position)))))) + (buffer-substring (point) (mh-line-end-position)))))) (when num (push num msg-list)) (forward-line)))) (if (null msg-list) diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el index 776f0c067a8..787f5c371fe 100644 --- a/lisp/mh-e/mh-mime.el +++ b/lisp/mh-e/mh-mime.el @@ -302,14 +302,14 @@ the attachment labeled with that number." start end) (cond ((and data (not inserted-flag) (not displayed-flag)) (let ((contents (mm-get-part data))) - (add-text-properties (line-beginning-position) (line-end-position) - '(mh-mime-inserted t)) + (add-text-properties (mh-line-beginning-position) + (mh-line-end-position) '(mh-mime-inserted t)) (setq start (point-marker)) (forward-line 1) (mm-insert-inline data contents) (setq end (point-marker)) (add-text-properties - start (progn (goto-char start) (line-end-position)) + start (progn (goto-char start) (mh-line-end-position)) `(mh-region (,start . ,end))))) ((and data (or inserted-flag displayed-flag)) (mh-press-button) @@ -746,7 +746,8 @@ buttons for alternative parts that are usually suppressed." (mh-insert-mime-button handle id (mm-handle-displayed-p handle)) (goto-char point) (when region - (add-text-properties (line-beginning-position) (line-end-position) + (add-text-properties (mh-line-beginning-position) + (mh-line-end-position) `(mh-region ,region))))))) (defun mh-mime-part-index (handle) @@ -1500,9 +1501,9 @@ This function will quote all such characters." (goto-char (point-min)) (while (re-search-forward "^#" nil t) (beginning-of-line) - (unless (mh-mh-directive-present-p (point) (line-end-position)) + (unless (mh-mh-directive-present-p (point) (mh-line-end-position)) (insert "#")) - (goto-char (line-end-position))))) + (goto-char (mh-line-end-position))))) ;;;###mh-autoload (defun mh-mh-to-mime-undo (noconfirm) @@ -1672,7 +1673,8 @@ buffer, while END defaults to the the end of the buffer." (block 'search-for-mh-directive (goto-char begin) (while (re-search-forward "^#" end t) - (let ((s (buffer-substring-no-properties (point) (line-end-position)))) + (let ((s (buffer-substring-no-properties + (point) (mh-line-end-position)))) (cond ((equal s "")) ((string-match "^forw[ \t\n]+" s) (return-from 'search-for-mh-directive t)) diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index 9fc9355a065..b58539c615c 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -51,7 +51,7 @@ (require 'gnus-util) (require 'imenu) -(require 'which-func nil t) +(mh-require 'which-func nil t) (defvar mh-searcher nil "Cached value of chosen search program.") @@ -358,12 +358,13 @@ configuration and is used when the search folder is dismissed." (goto-char (point-min)) (dotimes (i 5) (add-text-properties (point) (1+ (point)) '(front-sticky t)) - (add-text-properties (- (line-end-position) 2) (1- (line-end-position)) + (add-text-properties (- (mh-line-end-position) 2) + (1- (mh-line-end-position)) '(rear-nonsticky t)) - (add-text-properties (point) (1- (line-end-position)) '(read-only t)) + (add-text-properties (point) (1- (mh-line-end-position)) '(read-only t)) (forward-line)) (add-text-properties (point) (1+ (point)) '(front-sticky t)) - (add-text-properties (point) (1- (line-end-position)) '(read-only t)) + (add-text-properties (point) (1- (mh-line-end-position)) '(read-only t)) (goto-char (point-max))) ;; Sequence Searches @@ -526,9 +527,10 @@ group of results." (cond ((and (bolp) (eolp)) (ignore-errors (forward-line -1)) (setq msg (mh-get-msg-num t))) - ((equal (char-after (line-beginning-position)) ?+) + ((equal (char-after (mh-line-beginning-position)) ?+) (setq folder (buffer-substring-no-properties - (line-beginning-position) (line-end-position)))) + (mh-line-beginning-position) + (mh-line-end-position)))) (t (setq msg (mh-get-msg-num t))))) (when (not folder) (setq folder (car (gethash (gethash msg mh-index-msg-checksum-map) @@ -655,13 +657,13 @@ The cdr of the element is the pattern to search." start begin) (goto-char (point-min)) (while (not (eobp)) - (if (search-forward "--------" (line-end-position) t) + (if (search-forward "--------" (mh-line-end-position) t) (setq in-body-flag t) (beginning-of-line) (setq begin (point)) (setq start (if in-body-flag (point) - (search-forward ":" (line-end-position) t) + (search-forward ":" (mh-line-end-position) t) (point))) (push (cons (and (not in-body-flag) (intern (downcase @@ -669,7 +671,7 @@ The cdr of the element is the pattern to search." begin (1- start))))) (mh-index-parse-search-regexp (buffer-substring-no-properties - start (line-end-position)))) + start (mh-line-end-position)))) pattern-list)) (forward-line)) pattern-list))) @@ -979,8 +981,8 @@ is used to search." (return nil)) (when (equal (char-after (point)) ?#) (return 'error)) - (let* ((start (search-forward " " (line-end-position) t)) - (end (search-forward " " (line-end-position) t))) + (let* ((start (search-forward " " (mh-line-end-position) t)) + (end (search-forward " " (mh-line-end-position) t))) (unless (and start end) (return 'error)) (setq end (1- end)) @@ -1058,7 +1060,7 @@ SEARCH-REGEXP-LIST is used to search." (return 'error)) (let ((start (point)) end msg-start) - (setq end (line-end-position)) + (setq end (mh-line-end-position)) (unless (search-forward mh-mairix-folder end t) (return 'error)) (goto-char (match-beginning 0)) @@ -1191,7 +1193,7 @@ is used to search." (block nil (when (eobp) (return nil)) (let ((file-name (buffer-substring-no-properties - (point) (line-end-position)))) + (point) (mh-line-end-position)))) (unless (equal (string-match mh-namazu-folder file-name) 0) (return 'error)) (unless (file-exists-p file-name) @@ -1239,17 +1241,17 @@ is used to search." (prog1 (block nil (when (eobp) (return nil)) - (when (search-forward-regexp "^\+" (line-end-position) t) + (when (search-forward-regexp "^\+" (mh-line-end-position) t) (setq mh-index-pick-folder - (buffer-substring-no-properties (line-beginning-position) - (line-end-position))) + (buffer-substring-no-properties (mh-line-beginning-position) + (mh-line-end-position))) (return 'error)) - (unless (search-forward-regexp "^[1-9][0-9]*$" (line-end-position) t) + (unless (search-forward-regexp "^[1-9][0-9]*$" (mh-line-end-position) t) (return 'error)) (list mh-index-pick-folder (string-to-number - (buffer-substring-no-properties (line-beginning-position) - (line-end-position))) + (buffer-substring-no-properties (mh-line-beginning-position) + (mh-line-end-position))) nil)) (forward-line))) @@ -1326,8 +1328,8 @@ record is invalid return 'error." (block nil (when (eobp) (return nil)) - (let ((eol-pos (line-end-position)) - (bol-pos (line-beginning-position)) + (let ((eol-pos (mh-line-end-position)) + (bol-pos (mh-line-beginning-position)) folder-start msg-end) (goto-char bol-pos) (unless (search-forward mh-user-path eol-pos t) @@ -1423,7 +1425,7 @@ being the list of messages originally from that folder." (save-excursion (beginning-of-line) (push (cons (buffer-substring-no-properties - (point) (line-end-position)) + (point) (mh-line-end-position)) (set-marker (make-marker) (point))) alist))) (setq imenu--index-alist (nreverse alist))))) @@ -1696,7 +1698,8 @@ folder, is removed from `mh-index-data'." (mh-exec-cmd-output mh-scan-prog nil "-width" "80" "-format" "%{x-mhe-checksum}\n" folder msg) (goto-char (point-min)) - (string-equal (buffer-substring-no-properties (point) (line-end-position)) + (string-equal (buffer-substring-no-properties + (point) (mh-line-end-position)) checksum))) @@ -1805,8 +1808,8 @@ PROC is used to convert the value to actual data." (defun mh-md5sum-parser () "Parse md5sum output." - (let ((begin (line-beginning-position)) - (end (line-end-position)) + (let ((begin (mh-line-beginning-position)) + (end (mh-line-end-position)) first-space last-slash) (setq first-space (search-forward " " end t)) (goto-char end) @@ -1819,8 +1822,8 @@ PROC is used to convert the value to actual data." (defun mh-openssl-parser () "Parse openssl output." - (let ((begin (line-beginning-position)) - (end (line-end-position)) + (let ((begin (mh-line-beginning-position)) + (end (mh-line-end-position)) last-space last-slash) (goto-char end) (setq last-space (search-backward " " begin t)) @@ -1854,7 +1857,7 @@ origin-index) map is updated too." (let (msg checksum) (while (not (eobp)) (setq msg (buffer-substring-no-properties - (point) (line-end-position))) + (point) (mh-line-end-position))) (forward-line) (save-excursion (cond ((not (string-match "^[0-9]*$" msg))) @@ -1865,7 +1868,7 @@ origin-index) map is updated too." (t ;; update maps (setq checksum (buffer-substring-no-properties - (point) (line-end-position))) + (point) (mh-line-end-position))) (let ((msg (string-to-number msg))) (set-buffer folder) (mh-index-update-single-msg msg checksum origin-map))))) diff --git a/lisp/mh-e/mh-seq.el b/lisp/mh-e/mh-seq.el index cf2027392bd..a5732d00bc6 100644 --- a/lisp/mh-e/mh-seq.el +++ b/lisp/mh-e/mh-seq.el @@ -175,7 +175,7 @@ The list appears in a buffer named \"*MH-E Sequences*\"." (insert "\n")) (setq seq-list (cdr seq-list))) (goto-char (point-min)) - (view-mode-enter) + (mh-view-mode-enter) (setq view-exit-action 'kill-buffer) (message "Listing sequences...done"))))) @@ -749,7 +749,7 @@ completion is over." (goto-char (point-min)) (multiple-value-bind (folder unseen total) (mh-parse-flist-output-line - (buffer-substring (point) (line-end-position))) + (buffer-substring (point) (mh-line-end-position))) (values total unseen folder)))) (defun mh-folder-size-folder (folder) @@ -777,7 +777,7 @@ folders whose names end with a '+' character." (when (search-backward " out of " (point-min) t) (setq total (string-to-number (buffer-substring-no-properties - (match-end 0) (line-end-position)))) + (match-end 0) (mh-line-end-position)))) (when (search-backward " in sequence " (point-min) t) (setq p (point)) (when (search-backward " has " (point-min) t) @@ -955,7 +955,7 @@ font-lock is turned on." ;; the case of user sequences. (mh-notate nil nil mh-cmd-note) (when font-lock-mode - (font-lock-fontify-region (point) (line-end-position)))) + (font-lock-fontify-region (point) (mh-line-end-position)))) (forward-char (+ mh-cmd-note mh-scan-field-destination-offset)) (let ((stack (gethash msg mh-sequence-notation-history))) (setf (gethash msg mh-sequence-notation-history) diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el index f8728edb3e4..ab636ae8ab6 100644 --- a/lisp/mh-e/mh-show.el +++ b/lisp/mh-e/mh-show.el @@ -878,7 +878,7 @@ See also `mh-folder-mode'. (defun mh-show-addr () "Use `goto-address'." (when mh-show-use-goto-addr-flag - (require 'goto-addr nil t) + (mh-require 'goto-addr nil t) (if (fboundp 'goto-address) (goto-address)))) diff --git a/lisp/mh-e/mh-speed.el b/lisp/mh-e/mh-speed.el index 00cfd5ef961..ebf34abbd4c 100644 --- a/lisp/mh-e/mh-speed.el +++ b/lisp/mh-e/mh-speed.el @@ -69,13 +69,13 @@ ["Visit Folder" mh-speed-view (save-excursion (set-buffer speedbar-buffer) - (get-text-property (line-beginning-position) 'mh-folder))] + (get-text-property (mh-line-beginning-position) 'mh-folder))] ["Expand Nested Folders" mh-speed-expand-folder - (and (get-text-property (line-beginning-position) 'mh-children-p) - (not (get-text-property (line-beginning-position) 'mh-expanded)))] + (and (get-text-property (mh-line-beginning-position) 'mh-children-p) + (not (get-text-property (mh-line-beginning-position) 'mh-expanded)))] ["Contract Nested Folders" mh-speed-contract-folder - (and (get-text-property (line-beginning-position) 'mh-children-p) - (get-text-property (line-beginning-position) 'mh-expanded))] + (and (get-text-property (mh-line-beginning-position) 'mh-children-p) + (get-text-property (mh-line-beginning-position) 'mh-expanded))] ["Refresh Speedbar" mh-speed-refresh t]) "Extra menu items for speedbar.") @@ -157,7 +157,7 @@ The optional ARGS from speedbar are ignored." (forward-line -1) (speedbar-change-expand-button-char ?+) (add-text-properties - (line-beginning-position) (1+ (line-beginning-position)) + (mh-line-beginning-position) (1+ (line-beginning-position)) '(mh-expanded nil))) (t (forward-line) @@ -165,7 +165,7 @@ The optional ARGS from speedbar are ignored." (goto-char point) (speedbar-change-expand-button-char ?-) (add-text-properties - (line-beginning-position) (1+ (line-beginning-position)) + (mh-line-beginning-position) (1+ (line-beginning-position)) `(mh-expanded t))))))) (defun mh-speed-view (&rest args) @@ -173,7 +173,7 @@ The optional ARGS from speedbar are ignored." The optional ARGS from speedbar are ignored." (interactive) (declare (ignore args)) - (let* ((folder (get-text-property (line-beginning-position) 'mh-folder)) + (let* ((folder (get-text-property (mh-line-beginning-position) 'mh-folder)) (range (and (stringp folder) (mh-read-range "Scan" folder t nil nil mh-interpret-number-as-range-flag)))) @@ -199,9 +199,9 @@ created." (forward-line -1) (setf (gethash nil mh-speed-folder-map) (set-marker (or (gethash nil mh-speed-folder-map) (make-marker)) - (1+ (line-beginning-position)))) + (1+ (mh-line-beginning-position)))) (add-text-properties - (line-beginning-position) (1+ (line-beginning-position)) + (mh-line-beginning-position) (1+ (line-beginning-position)) `(mh-folder nil mh-expanded nil mh-children-p t mh-level 0)) (mh-speed-stealth-update t) (when (> mh-speed-update-interval 0) @@ -268,12 +268,12 @@ The update is always carried out if FORCE is non-nil." (speedbar-with-writable (goto-char (gethash folder mh-speed-folder-map (point))) (beginning-of-line) - (if (re-search-forward "([1-9][0-9]*/[0-9]+)" (line-end-position) t) + (if (re-search-forward "([1-9][0-9]*/[0-9]+)" (mh-line-end-position) t) (setq face (mh-speed-bold-face face)) (setq face (mh-speed-normal-face face))) (beginning-of-line) - (when (re-search-forward "\\[.\\] " (line-end-position) t) - (put-text-property (point) (line-end-position) 'face face))))) + (when (re-search-forward "\\[.\\] " (mh-line-end-position) t) + (put-text-property (point) (mh-line-end-position) 'face face))))) (defun mh-speed-normal-face (face) "Return normal face for given FACE." @@ -313,7 +313,7 @@ The function will expand out parent folders of FOLDER if needed." (while suffix-list ;; We always need atleast one toggle. We need two if the directory list ;; is stale since a folder was added. - (when (equal prefix (get-text-property (line-beginning-position) + (when (equal prefix (get-text-property (mh-line-beginning-position) 'mh-folder)) (mh-speed-toggle) (unless (get-text-property (point) 'mh-expanded) @@ -368,9 +368,9 @@ uses." (setf (gethash folder-name mh-speed-folder-map) (set-marker (or (gethash folder-name mh-speed-folder-map) (make-marker)) - (1+ (line-beginning-position)))) + (1+ (mh-line-beginning-position)))) (add-text-properties - (line-beginning-position) (1+ (line-beginning-position)) + (mh-line-beginning-position) (1+ (mh-line-beginning-position)) `(mh-folder ,folder-name mh-expanded nil mh-children-p ,(not (not (cdr f))) @@ -400,7 +400,7 @@ flists is run only for that one folder." (interactive (list t)) (when force (when mh-speed-flists-timer - (cancel-timer mh-speed-flists-timer) + (mh-cancel-timer mh-speed-flists-timer) (setq mh-speed-flists-timer nil)) (when (and (processp mh-speed-flists-process) (not (eq (process-status mh-speed-flists-process) 'exit))) @@ -471,25 +471,25 @@ be handled next." face) (when pos (goto-char pos) - (goto-char (line-beginning-position)) + (goto-char (mh-line-beginning-position)) (cond ((null (get-text-property (point) 'mh-count)) - (goto-char (line-end-position)) + (goto-char (mh-line-end-position)) (setq face (get-text-property (1- (point)) 'face)) (insert (format " (%s/%s)" unseen total)) (mh-speed-highlight 'unknown face) - (goto-char (line-beginning-position)) + (goto-char (mh-line-beginning-position)) (add-text-properties (point) (1+ (point)) `(mh-count (,unseen . ,total)))) ((not (equal (get-text-property (point) 'mh-count) (cons unseen total))) - (goto-char (line-end-position)) + (goto-char (mh-line-end-position)) (setq face (get-text-property (1- (point)) 'face)) - (re-search-backward " " (line-beginning-position) t) - (delete-region (point) (line-end-position)) + (re-search-backward " " (mh-line-beginning-position) t) + (delete-region (point) (mh-line-end-position)) (insert (format " (%s/%s)" unseen total)) (mh-speed-highlight 'unknown face) - (goto-char (line-beginning-position)) + (goto-char (mh-line-beginning-position)) (add-text-properties (point) (1+ (point)) `(mh-count (,unseen . ,total)))))))))))) @@ -519,15 +519,15 @@ be handled next." (caar parent-kids))) (setq parent-change ? )))) (goto-char parent-position) - (when (equal (get-text-property (line-beginning-position) 'mh-folder) + (when (equal (get-text-property (mh-line-beginning-position) 'mh-folder) parent) - (when (get-text-property (line-beginning-position) 'mh-expanded) + (when (get-text-property (mh-line-beginning-position) 'mh-expanded) (mh-speed-toggle)) (when parent-change (speedbar-with-writable (mh-speedbar-change-expand-button-char parent-change) (add-text-properties - (line-beginning-position) (1+ (line-beginning-position)) + (mh-line-beginning-position) (1+ (mh-line-beginning-position)) `(mh-children-p ,(equal parent-change ?+))))) (mh-speed-highlight mh-speed-last-selected-folder 'mh-speedbar-folder) (setq mh-speed-last-selected-folder nil) @@ -541,7 +541,7 @@ be handled next." "Change the expansion button character to CHAR for the current line." (save-excursion (beginning-of-line) - (if (re-search-forward "\\[.\\]" (line-end-position) t) + (if (re-search-forward "\\[.\\]" (mh-line-end-position) t) (speedbar-with-writable (backward-char 2) (delete-char 1) @@ -573,9 +573,9 @@ The function invalidates the latest ancestor that is present." (speedbar-with-writable (mh-speedbar-change-expand-button-char ?+) (add-text-properties - (line-beginning-position) (1+ (line-beginning-position)) + (mh-line-beginning-position) (1+ (mh-line-beginning-position)) `(mh-children-p t))) - (when (get-text-property (line-beginning-position) 'mh-expanded) + (when (get-text-property (mh-line-beginning-position) 'mh-expanded) (mh-speed-toggle)) (setq mh-speed-refresh-flag t)))) diff --git a/lisp/mh-e/mh-thread.el b/lisp/mh-e/mh-thread.el index fa9719985a9..0686b10ac26 100644 --- a/lisp/mh-e/mh-thread.el +++ b/lisp/mh-e/mh-thread.el @@ -296,7 +296,7 @@ at the end." (while (not (eobp)) (forward-char address-start-offset) (unless (equal (string-match spaces (buffer-substring-no-properties - (point) (line-end-position))) + (point) (mh-line-end-position))) 0) (beginning-of-line) (backward-char) @@ -456,9 +456,9 @@ are the same containers." If optional argument STRING is given then that is assumed to be the scan line. Otherwise uses the line at point as the scan line to parse." - (let* ((string (or string - (buffer-substring-no-properties (line-beginning-position) - (line-end-position)))) + (let* ((string (or string (buffer-substring-no-properties + (mh-line-beginning-position) + (mh-line-end-position)))) (address-start (+ mh-cmd-note mh-scan-field-from-start-offset)) (body-start (+ mh-cmd-note mh-scan-field-from-end-offset)) (first-string (substring string 0 address-start))) @@ -599,18 +599,20 @@ Only information about messages in MSG-LIST are added to the tree." (while (not (eobp)) (block process-message (let* ((index-line - (prog1 (buffer-substring (point) (line-end-position)) + (prog1 (buffer-substring (point) (mh-line-end-position)) (forward-line))) (index (string-to-number index-line)) - (id (prog1 (buffer-substring (point) (line-end-position)) + (id (prog1 (buffer-substring (point) (mh-line-end-position)) (forward-line))) - (refs (prog1 (buffer-substring (point) (line-end-position)) + (refs (prog1 + (buffer-substring (point) (mh-line-end-position)) (forward-line))) (in-reply-to (prog1 (buffer-substring (point) - (line-end-position)) + (mh-line-end-position)) (forward-line))) (subject (prog1 - (buffer-substring (point) (line-end-position)) + (buffer-substring + (point) (mh-line-end-position)) (forward-line))) (subject-re-p nil)) (unless (gethash index mh-thread-scan-line-map) diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el index b34ff8ee5b6..e948860058f 100644 --- a/lisp/mh-e/mh-utils.el +++ b/lisp/mh-e/mh-utils.el @@ -68,7 +68,7 @@ used in lieu of `search' in the CL package." (defun mh-colors-available-p () "Check if colors are available in the Emacs being used." (or mh-xemacs-flag - (let ((color-cells (display-color-cells))) + (let ((color-cells (mh-display-color-cells))) (and (numberp color-cells) (>= color-cells 8))))) ;;;###mh-autoload @@ -502,8 +502,8 @@ not be returned." ;; top-level folders; otherwise mh-sub-folders returns all the ;; files in / if given an empty string or +. (when folder - (setq folder (replace-regexp-in-string "^\+" "" folder)) - (setq folder (replace-regexp-in-string "/*$" "/" folder)) + (setq folder (mh-replace-regexp-in-string "^\+" "" folder)) + (setq folder (mh-replace-regexp-in-string "/*$" "/" folder)) (if (equal folder "") (setq folder nil))) (loop for f in (mh-sub-folders folder) do @@ -553,9 +553,10 @@ directories that aren't usually mail folders are hidden." (apply #'call-process arg-list) (goto-char (point-min)) (while (not (and (eolp) (bolp))) - (goto-char (line-end-position)) - (let ((start-pos (line-beginning-position)) - (has-pos (search-backward " has " (line-beginning-position) t))) + (goto-char (mh-line-end-position)) + (let ((start-pos (mh-line-beginning-position)) + (has-pos (search-backward " has " + (mh-line-beginning-position) t))) (when (integerp has-pos) (while (equal (char-after has-pos) ? ) (decf has-pos)) @@ -570,7 +571,7 @@ directories that aren't usually mail folders are hidden." (setq name (substring name 0 (1- (length name))))) (push (cons name - (search-forward "(others)" (line-end-position) t)) + (search-forward "(others)" (mh-line-end-position) t)) results)))) (forward-line 1)))) (setq results (nreverse results)) @@ -927,10 +928,12 @@ is hidden, if positive then the field is displayed." (unwind-protect (cond ((or (and (not arg) (text-property-any begin end 'invisible 'vanish)) - (and (numberp arg) (>= arg 0)) - (and (eq arg 'long) (> (line-beginning-position 5) end))) + (and (numberp arg) + (>= arg 0)) + (and (eq arg 'long) + (> (mh-line-beginning-position 5) end))) (remove-text-properties begin end '(invisible nil)) - (search-forward ":" (line-end-position) t) + (search-forward ":" (mh-line-end-position) t) (mh-letter-skip-leading-whitespace-in-header-field)) ;; XXX Redesign to make usable by user. Perhaps use a positive ;; numeric prefix to make that many lines visible.