aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann1999-07-21 21:43:03 +0000
committerGerd Moellmann1999-07-21 21:43:03 +0000
commit81b99826ff1a5090284e7c815b7ffb1f8e286208 (patch)
treeac9f65d2a9f07ed693d283e0bc516fdb20c8c4e5
parentcf4eb316c1a3c33882e2fad6cf943abe93933d85 (diff)
downloademacs-81b99826ff1a5090284e7c815b7ffb1f8e286208.tar.gz
emacs-81b99826ff1a5090284e7c815b7ffb1f8e286208.zip
(after-setting-font-hooks): New; from Eric Banchrow
<offby1@blarg.net>. (set-frame-font): Run the hooks. (frame-initialize): Use tty-create-frame-with-faces. (show-trailing-whitespace): New. (blink-cursor-mode): Function to toggle blinking cursor mode. The cursor of selected_window blinks if the mode is enabled.
-rw-r--r--lisp/frame.el123
1 files changed, 120 insertions, 3 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index c9cc139630d..e329a87af37 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -204,8 +204,8 @@ These supersede the values given in `default-frame-alist'."
204 ;; we support that feature, otherwise arrange to cause errors. 204 ;; we support that feature, otherwise arrange to cause errors.
205 (or (eq window-system 'pc) 205 (or (eq window-system 'pc)
206 (setq frame-creation-function 206 (setq frame-creation-function
207 (if (fboundp 'make-terminal-frame) 207 (if (fboundp 'tty-create-frame-with-faces)
208 'make-terminal-frame 208 'tty-create-frame-with-faces
209 (function 209 (function
210 (lambda (parameters) 210 (lambda (parameters)
211 (error 211 (error
@@ -445,6 +445,9 @@ The optional second argument PARAMETERS specifies additional frame parameters."
445 "Functions to run after a frame is created. 445 "Functions to run after a frame is created.
446The functions are run with one arg, the newly created frame.") 446The functions are run with one arg, the newly created frame.")
447 447
448(defvar after-setting-font-hooks nil
449 "Functions to run after a frame's font has been changed.")
450
448;; Alias, kept temporarily. 451;; Alias, kept temporarily.
449(defalias 'new-frame 'make-frame) 452(defalias 'new-frame 'make-frame)
450 453
@@ -662,7 +665,8 @@ To get the frame's current default font, use `frame-parameters'."
662 (modify-frame-parameters (selected-frame) 665 (modify-frame-parameters (selected-frame)
663 (list (cons 'font font-name))) 666 (list (cons 'font font-name)))
664 ;; Update faces that want a bold or italic version of the default font. 667 ;; Update faces that want a bold or italic version of the default font.
665 (frame-update-faces (selected-frame))) 668 (frame-update-faces (selected-frame))
669 (run-hooks 'after-setting-font-hooks))
666 670
667(defun set-background-color (color-name) 671(defun set-background-color (color-name)
668 "Set the background color of the selected frame to COLOR. 672 "Set the background color of the selected frame to COLOR.
@@ -770,6 +774,119 @@ should use `set-frame-height' instead."
770(make-obsolete 'set-screen-height 'set-frame-height) 774(make-obsolete 'set-screen-height 'set-frame-height)
771 775
772 776
777;;; Highlighting trailing whitespace.
778
779(make-variable-buffer-local 'show-trailing-whitespace)
780
781(defcustom show-trailing-whitespace nil
782 "*Non-nil means highlight trailing whitespace in face `trailing-whitespace'."
783 :tag "Highlight trailing whitespace."
784 :set #'(lambda (symbol value) (set-default symbol value))
785 :type 'boolean
786 :group 'font-lock)
787
788
789
790;;; Blinking cursor
791
792(defgroup cursor nil
793 "Cursor on frames."
794 :group 'frames)
795
796(defcustom blink-cursor-delay 0.5
797 "*Seconds of Emacs idle time after which cursor starts to blink."
798 :tag "Delay in seconds."
799 :type 'number
800 :group 'cursor)
801
802(defcustom blink-cursor-interval 0.5
803 "*Length of cursor blink interval in seconds."
804 :tag "Blink interval in seconds."
805 :type 'number
806 :group 'cursor)
807
808(defvar blink-cursor-idle-timer nil
809 "Timer started after blink-cursor-delay seconds of Emacs idle time.
810The function blink-cursor-start is called when the timer fires.")
811
812(defvar blink-cursor-timer nil
813 "Time started from blink-cursor-start. This timer calls blink-cursor
814every blink-cursor-interval seconds.")
815
816(defvar blink-cursor-mode nil
817 "Non-nil means blinking cursor is active.")
818
819(defun blink-cursor-mode (arg)
820 "Toggle blinking cursor mode.
821With arg, turn blinking cursor mode on iff arg is positive.
822When blinking cursor mode is enabled, the cursor of the selected
823window blinks."
824 (interactive "P")
825 (let ((on-p (if (null arg)
826 (not blink-cursor-mode)
827 (> (prefix-numeric-value arg) 0))))
828 (if blink-cursor-idle-timer
829 (cancel-timer blink-cursor-idle-timer))
830 (if blink-cursor-timer
831 (cancel-timer blink-cursor-timer))
832 (setq blink-cursor-idle-timer nil
833 blink-cursor-timer nil
834 blink-cursor-mode nil)
835 (if on-p
836 (progn
837 ;; Hide the cursor.
838 (show-cursor 0)
839 (setq blink-cursor-idle-timer
840 (run-with-idle-timer blink-cursor-delay
841 blink-cursor-delay
842 'blink-cursor-start))
843 (setq blink-cursor-mode t)))))
844
845(defcustom blink-cursor t
846 "*Non-nil means blink-cursor-mode is active."
847 :tag "Blinking cursor"
848 :type 'boolean
849 :group 'cursor
850 :set #'(lambda (symbol value)
851 (set-default symbol value)
852 (blink-cursor-mode (or value 0))))
853
854(defun blink-cursor-start ()
855 "Timer function called from timer blink-cursor-idle-timer.
856Starts the timer blink-cursor-timer which lets the cursor blink
857if the selected frame has a non-nil `cursor-blinking' frame parameter.
858Arranges to cancel that timer by installing a pre command hook."
859 (when (null blink-cursor-timer)
860 (add-hook 'pre-command-hook 'blink-cursor-end)
861 (setq blink-cursor-timer
862 (run-with-timer blink-cursor-interval blink-cursor-interval
863 'show-cursor))))
864
865(defun blink-cursor-end ()
866 "Stop cursor blinking.
867Installed as a pre-command hook by blink-cursor-start. Cancels
868the timer blink-cursor-timer and removes itself from the hook."
869 (remove-hook 'pre-command-hook 'blink-cursor-end)
870 (show-cursor 0)
871 (cancel-timer blink-cursor-timer)
872 (setq blink-cursor-timer nil))
873
874
875
876;;; Busy-cursor.
877
878(defcustom busy-cursor t
879 "*Non-nil means show a busy-cursor when running under a window-system."
880 :tag "Busy-cursor"
881 :type 'boolean
882 :group 'cursor
883 :get #'(lambda (symbol) display-busy-cursor)
884 :set #'(lambda (symbol value)
885 (set-default symbol value)
886 (setq display-busy-cursor value)))
887
888
889
773;;;; Key bindings 890;;;; Key bindings
774 891
775(define-key ctl-x-5-map "2" 'make-frame-command) 892(define-key ctl-x-5-map "2" 'make-frame-command)