[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fringes again
From: |
Simon Josefsson |
Subject: |
Fringes again |
Date: |
Mon, 20 May 2002 22:03:29 +0200 |
User-agent: |
Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2.50 (i686-pc-linux-gnu) |
I'm not sure if there was any consensus in the last discussion, but at
least there were some voices that wanted it to be possible to disable
the fringes from the menu (I remember Richard said it at least).
So, how about if I commit this?
2002-05-20 Simon Josefsson <address@hidden>
* fringe.el: New file.
* menu-bar.el (menu-bar-options-save): Add fringe-mode.
(menu-bar-showhide-fringe-menu): New menu.
(menu-bar-showhide-menu): Add Fringe sub-menu.
Index: NEWS
===================================================================
RCS file: /cvsroot/emacs/emacs/etc/NEWS,v
retrieving revision 1.673
diff -u -w -r1.673 NEWS
--- NEWS 20 May 2002 17:29:37 -0000 1.673
+++ NEWS 20 May 2002 20:01:53 -0000
@@ -52,6 +52,10 @@
* Changes in Emacs 21.4
+** The appearance of the fringes can now be customized, using either
+the global `fringe-mode', the frame specific M-x toggle-fringe, or the
+Show/Hide submenu of the top-level Options menu.
+
** There is a new user option `mail-default-directory' that allows you
to specify the value of `default-directory' for mail buffers. This
directory is used for auto-save files of mail buffers. It defaults to
@@ -777,6 +781,8 @@
* Lisp Changes in Emacs 21.4
+
+** The New lisp library fringe.el controls the apperance of fringes.
** The `defmacro' form may contain declarations specifying how to
indent the macro in Lisp mode and how to debug it with Edebug. The
Index: menu-bar.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/menu-bar.el,v
retrieving revision 1.218
diff -u -w -r1.218 menu-bar.el
--- menu-bar.el 16 May 2002 19:32:32 -0000 1.218
+++ menu-bar.el 20 May 2002 19:56:39 -0000
@@ -583,7 +583,7 @@
;; These are set with `customize-set-variable'.
(dolist (elt '(line-number-mode column-number-mode scroll-bar-mode
debug-on-quit debug-on-error menu-bar-mode tool-bar-mode
- save-place uniquify-buffer-name-style
+ save-place uniquify-buffer-name-style fringe-mode
case-fold-search cua-mode show-paren-mode
transient-mark-mode global-font-lock-mode
display-time-mode auto-compression-mode
@@ -652,6 +652,57 @@
(frame-live-p (symbol-value 'speedbar-frame))
(frame-visible-p
(symbol-value 'speedbar-frame))))))
+
+(setq menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe"))
+
+(define-key menu-bar-showhide-fringe-menu [customize]
+ '(menu-item "Customize"
+ (lambda ()
+ (interactive)
+ (customize-variable 'fringe-mode))
+ :help "Detailed customization of fringe"
+ :visible (display-graphic-p)))
+
+(define-key menu-bar-showhide-fringe-menu [default]
+ '(menu-item "Default"
+ (lambda ()
+ (interactive)
+ (customize-set-variable 'fringe-mode nil))
+ :help "Default width fringe on both left and right side"
+ :visible (display-graphic-p)
+ :button (:radio . (eq fringe-mode nil))))
+
+(define-key menu-bar-showhide-fringe-menu [left]
+ '(menu-item "On the Left"
+ (lambda ()
+ (interactive)
+ (customize-set-variable 'fringe-mode '(nil . 0)))
+ :help "Fringe only on the left side"
+ :visible (display-graphic-p)
+ :button (:radio . (equal fringe-mode '(nil . 0)))))
+
+(define-key menu-bar-showhide-fringe-menu [right]
+ '(menu-item "On the Right"
+ (lambda ()
+ (interactive)
+ (customize-set-variable 'fringe-mode '(0 . nil)))
+ :help "Fringe only on the right side"
+ :visible (display-graphic-p)
+ :button (:radio . (equal fringe-mode '(0 . nil)))))
+
+(define-key menu-bar-showhide-fringe-menu [none]
+ '(menu-item "None"
+ (lambda ()
+ (interactive)
+ (customize-set-variable 'fringe-mode 0))
+ :help "Turn off fringe"
+ :visible (display-graphic-p)
+ :button (:radio . (eq fringe-mode 0))))
+
+(define-key menu-bar-showhide-menu [showhide-fringe]
+ (list 'menu-item "Fringe" menu-bar-showhide-fringe-menu
+ :visible `(display-graphic-p)
+ :help "Select fringe mode"))
(defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar"))
Index: lisp/fringe.el
===================================================================
RCS file: lisp/fringe.el
diff -N lisp/fringe.el
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lisp/fringe.el 20 May 2002 19:57:22 -0000
@@ -0,0 +1,140 @@
+;;; fringe.el --- window system-independent fringe support
+
+;; Copyright (C) 2002 Free Software Foundation, Inc.
+
+;; Author: Simon Josefsson <address@hidden>
+;; Maintainer: FSF
+;; Keywords: frames
+
+;; 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
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; 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:
+
+;; This file contains helpful functions for enabling and disabling the
+;; fringe.
+
+;; The code is influenced by scroll-bar.el.
+
+;;; Code:
+
+(defvar fringe-mode)
+
+(defun set-fringe-mode-1 (ignore value)
+ "Call `set-fringe-mode' with VALUE.
+See `fringe-mode' for valid values and their effect.
+This is usually invoked when setting `fringe-mode' via customize."
+ (set-fringe-mode value))
+
+(defun set-fringe-mode (value)
+ "Set `fringe-mode' to VALUE and put the new value into effect.
+See `fringe-mode' for possible values and their effect."
+ (setq fringe-mode value)
+
+ ;; Apply it to default-frame-alist.
+ (let ((parameter (assq 'left-fringe default-frame-alist)))
+ (if (consp parameter)
+ (setcdr parameter fringe-mode)
+ (setq default-frame-alist
+ (cons (cons 'left-fringe (if (consp fringe-mode)
+ (car fringe-mode)
+ fringe-mode))
+ default-frame-alist))))
+ (let ((parameter (assq 'right-fringe default-frame-alist)))
+ (if (consp parameter)
+ (setcdr parameter fringe-mode)
+ (setq default-frame-alist
+ (cons (cons 'right-fringe (if (consp fringe-mode)
+ (cdr fringe-mode)
+ fringe-mode))
+ default-frame-alist))))
+
+ ;; Apply it to existing frames.
+ (let ((frames (frame-list)))
+ (while frames
+ (modify-frame-parameters
+ (car frames)
+ (list (cons 'left-fringe (if (consp fringe-mode)
+ (car fringe-mode)
+ fringe-mode))
+ (cons 'right-fringe (if (consp fringe-mode)
+ (cdr fringe-mode)
+ fringe-mode))))
+ (setq frames (cdr frames)))))
+
+(defcustom fringe-mode nil
+ "*Specify presence and width of fringes.
+This variable can be nil (the default) meaning the fringes should have
+the default width (8 pixels), it can be an integer value specifying
+the width of both left and right fringe (where 0 means no fringe), or
+a cons cell where car indicates width of left fringe and cdr indicates
+width of right fringe (where again 0 can be used to indicate no
+fringe).
+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 '(choice (const :tag "Default width" nil)
+ (const :tag "No fringes" 0)
+ (const :tag "Only right" (0 . nil))
+ (const :tag "Only left" (nil . 0))
+ (const :tag "Half width" (4 . 4))
+ (integer :tag "Specific width")
+ (cons :tag "Different left/right sizes"
+ (integer :tag "Left width")
+ (integer :tag "Right width")))
+ :group 'frames
+ :require 'fringe
+ :set 'set-fringe-mode-1)
+
+;;;###autoload
+(defun fringe-mode (&optional 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)
+ (if (eq (cdr-safe (assq 'left-fringe default-frame-alist)) 0)
+ nil
+ 0)
+ (and (numberp flag) (< flag 0) 0))))
+
+;;;###autoload
+(defun toggle-fringe (arg)
+ "Toggle whether or not the selected frame has a left and right fringe.
+With arg, turn fringes on if and only if arg is positive."
+ (interactive "P")
+ (if (null arg)
+ (setq arg
+ (if (eq (cdr (assq 'left-fringe
+ (frame-parameters (selected-frame)))) 0)
+ nil
+ 0))
+ (setq arg (prefix-numeric-value arg)))
+ (modify-frame-parameters
+ (selected-frame)
+ (list (cons 'left-fringe arg)
+ (cons 'right-fringe arg))))
+
+(provide 'fringe)
+
+;;; fringe.el ends here
- Fringes again,
Simon Josefsson <=
- Re: Fringes again, Miles Bader, 2002/05/20
- Re: Fringes again, Richard Stallman, 2002/05/21
- Re: Fringes again, Simon Josefsson, 2002/05/21
- Re: Fringes again, Miles Bader, 2002/05/21
- Re: Fringes again, Eli Zaretskii, 2002/05/21
- Re: Fringes again, Miles Bader, 2002/05/21
- Re: Fringes again, Simon Josefsson, 2002/05/22
- Re: Fringes again, Miles Bader, 2002/05/23