1 |
;;; viper-init.el --- some common definitions for Viper |
;;; viper-init.el --- some common definitions for Viper |
2 |
|
|
3 |
;; Copyright (C) 1997 Free Software Foundation, Inc. |
;; Copyright (C) 1997, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Michael Kifer <kifer@cs.sunysb.edu> |
;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
6 |
|
|
7 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
8 |
|
|
37 |
(defvar current-input-method) |
(defvar current-input-method) |
38 |
(defvar default-input-method) |
(defvar default-input-method) |
39 |
(defvar describe-current-input-method-function) |
(defvar describe-current-input-method-function) |
40 |
|
(defvar bar-cursor) |
41 |
|
(defvar default-cursor-type) |
42 |
|
(defvar cursor-type) |
43 |
;; end pacifier |
;; end pacifier |
44 |
|
|
45 |
|
|
53 |
;; Is it Emacs? |
;; Is it Emacs? |
54 |
(defconst viper-emacs-p (not viper-xemacs-p)) |
(defconst viper-emacs-p (not viper-xemacs-p)) |
55 |
;; Tell whether we are running as a window application or on a TTY |
;; Tell whether we are running as a window application or on a TTY |
56 |
|
|
57 |
|
;; This is used to avoid compilation warnings. When emacs/xemacs forms can |
58 |
|
;; generate compile time warnings, we use this macro. |
59 |
|
;; In this case, the macro will expand into the form that is appropriate to the |
60 |
|
;; compiler at hand. |
61 |
|
;; Suggested by rms. |
62 |
|
(defmacro viper-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form) |
63 |
|
(if (string-match "XEmacs" emacs-version) |
64 |
|
xemacs-form emacs-form)) |
65 |
|
|
66 |
|
|
67 |
(defsubst viper-device-type () |
(defsubst viper-device-type () |
68 |
(if viper-emacs-p |
(viper-cond-compile-for-xemacs-or-emacs |
69 |
window-system |
(device-type (selected-device)) |
70 |
(device-type (selected-device)))) |
window-system |
71 |
|
)) |
72 |
|
|
73 |
;; in XEmacs: device-type is tty on tty and stream in batch. |
;; in XEmacs: device-type is tty on tty and stream in batch. |
74 |
(defun viper-window-display-p () |
(defun viper-window-display-p () |
75 |
(and (viper-device-type) (not (memq (viper-device-type) '(tty stream pc))))) |
(and (viper-device-type) (not (memq (viper-device-type) '(tty stream pc))))) |
450 |
:group 'viper) |
:group 'viper) |
451 |
|
|
452 |
;; XEmacs requires glyphs |
;; XEmacs requires glyphs |
453 |
(if viper-xemacs-p |
(viper-cond-compile-for-xemacs-or-emacs |
454 |
(progn |
(progn ; xemacs |
455 |
(or (glyphp viper-replace-region-end-delimiter) |
(or (glyphp viper-replace-region-end-delimiter) |
456 |
(setq viper-replace-region-end-delimiter |
(setq viper-replace-region-end-delimiter |
457 |
(make-glyph viper-replace-region-end-delimiter))) |
(make-glyph viper-replace-region-end-delimiter))) |
458 |
(or (glyphp viper-replace-region-start-delimiter) |
(or (glyphp viper-replace-region-start-delimiter) |
459 |
(setq viper-replace-region-start-delimiter |
(setq viper-replace-region-start-delimiter |
460 |
(make-glyph viper-replace-region-start-delimiter))) |
(make-glyph viper-replace-region-start-delimiter))) |
461 |
)) |
) |
462 |
|
nil ; emacs |
463 |
|
) |
464 |
|
|
465 |
|
|
466 |
|
|
467 |
;; These are local marker that must be initialized to nil and moved with |
;; These are local marker that must be initialized to nil and moved with |
997 |
(if viper-xemacs-p |
(if viper-xemacs-p |
998 |
(setq bar-cursor nil) |
(setq bar-cursor nil) |
999 |
(setq cursor-type default-cursor-type)) |
(setq cursor-type default-cursor-type)) |
1000 |
(error))) |
(error nil))) |
1001 |
|
|
1002 |
(defun viper-set-insert-cursor-type () |
(defun viper-set-insert-cursor-type () |
1003 |
(if viper-xemacs-p |
(if viper-xemacs-p |