emacs-devel
[Top][All Lists]
Advanced

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

unnecessary fringe-indicators defcustom creates trouble


From: Luc Teirlinck
Subject: unnecessary fringe-indicators defcustom creates trouble
Date: Thu, 28 Jul 2005 20:13:53 -0500 (CDT)

Just loading fringe.el overrides my customizations for
indicate-empty-lines and indicate-buffer-boundaries.  It resets both
to nil, which is extremely annoying, because I have come to depend on
indicate-empty-lines.  The culprit is the :set function for
`fringe-indicators', a completely unnecessary variable, since it is
just a clumsy intertwining of indicate-empty-lines and
indicate-buffer-boundaries and it is much less powerful than the
combination of these two.  I have personally indicate-empty-lines set
to t and indicate-buffer-boundaries set to ((top . left)).  That is
one example of several useful combinations that are impossible to
achieve with fringe-indicators.  If you currently use one of these
combinations or just use `indicate-empty-lines', you are in constant
danger of your customizations being overridden by the
fringe-indicators bully.

`indicate-empty-lines' is already a defcustomed variable (actually set
in startup.el).  `indicate-buffer-boundaries' is not, but it should be
and the patches below make it customizable through startup.el.  Once
this is done, there is no longer any need for the annoying
fringe-indicators variable.  Neither `indicate-empty-lines' nor
`indicate-buffer-boundaries' use a :set function, so neither can
override anything that the user does not want it to override.  Because
`indicate-empty-lines' and `indicate-buffer-boundaries' are related in
their goals, they belong in the same customization buffer.  Therefore
the patches below change the custom group of `indicate-empty-lines'
from `display' to `fringe', which was the group of fringe-indicators
before my patches and of indicate-buffer-boundaries after my patches.

There are also some changes to the menu bar.  These are necessary,
because the menu bar used fringe-indicators.  The present layout of
the menu bar is problematic anyway.  Both indicate-empty-lines and
fringe-indicators are in the "fringe" submenu, where they do not
belong.  They belong directly under Show-Hide.  The patches below put
the most important and easiest to understand one, indicate-empty-lines
directly under Show-Hide, making it easier to find.  My patches
currently just remove the remaining functionality of fringe-indicators
from the menu bar.  It would be possible to put that functionality
back on the menu bar (in a more logical way) using
`indicate-buffer-boundaries' instead of fringe-indicators, but I doubt
that it is important enough.  We can not just put any customization
possibility of minor, or even of average, importance on the menu bar;
the menu bar is not a complete substitute for Custom.

Here are my patches.  I can install them if desired.

===File ~/cus-start.el-diff=================================
*** cus-start.el        07 Jul 2005 17:34:08 -0500      1.72
--- cus-start.el        28 Jul 2005 18:48:25 -0500      
***************
*** 65,71 ****
             (ctl-arrow display boolean)
             (truncate-lines display boolean)
             (selective-display-ellipses display boolean)
!            (indicate-empty-lines display boolean "21.1")
             (scroll-up-aggressively windows
                                     (choice (const :tag "off" nil) number)
                                     "21.1")
--- 65,105 ----
             (ctl-arrow display boolean)
             (truncate-lines display boolean)
             (selective-display-ellipses display boolean)
!            (indicate-empty-lines fringe boolean "21.1")
!            (indicate-buffer-boundaries
!             fringe
!             (choice
!              (const :tag "No indicators" nil)
!              (const :tag "On left, with arrows" left)
!              (const :tag "On right, with arrows" right)
!              (const :tag "On left, no arrows" t)
!              (set :tag "Other"
!                   (choice :tag "Default"
!                           :value (t . left)
!                           (const :tag "Do not show" (t . nil))
!                           (const :tag "On the left" (t . left))
!                           (const :tag "On the right" (t . right)))
!                   (choice :tag "Top"
!                           :value (top . left)
!                           (const :tag "Do not show" (top . nil))
!                           (const :tag "On the left" (top . left))
!                           (const :tag "On the right" (top . right)))
!                   (choice :tag "Bottom"
!                           :value (bottom . left)
!                           (const :tag "Do not show" (bottom . nil))
!                           (const :tag "On the left" (bottom . left))
!                           (const :tag "On the right" (bottom . right)))
!                   (choice :tag "Up arrow"
!                           :value (up . left)
!                           (const :tag "Do not show" (up . nil))
!                           (const :tag "On the left" (up . left))
!                           (const :tag "On the right" (up . right)))
!                   (choice :tag "Down arrow"
!                           :value (down . left)
!                           (const :tag "Do not show" (down . nil))
!                           (const :tag "On the left" (down . left))
!                           (const :tag "On the right" (down . right)))))
!             "22.1")
             (scroll-up-aggressively windows
                                     (choice (const :tag "off" nil) number)
                                     "21.1")
============================================================

===File ~/fringe.el-diff====================================
*** fringe.el   09 Jul 2005 19:13:39 -0500      1.20
--- fringe.el   27 Jul 2005 22:36:51 -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 ----
============================================================

===File ~/menubar.el-diff===================================
*** menu-bar.el 04 Jul 2005 19:48:43 -0500      1.261
--- menu-bar.el 28 Jul 2005 16:23:29 -0500      
***************
*** 649,655 ****
                   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,
--- 649,655 ----
                   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 case-fold-search
                   display-time-mode auto-compression-mode
                   current-language-environment default-input-method
                   ;; Saving `text-mode-hook' is somewhat questionable,
***************
*** 717,802 ****
                              (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"))
  
--- 717,727 ----
                              (frame-visible-p
                               (symbol-value 'speedbar-frame))))))
  
! (define-key menu-bar-showhide-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"))
  
  (defvar menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe"))
  
***************
*** 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"
--- 740,745 ----
============================================================




reply via email to

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