comparison lisp/mh-e/mh-utils.el @ 68135:03bac2d0a4aa

* Makefile (MH_E_SRC): Add mh-buffers.el. * emacs/lisp/Makefile.in (MH_E_SRC): Rename from MH-E-SRC since the dashes can give some systems gas. Add new file mh-buffers.el. * emacs/lisp/mh-e/mh-buffers.el: New file. Contains constants and code from mh-index.el and mh-utils.el. * emacs/lisp/mh-e/mh-alias.el: * emacs/lisp/mh-e/mh-comp.el: * emacs/lisp/mh-e/mh-e.el: * emacs/lisp/mh-e/mh-funcs.el: * emacs/lisp/mh-e/mh-init.el: * emacs/lisp/mh-e/mh-junk.el: * emacs/lisp/mh-e/mh-mime.el: * emacs/lisp/mh-e/mh-print.el: * emacs/lisp/mh-e/mh-seq.el: Require new file mh-buffers.el. * emacs/lisp/mh-e/mh-index.el: Require new file mh-buffers.el. (mh-index-temp-buffer, mh-checksum-buffer): Move to new file mh-buffers.el. * emacs/lisp/mh-e/mh-utils.el: Require new file mh-buffers.el. (mh-temp-buffer, mh-temp-fetch-buffer) (mh-aliases-buffer, mh-folders-buffer, mh-help-buffer) (mh-info-buffer, mh-log-buffer, mh-mail-delivery-buffer) (mh-recipients-buffer, mh-sequences-buffer, mh-log-buffer-lines) (mh-truncate-log-buffer): Move to new file mh-buffers.el.
author Bill Wohler <wohler@newt.com>
date Wed, 11 Jan 2006 19:50:07 +0000
parents b9b10fe7c97a
children ec4727559827
comparison
equal deleted inserted replaced
68134:48bf79d0aede 68135:03bac2d0a4aa
43 (eval-when-compile (require 'mh-acros)) 43 (eval-when-compile (require 'mh-acros))
44 (mh-require-cl) 44 (mh-require-cl)
45 45
46 (require 'font-lock) 46 (require 'font-lock)
47 (require 'gnus-util) 47 (require 'gnus-util)
48 (require 'mh-buffers)
48 (require 'mh-customize) 49 (require 'mh-customize)
49 (require 'mh-inc) 50 (require 'mh-inc)
50 (require 'mouse) 51 (require 'mouse)
51 (require 'sendmail) 52 (require 'sendmail)
52 53
514 515
515 (defvar mh-inbox nil 516 (defvar mh-inbox nil
516 "Cached value of the \"Inbox:\" MH profile component. 517 "Cached value of the \"Inbox:\" MH profile component.
517 Set to \"+inbox\" if no such component. 518 Set to \"+inbox\" if no such component.
518 Name of the Inbox folder.") 519 Name of the Inbox folder.")
519
520 ;; The names of ephemeral buffers have a " *mh-" prefix (so that they are
521 ;; hidden and can be programmatically removed in mh-quit), and the variable
522 ;; names have the form mh-temp-.*-buffer.
523 (defconst mh-temp-buffer " *mh-temp*") ;scratch
524 (defconst mh-temp-fetch-buffer " *mh-fetch*") ;wget/curl/fetch output
525
526 ;; The names of MH-E buffers that are not ephemeral and can be used by the
527 ;; user (and deleted by the user when no longer needed) have a "*MH-E " prefix
528 ;; (so they can be programmatically removed in mh-quit), and the variable
529 ;; names have the form mh-.*-buffer.
530 (defconst mh-aliases-buffer "*MH-E Aliases*") ;alias lookups
531 (defconst mh-folders-buffer "*MH-E Folders*") ;folder list
532 (defconst mh-help-buffer "*MH-E Help*") ;quick help
533 (defconst mh-info-buffer "*MH-E Info*") ;version information buffer
534 (defconst mh-log-buffer "*MH-E Log*") ;output of MH commands and so on
535 (defconst mh-mail-delivery-buffer "*MH-E Mail Delivery*") ;mail delivery log
536 (defconst mh-recipients-buffer "*MH-E Recipients*") ;killed when draft sent
537 (defconst mh-sequences-buffer "*MH-E Sequences*") ;sequences list
538
539 (defvar mh-log-buffer-lines 100
540 "Number of lines to keep in `mh-log-buffer'.")
541 520
542 (defvar mh-previous-window-config nil 521 (defvar mh-previous-window-config nil
543 "Window configuration before MH-E command.") 522 "Window configuration before MH-E command.")
544 523
545 (defvar mh-page-to-next-msg-flag nil 524 (defvar mh-page-to-next-msg-flag nil
2386 ((not (file-directory-p (mh-expand-file-name folder-name))) 2365 ((not (file-directory-p (mh-expand-file-name folder-name)))
2387 (error "%s is not a directory" 2366 (error "%s is not a directory"
2388 (mh-expand-file-name folder-name))))) 2367 (mh-expand-file-name folder-name)))))
2389 folder-name)) 2368 folder-name))
2390 2369
2391 (defun mh-truncate-log-buffer ()
2392 "If `mh-log-buffer' is too big then truncate it.
2393 If the number of lines in `mh-log-buffer' exceeds
2394 `mh-log-buffer-lines' then keep only the last
2395 `mh-log-buffer-lines'. As a side effect the point is set to the
2396 end of the log buffer.
2397
2398 The function returns the size of the final size of the log buffer."
2399 (with-current-buffer (get-buffer-create mh-log-buffer)
2400 (goto-char (point-max))
2401 (save-excursion
2402 (when (equal (forward-line (- mh-log-buffer-lines)) 0)
2403 (delete-region (point-min) (point))))
2404 (unless (or (bobp)
2405 (save-excursion
2406 (and (equal (forward-line -1) 0) (equal (char-after) ? ))))
2407 (insert "\n \n"))
2408 (buffer-size)))
2409
2410 2370
2411 2371
2412 ;;; Issue commands to MH. 2372 ;;; Issue commands to MH.
2413 2373
2414 (defun mh-exec-cmd (command &rest args) 2374 (defun mh-exec-cmd (command &rest args)