(tex-validate-region): Obey syntax-table text properties.
[bpt/emacs.git] / lisp / fringe.el
index 076ab1c..3f1e939 100644 (file)
@@ -1,6 +1,6 @@
 ;;; fringe.el --- change fringes appearance in various ways
 
-;; Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 ;; Maintainer: FSF
 
 ;;; Code:
 
+(defgroup fringe nil
+  "Window fringes."
+  :version "21.4"
+  :group 'frames)
+
 ;; Standard fringe bitmaps
 
 (defmacro fringe-bitmap-p (symbol)
@@ -113,6 +118,25 @@ See `fringe-mode' for possible values and their effect."
                                   fringe-mode))))
       (setq frames (cdr frames)))))
 
+;; For initialization of fringe-mode, take account of changes
+;; made explicitly to default-frame-alist.
+(defun fringe-mode-initialize (symbol value)
+  (let* ((left-pair (assq 'left-fringe default-frame-alist))
+        (right-pair (assq 'right-fringe default-frame-alist))
+        (left (cdr left-pair))
+        (right (cdr right-pair)))
+    (if (or left-pair right-pair)
+       ;; If there's something in default-frame-alist for fringes,
+       ;; don't change it, but reflect that into the value of fringe-mode.
+       (progn
+         (setq fringe-mode (cons left right))
+         (if (equal fringe-mode '(nil . nil))
+             (setq fringe-mode nil))
+         (if (equal fringe-mode '(0 . 0))
+             (setq fringe-mode 0)))
+      ;; Otherwise impose the user-specified value of fringe-mode.
+      (custom-initialize-reset symbol value))))
+
 ;;;###autoload
 (defcustom fringe-mode nil
   "*Specify appearance of fringes on all frames.
@@ -137,8 +161,9 @@ you can use the interactive function `toggle-fringe'"
                 (cons :tag "Different left/right sizes"
                       (integer :tag "Left width")
                       (integer :tag "Right width")))
-  :group 'frames
+  :group 'fringe
   :require 'fringe
+  :initialize 'fringe-mode-initialize
   :set 'set-fringe-mode-1)
 
 (defun fringe-query-style (&optional all-frames)
@@ -232,6 +257,43 @@ SIDE must be the symbol `left' or `right'."
               0)
            (float (frame-char-width))))
 
+;; Fake defvar.  Real definition using defcustom is below.  The fake
+;; defvar is necessary because `fringe-indicators' and
+;; `set-fringe-indicators-1' mutually use each other.
+(defvar fringe-indicators)
+
+(defun set-fringe-indicators-1 (ignore value)
+  "Set fringe indicators according to VALUE.
+This is usually invoked when setting `fringe-indicators' via customize."
+  (setq fringe-indicators value)
+  (setq default-indicate-empty-lines nil)
+  (setq default-indicate-buffer-boundaries
+       (cond
+        ((memq value '(left right t))
+         value)
+        ((eq value 'box)
+         '((top . left) (bottom . right)))
+        ((eq value 'mixed)
+         '((top . left) (t . right)))
+        ((eq value 'empty)
+         (setq default-indicate-empty-lines t)
+         nil)
+        (t nil))))
+
+;;;###autoload
+(defcustom fringe-indicators nil
+  "Visually indicate buffer boundaries and scrolling.
+Setting this variable, changes `default-indicate-buffer-boundaries'."
+  :type '(choice (const :tag "No indicators" nil)
+                (const :tag "On left" left)
+                (const :tag "On right" right)
+                (const :tag "Opposite, no arrows" box)
+                (const :tag "Opposite, arrows right" mixed)
+                (const :tag "Empty lines" empty))
+  :group 'fringe
+  :require 'fringe
+  :set 'set-fringe-indicators-1)
+
 (provide 'fringe)
 
 ;;; arch-tag: 6611ef60-0869-47ed-8b93-587ee7d3ff5d