all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Word wrapping and long lines
@ 2008-09-18 22:13 Lennart Borgman (gmail)
  2008-09-18 23:30 ` Chong Yidong
  0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-18 22:13 UTC (permalink / raw)
  To: Emacs Devel

I guess I did not follow the changes to word wrapping etc closely
enough. Now I am a bit confused.

I look in the Options menu at "Line Wrapping in this Buffer".

The first alternative there, "Wrap at Window Edge" and the third, "Word
Wrap (Visual Line Mode)" are surprisingly similar. I mean in behaviour.
What am I missing?

And what about longlines-mode, is it not welcome to that sub-menu?




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-18 22:13 Word wrapping and long lines Lennart Borgman (gmail)
@ 2008-09-18 23:30 ` Chong Yidong
  2008-09-18 23:58   ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 14+ messages in thread
From: Chong Yidong @ 2008-09-18 23:30 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> The first alternative there, "Wrap at Window Edge" and the third,
> "Word Wrap (Visual Line Mode)" are surprisingly similar. I mean in
> behaviour.  What am I missing?

"Wrap at window edge" is the default line wrapping method; wrapping
occurs at the window edge regardless of where the word boundaries are.

> And what about longlines-mode, is it not welcome to that sub-menu?

Longlines mode will hopefully be phased out as its functionality is
replaced by visual-line-mode.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-18 23:30 ` Chong Yidong
@ 2008-09-18 23:58   ` Lennart Borgman (gmail)
  2008-09-19  1:12     ` Chong Yidong
  2008-09-20 15:51     ` Johan Bockgård
  0 siblings, 2 replies; 14+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-18 23:58 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Emacs Devel

Chong Yidong wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> 
>> The first alternative there, "Wrap at Window Edge" and the third,
>> "Word Wrap (Visual Line Mode)" are surprisingly similar. I mean in
>> behaviour.  What am I missing?
> 
> "Wrap at window edge" is the default line wrapping method; wrapping
> occurs at the window edge regardless of where the word boundaries are.

Thanks.

>> And what about longlines-mode, is it not welcome to that sub-menu?
> 
> Longlines mode will hopefully be phased out as its functionality is
> replaced by visual-line-mode.

But what about wrapping at some specific width (like longlines-mode
does), is that not implemented yet? I am just looking at
visual-line-mode and it does not mention anything about this.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-18 23:58   ` Lennart Borgman (gmail)
@ 2008-09-19  1:12     ` Chong Yidong
  2008-09-19  1:29       ` Lennart Borgman (gmail)
  2008-09-20 15:51     ` Johan Bockgård
  1 sibling, 1 reply; 14+ messages in thread
From: Chong Yidong @ 2008-09-19  1:12 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

>> Longlines mode will hopefully be phased out as its functionality is
>> replaced by visual-line-mode.
>
> But what about wrapping at some specific width (like longlines-mode
> does), is that not implemented yet?

No.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-19  1:12     ` Chong Yidong
@ 2008-09-19  1:29       ` Lennart Borgman (gmail)
  2008-09-19  1:36         ` Miles Bader
  0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-19  1:29 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Emacs Devel

Chong Yidong wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> 
>>> Longlines mode will hopefully be phased out as its functionality is
>>> replaced by visual-line-mode.
>> But what about wrapping at some specific width (like longlines-mode
>> does), is that not implemented yet?
> 
> No.

Maybe something like this can be used:

(defun set-wrap-to-fill-values ()
  "Center `fill-column' display columns in buffer windows."
  (let ((buf-windows (get-buffer-window-list (current-buffer))))
    (dolist (win buf-windows)
      (let* ((edges (window-edges win))
             (win-width (- (nth 2 edges) (nth 0 edges)))
             (extra-width (- win-width fill-column))
             (left-marg (- (/ extra-width 2) 1))
             (right-marg (- win-width fill-column left-marg))
             (old-left left-margin-width)
             (old-right right-margin-width)
             )
        (unless (> left-marg 0) (setq left-marg 0))
        (unless (> right-marg 0) (setq right-marg 0))
        (unless (and (= old-left left-marg)
                     (= old-right right-marg))
          (set-window-margins win left-marg right-marg))))))

(define-minor-mode wrap-to-fill-mode
  "Center `fill-column' display columns in buffer windows."
  :group 'emacs
  (if wrap-to-fill-mode
      (add-hook 'window-configuration-change-hook
'set-wrap-to-fill-values nil t)
    (remove-hook 'window-configuration-change-hook
'set-wrap-to-fill-values t)))





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-19  1:29       ` Lennart Borgman (gmail)
@ 2008-09-19  1:36         ` Miles Bader
  2008-09-19  2:03           ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 14+ messages in thread
From: Miles Bader @ 2008-09-19  1:36 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Chong Yidong, Emacs Devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> Maybe something like this can be used:
...
> (define-minor-mode wrap-to-fill-mode

A clever idea, but...
(1) _centering_ the display like that is bizarre and unpleasant
(2) Having the margin be on the other side of the fringe is kind of
annoying; personally, when I want a bunch of whitespace on the right, I
want it to be whitespace, without the "barrier" the fringe represents.

But maybe it's a good start...

-Miles

-- 
"Don't just question authority,
Don't forget to question me."
-- Jello Biafra




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-19  1:36         ` Miles Bader
@ 2008-09-19  2:03           ` Lennart Borgman (gmail)
  2008-09-19  2:06             ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-19  2:03 UTC (permalink / raw)
  To: Miles Bader; +Cc: Chong Yidong, Emacs Devel

Miles Bader wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>> Maybe something like this can be used:
> ...
>> (define-minor-mode wrap-to-fill-mode
> 
> A clever idea, but...
> (1) _centering_ the display like that is bizarre and unpleasant
> (2) Having the margin be on the other side of the fringe is kind of
> annoying; personally, when I want a bunch of whitespace on the right, I
> want it to be whitespace, without the "barrier" the fringe represents.
> 
> But maybe it's a good start...
> 
> -Miles

I do not know what to do about the barrier, but this takes care of the
left margin.

(defun set-wrap-to-fill-values ()
  "Use `fill-column' display columns in buffer windows."
  (let ((buf-windows (get-buffer-window-list (current-buffer))))
    (dolist (win buf-windows)
      (if wrap-to-fill-mode
          (let* ((edges (window-edges win))
                 (win-width (- (nth 2 edges) (nth 0 edges)))
                 (extra-width (- win-width fill-column))
                 (left-marg (if wrap-to-fill-left-marg
                                wrap-to-fill-left-marg
                              (- (/ extra-width 2) 1)))
                 (right-marg (- win-width fill-column left-marg))
                 (win-margs (window-margins win))
                 (old-left (or (car win-margs) 0))
                 (old-right (or (cdr win-margs) 0)))
            (unless (> left-marg 0) (setq left-marg 0))
            (unless (> right-marg 0) (setq right-marg 0))
            (unless (and (= old-left left-marg)
                         (= old-right right-marg))
              (set-window-margins win left-marg right-marg)))
        (set-window-buffer win (current-buffer))))))

(defcustom wrap-to-fill-left-marg nil
  "Left margin handling for `wrap-to-fill-mode'.
Used by `wrap-to-fill-mode'. If nil then center the display
columns. Otherwise it should be a number which will be the left
margin."
  :type '(choice (const :tag "Center" nil)
                 (integer :tag "Left margin"))
  :group 'emacs)
(make-variable-buffer-local 'wrap-to-fill-left-marg)

(define-minor-mode wrap-to-fill-mode
  "Use `fill-column' display columns in buffer windows.
By default the display columns are centered, but see the option
`wrap-to-fill-left-marg'.

Note: When turning this on `visual-line-mode' is also turned on. This
is not reset when turning off this mode."
  :group 'emacs
  (if wrap-to-fill-mode
      (progn
        (add-hook 'window-configuration-change-hook
'set-wrap-to-fill-values nil t)
        (visual-line-mode 1))
    (remove-hook 'window-configuration-change-hook
'set-wrap-to-fill-values t))
  (set-wrap-to-fill-values))





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-19  2:03           ` Lennart Borgman (gmail)
@ 2008-09-19  2:06             ` Lennart Borgman (gmail)
  2008-09-19  2:28               ` Miles Bader
  0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-19  2:06 UTC (permalink / raw)
  To: Miles Bader; +Cc: Chong Yidong, Emacs Devel

Lennart Borgman (gmail) wrote:
>> (2) Having the margin be on the other side of the fringe is kind of
>> annoying; personally, when I want a bunch of whitespace on the right, I
>> want it to be whitespace, without the "barrier" the fringe represents.
>>
>> But maybe it's a good start...
>>
>> -Miles
> 
> I do not know what to do about the barrier, but this takes care of the
> left margin.

But ... - why do you car about the barrier? I mean there is no new line
characters involved. The text is "floating".




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-19  2:06             ` Lennart Borgman (gmail)
@ 2008-09-19  2:28               ` Miles Bader
  2008-09-19  2:37                 ` Lennart Borgman (gmail)
                                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Miles Bader @ 2008-09-19  2:28 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Chong Yidong, Emacs Devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>>> (2) Having the margin be on the other side of the fringe is kind of
>>> annoying; personally, when I want a bunch of whitespace on the right, I
>>> want it to be whitespace, without the "barrier" the fringe represents.
>> 
>> I do not know what to do about the barrier, but this takes care of the
>> left margin.
>
> But ... - why do you car about the barrier? I mean there is no new line
> characters involved. The text is "floating".

It's visually distracting.  I want the fringe to be exactly that -- a
fringe, on the edge of the display, not in the middle of my window.

I think the essential problem is that putting the margin areas on the
opposite side of the fringe from the text was just kind of stupid in the
first place.  I dunno why that was done...

Given that almost no code seems to use the margins, I think it might be
reasonable to change their locations without bothering about backward
compatibility.

-Miles

-- 
Selfish, adj. Devoid of consideration for the selfishness of others.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-19  2:28               ` Miles Bader
@ 2008-09-19  2:37                 ` Lennart Borgman (gmail)
  2008-09-19  2:43                 ` Stefan Monnier
  2008-09-20 10:45                 ` Johan Bockgård
  2 siblings, 0 replies; 14+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-19  2:37 UTC (permalink / raw)
  To: Miles Bader; +Cc: Chong Yidong, Emacs Devel

Miles Bader wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>>>> (2) Having the margin be on the other side of the fringe is kind of
>>>> annoying; personally, when I want a bunch of whitespace on the right, I
>>>> want it to be whitespace, without the "barrier" the fringe represents.
>>> I do not know what to do about the barrier, but this takes care of the
>>> left margin.
>> But ... - why do you car about the barrier? I mean there is no new line
>> characters involved. The text is "floating".
> 
> It's visually distracting.  I want the fringe to be exactly that -- a
> fringe, on the edge of the display, not in the middle of my window.
> 
> I think the essential problem is that putting the margin areas on the
> opposite side of the fringe from the text was just kind of stupid in the
> first place.  I dunno why that was done...
> 
> Given that almost no code seems to use the margins, I think it might be
> reasonable to change their locations without bothering about backward
> compatibility.

Yes, I can see what you mean.

I found another small problem. There is a confusion between buffer and
window margins here. The doc says that left-margin-width and dito right
may be nil. However they seem to be 0 by default, but when displaying a
buffer in a window then window-margins returns (nil).

This prevents using the buffer values in a meaningful way in code like
that I sent here.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-19  2:28               ` Miles Bader
  2008-09-19  2:37                 ` Lennart Borgman (gmail)
@ 2008-09-19  2:43                 ` Stefan Monnier
  2008-09-19  2:53                   ` Miles Bader
  2008-09-20 10:45                 ` Johan Bockgård
  2 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2008-09-19  2:43 UTC (permalink / raw)
  To: Miles Bader; +Cc: Chong Yidong, Lennart Borgman (gmail), Emacs Devel

> Given that almost no code seems to use the margins, I think it might be
> reasonable to change their locations without bothering about backward
> compatibility.

I can't remember exactly how it happened, but I have the nagging feeling
that GUD's use of the margin for breakpoints was part of the motivation
to move the margin to the outside.  I don't think just switching it is
the right answer.


        Stefan




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-19  2:43                 ` Stefan Monnier
@ 2008-09-19  2:53                   ` Miles Bader
  0 siblings, 0 replies; 14+ messages in thread
From: Miles Bader @ 2008-09-19  2:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Chong Yidong, Lennart Borgman (gmail), Emacs Devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Given that almost no code seems to use the margins, I think it might be
>> reasonable to change their locations without bothering about backward
>> compatibility.
>
> I can't remember exactly how it happened, but I have the nagging feeling
> that GUD's use of the margin for breakpoints was part of the motivation
> to move the margin to the outside.  I don't think just switching it is
> the right answer.

Hmm, what difference does it make to GUD which side they're on?

In practice, of course, gud doesn't even seem to encounter the issue --
it uses the fringe for breakpoints on X, and though it uses the left
margin for breakpoints on terminals, there's no left fringe at all in
that case.

-Miles

-- 
Politeness, n. The most acceptable hypocrisy.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-19  2:28               ` Miles Bader
  2008-09-19  2:37                 ` Lennart Borgman (gmail)
  2008-09-19  2:43                 ` Stefan Monnier
@ 2008-09-20 10:45                 ` Johan Bockgård
  2 siblings, 0 replies; 14+ messages in thread
From: Johan Bockgård @ 2008-09-20 10:45 UTC (permalink / raw)
  To: emacs-devel

Miles Bader <miles.bader@necel.com> writes:

> I think the essential problem is that putting the margin areas on the
> opposite side of the fringe from the text was just kind of stupid in the
> first place.  I dunno why that was done...

    fringes-outside-margins is a variable defined in `C source code'.
    Its value is nil

      Automatically becomes buffer-local when set in any fashion.

    Documentation:
    *Non-nil means to display fringes outside display margins.
    A value of nil means to display fringes between margins and buffer text.

-- 
Johan Bockgård





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Word wrapping and long lines
  2008-09-18 23:58   ` Lennart Borgman (gmail)
  2008-09-19  1:12     ` Chong Yidong
@ 2008-09-20 15:51     ` Johan Bockgård
  1 sibling, 0 replies; 14+ messages in thread
From: Johan Bockgård @ 2008-09-20 15:51 UTC (permalink / raw)
  To: emacs-devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

> But what about wrapping at some specific width (like longlines-mode
> does), is that not implemented yet? I am just looking at
> visual-line-mode and it does not mention anything about this.

Kim's original patch did have this feature.

-- 
Johan Bockgård





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-09-20 15:51 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-18 22:13 Word wrapping and long lines Lennart Borgman (gmail)
2008-09-18 23:30 ` Chong Yidong
2008-09-18 23:58   ` Lennart Borgman (gmail)
2008-09-19  1:12     ` Chong Yidong
2008-09-19  1:29       ` Lennart Borgman (gmail)
2008-09-19  1:36         ` Miles Bader
2008-09-19  2:03           ` Lennart Borgman (gmail)
2008-09-19  2:06             ` Lennart Borgman (gmail)
2008-09-19  2:28               ` Miles Bader
2008-09-19  2:37                 ` Lennart Borgman (gmail)
2008-09-19  2:43                 ` Stefan Monnier
2008-09-19  2:53                   ` Miles Bader
2008-09-20 10:45                 ` Johan Bockgård
2008-09-20 15:51     ` Johan Bockgård

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.