[Top][All Lists]

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

Please make the fringe configurable

From: Simon Josefsson
Subject: Please make the fringe configurable
Date: Sat, 10 Nov 2001 15:00:43 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu)

This is not a bug report, but a feature request.

Please make the fringe configurable on a per-frame parameter basis,
just as the scroll-bar and menu-bar currently are.

I did the trivial part, a lisp interface in "fringe.el", by copying
from scroll-bar.el, below.  I don't have the knowledge to do the C
part of this though, but looking at frame.{ch} and xterm.{ch} it
doesn't look infeasible to someone who understands the code.

The reason?  Some frames, such as Speedbar and Gnus Picons (Picons
doesn't work in Emacs yet, but perhaps soon) uses small separate
frames with special contents.  The fringe takes up screen space and
doesn't serve a useful purpose -- the same reason Speedbar etc
disables the menu bar and tool bar.

;;; fringe.el --- window system-independent fringe support

;; Copyright (C) 2001 Free Software Foundation, Inc.

;; Maintainer: FSF
;; Keywords: hardware

;; This file is part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;;; Code:

;;;; Helpful functions for enabling and disabling the fringe

(defvar fringe-mode)

(defvar fringe-mode-explicit nil
  "Non-nil means `set-fringe-mode' should really do something.
This is nil while loading `fringe.el', and t afterward.")

(defun set-fringe-mode-1 (ignore value)
  (set-fringe-mode value))

(defun set-fringe-mode (value)
  "Set `fringe-mode' to VALUE and put the new value into effect."
  (setq fringe-mode value)

  (when fringe-mode-explicit
    ;; Apply it to default-frame-alist.
    (let ((parameter (assq 'vertical-fringes default-frame-alist)))
      (if (consp parameter)
          (setcdr parameter fringe-mode)
        (setq default-frame-alist
              (cons (cons 'vertical-fringes fringe-mode)

    ;; Apply it to existing frames.
    (let ((frames (frame-list)))
      (while frames
         (car frames)
         (list (cons 'vertical-fringes fringe-mode)))
        (setq frames (cdr frames))))))

(defcustom fringe-mode t
  "*Specify whether to have fringes.
To set this variable in a Lisp program, use `set-fringe-mode'
to make it take real effect.
Setting the variable with a customization buffer also takes effect."
  :type 'boolean
  :group 'frames
  :set 'set-fringe-mode-1)

;; We just set fringe-mode, but that was the default.
;; If it is set again, that is for real.
(setq fringe-mode-explicit t)

(defun fringe-mode (flag)
  "Toggle display of the fringe on all frames.
This command applies to all frames that exist and frames to be
created in the future.
With a numeric argument, if the argument is negative,
turn off the fringe; otherwise, turn on the fringe."
  (interactive "P")
  (if flag (setq flag (prefix-numeric-value flag)))

  ;; Tweedle the variable according to the argument.
  (set-fringe-mode (if (null flag)
                       (not fringe-mode)
                     (or (not (numberp flag)) (>= flag 0)))))

(defun toggle-fringe (arg)
  "Toggle whether or not the selected frame has vertical scroll bars.
With arg, turn vertical scroll bars on if and only if arg is positive."
  (interactive "P")
  (if (null arg)
      (setq arg
            (if (cdr (assq 'vertical-fringes
                           (frame-parameters (selected-frame))))
                -1 1))
    (setq arg (prefix-numeric-value arg)))
   (list (cons 'vertical-fringes
               (if (> arg 0)

(provide 'fringe)

;;; fringe.el ends here

reply via email to

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