X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fgnus-ems.el;h=9b3e2cb88486eaf0cc6dcacc57eb55d67bde0fc7;hb=9d1b6122fc44b16bc4590baf99b40d393e729c94;hp=7ded20584a4a1ea68c0b29fcc40f60675c1c266f;hpb=fa8e53b022f57d6040801d21b5c297a0415949fd;p=elisp%2Fgnus.git- diff --git a/lisp/gnus-ems.el b/lisp/gnus-ems.el index 7ded205..9b3e2cb 100644 --- a/lisp/gnus-ems.el +++ b/lisp/gnus-ems.el @@ -34,7 +34,9 @@ "Non-nil if running under XEmacs.") (defvar gnus-mouse-2 [mouse-2]) +(defvar gnus-mouse-3 [mouse-3]) (defvar gnus-down-mouse-2 [down-mouse-2]) +(defvar gnus-widget-button-keymap nil) (defvar gnus-mode-line-modified (if (or gnus-xemacs (< emacs-major-version 20)) @@ -69,14 +71,6 @@ gnus-cite-overlay-list) (gnus-overlay-put (gnus-make-overlay from to) 'face face)))))) -(defun gnus-mule-max-width-function (el max-width) - (` (let* ((val (eval (, el))) - (valstr (if (numberp val) - (int-to-string val) val))) - (if (> (length valstr) (, max-width)) - (truncate-string valstr (, max-width)) - valstr)))) - (defvar gnus-mule-bitmap-image-file nil) (defun gnus-mule-group-startup-message (&optional x y) "Insert startup message in current buffer." @@ -170,14 +164,7 @@ (while funcs (unless (fboundp (car funcs)) (fset (car funcs) 'gnus-dummy-func)) - (setq funcs (cdr funcs)))))) - (unless (fboundp 'file-regular-p) - (defun file-regular-p (file) - (and (not (file-directory-p file)) - (not (file-symlink-p file)) - (file-exists-p file)))) - (unless (fboundp 'face-list) - (defun face-list (&rest args)))) + (setq funcs (cdr funcs))))))) (eval-and-compile (let ((case-fold-search t)) @@ -228,6 +215,50 @@ (fset 'gnus-encode-coding-string 'encode-coding-string) (fset 'gnus-decode-coding-string 'decode-coding-string) + (if (fboundp 'truncate-string-to-width) + (fset 'gnus-truncate-string 'truncate-string-to-width) + (fset 'gnus-truncate-string 'truncate-string)) + + (defun gnus-tilde-max-form (el max-width) + "Return a form that limits EL to MAX-WIDTH." + (let ((max (abs max-width))) + (if (symbolp el) + `(if (> (string-width ,el) ,max) + ,(if (< max-width 0) + `(gnus-truncate-string + ,el (string-width ,el) + (- (string-width ,el) ,max)) + `(gnus-truncate-string ,el ,max)) + ,el) + `(let ((val (eval ,el))) + (if (> (string-width val) ,max) + ,(if (< max-width 0) + `(gnus-truncate-string + val (string-width val) + (- (string-width val) ,max)) + `(gnus-truncate-string val ,max)) + val))))) + + (defun gnus-tilde-cut-form (el cut-width) + "Return a form that cuts CUT-WIDTH off of EL." + (let ((cut (abs cut-width))) + (if (symbolp el) + `(if (> (string-width ,el) ,cut) + ,(if (< cut-width 0) + `(gnus-truncate-string + ,el (- (string-width ,el) ,cut)) + `(gnus-truncate-string + ,el (- (string-width ,el) ,cut) ,cut)) + ,el) + `(let ((val (eval ,el))) + (if (> (string-width val) ,cut) + ,(if (< cut-width 0) + `(gnus-truncate-string + val (- (string-width val) ,cut)) + `(gnus-truncate-string + val (- (string-width val) ,cut) ,cut)) + val))))) + (when window-system (require 'path-util) (if (module-installed-p 'bitmap) @@ -239,31 +270,9 @@ (delq 'long-lines (delq 'control-chars gnus-check-before-posting)))) - (unless (and (fboundp 'set-buffer-multibyte) - (subrp (symbol-function 'set-buffer-multibyte))) - ;; For Emacs 20.1 and 20.2 - (defalias 'gnus-truncate-string 'truncate-string) - (fset 'gnus-cite-add-face 'gnus-mule-cite-add-face) - (fset 'gnus-max-width-function 'gnus-mule-max-width-function) - - (defun gnus-tilde-max-form (el max-width) - "Return a form that limits EL to MAX-WIDTH." - (let ((max (abs max-width))) - (if (symbolp el) - `(if (> (length ,el) ,max) - ,(if (< max-width 0) - `(truncate-string - ,el (string-width ,el) (- (string-width ,el) ,max)) - `(truncate-string ,el ,max)) - ,el) - `(let ((val (eval ,el))) - (if (> (length val) ,max) - ,(if (< max-width 0) - `(truncate-string - val (string-width val) (- (string-width val) ,max)) - `(truncate-string val ,max)) - val))))) - ) + (when (fboundp 'chars-in-string) + (fset 'gnus-cite-add-face 'gnus-mule-cite-add-face)) + ))) (defun gnus-region-active-p () @@ -276,6 +285,7 @@ (defun gnus-add-minor-mode (mode name map) (if (fboundp 'add-minor-mode) (add-minor-mode mode name map) + (set (make-local-variable mode) t) (unless (assq mode minor-mode-alist) (push `(,mode ,name) minor-mode-alist)) (unless (assq mode minor-mode-map-alist) @@ -287,12 +297,12 @@ (let ((dir (nnheader-find-etc-directory "gnus")) pixmap file height beg i) (save-excursion - (switch-to-buffer (get-buffer-create gnus-group-buffer)) + (switch-to-buffer (gnus-get-buffer-create gnus-group-buffer)) (let ((buffer-read-only nil)) (erase-buffer) (when (and dir (file-exists-p (setq file (concat dir "x-splash")))) - (nnheader-temp-write nil + (with-temp-file nil (insert-file-contents file) (goto-char (point-min)) (ignore-errors