"Make HOOK local if needed.
XEmacs and versions of GNU Emacs before 21.1 require
`make-local-hook' to be called."
+ (declare (obsolete nil "29.1"))
(when (and (fboundp 'make-local-hook)
(not (get 'make-local-hook 'byte-obsolete-info)))
`(make-local-hook ,hook)))
(setq res (match-string 1 res)))
;; Replace "&" with capitalized username
(if (string-search "&" res)
- (setq res (mh-replace-regexp-in-string "&" (capitalize username) res)))
+ (setq res (replace-regexp-in-string "&" (capitalize username) res)))
;; Remove " character
(if (string-search "\"" res)
- (setq res (mh-replace-regexp-in-string "\"" "" res)))
+ (setq res (replace-regexp-in-string "\"" "" res)))
;; If empty string, use username instead
(if (string-equal "" res)
(setq res username))
(if (string-equal username realname)
(concat "<" username ">")
(concat realname " <" username ">"))))
- (when (not (mh-assoc-string alias-name mh-alias-alist t))
+ (when (not (assoc-string alias-name mh-alias-alist t))
(setq passwd-alist (cons (list alias-name alias-translation)
passwd-alist)))))))
(forward-line 1)))
(cond
((looking-at "^[ \t]")) ;Continuation line
((looking-at "\\(.+\\): .+: .*$") ; A new -blind- MH alias
- (when (not (mh-assoc-string (match-string 1) mh-alias-blind-alist t))
+ (when (not (assoc-string (match-string 1) mh-alias-blind-alist t))
(setq mh-alias-blind-alist
(cons (list (match-string 1)) mh-alias-blind-alist))
(setq mh-alias-alist (cons (list (match-string 1)) mh-alias-alist))))
((looking-at "\\(.+\\): .*$") ; A new MH alias
- (when (not (mh-assoc-string (match-string 1) mh-alias-alist t))
+ (when (not (assoc-string (match-string 1) mh-alias-alist t))
(setq mh-alias-alist
(cons (list (match-string 1)) mh-alias-alist)))))
(forward-line 1)))
user)
(while local-users
(setq user (car local-users))
- (if (not (mh-assoc-string (car user) mh-alias-alist t))
+ (if (not (assoc-string (car user) mh-alias-alist t))
(setq mh-alias-alist (append mh-alias-alist (list user))))
(setq local-users (cdr local-users)))))
(run-hooks 'mh-alias-reloaded-hook)
"Return expansion for ALIAS.
Blind aliases or users from /etc/passwd are not expanded."
(cond
- ((mh-assoc-string alias mh-alias-blind-alist t)
+ ((assoc-string alias mh-alias-blind-alist t)
alias) ; Don't expand a blind alias
- ((mh-assoc-string alias mh-alias-passwd-alist t)
- (cadr (mh-assoc-string alias mh-alias-passwd-alist t)))
+ ((assoc-string alias mh-alias-passwd-alist t)
+ (cadr (assoc-string alias mh-alias-passwd-alist t)))
(t
(mh-alias-ali alias))))
(eval-and-compile
- (mh-require 'crm nil t) ; completing-read-multiple
- (mh-require 'multi-prompt nil t))
+ (require 'crm nil t) ; completing-read-multiple
+ (require 'multi-prompt nil t))
;;;###mh-autoload
(defun mh-read-address (prompt)
(let* ((case-fold-search t)
(beg (mh-beginning-of-word))
(the-name (buffer-substring-no-properties beg (point))))
- (if (mh-assoc-string the-name mh-alias-alist t)
+ (if (assoc-string the-name mh-alias-alist t)
(message "%s -> %s" the-name (mh-alias-expand the-name))
;; Check if it was a single word likely to be an alias
(if (and (equal mh-alias-flash-on-comma 1)
res)
res)))
((t) (all-completions string mh-alias-alist pred))
- ((lambda) (mh-test-completion string mh-alias-alist pred)))))))))
+ ((lambda) (test-completion string mh-alias-alist pred)))))))))
\f
;;; Alias File Updating
(set (make-local-variable 'mh-mail-header-separator)
(save-excursion
(goto-char (mh-mail-header-end))
- (buffer-substring-no-properties (point) (mh-line-end-position))))
+ (buffer-substring-no-properties (point) (line-end-position))))
(set (make-local-variable 'mail-header-separator) mh-mail-header-separator) ;override sendmail.el
;; If using MML, translate MH-style directive
(if (equal mh-compose-insertion 'mml)
(setq mh-previous-window-config config)
(setq mode-line-buffer-identification (list " {%b}"))
(mh-logo-display)
- (mh-make-local-hook 'kill-buffer-hook)
(add-hook 'kill-buffer-hook #'mh-tidy-draft-buffer nil t)
(run-hook-with-args 'mh-compose-letter-function to subject cc))
(cond ((and overwrite-flag
(mh-goto-header-field (concat field ":")))
(insert " " value)
- (delete-region (point) (mh-line-end-position)))
+ (delete-region (point) (line-end-position)))
((and (not overwrite-flag)
(mh-regexp-in-field-p (concat "\\b" (regexp-quote value) "\\b") field))
;; Already there, do nothing.
;; Please use mh-gnus.el when providing compatibility with different
;; versions of Gnus.
-;; Items are listed alphabetically (except for mh-require which is
-;; needed sooner it would normally appear).
+;; Items are listed alphabetically.
(eval-when-compile (require 'mh-acros))
(mh-do-in-gnu-emacs
- (defalias 'mh-require #'require))
-
-(defun-mh 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 is used by Emacs versions that lack `assoc-string',
-introduced in Emacs 22."
- ;; Test for fboundp is solely to silence compiler for Emacs >= 22.1.
- (if (and case-fold (fboundp 'assoc-ignore-case))
- (assoc-ignore-case key list)
- (assoc key list)))
-
-;; For XEmacs.
-(defalias 'mh-cancel-timer
- (if (fboundp 'cancel-timer)
- 'cancel-timer
- 'delete-itimer))
+ (define-obsolete-function-alias 'mh-require #'require "29.1"))
+
+(define-obsolete-function-alias 'mh-assoc-string #'assoc-string "29.1")
+(define-obsolete-function-alias 'mh-cancel-timer #'cancel-timer "29.1")
;; Emacs 24 made flet obsolete and suggested either cl-flet or
;; cl-letf. This macro is based upon gmm-flet from Gnus.
,@body)
`(flet ,bindings ,@body)))
-(defun mh-display-color-cells (&optional display)
- "Return the number of color cells supported by DISPLAY.
-This function is used by XEmacs to return 2 when `device-color-cells'
-or `display-color-cells' returns nil. This happens when compiling or
-running on a tty and causes errors since `display-color-cells' is
-expected to return an integer."
- (cond ((fboundp 'display-color-cells) ; GNU Emacs, XEmacs 21.5b28
- (or (display-color-cells display) 2))
- ((fboundp 'device-color-cells) ; XEmacs 21.4
- (or (device-color-cells display) 2))
- (t 2)))
+(define-obsolete-function-alias 'mh-display-color-cells
+ #'display-color-cells "29.1")
(defmacro mh-display-completion-list (completions &optional common-substring)
"Display the list of COMPLETIONS.
(t ; Emacs 22
`(display-completion-list ,completions ,common-substring))))
-(defmacro mh-face-foreground (face &optional frame inherit)
- "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 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)))
-
-(defmacro mh-face-background (face &optional frame inherit)
- "Return the background color name of face, or nil if unspecified.
-See documentation for `face-background' for a description of the
-arguments FACE, FRAME, and INHERIT.
-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)))
-
-(defun-mh mh-font-lock-add-keywords font-lock-add-keywords
- (_mode _keywords &optional _how)
- "XEmacs does not have `font-lock-add-keywords'.
-This function returns nil on that system.")
-
-(defun-mh mh-image-load-path-for-library
- image-load-path-for-library (library image &optional path no-error)
- "Return a suitable search path for images used by LIBRARY.
-
-It searches for IMAGE in `image-load-path' (excluding
-\"`data-directory'/images\") and `load-path', followed by a path
-suitable for LIBRARY, which includes \"../../etc/images\" and
-\"../etc/images\" relative to the library file itself, and then
-in \"`data-directory'/images\".
-
-Then this function returns a list of directories which contains
-first the directory in which IMAGE was found, followed by the
-value of `load-path'. If PATH is given, it is used instead of
-`load-path'.
-
-If NO-ERROR is non-nil and a suitable path can't be found, don't
-signal an error. Instead, return a list of directories as before,
-except that nil appears in place of the image directory.
-
-Here is an example that uses a common idiom to provide
-compatibility with versions of Emacs that lack the variable
-`image-load-path':
-
- ;; Shush compiler.
- (defvar image-load-path)
-
- (let* ((load-path (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\"))
- (image-load-path (cons (car load-path)
- (when (boundp \\='image-load-path)
- image-load-path))))
- (mh-tool-bar-folder-buttons-init))"
- (unless library (error "No library specified"))
- (unless image (error "No image specified"))
- (let (image-directory image-directory-load-path)
- ;; Check for images in image-load-path or load-path.
- (let ((img image)
- (dir (or
- ;; Images in image-load-path.
- (mh-image-search-load-path image)
- ;; Images in load-path.
- (locate-library image)))
- parent)
- ;; Since the image might be in a nested directory (for
- ;; example, mail/attach.pbm), adjust `image-directory'
- ;; accordingly.
- (when dir
- (setq dir (file-name-directory dir))
- (while (setq parent (file-name-directory img))
- (setq img (directory-file-name parent)
- dir (expand-file-name "../" dir))))
- (setq image-directory-load-path dir))
-
- ;; If `image-directory-load-path' isn't Emacs's image directory,
- ;; it's probably a user preference, so use it. Then use a
- ;; relative setting if possible; otherwise, use
- ;; `image-directory-load-path'.
- (cond
- ;; User-modified image-load-path?
- ((and image-directory-load-path
- (not (equal image-directory-load-path
- (file-name-as-directory
- (expand-file-name "images" data-directory)))))
- (setq image-directory image-directory-load-path))
- ;; Try relative setting.
- ((let (library-name d1ei d2ei)
- ;; First, find library in the load-path.
- (setq library-name (locate-library library))
- (if (not library-name)
- (error "Cannot find library %s in load-path" library))
- ;; And then set image-directory relative to that.
- (setq
- ;; Go down 2 levels.
- d2ei (file-name-as-directory
- (expand-file-name
- (concat (file-name-directory library-name) "../../etc/images")))
- ;; Go down 1 level.
- d1ei (file-name-as-directory
- (expand-file-name
- (concat (file-name-directory library-name) "../etc/images"))))
- (setq image-directory
- ;; Set it to nil if image is not found.
- (cond ((file-exists-p (expand-file-name image d2ei)) d2ei)
- ((file-exists-p (expand-file-name image d1ei)) d1ei)))))
- ;; Use Emacs's image directory.
- (image-directory-load-path
- (setq image-directory image-directory-load-path))
- (no-error
- (message "Could not find image %s for library %s" image library))
- (t
- (error "Could not find image %s for library %s" image library)))
-
- ;; Return an augmented `path' or `load-path'.
- (nconc (list image-directory)
- (delete image-directory (copy-sequence (or path load-path))))))
-
-(defun-mh mh-image-search-load-path
- image-search-load-path (_file &optional _path)
- "Emacs 21 and XEmacs don't have `image-search-load-path'.
-This function returns nil on those systems."
- nil)
-
-;; 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)
-(defun-mh 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 returns nil on those systems."
- nil)
-
-(defmacro mh-define-obsolete-variable-alias
- (obsolete-name current-name &optional when docstring)
- "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete.
-See documentation for `define-obsolete-variable-alias' for a description
-of the arguments OBSOLETE-NAME, CURRENT-NAME, and perhaps WHEN
-and DOCSTRING. This macro is used by XEmacs that lacks WHEN and
-DOCSTRING arguments."
- (if (featurep 'xemacs)
- `(define-obsolete-variable-alias ,obsolete-name ,current-name)
- `(define-obsolete-variable-alias ,obsolete-name ,current-name ,when ,docstring)))
-
-(defmacro mh-make-obsolete-variable (obsolete-name current-name &optional when access-type)
- "Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
-See documentation for `make-obsolete-variable' for a description
-of the arguments OBSOLETE-NAME, CURRENT-NAME, and perhaps WHEN
-and ACCESS-TYPE. This macro is used by XEmacs that lacks WHEN and
-ACCESS-TYPE arguments and by Emacs versions that lack ACCESS-TYPE,
-introduced in Emacs 24."
- (if (featurep 'xemacs)
- `(make-obsolete-variable ,obsolete-name ,current-name)
- (if (< emacs-major-version 24)
- `(make-obsolete-variable ,obsolete-name ,current-name ,when)
- `(make-obsolete-variable ,obsolete-name ,current-name ,when ,access-type))))
-
-(defun-mh 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)))
-
-(defun-mh mh-replace-regexp-in-string replace-regexp-in-string
- (regexp 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, SUBEXP, and START, used by
-`replace-in-string' are ignored."
- (if (featurep 'xemacs) ; silence Emacs compiler
- (replace-in-string string regexp rep literal)))
-
-(defun-mh mh-test-completion
- test-completion (_string _collection &optional _predicate)
- "Return non-nil if STRING is a valid completion.
-XEmacs does not have `test-completion'. This function returns nil
-on that system." nil)
-
-;; Copy of constant from url-util.el in Emacs 22; needed by Emacs 21.
+(define-obsolete-function-alias 'mh-face-foreground
+ #'face-foreground "29.1")
+
+(define-obsolete-function-alias 'mh-face-background
+ #'face-background "29.1")
+
+(define-obsolete-function-alias 'mh-font-lock-add-keywords
+ #'font-lock-add-keywords "29.1")
+
+(define-obsolete-function-alias 'mh-image-load-path-for-library
+ #'image-load-path-for-library "29.1")
+
+(define-obsolete-function-alias 'mh-image-search-load-path
+ #'image-search-load-path "29.1")
+
+(define-obsolete-function-alias 'mh-line-beginning-position
+ #'line-beginning-position "29.1")
+
+(define-obsolete-function-alias 'mh-line-end-position
+ #'line-end-position "29.1")
+
+(require 'mailabbrev nil t)
+(define-obsolete-function-alias 'mh-mail-abbrev-make-syntax-table
+ #'mail-abbrev-make-syntax-table "29.1")
+
+(define-obsolete-function-alias 'mh-define-obsolete-variable-alias
+ #'define-obsolete-variable-alias "29.1")
+
+(define-obsolete-function-alias 'mh-make-obsolete-variable
+ #'make-obsolete-variable "29.1")
+
+(define-obsolete-function-alias 'mh-match-string-no-properties
+ #'match-string-no-properties "29.1")
+
+(define-obsolete-function-alias 'mh-replace-regexp-in-string
+ #'replace-regexp-in-string "29.1")
+
+(define-obsolete-function-alias 'mh-test-completion
+ #'test-completion "29.1")
+
(defconst mh-url-unreserved-chars
'(
?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z
?- ?_ ?. ?! ?~ ?* ?' ?\( ?\))
"A list of characters that are _NOT_ reserved in the URL spec.
This is taken from RFC 2396.")
+(make-obsolete-variable 'mh-url-unreserved-chars 'url-unreserved-chars "29.1")
+
+(define-obsolete-function-alias 'mh-url-hexify-string
+ #'url-hexify-string "29.1")
+
+(define-obsolete-function-alias 'mh-view-mode-enter
+ #'view-mode-enter "29.1")
-(defun-mh mh-url-hexify-string url-hexify-string (str)
- "Escape characters in a string.
-This is a copy of `url-hexify-string' from url-util.el in Emacs
-22; needed by Emacs 21."
- (mapconcat
- (lambda (char)
- ;; Fixme: use a char table instead.
- (if (not (memq char mh-url-unreserved-chars))
- (if (> char 255)
- (error "Hexifying multibyte character %s" str)
- (format "%%%02X" char))
- (char-to-string char)))
- str ""))
-
-(defun-mh 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))
-
-(defun-mh mh-window-full-height-p
- window-full-height-p (&optional _window)
- "Return non-nil if WINDOW is not the result of a vertical split.
-This function is defined in XEmacs as it lacks
-`window-full-height-p'. The values of the functions
-`window-height' and `frame-height' are compared instead. The
-argument WINDOW is ignored."
- (= (1+ (window-height))
- (frame-height)))
+(define-obsolete-function-alias 'mh-window-full-height-p
+ #'window-full-height-p "29.1")
(defmacro mh-write-file-functions ()
- "Return `write-file-functions' if it exists.
-Otherwise return `local-write-file-hooks'.
-This macro exists purely for compatibility. The former symbol is used
-in Emacs 22 onward while the latter is used in previous versions and
-XEmacs."
- (if (boundp 'write-file-functions)
- ''write-file-functions ;Emacs 22 on
- ''local-write-file-hooks)) ;XEmacs
+ "Return `write-file-functions'. "
+ (declare (obsolete nil "29.1"))
+ ''write-file-functions)
(provide 'mh-compat)
(require 'mh-buffers)
(require 'mh-compat)
-(mh-font-lock-add-keywords
+(font-lock-add-keywords
'emacs-lisp-mode
(eval-when-compile
`((,(concat "(\\("
(count 0))
(while (and (not (eobp)) (< count mh-index-max-cmdline-args))
(push (buffer-substring-no-properties (point)
- (mh-line-end-position))
+ (line-end-position))
arg-list)
(cl-incf count)
(forward-line))
:group 'mh-letter
:package-version '(MH-E . "8.0"))
-(mh-define-obsolete-variable-alias 'mh-kill-folder-suppress-prompt-hooks
+(define-obsolete-variable-alias 'mh-kill-folder-suppress-prompt-hooks
'mh-kill-folder-suppress-prompt-functions "24.3")
(defcustom-mh mh-kill-folder-suppress-prompt-functions '(mh-search-p)
"Abnormal hook run at the beginning of \\<mh-folder-mode-map>\\[mh-kill-folder].
(if mh-min-colors-defined-flag
spec
- (let ((cells (mh-display-color-cells))
+ (let ((cells (display-color-cells))
new-spec)
;; Remove entries with min-colors, or delete them if we have
;; fewer colors than they specify.
nil)
;; Register mh-folder-mode as supporting which-function-mode...
-(eval-and-compile (mh-require 'which-func nil t))
+(eval-and-compile (require 'which-func nil t))
(when (and (boundp 'which-func-modes) (listp which-func-modes))
(add-to-list 'which-func-modes 'mh-folder-mode))
(setq truncate-lines t)
(auto-save-mode -1)
(setq buffer-offer-save t)
- (mh-make-local-hook (mh-write-file-functions))
- (add-hook (mh-write-file-functions) #'mh-execute-commands nil t)
+ (add-hook 'write-file-functions #'mh-execute-commands nil t)
(make-local-variable 'revert-buffer-function)
(make-local-variable 'hl-line-mode) ; avoid pollution
(mh-funcall-if-exists hl-line-mode 1)
"-recurse"
"-norecurse"))
(goto-char (point-min))
- (mh-view-mode-enter)
+ (view-mode-enter)
(setq view-exit-action 'kill-buffer)
(message "Listing folders...done")))))
(require 'mh-e)
(eval-and-compile
- (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))
+ (require 'gnus-util nil t)
+ (require 'mm-bodies nil t)
+ (require 'mm-decode nil t)
+ (require 'mm-view nil t)
+ (require 'mml nil t))
;; Copy of function from gnus-util.el.
;; TODO This is not in Gnus 5.11.
character \":\", then it must have a special handler defined in
`mh-identity-handlers', else return an error since it is not a
valid header field."
- (or (cdr (mh-assoc-string field mh-identity-handlers t))
+ (or (cdr (assoc-string field mh-identity-handlers t))
(and (eq (aref field 0) ?:)
(error "Field %s not found in `mh-identity-handlers'" field))
(cdr (assoc ":default" mh-identity-handlers))
(goto-char (point-min))
(cond ((equal mh-mail-header-separator "") (point-min))
((search-forward (format "\n%s\n" mh-mail-header-separator) nil t)
- (mh-line-beginning-position 0))
+ (line-beginning-position 0))
(t (point-min)))))
\f
(set (make-local-variable 'mh-mail-header-separator)
(save-excursion
(goto-char (mh-mail-header-end))
- (buffer-substring-no-properties (point) (mh-line-end-position))))
+ (buffer-substring-no-properties (point) (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)
((< (point) (progn
(beginning-of-line)
(re-search-forward mh-letter-header-field-regexp
- (mh-line-end-position) t)
+ (line-end-position) t)
(point)))
(beginning-of-line))
(t (end-of-line)))
(setq pick-expr
(let ((case-fold-search t))
(cl-loop for s in pick-expr
- collect (mh-replace-regexp-in-string "re: *" "" s))))
+ collect (replace-regexp-in-string "re: *" "" s))))
(mh-narrow-to-header-field 'subject pick-expr))
;;;###mh-autoload
(string-equal "" (match-string 3)))
(progn (message "No subject line")
nil)
- (let ((subject (mh-match-string-no-properties 3))
+ (let ((subject (match-string-no-properties 3))
(list))
(if (> (length subject) mh-limit-max-subject-size)
(setq subject (substring subject 0 mh-limit-max-subject-size)))
(if all
(goto-char (point-min)))
(while (re-search-forward mh-scan-subject-regexp nil t)
- (let ((this-subject (mh-match-string-no-properties 3)))
+ (let ((this-subject (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)))
(while (not (eobp))
(let ((num (ignore-errors
(string-to-number
- (buffer-substring (point) (mh-line-end-position))))))
+ (buffer-substring (point) (line-end-position))))))
(when num (push num msg-list))
(forward-line))))
(if (null msg-list)
start end)
(cond ((and data (not inserted-flag) (not displayed-flag))
(let ((contents (mm-get-part data)))
- (add-text-properties (mh-line-beginning-position)
- (mh-line-end-position) '(mh-mime-inserted t))
+ (add-text-properties (line-beginning-position)
+ (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) (mh-line-end-position))
+ start (progn (goto-char start) (line-end-position))
`(mh-region (,start . ,end)))))
((and data (or inserted-flag displayed-flag))
(mh-press-button)
(mh-insert-mime-button handle id (mm-handle-displayed-p handle))
(goto-char point)
(when region
- (add-text-properties (mh-line-beginning-position)
- (mh-line-end-position)
+ (add-text-properties (line-beginning-position)
+ (line-end-position)
`(mh-region ,region)))))))
(defun mh-mime-part-index (handle)
(goto-char (point-min))
(while (re-search-forward "^#" nil t)
(beginning-of-line)
- (unless (mh-mh-directive-present-p (point) (mh-line-end-position))
+ (unless (mh-mh-directive-present-p (point) (line-end-position))
(insert "#"))
- (goto-char (mh-line-end-position)))))
+ (goto-char (line-end-position)))))
;;;###mh-autoload
(defun mh-mh-to-mime-undo (noconfirm)
(goto-char begin)
(while (re-search-forward "^#" end t)
(let ((s (buffer-substring-no-properties
- (point) (mh-line-end-position))))
+ (point) (line-end-position))))
(cond ((equal s ""))
((string-match "^forw[ \t\n]+" s)
(cl-return-from search-for-mh-directive t))
(goto-char (point-min))
(dotimes (_ 5)
(add-text-properties (point) (1+ (point)) '(front-sticky t))
- (add-text-properties (- (mh-line-end-position) 2)
- (1- (mh-line-end-position))
+ (add-text-properties (- (line-end-position) 2)
+ (1- (line-end-position))
'(rear-nonsticky t))
- (add-text-properties (point) (1- (mh-line-end-position)) '(read-only t))
+ (add-text-properties (point) (1- (line-end-position)) '(read-only t))
(forward-line))
(add-text-properties (point) (1+ (point)) '(front-sticky t))
- (add-text-properties (point) (1- (mh-line-end-position)) '(read-only t))
+ (add-text-properties (point) (1- (line-end-position)) '(read-only t))
(goto-char (point-max)))
;; Sequence Searches
(cond ((and (bolp) (eolp))
(ignore-errors (forward-line -1))
(setq msg (mh-get-msg-num t)))
- ((equal (char-after (mh-line-beginning-position)) ?+)
+ ((equal (char-after (line-beginning-position)) ?+)
(setq folder (buffer-substring-no-properties
- (mh-line-beginning-position)
- (mh-line-end-position))))
+ (line-beginning-position)
+ (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)
start begin)
(goto-char (point-min))
(while (not (eobp))
- (if (search-forward "--------" (mh-line-end-position) t)
+ (if (search-forward "--------" (line-end-position) t)
(setq in-body-flag t)
(beginning-of-line)
(setq begin (point))
(setq start (if in-body-flag
(point)
- (search-forward ":" (mh-line-end-position) t)
+ (search-forward ":" (line-end-position) t)
(point)))
(push (cons (and (not in-body-flag)
(intern (downcase
begin (1- start)))))
(mh-index-parse-search-regexp
(buffer-substring-no-properties
- start (mh-line-end-position))))
+ start (line-end-position))))
pattern-list))
(forward-line))
pattern-list)))
(cl-return nil))
(when (equal (char-after (point)) ?#)
(cl-return 'error))
- (let* ((start (search-forward " " (mh-line-end-position) t))
- (end (search-forward " " (mh-line-end-position) t)))
+ (let* ((start (search-forward " " (line-end-position) t))
+ (end (search-forward " " (line-end-position) t)))
(unless (and start end)
(cl-return 'error))
(setq end (1- end))
(cl-return 'error))
(let ((start (point))
end msg-start)
- (setq end (mh-line-end-position))
+ (setq end (line-end-position))
(unless (search-forward mh-mairix-folder end t)
(cl-return 'error))
(goto-char (match-beginning 0))
(cl-block nil
(when (eobp) (cl-return nil))
(let ((file-name (buffer-substring-no-properties
- (point) (mh-line-end-position))))
+ (point) (line-end-position))))
(unless (equal (string-match mh-namazu-folder file-name) 0)
(cl-return 'error))
(unless (file-exists-p file-name)
(prog1
(cl-block nil
(when (eobp) (cl-return nil))
- (when (search-forward-regexp "^\\+" (mh-line-end-position) t)
+ (when (search-forward-regexp "^\\+" (line-end-position) t)
(setq mh-index-pick-folder
- (buffer-substring-no-properties (mh-line-beginning-position)
- (mh-line-end-position)))
+ (buffer-substring-no-properties (line-beginning-position)
+ (line-end-position)))
(cl-return 'error))
- (unless (search-forward-regexp "^[1-9][0-9]*$" (mh-line-end-position) t)
+ (unless (search-forward-regexp "^[1-9][0-9]*$" (line-end-position) t)
(cl-return 'error))
(list mh-index-pick-folder
(string-to-number
- (buffer-substring-no-properties (mh-line-beginning-position)
- (mh-line-end-position)))
+ (buffer-substring-no-properties (line-beginning-position)
+ (line-end-position)))
nil))
(forward-line)))
(cl-block nil
(when (eobp)
(cl-return nil))
- (let ((eol-pos (mh-line-end-position))
- (bol-pos (mh-line-beginning-position))
+ (let ((eol-pos (line-end-position))
+ (bol-pos (line-beginning-position))
folder-start msg-end)
(goto-char bol-pos)
(unless (search-forward mh-user-path eol-pos t)
(when cur-msg (mh-goto-msg cur-msg t t))
(set-buffer-modified-p old-buffer-modified-flag)))
-(eval-and-compile (mh-require 'which-func nil t))
+(eval-and-compile (require 'which-func nil t))
;; Shush compiler.
(defvar which-func-mode) ; < Emacs 22, XEmacs
(save-excursion
(beginning-of-line)
(push (cons (buffer-substring-no-properties
- (point) (mh-line-end-position))
+ (point) (line-end-position))
(point-marker))
alist)))
(setq imenu--index-alist (nreverse alist)))))
"-format" "%{x-mhe-checksum}\n" folder msg)
(goto-char (point-min))
(string-equal (buffer-substring-no-properties
- (point) (mh-line-end-position))
+ (point) (line-end-position))
checksum)))
\f
(defun mh-md5sum-parser ()
"Parse md5sum output."
- (let ((begin (mh-line-beginning-position))
- (end (mh-line-end-position))
+ (let ((begin (line-beginning-position))
+ (end (line-end-position))
first-space last-slash)
(setq first-space (search-forward " " end t))
(goto-char end)
(defun mh-openssl-parser ()
"Parse openssl output."
- (let ((begin (mh-line-beginning-position))
- (end (mh-line-end-position))
+ (let ((begin (line-beginning-position))
+ (end (line-end-position))
last-space last-slash)
(goto-char end)
(setq last-space (search-backward " " begin t))
(let (msg checksum)
(while (not (eobp))
(setq msg (buffer-substring-no-properties
- (point) (mh-line-end-position)))
+ (point) (line-end-position)))
(forward-line)
(save-excursion
(cond ((not (string-match "^[0-9]*$" msg)))
(t
;; update maps
(setq checksum (buffer-substring-no-properties
- (point) (mh-line-end-position)))
+ (point) (line-end-position)))
(let ((msg (string-to-number msg)))
(set-buffer folder)
(mh-index-update-single-msg msg checksum origin-map)))))
(insert "\n"))
(setq seq-list (cdr seq-list)))
(goto-char (point-min))
- (mh-view-mode-enter)
+ (view-mode-enter)
(setq view-exit-action 'kill-buffer)
(message "Listing sequences...done")))))
(cl-multiple-value-bind (folder unseen total)
(cl-values-list
(mh-parse-flist-output-line
- (buffer-substring (point) (mh-line-end-position))))
+ (buffer-substring (point) (line-end-position))))
(list total unseen folder))))
(defun mh-folder-size-folder (folder)
(when (search-backward " out of " (point-min) t)
(setq total (string-to-number
(buffer-substring-no-properties
- (match-end 0) (mh-line-end-position))))
+ (match-end 0) (line-end-position))))
(when (search-backward " in sequence " (point-min) t)
(setq p (point))
(when (search-backward " has " (point-min) t)
;; the case of user sequences.
(mh-notate nil nil mh-cmd-note)
(when font-lock-mode
- (font-lock-fontify-region (point) (mh-line-end-position))))
+ (font-lock-fontify-region (point) (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)
(if (not clean-message-header)
(mh-start-of-uncleaned-message)))
(mh-display-msg msg folder)))
- (unless (mh-window-full-height-p) ; not vertically split
+ (unless (window-full-height-p) ; not vertically split
(shrink-window (- (window-height) (or mh-summary-height
(mh-summary-height)))))
(mh-recenter nil)
(t
(setq font-lock-defaults '(mh-show-font-lock-keywords t))))
(when mh-decode-mime-flag
- (mh-make-local-hook 'kill-buffer-hook)
(add-hook 'kill-buffer-hook #'mh-mime-cleanup nil t))
(make-local-variable 'mh-show-folder-buffer)
(buffer-disable-undo)
'("--"
["Visit Folder" mh-speed-view
(with-current-buffer speedbar-buffer
- (get-text-property (mh-line-beginning-position) 'mh-folder))]
+ (get-text-property (line-beginning-position) 'mh-folder))]
["Expand Nested Folders" mh-speed-expand-folder
- (and (get-text-property (mh-line-beginning-position) 'mh-children-p)
- (not (get-text-property (mh-line-beginning-position) 'mh-expanded)))]
+ (and (get-text-property (line-beginning-position) 'mh-children-p)
+ (not (get-text-property (line-beginning-position) 'mh-expanded)))]
["Contract Nested Folders" mh-speed-contract-folder
- (and (get-text-property (mh-line-beginning-position) 'mh-children-p)
- (get-text-property (mh-line-beginning-position) 'mh-expanded))]
+ (and (get-text-property (line-beginning-position) 'mh-children-p)
+ (get-text-property (line-beginning-position) 'mh-expanded))]
["Refresh Speedbar" mh-speed-refresh t])
"Extra menu items for speedbar.")
(forward-line -1)
(speedbar-change-expand-button-char ?+)
(add-text-properties
- (mh-line-beginning-position) (1+ (line-beginning-position))
+ (line-beginning-position) (1+ (line-beginning-position))
'(mh-expanded nil)))
(t
(forward-line)
(goto-char point)
(speedbar-change-expand-button-char ?-)
(add-text-properties
- (mh-line-beginning-position) (1+ (line-beginning-position))
+ (line-beginning-position) (1+ (line-beginning-position))
'(mh-expanded t)))))))
(defun mh-speed-view (&rest _ignored)
"Visits the selected folder just as if you had used \\<mh-folder-mode-map>\\[mh-visit-folder].
The optional arguments from speedbar are IGNORED."
(interactive)
- (let* ((folder (get-text-property (mh-line-beginning-position) 'mh-folder))
+ (let* ((folder (get-text-property (line-beginning-position) 'mh-folder))
(range (and (stringp folder)
(mh-read-range "Scan" folder t nil nil
mh-interpret-number-as-range-flag))))
(forward-line -1)
(setf (gethash nil mh-speed-folder-map)
(set-marker (or (gethash nil mh-speed-folder-map) (make-marker))
- (1+ (mh-line-beginning-position))))
+ (1+ (line-beginning-position))))
(add-text-properties
- (mh-line-beginning-position) (1+ (line-beginning-position))
+ (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)
(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]+)" (mh-line-end-position) t)
+ (if (re-search-forward "([1-9][0-9]*/[0-9]+)" (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 "\\[.\\] " (mh-line-end-position) t)
- (put-text-property (point) (mh-line-end-position) 'face face)))))
+ (when (re-search-forward "\\[.\\] " (line-end-position) t)
+ (put-text-property (point) (line-end-position) 'face face)))))
(defun mh-speed-normal-face (face)
"Return normal face for given FACE."
(while suffix-list
;; We always need at least one toggle. We need two if the directory list
;; is stale since a folder was added.
- (when (equal prefix (get-text-property (mh-line-beginning-position)
+ (when (equal prefix (get-text-property (line-beginning-position)
'mh-folder))
(mh-speed-toggle)
(unless (get-text-property (point) 'mh-expanded)
(setf (gethash folder-name mh-speed-folder-map)
(set-marker (or (gethash folder-name mh-speed-folder-map)
(make-marker))
- (1+ (mh-line-beginning-position))))
+ (1+ (line-beginning-position))))
(add-text-properties
- (mh-line-beginning-position) (1+ (mh-line-beginning-position))
+ (line-beginning-position) (1+ (line-beginning-position))
`(mh-folder ,folder-name
mh-expanded nil
mh-children-p ,(not (not (cdr f)))
(interactive (list t))
(when force
(when mh-speed-flists-timer
- (mh-cancel-timer mh-speed-flists-timer)
+ (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)))
face)
(when pos
(goto-char pos)
- (goto-char (mh-line-beginning-position))
+ (goto-char (line-beginning-position))
(cond
((null (get-text-property (point) 'mh-count))
- (goto-char (mh-line-end-position))
+ (goto-char (line-end-position))
(setq face (get-text-property (1- (point)) 'face))
(insert (format " (%s/%s)" unseen total))
(mh-speed-highlight 'unknown face)
- (goto-char (mh-line-beginning-position))
+ (goto-char (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 (mh-line-end-position))
+ (goto-char (line-end-position))
(setq face (get-text-property (1- (point)) 'face))
- (re-search-backward " " (mh-line-beginning-position) t)
- (delete-region (point) (mh-line-end-position))
+ (re-search-backward " " (line-beginning-position) t)
+ (delete-region (point) (line-end-position))
(insert (format " (%s/%s)" unseen total))
(mh-speed-highlight 'unknown face)
- (goto-char (mh-line-beginning-position))
+ (goto-char (line-beginning-position))
(add-text-properties
(point) (1+ (point))
`(mh-count (,unseen . ,total))))))))))))
(caar parent-kids)))
(setq parent-change ? ))))
(goto-char parent-position)
- (when (equal (get-text-property (mh-line-beginning-position) 'mh-folder)
+ (when (equal (get-text-property (line-beginning-position) 'mh-folder)
parent)
- (when (get-text-property (mh-line-beginning-position) 'mh-expanded)
+ (when (get-text-property (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
- (mh-line-beginning-position) (1+ (mh-line-beginning-position))
+ (line-beginning-position) (1+ (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)
"Change the expansion button character to CHAR for the current line."
(save-excursion
(beginning-of-line)
- (if (re-search-forward "\\[.\\]" (mh-line-end-position) t)
+ (if (re-search-forward "\\[.\\]" (line-end-position) t)
(speedbar-with-writable
(backward-char 2)
(delete-char 1)
(speedbar-with-writable
(mh-speedbar-change-expand-button-char ?+)
(add-text-properties
- (mh-line-beginning-position) (1+ (mh-line-beginning-position))
+ (line-beginning-position) (1+ (line-beginning-position))
'(mh-children-p t)))
- (when (get-text-property (mh-line-beginning-position) 'mh-expanded)
+ (when (get-text-property (line-beginning-position) 'mh-expanded)
(mh-speed-toggle))
(setq mh-speed-refresh-flag t))))
(while (not (eobp))
(forward-char address-start-offset)
(unless (equal (string-match spaces (buffer-substring-no-properties
- (point) (mh-line-end-position)))
+ (point) (line-end-position)))
0)
(beginning-of-line)
(backward-char)
the scan line. Otherwise uses the line at point as the scan line
to parse."
(let* ((string (or string (buffer-substring-no-properties
- (mh-line-beginning-position)
- (mh-line-end-position))))
+ (line-beginning-position)
+ (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)))
(while (not (eobp))
(cl-block process-message
(let* ((index-line
- (prog1 (buffer-substring (point) (mh-line-end-position))
+ (prog1 (buffer-substring (point) (line-end-position))
(forward-line)))
(index (string-to-number index-line))
- (id (prog1 (buffer-substring (point) (mh-line-end-position))
+ (id (prog1 (buffer-substring (point) (line-end-position))
(forward-line)))
(refs (prog1
- (buffer-substring (point) (mh-line-end-position))
+ (buffer-substring (point) (line-end-position))
(forward-line)))
(in-reply-to (prog1 (buffer-substring (point)
- (mh-line-end-position))
+ (line-end-position))
(forward-line)))
(subject (prog1
(buffer-substring
- (point) (mh-line-end-position))
+ (point) (line-end-position))
(forward-line)))
(subject-re-p nil))
(unless (gethash index mh-thread-scan-line-map)
;; Tool bar initialization functions
(defun mh-tool-bar-folder-buttons-init ()
(when (mh-buffer-exists-p 'mh-folder-mode)
- (let* ((load-path (mh-image-load-path-for-library "mh-e"
- "mh-logo.xpm"))
+ (let* ((load-path (image-load-path-for-library "mh-e"
+ "mh-logo.xpm"))
(image-load-path (cons (car load-path)
(when (boundp 'image-load-path)
image-load-path))))
tool-bar-map)))))
(defun mh-tool-bar-letter-buttons-init ()
(when (mh-buffer-exists-p 'mh-letter-mode)
- (let* ((load-path (mh-image-load-path-for-library "mh-e"
- "mh-logo.xpm"))
+ (let* ((load-path (image-load-path-for-library "mh-e"
+ "mh-logo.xpm"))
(image-load-path (cons (car load-path)
(when (boundp 'image-load-path)
image-load-path))))
(let ((syntax-table (syntax-table)))
(unwind-protect
(save-excursion
- (mh-mail-abbrev-make-syntax-table)
+ (mail-abbrev-make-syntax-table)
(set-syntax-table mail-abbrev-syntax-table)
(backward-word n)
(point))
(defun mh-colors-available-p ()
"Check if colors are available in the Emacs being used."
;; FIXME: Can this be replaced with `display-color-p'?
- (let ((color-cells (mh-display-color-cells)))
+ (let ((color-cells (display-color-cells)))
(and (numberp color-cells) (>= color-cells 8))))
;;;###mh-autoload
(not (string-equal string "")))
(cl-loop for i from 0 to (1- (length mh-pick-regexp-chars)) do
(let ((s (string ?\\ (aref mh-pick-regexp-chars i))))
- (setq string (mh-replace-regexp-in-string s s string t t))))
+ (setq string (replace-regexp-in-string s s string t t))))
(setq quoted-pick-expr (append quoted-pick-expr (list string)))))
quoted-pick-expr))
(defun mh-logo-display ()
"Modify mode line to display MH-E logo."
(mh-do-in-gnu-emacs
- (let* ((load-path (mh-image-load-path-for-library "mh-e" "mh-logo.xpm"))
+ (let* ((load-path (image-load-path-for-library "mh-e" "mh-logo.xpm"))
(image-load-path (cons (car load-path)
(when (boundp 'image-load-path)
image-load-path))))
;; folder is specified, ensure it is nil to avoid adding the
;; folder to the folder-list and adding a slash to it.
(when folder
- (setq folder (mh-replace-regexp-in-string "^\\+" "" folder))
- (setq folder (mh-replace-regexp-in-string "/+$" "" folder))
+ (setq folder (replace-regexp-in-string "^\\+" "" folder))
+ (setq folder (replace-regexp-in-string "/+$" "" folder))
(if (equal folder "")
(setq folder nil)))
;; Add provided folder to list, unless all folders are asked for.
(apply #'call-process arg-list)
(goto-char (point-min))
(while (not (and (eolp) (bolp)))
- (goto-char (mh-line-end-position))
- (let ((start-pos (mh-line-beginning-position))
+ (goto-char (line-end-position))
+ (let ((start-pos (line-beginning-position))
(has-pos (search-backward " has "
- (mh-line-beginning-position) t)))
+ (line-beginning-position) t)))
(when (integerp has-pos)
(while (equal (char-after has-pos) ? )
(cl-decf has-pos))
(setq name (substring name 0 (1- (length name)))))
(push
(cons name
- (search-forward "(others)" (mh-line-end-position) t))
+ (search-forward "(others)" (line-end-position) t))
results))))
(forward-line 1))))
(setq results (nreverse results))
(and (numberp arg)
(>= arg 0))
(and (eq arg 'long)
- (> (mh-line-beginning-position 5) end)))
+ (> (line-beginning-position 5) end)))
(remove-text-properties begin end '(invisible nil))
- (search-forward ":" (mh-line-end-position) t)
+ (search-forward ":" (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.
(when type
(goto-char (point-min))
(when (re-search-forward "^from:" (point-max) t)
- ;; GNU Emacs
(mh-do-in-gnu-emacs
(if (eq type 'url)
(mh-x-image-url-display url)
insert-image (create-image
raw type t
:foreground
- (mh-face-foreground 'mh-show-xface nil t)
+ (face-foreground 'mh-show-xface nil t)
:background
- (mh-face-background 'mh-show-xface nil t))
+ (face-background 'mh-show-xface nil t))
" "))))))))
(defun mh-face-to-png (data)
(defun mh-x-image-url-cache-canonicalize (url)
"Canonicalize URL.
Replace the ?/ character with a ?! character and append .png.
-Also replaces special characters with `mh-url-hexify-string'
+Also replaces special characters with `url-hexify-string'
since not all characters, such as :, are valid within Windows
filenames. In addition, replaces * with %2a. See URL
`https://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/iitemnamelimits/GetValidCharacters.asp'."
(format "%s/%s.png" mh-x-image-cache-directory
- (mh-replace-regexp-in-string
+ (replace-regexp-in-string
"\\*" "%2a"
- (mh-url-hexify-string
+ (url-hexify-string
(with-temp-buffer
(insert url)
(mh-replace-string "/" "!")