emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C-n and C-a


From: Juri Linkov
Subject: Re: C-n and C-a
Date: Thu, 12 Feb 2009 00:45:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.90 (x86_64-pc-linux-gnu)

>> For starters, the following patch does this for dired-mode:
>
> FWIW, I think the right patch for dired would be to set truncate-lines
> to t.

I have no opinion on the default of truncate-lines in dired but I think
setting word-wrap to nil in dired-mode is necessary as well to prevent
the problem I described in the case when someone sets truncate-lines to nil
and word-wrap to t globally.

There are also two other ways to mitigate the word-wrap problem in Dired:

1. display arrows at the right fringe in visual-line-mode indicating
that the file name is wrapped to the left side of the dired buffer;

2. add an option to the variable word-wrap to wrap at word boundaries
instead of whitespace as is currently implemented.  Thus wrapping might
occur inside a long file name that has non-word non-whitespace characters,
and it's likely that at least the first word will remain unwrapped.
However, this is not for the coming release.

For the same reason I think we should not set word-mode in
visual-line-mode.  Someone might want to enable visual-line-mode in
dired and stumble upon the same problem.  The following patch
fixes this.

Also there is a problem with the terminology.  The term "logical line"
causes cognitive dissonance - it is a common synonym of "virtual line"
and is opposite to the "real line".  But currently "logical line"
is used as a synonym of "real line".

>From Jargon File 4.4.4 (14 Aug 2003):

  virtual

     1. Common alternative to logical; often used to refer to the
     artificial objects (like addressable virtual memory larger than
     physical memory) simulated by a computer system as a convenient way
     to manage access to shared resources.

     2. Simulated; performing the functions of something that isn't
     really there. An imaginative child's doll may be a virtual playmate.
     Oppose real.

I suggest using the term "real lines" instead of "logical lines".

Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.971
diff -c -r1.971 simple.el
*** lisp/simple.el      8 Feb 2009 00:46:38 -0000       1.971
--- lisp/simple.el      11 Feb 2009 22:44:57 -0000
***************
*** 4554,4564 ****
  (defvar visual-line--saved-state nil)
  
  (define-minor-mode visual-line-mode
!   "Redefine simple editing commands to act on visual lines, not logical lines.
! This also turns on `word-wrap' in the buffer."
    :keymap visual-line-mode-map
    :group 'visual-line
    :lighter " wrap"
--- 4564,4574 ----
  (defvar visual-line--saved-state nil)
  
  (define-minor-mode visual-line-mode
!   "Redefine simple editing commands to act on visual lines, not real lines.
! This also turns off `truncate-lines' in the buffer."
    :keymap visual-line-mode-map
    :group 'visual-line
    :lighter " wrap"
***************
*** 4566,4584 ****
        ;; visual-line-mode is turned off.
        (dolist (var '(line-move-visual truncate-lines
                       truncate-partial-width-windows
!                      word-wrap fringe-indicator-alist))
          (if (local-variable-p var)
              (push (cons var (symbol-value var))
                    visual-line--saved-state)))
        (set (make-local-variable 'line-move-visual) t)
        (set (make-local-variable 'truncate-partial-width-windows) nil)
        (setq truncate-lines nil
-             word-wrap t
              fringe-indicator-alist
              (cons (cons 'continuation visual-line-fringe-indicators)
                    fringe-indicator-alist)))
      (kill-local-variable 'line-move-visual)
-     (kill-local-variable 'word-wrap)
      (kill-local-variable 'truncate-lines)
      (kill-local-variable 'truncate-partial-width-windows)
      (kill-local-variable 'fringe-indicator-alist)
--- 4576,4592 ----
        ;; visual-line-mode is turned off.
        (dolist (var '(line-move-visual truncate-lines
                       truncate-partial-width-windows
!                      fringe-indicator-alist))
          (if (local-variable-p var)
              (push (cons var (symbol-value var))
                    visual-line--saved-state)))
        (set (make-local-variable 'line-move-visual) t)
        (set (make-local-variable 'truncate-partial-width-windows) nil)
        (setq truncate-lines nil
              fringe-indicator-alist
              (cons (cons 'continuation visual-line-fringe-indicators)
                    fringe-indicator-alist)))
      (kill-local-variable 'line-move-visual)
      (kill-local-variable 'truncate-lines)
      (kill-local-variable 'truncate-partial-width-windows)
      (kill-local-variable 'fringe-indicator-alist)

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]