Commit 6edcb099 authored by Dave Love's avatar Dave Love

#

parent d56a5054
1999-10-04 Dave Love <fx@gnu.org>
* cus-start.el: Add x-stretch-cursor, indicate-empty-lines,
scroll-up-aggressively, scroll-down-aggressively.
* widget.el (define-widget-keywords): Make dummy definition and
comment-out its use.
* time.el (display-time-mode): Add autoload cookie.
* term.el: Avoid ange-ftp related compilation warnings.
* sun-curs.el: Require sun-fns.
* msb.el: (msb--choose-file-menu): Use `completion-ignore-case' in
name comparisons.
* rect.el: Add/fix various doc strings. Add `*' to all the
interactive specs.
(delete-extract-rectangle): Doc fix from verna.
* tooltip.el (tooltip-mode): Customize this, per convention.
(tooltip-active): Option deleted.
* help-macro.el (three-step-help): Customize.
1999-10-03 Dave Love <fx@gnu.org>
* image.el (defimage): Remove redundant code. Substitute file in
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
;;; dos-win32.el --- Functions shared among MS-DOS and Win32 (NT/95) platforms
;; Copyright (C) 1996 Free Software Foundation, Inc.
;; Maintainer: Geoff Voelker (voelker@cs.washington.edu)
;; Keywords: internal
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; Parts of this code are duplicated functions taken from dos-fns.el
;; and winnt.el.
;;; Code:
;;; Add %t: into the mode line format just after the open-paren.
(let ((tail (member " %[(" mode-line-format)))
(setcdr tail (cons (purecopy "%t:")
(cdr tail))))
;; Use ";" instead of ":" as a path separator (from files.el).
(setq path-separator ";")
;; Set the null device (for compile.el).
(setq grep-null-device "NUL")
;; Set the grep regexp to match entries with drive letters.
(setq grep-regexp-alist
'(("^\\(\\([a-zA-Z]:\\)?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 3)))
;; For distinguishing file types based upon suffixes.
(defvar file-name-buffer-file-type-alist
'(
("[:/].*config.sys$" . nil) ; config.sys text
("\\.elc$" . t) ; emacs stuff
("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\)$" . t)
; MS-Dos stuff
("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t)
; Packers
("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\)$" . t)
; Unix stuff
("\\.tp[ulpw]$" . t)
; Borland Pascal stuff
("[:/]tags$" . t)
; Emacs TAGS file
)
"*Alist for distinguishing text files from binary files.
Each element has the form (REGEXP . TYPE), where REGEXP is matched
against the file name, and TYPE is nil for text, t for binary.")
(defun find-buffer-file-type (filename)
;; First check if file is on an untranslated filesystem, then on the alist.
(if (untranslated-file-p filename)
t ; for binary
(let ((alist file-name-buffer-file-type-alist)
(found nil)
(code nil))
(let ((case-fold-search t))
(setq filename (file-name-sans-versions filename))
(while (and (not found) alist)
(if (string-match (car (car alist)) filename)
(setq code (cdr (car alist))
found t))
(setq alist (cdr alist))))
(if found
(cond ((memq code '(nil t)) code)
((and (symbolp code) (fboundp code))
(funcall code filename)))
default-buffer-file-type))))
(defun find-file-binary (filename)
"Visit file FILENAME and treat it as binary."
(interactive "FFind file binary: ")
(let ((file-name-buffer-file-type-alist '(("" . t))))
(find-file filename)))
(defun find-file-text (filename)
"Visit file FILENAME and treat it as a text file."
(interactive "FFind file text: ")
(let ((file-name-buffer-file-type-alist '(("" . nil))))
(find-file filename)))
(defun find-file-not-found-set-buffer-file-type ()
(save-excursion
(set-buffer (current-buffer))
(setq buffer-file-type (find-buffer-file-type (buffer-file-name))))
nil)
;;; To set the default file type on new files.
(add-hook 'find-file-not-found-hooks 'find-file-not-found-set-buffer-file-type)
;;; To accomodate filesystems that do not require CR/LF translation.
(defvar untranslated-filesystem-list nil
"List of filesystems that require no CR/LF translation during file I/O.
Each element in the list is a string naming the directory prefix
corresponding to the filesystem.")
(defun untranslated-canonical-name (filename)
"Return FILENAME in a canonicalized form.
This is for use with the functions dealing with untranslated filesystems."
(if (memq system-type '(ms-dos windows-nt))
;; The canonical form for DOS/NT/Win95 is with A-Z downcased and all
;; directory separators changed to directory-sep-char.
(let ((name nil))
(setq name (mapconcat
'(lambda (char)
(if (and (<= ?A char) (<= char ?Z))
(char-to-string (+ (- char ?A) ?a))
(char-to-string char)))
filename nil))
;; Use expand-file-name to canonicalize directory separators, except
;; with bare drive letters (which would have the cwd appended).
(if (string-match "^.:$" name)
name
(expand-file-name name)))
filename))
(defun untranslated-file-p (filename)
"Test whether CR/LF translation should be disabled for FILENAME.
Return t if FILENAME is on a filesystem that does not require
CR/LF translation, and nil otherwise."
(let ((fs (untranslated-canonical-name filename))
(ufs-list untranslated-filesystem-list)
(found nil))
(while (and (not found) ufs-list)
(if (string-match (concat "^" (regexp-quote (car ufs-list))) fs)
(setq found t)
(setq ufs-list (cdr ufs-list))))
found))
(defun add-untranslated-filesystem (filesystem)
"Record that FILESYSTEM does not require CR/LF translation.
FILESYSTEM is a string containing the directory prefix corresponding to
the filesystem. For example, for a Unix filesystem mounted on drive Z:,
FILESYSTEM could be \"Z:\"."
(let ((fs (untranslated-canonical-name filesystem)))
(if (member fs untranslated-filesystem-list)
untranslated-filesystem-list
(setq untranslated-filesystem-list
(cons fs untranslated-filesystem-list)))))
(defun remove-untranslated-filesystem (filesystem)
"Record that FILESYSTEM requires CR/LF translation.
FILESYSTEM is a string containing the directory prefix corresponding to
the filesystem. For example, for a Unix filesystem mounted on drive Z:,
FILESYSTEM could be \"Z:\"."
(setq untranslated-filesystem-list
(delete (untranslated-canonical-name filesystem)
untranslated-filesystem-list)))
(provide 'dos-win32)
;;; dos-win32.el ends here
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
;;; gnus-demon.el --- daemonic Gnus behaviour
;; Copyright (C) 1995,96 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
;; Keywords: news
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; Code:
(require 'gnus)
(eval-when-compile (require 'cl))
(defvar gnus-demon-handlers nil
"Alist of daemonic handlers to be run at intervals.
Each handler is a list on the form
\(FUNCTION TIME IDLE)
FUNCTION is the function to be called.
TIME is the number of `gnus-demon-timestep's between each call.
If nil, never call. If t, call each `gnus-demon-timestep'.
If IDLE is t, only call if Emacs has been idle for a while. If IDLE
is a number, only call when Emacs has been idle more than this number
of `gnus-demon-timestep's. If IDLE is nil, don't care about
idleness. If IDLE is a number and TIME is nil, then call once each
time Emacs has been idle for IDLE `gnus-demon-timestep's.")
(defvar gnus-demon-timestep 60
"*Number of seconds in each demon timestep.")
;;; Internal variables.
(defvar gnus-demon-timer nil)
(defvar gnus-demon-idle-has-been-called nil)
(defvar gnus-demon-idle-time 0)
(defvar gnus-demon-handler-state nil)
(defvar gnus-demon-is-idle nil)
(defvar gnus-demon-last-keys nil)
(eval-and-compile
(autoload 'timezone-parse-date "timezone")
(autoload 'timezone-make-arpa-date "timezone"))
;;; Functions.
(defun gnus-demon-add-handler (function time idle)
"Add the handler FUNCTION to be run at TIME and IDLE."
;; First remove any old handlers that use this function.
(gnus-demon-remove-handler function)
;; Then add the new one.
(push (list function time idle) gnus-demon-handlers)
(gnus-demon-init))
(defun gnus-demon-remove-handler (function &optional no-init)
"Remove the handler FUNCTION from the list of handlers."
(setq gnus-demon-handlers
(delq (assq function gnus-demon-handlers)
gnus-demon-handlers))
(or no-init (gnus-demon-init)))
(defun gnus-demon-init ()
"Initialize the Gnus daemon."
(interactive)
(gnus-demon-cancel)
(if (null gnus-demon-handlers)
() ; Nothing to do.
;; Set up timer.
(setq gnus-demon-timer
(nnheader-run-at-time
gnus-demon-timestep gnus-demon-timestep 'gnus-demon))
;; Reset control variables.
(setq gnus-demon-handler-state
(mapcar
(lambda (handler)
(list (car handler) (gnus-demon-time-to-step (nth 1 handler))
(nth 2 handler)))
gnus-demon-handlers))
(setq gnus-demon-idle-time 0)
(setq gnus-demon-idle-has-been-called nil)
(setq gnus-use-demon t)))
(gnus-add-shutdown 'gnus-demon-cancel 'gnus)
(defun gnus-demon-cancel ()
"Cancel any Gnus daemons."
(interactive)
(and gnus-demon-timer
(nnheader-cancel-timer gnus-demon-timer))
(setq gnus-demon-timer nil
gnus-use-demon nil))
(defun gnus-demon-is-idle-p ()
"Whether Emacs is idle or not."
;; We do this simply by comparing the 100 most recent keystrokes
;; with the ones we had last time. If they are the same, one might
;; guess that Emacs is indeed idle. This only makes sense if one
;; calls this function seldom -- like once a minute, which is what
;; we do here.
(let ((keys (recent-keys)))
(or (equal keys gnus-demon-last-keys)
(progn
(setq gnus-demon-last-keys keys)
nil))))
(defun gnus-demon-time-to-step (time)
"Find out how many seconds to TIME, which is on the form \"17:43\"."
(if (not (stringp time))
time
(let* ((date (current-time-string))
(dv (timezone-parse-date date))
(tdate (timezone-make-arpa-date
(string-to-number (aref dv 0))
(string-to-number (aref dv 1))
(string-to-number (aref dv 2)) time
(or (aref dv 4) "UT")))
(nseconds (gnus-time-minus
(gnus-encode-date tdate) (gnus-encode-date date))))
(round
(/ (if (< nseconds 0)
(+ nseconds (* 60 60 24))
nseconds) gnus-demon-timestep)))))
(defun gnus-demon ()
"The Gnus daemon that takes care of running all Gnus handlers."
;; Increase or reset the time Emacs has been idle.
(if (gnus-demon-is-idle-p)
(incf gnus-demon-idle-time)
(setq gnus-demon-idle-time 0)
(setq gnus-demon-idle-has-been-called nil))
;; Then we go through all the handler and call those that are
;; sufficiently ripe.
(let ((handlers gnus-demon-handler-state)
handler time idle)
(while handlers
(setq handler (pop handlers))
(cond
((numberp (setq time (nth 1 handler)))
;; These handlers use a regular timeout mechanism. We decrease
;; the timer if it hasn't reached zero yet.
(or (zerop time)
(setcar (nthcdr 1 handler) (decf time)))
(and (zerop time) ; If the timer now is zero...
(or (not (setq idle (nth 2 handler))) ; Don't care about idle.
(and (numberp idle) ; Numerical idle...
(< idle gnus-demon-idle-time)) ; Idle timed out.
gnus-demon-is-idle) ; Or just need to be idle.
;; So we call the handler.
(progn
(funcall (car handler))
;; And reset the timer.
(setcar (nthcdr 1 handler)
(gnus-demon-time-to-step
(nth 1 (assq (car handler) gnus-demon-handlers)))))))
;; These are only supposed to be called when Emacs is idle.
((null (setq idle (nth 2 handler)))
;; We do nothing.
)
((not (numberp idle))
;; We want to call this handler each and every time that
;; Emacs is idle.
(funcall (car handler)))
(t
;; We want to call this handler only if Emacs has been idle
;; for a specified number of timesteps.
(and (not (memq (car handler) gnus-demon-idle-has-been-called))
(< idle gnus-demon-idle-time)
(progn
(funcall (car handler))
;; Make sure the handler won't be called once more in
;; this idle-cycle.
(push (car handler) gnus-demon-idle-has-been-called))))))))
(defun gnus-demon-add-nocem ()
"Add daemonic NoCeM handling to Gnus."
(gnus-demon-add-handler 'gnus-demon-scan-nocem 60 t))
(defun gnus-demon-scan-nocem ()
"Scan NoCeM groups for NoCeM messages."
(gnus-nocem-scan-groups))
(defun gnus-demon-add-disconnection ()
"Add daemonic server disconnection to Gnus."
(gnus-demon-add-handler 'gnus-demon-close-connections nil 30))
(defun gnus-demon-close-connections ()
(gnus-close-backends))
(defun gnus-demon-add-scanmail ()
"Add daemonic scanning of mail from the mail backends."
(gnus-demon-add-handler 'gnus-demon-scan-mail 120 60))
(defun gnus-demon-scan-mail ()
(let ((servers gnus-opened-servers)
server)
(while (setq server (car (pop servers)))
(and (gnus-check-backend-function 'request-scan (car server))
(or (gnus-server-opened server)
(gnus-open-server server))
(gnus-request-scan nil server)))))
(provide 'gnus-demon)
;;; gnus-demon.el ends here
This diff is collapsed.
;;; gnus-ems.el --- functions for making Gnus work under different Emacsen
;; Copyright (C) 1995,96 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
;; Keywords: news
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; Code:
(eval-when-compile (require 'cl))
(defvar gnus-mouse-2 [mouse-2])
(defalias 'gnus-make-overlay 'make-overlay)
(defalias 'gnus-overlay-put 'overlay-put)
(defalias 'gnus-move-overlay 'move-overlay)
(defalias 'gnus-overlay-end 'overlay-end)
(defalias 'gnus-extent-detached-p 'ignore)
(defalias 'gnus-extent-start-open 'ignore)
(defalias 'gnus-set-text-properties 'set-text-properties)
(defalias 'gnus-group-remove-excess-properties 'ignore)
(defalias 'gnus-topic-remove-excess-properties 'ignore)
(defalias 'gnus-appt-select-lowest-window 'appt-select-lowest-window)
(defalias 'gnus-mail-strip-quoted-names 'mail-strip-quoted-names)
(defalias 'gnus-make-local-hook 'make-local-hook)
(defalias 'gnus-add-hook 'add-hook)
(defalias 'gnus-character-to-event 'identity)
(defalias 'gnus-add-text-properties 'add-text-properties)
(defalias 'gnus-put-text-property 'put-text-property)
(defalias 'gnus-mode-line-buffer-identification 'identity)
(eval-and-compile
(autoload 'gnus-xmas-define "gnus-xmas")
(autoload 'gnus-xmas-redefine "gnus-xmas")
(autoload 'appt-select-lowest-window "appt.el"))
(or (fboundp 'mail-file-babyl-p)
(fset 'mail-file-babyl-p 'rmail-file-p))
;;; Mule functions.
(defun gnus-mule-cite-add-face (number prefix face)
;; At line NUMBER, ignore PREFIX and add FACE to the rest of the line.
(if face
(let ((inhibit-point-motion-hooks t)
from to)
(goto-line number)
(if (boundp 'MULE)
(forward-char (chars-in-string prefix))
(forward-char (length prefix)))
(skip-chars-forward " \t")
(setq from (point))
(end-of-line 1)
(skip-chars-backward " \t")
(setq to (point))
(if (< from to)
(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))))
(eval-and-compile
(if (string-match "XEmacs\\|Lucid" emacs-version)
()
(defvar gnus-mouse-face-prop 'mouse-face
"Property used for highlighting mouse regions.")
(defvar gnus-article-x-face-command
"{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | xv -quit -"
"String or function to be executed to display an X-Face header.
If it is a string, the command will be executed in a sub-shell
asynchronously. The compressed face will be piped to this command.")
;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
(defvar gnus-display-type
(condition-case nil
(let ((display-resource (x-get-resource ".displayType" "DisplayType")))
(cond (display-resource (intern (downcase display-resource)))
((x-display-color-p) 'color)
((x-display-grayscale-p) 'grayscale)
(t 'mono)))
(error 'mono))
"A symbol indicating the display Emacs is running under.
The symbol should be one of `color', `grayscale' or `mono'. If Emacs
guesses this display attribute wrongly, either set this variable in
your `~/.emacs' or set the resource `Emacs.displayType' in your
`~/.Xdefaults'. See also `gnus-background-mode'.
This is a meta-variable that will affect what default values other
variables get. You would normally not change this variable, but
pounce directly on the real variables themselves.")
(defvar gnus-background-mode
(condition-case nil
(let ((bg-resource (x-get-resource ".backgroundMode"
"BackgroundMode"))
(params (frame-parameters)))
(cond (bg-resource (intern (downcase bg-resource)))
((and (cdr (assq 'background-color params))
(< (apply '+ (x-color-values
(cdr (assq 'background-color params))))
(* (apply '+ (x-color-values "white")) .6)))
'dark)
(t 'light)))
(error 'light))
"A symbol indicating the Emacs background brightness.
The symbol should be one of `light' or `dark'.
If Emacs guesses this frame attribute wrongly, either set this variable in
your `~/.emacs' or set the resource `Emacs.backgroundMode' in your
`~/.Xdefaults'.
See also `gnus-display-type'.
This is a meta-variable that will affect what default values other
variables get. You would normally not change this variable, but
pounce directly on the real variables themselves."))
(cond
((string-match "XEmacs\\|Lucid" emacs-version)
(gnus-xmas-define))
((or (not (boundp 'emacs-minor-version))
(< emacs-minor-version 30))
;; Remove the `intangible' prop.
(let ((props (and (boundp 'gnus-hidden-properties)
gnus-hidden-properties)))
(while (and props (not (eq (car (cdr props)) 'intangible)))
(setq props (cdr props)))
(and props (setcdr props (cdr (cdr (cdr props))))))
(or (fboundp 'buffer-substring-no-properties)
(defun buffer-substring-no-properties (beg end)
(format "%s" (buffer-substring beg end)))))
((boundp 'MULE)
(provide 'gnusutil))))
(eval-and-compile
(cond
((not window-system)
(defun gnus-dummy-func (&rest args))
(let ((funcs '(mouse-set-point set-face-foreground
set-face-background x-popup-menu)))
(while funcs
(or (fboundp (car funcs))
(fset (car funcs) 'gnus-dummy-func))
(setq funcs (cdr funcs))))))
(or (fboundp 'file-regular-p)
(defun file-regular-p (file)
(and (not (file-directory-p file))
(not (file-symlink-p file))
(file-exists-p file))))
(or (fboundp 'face-list)
(defun face-list (&rest args))))
(eval-and-compile
(let ((case-fold-search t))
(cond
((string-match "windows-nt\\|os/2\\|emx" (format "%s" system-type))
(setq nnheader-file-name-translation-alist
(append nnheader-file-name-translation-alist
'((?: . ?_)
(?+ . ?-))))))))
(defvar gnus-tmp-unread)
(defvar gnus-tmp-replied)
(defvar gnus-tmp-score-char)
(defvar gnus-tmp-indentation)
(defvar gnus-tmp-opening-bracket)
(defvar gnus-tmp-lines)
(defvar gnus-tmp-name)
(defvar gnus-tmp-closing-bracket)
(defvar gnus-tmp-subject-or-nil)
(defun gnus-ems-redefine ()
(cond
((string-match "XEmacs\\|Lucid" emacs-version)
(gnus-xmas-redefine))
((boundp 'MULE)
;; Mule definitions