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: Fringes again Date: Tue, 21 May 2002 22:53:01 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: References: <877klyie6t.fsf@tc-1-100.kawasaki.gol.ne.jp> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1022014639 15366 127.0.0.1 (21 May 2002 20:57:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 21 May 2002 20:57:19 +0000 (UTC) Cc: 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 17AGh5-0003zj-00 for ; Tue, 21 May 2002 22:57:19 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17AGvg-0007o7-00 for ; Tue, 21 May 2002 23:12:24 +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 17AGhF-0003r5-00; Tue, 21 May 2002 16:57:29 -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 17AGeY-0003U5-00; Tue, 21 May 2002 16:54:42 -0400 Original-Received: from latte.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 g4LKseWa006413; Tue, 21 May 2002 22:54:41 +0200 Original-To: Miles Bader In-Reply-To: <877klyie6t.fsf@tc-1-100.kawasaki.gol.ne.jp> (Miles Bader's message of "21 May 2002 08:37:14 +0900") Mail-Copies-To: nobody Original-Lines: 47 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:4258 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:4258 --=-=-= Miles Bader writes: > Simon Josefsson writes: >> 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? > > Um, please no. You appear to have ignored most of the arguments. Were there more than in this mail? > The menu entries are probably uncontroversial because they allow > choosing from a set of different styles. OK. > However, you've retained the simple toggling version of `M-x fringe-mode', > and there seemed to be a reasonable concensus that the M-x command > shouldn't just turn off the fringes, but rather should do something like > prompt for a fringe style. There were several good ideas presented. > > Why not implement one of those? I never understood exactly how the ideas were supposed to work, but I've now implemented one approach below. It makes the user interface of fringe.el similar as mouse-avoidance-mode.el. Is this OK? > Another criticism is that you define a command called `toggle-fringe' > who's distinguishing feature is (apparently) that it only affects the > current frame -- if this is the case, it should probably reflect that in > the command name. > > Granted there are plenty of functions that only affect the current frame, > but don't have a name that says so, but it really is a bad idea to define > two `similar' commands, one affecting all frames, and the other affecting > only the current one, and to distinguish between them only by choosing two > different-but-apparently-equivalent names. It is consistent with how `toggle-scroll-bar' and `scroll-bar-mode' already behaves. The docstring and the prompt triggered by invoking `toggle-fringe' and `fringe-mode' should now be clear. Is this OK, or can you suggest alternative names? --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=fringe.el Content-Transfer-Encoding: 8bit ;;; fringe.el --- window system-independent fringe support ;; Copyright (C) 2002 Free Software Foundation, Inc. ;; Author: Simon Josefsson ;; 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 customizing the appearance ;; of the fringe. ;; The code is influenced by scroll-bar.el and avoid.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 appearance of fringes on all frames. 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. If you only want to modify the appearance of the fringe in one frame, you can use the interactive function `toggle-fringe'" :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 mode) "Toggle appearance of fringes on all frames. Valid values for MODE include `none', `default', `left', `right' and `half'. If MODE is not specified, the user is queried. It applies to all frames that exist and frames to be created in the future." (interactive (list (intern (completing-read "Select fringe mode for all frames (SPACE for list): " '(("none") ("default") ("left") ("right") ("half")) nil t)))) (set-fringe-mode (cond ((eq mode 'none) 0) ((eq mode 'default) nil) ((eq mode 'left) '(nil . 0)) ((eq mode 'right) '(0 . nil)) ((eq mode 'half) '(4 . 4)) (t (if (eq (cdr-safe (assq 'left-fringe default-frame-alist)) 0) nil 0))))) ;;;###autoload (defun toggle-fringe (&optional mode) "Toggle appearance of fringes on selected frame. Valid values for MODE include `none', `default', `left', `right' and `half'. If MODE is not specified, the user is queried." (interactive (list (intern (completing-read "Select fringe mode for selected frame (SPACE for list): " '(("none") ("default") ("left") ("right") ("half")) nil t)))) (setq mode (cond ((eq mode 'none) 0) ((eq mode 'default) nil) ((eq mode 'left) '(nil . 0)) ((eq mode 'right) '(0 . nil)) ((eq mode 'half) '(4 . 4)) (t (if (eq (cdr-safe (assq 'left-fringe (frame-parameters (selected-frame)))) 0) nil 0)))) (modify-frame-parameters (selected-frame) (list (cons 'left-fringe (if (consp mode) (car mode) mode)) (cons 'right-fringe (if (consp mode) (cdr mode) mode))))) (provide 'fringe) ;;; fringe.el ends here --=-=-=--