From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.devel Subject: Re: Customize fringe Date: Fri, 10 May 2002 00:13:43 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: References: <877kmd7bf5.fsf@tc-1-100.kawasaki.gol.ne.jp> <9003-Thu09May2002210730+0300-eliz@is.elta.co.il> <200205091835.g49IZDZ17232@rum.cs.yale.edu> <200205092118.g49LIsR17755@rum.cs.yale.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1020982517 2030 127.0.0.1 (9 May 2002 22:15:17 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 9 May 2002 22:15:17 +0000 (UTC) Cc: "Eli Zaretskii" , miles@gnu.org, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 175wBx-0000Wd-00 for ; Fri, 10 May 2002 00:15:17 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 175wKl-0006vH-00 for ; Fri, 10 May 2002 00:24:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 175wBp-0004vp-00; Thu, 09 May 2002 18:15:09 -0400 Original-Received: from 178.230.13.217.in-addr.dgcsystems.net ([217.13.230.178] helo=yxa.extundo.com) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 175wAc-0004sT-00; Thu, 09 May 2002 18:13:54 -0400 Original-Received: from latte-eth2-dhcp128.josefsson.org (yxa.extundo.com [217.13.230.178]) (authenticated bits=0) by yxa.extundo.com (8.12.3/8.12.3) with ESMTP id g49MDp5p009251; Fri, 10 May 2002 00:13:52 +0200 Original-To: "Stefan Monnier" In-Reply-To: <200205092118.g49LIsR17755@rum.cs.yale.edu> ("Stefan Monnier"'s message of "Thu, 09 May 2002 17:18:54 -0400") Mail-Copies-To: nobody Original-Lines: 38 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2.50 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:3788 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3788 --=-=-= "Stefan Monnier" writes: >> > See my previous post yesterday or the day before on a separate thread >> > for why I don't think there should be a "toggle fringe" in the menu bar. >> This was it: > [...] > No this was not it. > It was: Oops. I guess there were several articles in the thread. > Admittedly, I forced the tone. But I just feel like users might miss > on the neat fringes just because they think they don't want them. > If you turn off the fringes you lose: > - legibility (chars stuck right next to a window border are more difficult > to read; the fringes act like a margin). > - continuation glyphs (i.e. it's not the same as on console). > - neat icons instead of overlayed text for the gud&edebug overlay arrow. > - various future extensions like mouse bindings in the fringes. > > I don't think the tradeoffs are obvious to the first-time user (even if he's > an experienced Emacs user) so she might make the wrong decision. This > is to be contrasted to other "similar" things like the menu-bar, the > tool-bar, the scroll-bar where the user can be reasonably expected to know > what she loses by turning it off. > > I'm not saying turning off the fringe should be a hidden feature. > Just that it shouldn't be in the user's face. I think that would translate into having fringe.el but no modifications to menu-bar.el, meaning the user need to M-x toggle-fringe RET or something like that. The following has the modifications suggested by Miles; it uses :require and it has a more flexible :type. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=fringe.el ;;; fringe.el --- window system-independent fringe support ;; Copyright (C) 2001 Free Software Foundation, Inc. ;; Author: Simon Josefsson ;; 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 ;; 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. ;; It is influenced by scroll-bar.el. ;;; Code: (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) (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) (when fringe-mode-explicit ;; 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)))))) ;;;###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 --=-=-=--