[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14170: 24.3; linum won't create all overlays after a folding
From: |
Eli Zaretskii |
Subject: |
bug#14170: 24.3; linum won't create all overlays after a folding |
Date: |
Sun, 14 Apr 2013 09:15:27 +0300 |
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Glenn Morris <rgm@gnu.org>, 14170@debbugs.gnu.org
> Date: Sat, 13 Apr 2013 21:21:22 -0400
>
> >> > nlinum works correctly.
> >> This is the answer to most recent bug reports involving linum, as I
> >> recall. Will nlinum replace linum at some point?
> > Btw, if nlinum is our response to the problems in linum, then nlinum
> > should be a bit more friendly to bidirectional text, and determine
> > whether to put numbers on the left or right margin by looking at what
> > current-bidi-paragraph-direction returns. (Yes, this means that if
> > some paragraphs are L2R and others R2L, some numbers will be on the
> > left, while others on the right.)
>
> Patches welcome
Below. (There's a missing feature in bidi display that causes the
numbers to be displayed backwards in R2L paragraphs; I will fix that
later.)
> but I don't think we need to worry a bout this w.r.t moving from
> linum.el to nlinum.el since linum.el doesn't support R2L paragraphs
> either.
Well, I hope you allow me to worry about that ;-)
=== modified file 'packages/nlinum/nlinum.el'
--- packages/nlinum/nlinum.el 2012-10-24 19:29:40 +0000
+++ packages/nlinum/nlinum.el 2013-04-14 06:09:13 +0000
@@ -35,7 +35,7 @@
;;;###autoload
(define-minor-mode nlinum-mode
- "Toggle display of line numbers in the left margin (Linum mode).
+ "Toggle display of line numbers in the margin (Linum mode).
With a prefix argument ARG, enable Linum mode if ARG is positive,
and disable it otherwise. If called from Lisp, enable the mode
if ARG is omitted or nil.
@@ -55,9 +55,21 @@ Linum mode is a buffer-local minor mode.
(jit-lock-register #'nlinum--region t))
(nlinum--setup-windows))
+(defvar margin-side nil)
(defun nlinum--setup-window ()
- (set-window-margins nil (if nlinum-mode nlinum--width)
- (cdr (window-margins))))
+ (cond ((eq bidi-paragraph-direction 'left-to-right)
+ (set-window-margins nil (if nlinum-mode nlinum--width)
+ (cdr (window-margins)))
+ (setq-local margin-side 'left))
+ ((eq bidi-paragraph-direction 'right-to-left)
+ (set-window-margins nil (car (window-margins))
+ (if nlinum-mode nlinum--width))
+ (setq-local margin-side 'right))
+ (t
+ (set-window-margins nil
+ (if nlinum-mode nlinum--width)
+ (if nlinum-mode nlinum--width))
+ (setq-local margin-side nil))))
(defun nlinum--setup-windows ()
(dolist (win (get-buffer-window-list nil nil t))
@@ -157,7 +169,14 @@ Linum mode is a buffer-local minor mode.
(and (not (eobp)) (< (point) limit)
(let* ((ol (make-overlay (point) (1+ (point))))
(str (format fmt line))
- (width (string-width str)))
+ (width (string-width str))
+ (side
+ (cond ((eq margin-side 'left) 'left-margin)
+ ((eq margin-side 'right) 'right-margin)
+ (t (if (eq (current-bidi-paragraph-direction)
+ 'right-to-left)
+ 'right-margin
+ 'left-margin)))))
(when (< nlinum--width width)
(setq nlinum--width width)
(nlinum--new-width))
@@ -165,7 +184,7 @@ Linum mode is a buffer-local minor mode.
(overlay-put ol 'evaporate t)
(overlay-put ol 'before-string
(propertize " " 'display
- `((margin left-margin)
+ `((margin ,side)
,(propertize str
'face 'linum))))
;; (setq nlinum--ol-counter (1- nlinum--ol-counter))
- bug#14170: 24.3; linum won't create all overlays after a folding, E Sabof, 2013/04/09
- bug#14170: 24.3; linum won't create all overlays after a folding, Stefan Monnier, 2013/04/09
- bug#14170: 24.3; linum won't create all overlays after a folding, E Sabof, 2013/04/09
- bug#14170: 24.3; linum won't create all overlays after a folding, Glenn Morris, 2013/04/09
- bug#14170: 24.3; linum won't create all overlays after a folding, Eli Zaretskii, 2013/04/12
- bug#14170: 24.3; linum won't create all overlays after a folding, Stefan Monnier, 2013/04/13
- bug#14170: 24.3; linum won't create all overlays after a folding,
Eli Zaretskii <=
- bug#14170: 24.3; linum won't create all overlays after a folding, Stefan Monnier, 2013/04/15
- bug#14170: 24.3; linum won't create all overlays after a folding, Eli Zaretskii, 2013/04/16
- bug#14170: 24.3; linum won't create all overlays after a folding, E Sabof, 2013/04/10
- bug#14170: 24.3; linum won't create all overlays after a folding, E Sabof, 2013/04/10
- bug#14170: 24.3; linum won't create all overlays after a folding, Eli Zaretskii, 2013/04/10
- bug#14170: 24.3; linum won't create all overlays after a folding, E Sabof, 2013/04/10
- bug#14170: 24.3; linum won't create all overlays after a folding, Eli Zaretskii, 2013/04/11
- bug#14170: 24.3; linum won't create all overlays after a folding, Stefan Monnier, 2013/04/11
- Message not available
- Message not available
- bug#14170: 24.3; linum won't create all overlays after a folding, E Sabof, 2013/04/13
- bug#14170: 24.3; linum won't create all overlays after a folding, Stefan Monnier, 2013/04/13