Mercurial > hg > xemacs-beta
comparison lisp/mh-e/mh-utils.el @ 2:ac2d302a0011 r19-15b2
Import from CVS: tag r19-15b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:35 +0200 |
parents | 376386a54a3c |
children | 131b0175ea99 |
comparison
equal
deleted
inserted
replaced
1:c0c6a60d29db | 2:ac2d302a0011 |
---|---|
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 ;; GNU General Public License for more details. | 16 ;; GNU General Public License for more details. |
17 | 17 |
18 ;; You should have received a copy of the GNU General Public License | 18 ;; You should have received a copy of the GNU General Public License |
19 ;; along with GNU Emacs; see the file COPYING. If not, write to | 19 ;; along with XEmacs; see the file COPYING. If not, write to the |
20 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 ;; Boston, MA 02111-1307, USA. | |
22 | |
23 ;;; Synched up with: FSF 19.34. | |
21 | 24 |
22 ;;; Commentary: | 25 ;;; Commentary: |
23 | 26 |
24 ;; Internal support for mh-e package. | 27 ;; Internal support for mh-e package. |
25 | 28 |
26 ;;; Change Log: | 29 ;;; Change Log: |
27 | 30 |
28 ;; $Id: mh-utils.el,v 1.1.1.1 1996/12/18 03:34:39 steve Exp $ | 31 ;; $Id: mh-utils.el,v 1.1.1.2 1996/12/18 03:46:49 steve Exp $ |
29 | 32 |
30 ;;; Code: | 33 ;;; Code: |
31 | 34 |
32 ;;; Set for local environment: | 35 ;;; Set for local environment: |
33 ;;; mh-progs and mh-lib used to be set in paths.el, which tried to | 36 ;;; mh-progs and mh-lib used to be set in paths.el, which tried to |
298 (mh-unvisit-file) | 301 (mh-unvisit-file) |
299 (erase-buffer) | 302 (erase-buffer) |
300 ;; Changing contents, so this hook needs to be reinitialized. | 303 ;; Changing contents, so this hook needs to be reinitialized. |
301 ;; pgp.el uses this. | 304 ;; pgp.el uses this. |
302 (if (boundp 'write-contents-hooks) ;Emacs 19 | 305 (if (boundp 'write-contents-hooks) ;Emacs 19 |
303 (setq write-contents-hooks nil)) | 306 (kill-local-variable 'write-contents-hooks)) |
304 (if formfile | 307 (if formfile |
305 (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear" | 308 (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear" |
306 (if (stringp formfile) | 309 (if (stringp formfile) |
307 (list "-form" formfile)) | 310 (list "-form" formfile)) |
308 msg-filename) | 311 msg-filename) |
510 (re-search-forward "[\t ]*\\([^\t \n].*\\)$" nil t) | 513 (re-search-forward "[\t ]*\\([^\t \n].*\\)$" nil t) |
511 (let ((start (match-beginning 1))) | 514 (let ((start (match-beginning 1))) |
512 (end-of-line) | 515 (end-of-line) |
513 (buffer-substring start (point))))))) | 516 (buffer-substring start (point))))))) |
514 | 517 |
515 (defvar mua-paradigm "MH-E") ;from mua.el | 518 (defvar mail-user-agent 'mh-e-user-agent) ;from reporter.el 3.2 |
516 | 519 |
517 (defun mh-find-path () | 520 (defun mh-find-path () |
518 ;; Set mh-progs and mh-lib. | 521 ;; Set mh-progs and mh-lib. |
519 ;; (This step is necessary if MH was installed after this Emacs was dumped.) | 522 ;; (This step is necessary if MH was installed after this Emacs was dumped.) |
520 ;; From profile file, set mh-user-path, mh-draft-folder, | 523 ;; From profile file, set mh-user-path, mh-draft-folder, |
554 (setq mh-unseen-seq (intern mh-unseen-seq)) | 557 (setq mh-unseen-seq (intern mh-unseen-seq)) |
555 (setq mh-unseen-seq 'unseen)) ;old MH default? | 558 (setq mh-unseen-seq 'unseen)) ;old MH default? |
556 (setq mh-previous-seq (mh-get-profile-field "Previous-Sequence:")) | 559 (setq mh-previous-seq (mh-get-profile-field "Previous-Sequence:")) |
557 (if mh-previous-seq | 560 (if mh-previous-seq |
558 (setq mh-previous-seq (intern mh-previous-seq))) | 561 (setq mh-previous-seq (intern mh-previous-seq))) |
559 (setq mua-paradigm "MH-E") | 562 (setq mail-user-agent 'mh-e-user-agent) |
560 (run-hooks 'mh-find-path-hook)))) | 563 (run-hooks 'mh-find-path-hook)))) |
561 | 564 |
562 (defun mh-find-progs () | 565 (defun mh-find-progs () |
563 (or (file-exists-p (expand-file-name "inc" mh-progs)) | 566 (or (file-exists-p (expand-file-name "inc" mh-progs)) |
564 (setq mh-progs | 567 (setq mh-progs |
892 ;; Program output is in current buffer. | 895 ;; Program output is in current buffer. |
893 ;; If output is too long to include in error message, display the buffer. | 896 ;; If output is too long to include in error message, display the buffer. |
894 (cond ((eql status 0) ;success | 897 (cond ((eql status 0) ;success |
895 status) | 898 status) |
896 ((stringp status) ;kill string | 899 ((stringp status) ;kill string |
897 (error (format "%s: %s" command status))) | 900 (error "%s: %s" command status)) |
898 (t ;exit code | 901 (t ;exit code |
899 (cond | 902 (cond |
900 ((= (buffer-size) 0) ;program produced no error message | 903 ((= (buffer-size) 0) ;program produced no error message |
901 (error (format "%s: exit code %d" command status))) | 904 (error "%s: exit code %d" command status)) |
902 (t | 905 (t |
903 ;; will error message fit on one line? | 906 ;; will error message fit on one line? |
904 (goto-line 2) | 907 (goto-line 2) |
905 (if (and (< (buffer-size) (screen-width)) | 908 (if (and (< (buffer-size) (screen-width)) |
906 (eobp)) | 909 (eobp)) |
907 (error (buffer-substring 1 (progn (goto-char 1) | 910 (error "%s" |
911 (buffer-substring 1 (progn (goto-char 1) | |
908 (end-of-line) | 912 (end-of-line) |
909 (point)))) | 913 (point)))) |
910 (display-buffer (current-buffer)) | 914 (display-buffer (current-buffer)) |
911 (error (format | 915 (error "%s failed with status %d. See error message in other window." |
912 "%s failed with status %d. See error message in other window." | 916 command status))))))) |
913 command status)))))))) | |
914 | 917 |
915 | 918 |
916 (defun mh-expand-file-name (filename &optional default) | 919 (defun mh-expand-file-name (filename &optional default) |
917 ;; Just like `expand-file-name', but also handles MH folder names. | 920 ;; Just like `expand-file-name', but also handles MH folder names. |
918 ;; Assumes that any filename that starts with '+' is a folder name. | 921 ;; Assumes that any filename that starts with '+' is a folder name. |