emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unnecessary fringe-indicators defcustom creates trouble


From: Luc Teirlinck
Subject: Re: unnecessary fringe-indicators defcustom creates trouble
Date: Wed, 3 Aug 2005 20:03:04 -0500 (CDT)

The patches below keep all the functionality available through the
menu bar while getting rid of `fringe-indicators'.  They implement
some changes, but that is only because I believe that they are very
much changes for the better and not because getting rid of
`fringe-indicators' requires them.  They can be undone, while still
getting rid of `fringe-indicators'.  The changes are:

1.  More descriptive help-echos.

2.  The extra choice "Other (customize)" for `indicate-buffer-boundaries'.
    If you select that one, you get a customization buffer for
    `indicate-buffer-boundaries'.  This is just to inform people that
    additional choices are available.

3.  The possibility to customize `indicate-empty-lines' and
    `indicate-buffer-boundaries' independently through the menu bar.
    This is desirable, because the two do by no means make each other
    useless. `indicate-empty-lines' does not show buffer beginning nor
    arrows.  `indicate-buffer-boundaries' does not reliably indicate
    all empty lines:  for instance, just using indicate-buffer-boundaries
    it is impossible to tell whether a buffer is completely empty or
    whether you are completely overscrolled.  Also, the isolated
    end-of-buffer glyph can easily be overwritten by some other glyph,
    much more easily than all empty lines at the end of a buffer.
    I personally enable empty line indicators to the left and boundary
    indicators to the right.  The two are absolutely not redundant.

    I also believe that it is confusing to somebody that has enabled
    `indicate-empty-lines' in some other way that enabling buffer
    boundary indicators in the right fringe gets rid of the empty line
    indicators in the left fringe.

===File ~/menu-bar-diff=====================================
*** menu-bar.el 04 Jul 2005 19:48:43 -0500      1.261
--- menu-bar.el 03 Aug 2005 18:34:45 -0500      
***************
*** 649,656 ****
                   debug-on-quit debug-on-error
                   tooltip-mode menu-bar-mode tool-bar-mode
                   save-place uniquify-buffer-name-style fringe-mode
!                  fringe-indicators case-fold-search
!                  display-time-mode auto-compression-mode
                   current-language-environment default-input-method
                   ;; Saving `text-mode-hook' is somewhat questionable,
                   ;; as we might get more than we bargain for, if
--- 649,656 ----
                   debug-on-quit debug-on-error
                   tooltip-mode menu-bar-mode tool-bar-mode
                   save-place uniquify-buffer-name-style fringe-mode
!                  indicate-empty-lines indicate-buffer-boundaries
!                  case-fold-search display-time-mode auto-compression-mode
                   current-language-environment default-input-method
                   ;; Saving `text-mode-hook' is somewhat questionable,
                   ;; as we might get more than we bargain for, if
***************
*** 717,804 ****
                              (frame-visible-p
                               (symbol-value 'speedbar-frame))))))
  
  
! (defvar menu-bar-showhide-fringe-ind-menu (make-sparse-keymap "Indicators"))
! 
! ;; The real definition is in fringe.el.
! ;; This is to prevent errors in the :radio conditions below.
! (setq fringe-indicators nil)
  
! (defun menu-bar-showhide-fringe-ind-empty ()
!   "Display empty line indicators in the left or right fringe."
    (interactive)
!   (require 'fringe)
!   (customize-set-variable 'fringe-indicators 'empty))
  
! (define-key menu-bar-showhide-fringe-ind-menu [empty]
!   '(menu-item "Empty lines only" menu-bar-showhide-fringe-ind-empty
!             :help "Show empty line indicators in fringe"
!             :visible (display-graphic-p)
!             :button (:radio . (eq fringe-indicators 'empty))))
  
  (defun menu-bar-showhide-fringe-ind-mixed ()
!   "Display top and bottom indicators in opposite fringes, arrow in right."
    (interactive)
!   (require 'fringe)
!   (customize-set-variable 'fringe-indicators 'mixed))
  
  (define-key menu-bar-showhide-fringe-ind-menu [mixed]
    '(menu-item "Opposite, arrows right" menu-bar-showhide-fringe-ind-mixed
!             :help "Show top/bottom indicators in opposite fringes, arrows in 
right"
              :visible (display-graphic-p)
!             :button (:radio . (eq fringe-indicators 'mixed))))
  
  (defun menu-bar-showhide-fringe-ind-box ()
    "Display top and bottom indicators in opposite fringes."
    (interactive)
!   (require 'fringe)
!   (customize-set-variable 'fringe-indicators 'box))
  
  (define-key menu-bar-showhide-fringe-ind-menu [box]
    '(menu-item "Opposite, no arrows" menu-bar-showhide-fringe-ind-box
              :help "Show top/bottom indicators in opposite fringes, no arrows"
              :visible (display-graphic-p)
!             :button (:radio . (eq fringe-indicators 'box))))
  
  (defun menu-bar-showhide-fringe-ind-right ()
!   "Display fringe indicators in the right fringe."
    (interactive)
!   (require 'fringe)
!   (customize-set-variable 'fringe-indicators 'right))
  
  (define-key menu-bar-showhide-fringe-ind-menu [right]
    '(menu-item "In right fringe" menu-bar-showhide-fringe-ind-right
!             :help "Show indicators in right fringe"
              :visible (display-graphic-p)
!             :button (:radio . (eq fringe-indicators 'right))))
  
  (defun menu-bar-showhide-fringe-ind-left ()
!   "Display fringe indicators in the left fringe."
    (interactive)
!   (require 'fringe)
!   (customize-set-variable 'fringe-indicators 'left))
  
  (define-key menu-bar-showhide-fringe-ind-menu [left]
    '(menu-item "In left fringe" menu-bar-showhide-fringe-ind-left
!             :help "Show indicators in left fringe"
              :visible (display-graphic-p)
!             :button (:radio . (eq fringe-indicators 'left))))
  
  (defun menu-bar-showhide-fringe-ind-none ()
!   "Do not display any fringe indicators."
    (interactive)
!   (require 'fringe)
!   (customize-set-variable 'fringe-indicators nil))
  
  (define-key menu-bar-showhide-fringe-ind-menu [none]
    '(menu-item "No indicators" menu-bar-showhide-fringe-ind-none
!             :help "Hide all fringe indicators"
              :visible (display-graphic-p)
!             :button (:radio . (eq fringe-indicators nil))))
! 
  
  
! (defvar menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe"))
  
  (defun menu-bar-showhide-fringe-menu-customize ()
    "Show customization buffer for `fringe-mode'."
--- 717,808 ----
                              (frame-visible-p
                               (symbol-value 'speedbar-frame))))))
  
+ (defvar menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe"))
  
! (defvar menu-bar-showhide-fringe-ind-menu
!   (make-sparse-keymap "Buffer boundaries"))
  
! (defun menu-bar-showhide-boundaries-menu-customize ()
!   "Show customization buffer for `indicate-buffer-boundaries'."
    (interactive)
!   (customize-variable 'indicate-buffer-boundaries))
  
! (define-key menu-bar-showhide-fringe-ind-menu [customize]
!   '(menu-item "Other (customize)"
!             menu-bar-showhide-boundaries-menu-customize
!             :help "Additional choices available through Custom buffer"
!             :visible (display-graphic-p)))
  
  (defun menu-bar-showhide-fringe-ind-mixed ()
!   "Display top and bottom indicators in opposite fringes, arrows in right."
    (interactive)
!   (customize-set-variable 'indicate-buffer-boundaries
!                         '((t . right) (top . left))))
  
  (define-key menu-bar-showhide-fringe-ind-menu [mixed]
    '(menu-item "Opposite, arrows right" menu-bar-showhide-fringe-ind-mixed
!             :help
!             "Show top/bottom indicators in opposite fringes, arrows in right"
              :visible (display-graphic-p)
!             :button (:radio . (eq indicate-buffer-boundaries
!                                   '((t . right) (top . left))))))
  
  (defun menu-bar-showhide-fringe-ind-box ()
    "Display top and bottom indicators in opposite fringes."
    (interactive)
!   (customize-set-variable 'indicate-buffer-boundaries
!                         '((top . left) (bottom . right))))
  
  (define-key menu-bar-showhide-fringe-ind-menu [box]
    '(menu-item "Opposite, no arrows" menu-bar-showhide-fringe-ind-box
              :help "Show top/bottom indicators in opposite fringes, no arrows"
              :visible (display-graphic-p)
!             :button (:radio . (eq indicate-buffer-boundaries
!                                   '((top . left) (bottom . right))))))
  
  (defun menu-bar-showhide-fringe-ind-right ()
!   "Display buffer boundaries and arrows in the right fringe."
    (interactive)
!   (customize-set-variable 'indicate-buffer-boundaries 'right))
  
  (define-key menu-bar-showhide-fringe-ind-menu [right]
    '(menu-item "In right fringe" menu-bar-showhide-fringe-ind-right
!             :help "Show buffer boundaries and arrows in right fringe"
              :visible (display-graphic-p)
!             :button (:radio . (eq indicate-buffer-boundaries 'right))))
  
  (defun menu-bar-showhide-fringe-ind-left ()
!   "Display buffer boundaries and arrows in the left fringe."
    (interactive)
!   (customize-set-variable 'indicate-buffer-boundaries 'left))
  
  (define-key menu-bar-showhide-fringe-ind-menu [left]
    '(menu-item "In left fringe" menu-bar-showhide-fringe-ind-left
!             :help "Show buffer boundaries and arrows in left fringe"
              :visible (display-graphic-p)
!             :button (:radio . (eq indicate-buffer-boundaries 'left))))
  
  (defun menu-bar-showhide-fringe-ind-none ()
!   "Do not display any buffer boundary indicators."
    (interactive)
!   (customize-set-variable 'indicate-buffer-boundaries nil))
  
  (define-key menu-bar-showhide-fringe-ind-menu [none]
    '(menu-item "No indicators" menu-bar-showhide-fringe-ind-none
!             :help "Hide all buffer boundary indicators and arrows"
              :visible (display-graphic-p)
!             :button (:radio . (eq indicate-buffer-boundaries nil))))
  
+ (define-key menu-bar-showhide-fringe-menu [showhide-fringe-ind]
+   (list 'menu-item "Buffer boundaries" menu-bar-showhide-fringe-ind-menu
+       :visible `(display-graphic-p)
+       :help "Indicate buffer boundaries in fringe"))
  
! (define-key menu-bar-showhide-fringe-menu [indicate-empty-lines]
!   (menu-bar-make-toggle toggle-indicate-empty-lines indicate-empty-lines
!                       "Empty line indicators"
!                       "Indicating of empty lines %s"
!                       "Indicate trailing empty lines in fringe"))
  
  (defun menu-bar-showhide-fringe-menu-customize ()
    "Show customization buffer for `fringe-mode'."
***************
*** 806,812 ****
    (customize-variable 'fringe-mode))
  
  (define-key menu-bar-showhide-fringe-menu [customize]
!   '(menu-item "Customize" menu-bar-showhide-fringe-menu-customize
              :help "Detailed customization of fringe"
              :visible (display-graphic-p)))
  
--- 810,816 ----
    (customize-variable 'fringe-mode))
  
  (define-key menu-bar-showhide-fringe-menu [customize]
!   '(menu-item "Customize fringe" menu-bar-showhide-fringe-menu-customize
              :help "Detailed customization of fringe"
              :visible (display-graphic-p)))
  
***************
*** 815,829 ****
    (interactive)
    (customize-set-variable 'fringe-mode nil))
  
- (define-key menu-bar-showhide-fringe-menu [showhide-fringe-ind]
-   (list 'menu-item "Indicators" menu-bar-showhide-fringe-ind-menu
-       :visible `(display-graphic-p)
-       :help "Select fringe mode"))
- 
- ;; The real definition is in fringe.el.
- ;; This is to prevent errors in the :radio conditions below.
- (setq fringe-mode nil)
- 
  (define-key menu-bar-showhide-fringe-menu [default]
    '(menu-item "Default" menu-bar-showhide-fringe-menu-customize-reset
              :help "Default width fringe on both left and right side"
--- 819,824 ----
============================================================

===File ~/fringe-diff=======================================
*** fringe.el   09 Jul 2005 19:13:39 -0500      1.20
--- fringe.el   02 Aug 2005 07:49:07 -0500      
***************
*** 260,302 ****
               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
--- 260,265 ----
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]