* Fringes again
@ 2002-05-20 20:03 Simon Josefsson
2002-05-20 23:37 ` Miles Bader
2002-05-21 15:57 ` Richard Stallman
0 siblings, 2 replies; 17+ messages in thread
From: Simon Josefsson @ 2002-05-20 20:03 UTC (permalink / raw)
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 <jas@extundo.com>
* 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 @@
\f
* 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 @@
\f
* 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 <simon@josefsson.org>
+;; 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-20 20:03 Fringes again Simon Josefsson
@ 2002-05-20 23:37 ` Miles Bader
2002-05-21 19:12 ` Richard Stallman
2002-05-21 20:53 ` Simon Josefsson
2002-05-21 15:57 ` Richard Stallman
1 sibling, 2 replies; 17+ messages in thread
From: Miles Bader @ 2002-05-20 23:37 UTC (permalink / raw)
Cc: emacs-devel
Simon Josefsson <jas@extundo.com> 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.
The menu entries are probably uncontroversial because they allow
choosing from a set of different styles.
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?
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.
-Miles
--
We live, as we dream -- alone....
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-20 20:03 Fringes again Simon Josefsson
2002-05-20 23:37 ` Miles Bader
@ 2002-05-21 15:57 ` Richard Stallman
1 sibling, 0 replies; 17+ messages in thread
From: Richard Stallman @ 2002-05-21 15:57 UTC (permalink / raw)
Cc: emacs-devel
+(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)))
Please define named functions for all these menu items to call. Ok?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-20 23:37 ` Miles Bader
@ 2002-05-21 19:12 ` Richard Stallman
2002-05-21 20:53 ` Simon Josefsson
1 sibling, 0 replies; 17+ messages in thread
From: Richard Stallman @ 2002-05-21 19:12 UTC (permalink / raw)
Cc: jas, emacs-devel
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.
There are other graphical frame features that have the exact parallel
setup, such as scroll bars. So it's right to use it here too.
We could discuss making a systematic change in that convention,
but there is no reason to delay this change for that discussion.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-20 23:37 ` Miles Bader
2002-05-21 19:12 ` Richard Stallman
@ 2002-05-21 20:53 ` Simon Josefsson
2002-05-21 21:40 ` Thien-Thi Nguyen
2002-05-22 1:24 ` Miles Bader
1 sibling, 2 replies; 17+ messages in thread
From: Simon Josefsson @ 2002-05-21 20:53 UTC (permalink / raw)
Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1924 bytes --]
Miles Bader <miles@gnu.org> writes:
> Simon Josefsson <jas@extundo.com> 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?
[-- Attachment #2: fringe.el --]
[-- Type: application/emacs-lisp, Size: 5321 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-21 20:53 ` Simon Josefsson
@ 2002-05-21 21:40 ` Thien-Thi Nguyen
2002-05-22 8:20 ` Simon Josefsson
2002-05-22 1:24 ` Miles Bader
1 sibling, 1 reply; 17+ messages in thread
From: Thien-Thi Nguyen @ 2002-05-21 21:40 UTC (permalink / raw)
Cc: emacs-devel
Simon Josefsson <jas@extundo.com> writes:
;;; fringe.el --- window system-independent fringe support
this is confusing to me, i.e., i alternatively parse this as:
(window-system)-independent
and
window (system-independent)
maybe something like "change fringes appearance in various ways"
would be better. too, i tend to view elisp as system-independent
by default, and only needing special note if actually otherwise.
thi
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-21 20:53 ` Simon Josefsson
2002-05-21 21:40 ` Thien-Thi Nguyen
@ 2002-05-22 1:24 ` Miles Bader
2002-05-22 3:21 ` Eli Zaretskii
2002-05-22 8:54 ` Simon Josefsson
1 sibling, 2 replies; 17+ messages in thread
From: Miles Bader @ 2002-05-22 1:24 UTC (permalink / raw)
Simon Josefsson <jas@extundo.com> writes:
> I've now implemented one approach below. It makes the user interface
> of fringe.el similar as mouse-avoidance-mode.el. Is this OK?
I like that much better.
Perhaps `left' and `right' should be called `left-only' and `right-only'
to emphasize what they do (when I first looked at the choices, and saw
`left', I immediately thought `left what?' -- even though I already knew
what to expect!).
I also think it would be clearer to use `both' instead of `default',
but that would actually be a slight misnomer, since the implemenation
actually does just revert to the default, and that might make the name
wrong if the default is ever changed. What do you think?
> 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?
Well, I like the prompting behavior better, and Richard approved the
name `toggle-fringe', but I'm not sure the name `toggle-fringe' makes
much sense if it doesn't actually `toggle'... :-(
One alternative would be to use the name `set-fringe-mode' to set the
per-frame fringe style -- this is also consistent with existing
practice, e.g., `set-default-font', `set-background-color', etc., and
with this name, prompting for a value actually make sense. :-)
A last niggling point is that the (interactive ...) prompting code
should probably be put into a function, since it's duplicated in two
commands now...
Thanks,
-Miles
--
Come now, if we were really planning to harm you, would we be waiting here,
beside the path, in the very darkest part of the forest?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-22 1:24 ` Miles Bader
@ 2002-05-22 3:21 ` Eli Zaretskii
2002-05-22 3:40 ` Miles Bader
2002-05-22 8:54 ` Simon Josefsson
1 sibling, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2002-05-22 3:21 UTC (permalink / raw)
Cc: emacs-devel
> From: Miles Bader <miles@lsi.nec.co.jp>
> Date: 22 May 2002 10:24:09 +0900
>
> Perhaps `left' and `right' should be called `left-only' and `right-only'
left-only and right-only sound better IMO as well.
> One alternative would be to use the name `set-fringe-mode'
Or set-fringe-style?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-22 3:21 ` Eli Zaretskii
@ 2002-05-22 3:40 ` Miles Bader
0 siblings, 0 replies; 17+ messages in thread
From: Miles Bader @ 2002-05-22 3:40 UTC (permalink / raw)
Cc: emacs-devel
"Eli Zaretskii" <eliz@is.elta.co.il> writes:
> > One alternative would be to use the name `set-fringe-mode'
>
> Or set-fringe-style?
Yeah, I agree, that's better.
-Miles
--
`Life is a boundless sea of bitterness'
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-21 21:40 ` Thien-Thi Nguyen
@ 2002-05-22 8:20 ` Simon Josefsson
0 siblings, 0 replies; 17+ messages in thread
From: Simon Josefsson @ 2002-05-22 8:20 UTC (permalink / raw)
Cc: emacs-devel
Thien-Thi Nguyen <ttn@glug.org> writes:
> Simon Josefsson <jas@extundo.com> writes:
>
> ;;; fringe.el --- window system-independent fringe support
>
> this is confusing to me, i.e., i alternatively parse this as:
>
> (window-system)-independent
>
> and
>
> window (system-independent)
>
> maybe something like "change fringes appearance in various ways"
> would be better. too, i tend to view elisp as system-independent
> by default, and only needing special note if actually otherwise.
I changed the title, thanks.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-22 1:24 ` Miles Bader
2002-05-22 3:21 ` Eli Zaretskii
@ 2002-05-22 8:54 ` Simon Josefsson
2002-05-24 0:07 ` Miles Bader
1 sibling, 1 reply; 17+ messages in thread
From: Simon Josefsson @ 2002-05-22 8:54 UTC (permalink / raw)
Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2095 bytes --]
Miles Bader <miles@lsi.nec.co.jp> writes:
> Simon Josefsson <jas@extundo.com> writes:
>> I've now implemented one approach below. It makes the user interface
>> of fringe.el similar as mouse-avoidance-mode.el. Is this OK?
>
> I like that much better.
>
> Perhaps `left' and `right' should be called `left-only' and `right-only'
> to emphasize what they do (when I first looked at the choices, and saw
> `left', I immediately thought `left what?' -- even though I already knew
> what to expect!).
Yup, fixed.
> I also think it would be clearer to use `both' instead of `default',
> but that would actually be a slight misnomer, since the implemenation
> actually does just revert to the default, and that might make the name
> wrong if the default is ever changed. What do you think?
It would be a misnomer when the new per-buffer or per-window code gets
added which makes it possible to fine-tune the fringe. OTOH I kind
off like both better as well, but I think default is safer.
>> 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?
>
> Well, I like the prompting behavior better, and Richard approved the
> name `toggle-fringe', but I'm not sure the name `toggle-fringe' makes
> much sense if it doesn't actually `toggle'... :-(
>
> One alternative would be to use the name `set-fringe-mode' to set the
> per-frame fringe style -- this is also consistent with existing
> practice, e.g., `set-default-font', `set-background-color', etc., and
> with this name, prompting for a value actually make sense. :-)
I changed it to set-fringe-style.
> A last niggling point is that the (interactive ...) prompting code
> should probably be put into a function, since it's duplicated in two
> commands now...
Right, done.
Does anyone have any opinions on the attached code?
I have one remaining question: How do you find out the default fringe
width? Right now it is hard coded to 10.
[-- Attachment #2: fringe.el --]
[-- Type: application/emacs-lisp, Size: 5744 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-22 8:54 ` Simon Josefsson
@ 2002-05-24 0:07 ` Miles Bader
2002-05-24 9:47 ` Simon Josefsson
0 siblings, 1 reply; 17+ messages in thread
From: Miles Bader @ 2002-05-24 0:07 UTC (permalink / raw)
Simon Josefsson <jas@extundo.com> writes:
> Does anyone have any opinions on the attached code?
Looks good to me.
A few little nits:
* I think you should use `left-only' and `right-only' instead of
`leftonly' and `rightonly' -- they're easier to read and more
consistent with general elisp style.
* It would be useful if the doc-strings for `set-fringe-style' and
`set-fringe-mode' referenced each other explicitly, since the names
are so similar that they may cause some confusion.
When I tried out your code, I noticed a few problems with the underlying
non-default-fringe support (but they aren't problems in your code), in
particular:
(1) When non-default fringes are active, the vertical line separating
two vertically-split windows (from C-x 3) gets messed up,
apparently because it's not allocated space correctly, and gets
drawn in the fringe instead (so the line alternatively gets drawn
and erased on different lines as redisplay changes happen).
(2) When you give both left and right fringes reduced widths, but the
display code needs to add some more space (because the sum of the
fringe widths doesn't add up to a multiple of the default-font
character width), then it seems to allocate all the extra space
to the _left_ fringe, which seems backwards -- users probably
would prefer that any extra space go into the right fringe, since
it's much less noticable.
> I have one remaining question: How do you find out the default fringe
> width? Right now it is hard coded to 10.
I thought (without having looked at the code) it was 8 pixels rounded
up to a multiple of the width of a character in the default font.
-Miles
--
Is it true that nothing can be known? If so how do we know this? -Woody Allen
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-24 0:07 ` Miles Bader
@ 2002-05-24 9:47 ` Simon Josefsson
2002-05-24 23:00 ` Kim F. Storm
0 siblings, 1 reply; 17+ messages in thread
From: Simon Josefsson @ 2002-05-24 9:47 UTC (permalink / raw)
Cc: emacs-devel
Miles Bader <miles@gnu.org> writes:
> Simon Josefsson <jas@extundo.com> writes:
>> Does anyone have any opinions on the attached code?
>
> Looks good to me.
>
> A few little nits:
>
> * I think you should use `left-only' and `right-only' instead of
> `leftonly' and `rightonly' -- they're easier to read and more
> consistent with general elisp style.
>
> * It would be useful if the doc-strings for `set-fringe-style' and
> `set-fringe-mode' referenced each other explicitly, since the names
> are so similar that they may cause some confusion.
Fixed. I committed the code.
>> I have one remaining question: How do you find out the default fringe
>> width? Right now it is hard coded to 10.
>
> I thought (without having looked at the code) it was 8 pixels rounded
> up to a multiple of the width of a character in the default font.
Right, but how do you programmatically calculate that?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-24 9:47 ` Simon Josefsson
@ 2002-05-24 23:00 ` Kim F. Storm
2002-05-24 23:48 ` Simon Josefsson
0 siblings, 1 reply; 17+ messages in thread
From: Kim F. Storm @ 2002-05-24 23:00 UTC (permalink / raw)
Cc: emacs-devel
Simon Josefsson <jas@extundo.com> writes:
> >> I have one remaining question: How do you find out the default fringe
> >> width? Right now it is hard coded to 10.
> >
> > I thought (without having looked at the code) it was 8 pixels rounded
> > up to a multiple of the width of a character in the default font.
>
Actually, the default is to take 2x8 = 16 pixels and find the minimum
number of characters in the default font that is at least 16 pixels wide,
and then distribute that space evenly between the two fringes.
Suppose the default font width is 6 pixels. This needs 3 characters =
18 pixels to hold the fringes => 9 pixels for each fringe.
If an odd number of pixels are allocated, the extra pixel is
added to the right fringe.
> Right, but how do you programmatically calculate that?
Something like
(/ (* (/ (+ (* 2 8) (frame-char-width) -1)
(frame-char-width))
(frame-char-width))
2)
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-24 23:00 ` Kim F. Storm
@ 2002-05-24 23:48 ` Simon Josefsson
2002-05-25 23:06 ` Kim F. Storm
0 siblings, 1 reply; 17+ messages in thread
From: Simon Josefsson @ 2002-05-24 23:48 UTC (permalink / raw)
Cc: emacs-devel
storm@cua.dk (Kim F. Storm) writes:
> Actually, the default is to take 2x8 = 16 pixels and find the minimum
> number of characters in the default font that is at least 16 pixels wide,
> and then distribute that space evenly between the two fringes.
>
> Suppose the default font width is 6 pixels. This needs 3 characters =
> 18 pixels to hold the fringes => 9 pixels for each fringe.
>
> If an odd number of pixels are allocated, the extra pixel is
> added to the right fringe.
>
>> Right, but how do you programmatically calculate that?
>
> Something like
>
> (/ (* (/ (+ (* 2 8) (frame-char-width) -1)
> (frame-char-width))
> (frame-char-width))
> 2)
Hm. Will this work for e.g. `default-frame-alist'? It need to have
integers, not expressions that can vary depending on the font or
display (consider multi-head X where the screens has different
resolutions, `frame-char-width' would probably return different values
depending on which screen it is on). It doesn't look very reliable to
calculate "half fringe width" (if there isn't something better than
the above), so perhaps the "half width" option should be removed.
Opinions?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-24 23:48 ` Simon Josefsson
@ 2002-05-25 23:06 ` Kim F. Storm
2002-05-25 23:15 ` Simon Josefsson
0 siblings, 1 reply; 17+ messages in thread
From: Kim F. Storm @ 2002-05-25 23:06 UTC (permalink / raw)
Simon Josefsson <jas@extundo.com> writes:
> storm@cua.dk (Kim F. Storm) writes:
>
> > Actually, the default is to take 2x8 = 16 pixels and find the minimum
> > number of characters in the default font that is at least 16 pixels wide,
> > and then distribute that space evenly between the two fringes.
> >
> > Suppose the default font width is 6 pixels. This needs 3 characters =
> > 18 pixels to hold the fringes => 9 pixels for each fringe.
> >
> > If an odd number of pixels are allocated, the extra pixel is
> > added to the right fringe.
> >
> >> Right, but how do you programmatically calculate that?
> >
> > Something like
> >
> > (/ (* (/ (+ (* 2 8) (frame-char-width) -1)
> > (frame-char-width))
> > (frame-char-width))
> > 2)
>
> Hm. Will this work for e.g. `default-frame-alist'? It need to have
> integers, not expressions that can vary depending on the font or
> display (consider multi-head X where the screens has different
> resolutions, `frame-char-width' would probably return different values
> depending on which screen it is on). It doesn't look very reliable to
> calculate "half fringe width" (if there isn't something better than
> the above), so perhaps the "half width" option should be removed.
> Opinions?
IMO, reducing the fringe width below 8 pixels really doesn't make sense.
But if you want the minimum fringe width (i.e. half the width of the
default face width), simply set both widths to 1.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Fringes again
2002-05-25 23:06 ` Kim F. Storm
@ 2002-05-25 23:15 ` Simon Josefsson
0 siblings, 0 replies; 17+ messages in thread
From: Simon Josefsson @ 2002-05-25 23:15 UTC (permalink / raw)
Cc: emacs-devel
storm@cua.dk (Kim F. Storm) writes:
>> >> Right, but how do you programmatically calculate that?
>> >
>> > Something like
>> >
>> > (/ (* (/ (+ (* 2 8) (frame-char-width) -1)
>> > (frame-char-width))
>> > (frame-char-width))
>> > 2)
>>
>> Hm. Will this work for e.g. `default-frame-alist'? It need to have
>> integers, not expressions that can vary depending on the font or
>> display (consider multi-head X where the screens has different
>> resolutions, `frame-char-width' would probably return different values
>> depending on which screen it is on). It doesn't look very reliable to
>> calculate "half fringe width" (if there isn't something better than
>> the above), so perhaps the "half width" option should be removed.
>> Opinions?
>
> IMO, reducing the fringe width below 8 pixels really doesn't make sense.
> But if you want the minimum fringe width (i.e. half the width of the
> default face width), simply set both widths to 1.
Setting it to 1 makes good sense, I tried it and I like it (even
better than none at all). It only wastes one pixel, but I notice when
the gdb arrow and other bitmaps is there. I added it as a new fringe
style: "minimal". I'll keep the "half" style as someone asked for it.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2002-05-25 23:15 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-20 20:03 Fringes again Simon Josefsson
2002-05-20 23:37 ` Miles Bader
2002-05-21 19:12 ` Richard Stallman
2002-05-21 20:53 ` Simon Josefsson
2002-05-21 21:40 ` Thien-Thi Nguyen
2002-05-22 8:20 ` Simon Josefsson
2002-05-22 1:24 ` Miles Bader
2002-05-22 3:21 ` Eli Zaretskii
2002-05-22 3:40 ` Miles Bader
2002-05-22 8:54 ` Simon Josefsson
2002-05-24 0:07 ` Miles Bader
2002-05-24 9:47 ` Simon Josefsson
2002-05-24 23:00 ` Kim F. Storm
2002-05-24 23:48 ` Simon Josefsson
2002-05-25 23:06 ` Kim F. Storm
2002-05-25 23:15 ` Simon Josefsson
2002-05-21 15:57 ` Richard Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.