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:24:59 +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 1020983248 3447 127.0.0.1 (9 May 2002 22:27:28 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 9 May 2002 22:27:28 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 175wNk-0000tU-00 for ; Fri, 10 May 2002 00:27:28 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 175wWY-0007B3-00 for ; Fri, 10 May 2002 00:36:34 +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 175wNf-0005oD-00; Thu, 09 May 2002 18:27:23 -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 175wLW-0005YI-00 for ; Thu, 09 May 2002 18:25:10 -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 g49MP85p009364 for ; Fri, 10 May 2002 00:25:09 +0200 Original-To: emacs-devel@gnu.org In-Reply-To: (Simon Josefsson's message of "Fri, 10 May 2002 00:13:43 +0200") Mail-Copies-To: nobody Original-Lines: 8 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:3789 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3789 --=-=-= Simon Josefsson writes: > ;;; fringe.el --- window system-independent fringe support That version contained some bugs. The following should work better. --=-=-= 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: (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 --=-=-=--