unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Are Windows-Emacs' scrollbars broken?
@ 2003-04-10  9:10 Jon
  2003-04-12 10:07 ` Eli Zaretskii
       [not found] ` <mailman.4474.1050138530.21513.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 15+ messages in thread
From: Jon @ 2003-04-10  9:10 UTC (permalink / raw)


I'm running Emacs 21.1.1 under Windows NT.  The scrollbar behaviour is
horrible.

It doesn't scroll all the way to the bottom, stopping a couple of
lines before the end of the buffer.
And the scrolling text jitters up & down while scrolling.

I found a message about this way back in 2001, with no replies.  Have
there been any further advances on it?

Jon

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

* Re: Are Windows-Emacs' scrollbars broken?
  2003-04-10  9:10 Are Windows-Emacs' scrollbars broken? Jon
@ 2003-04-12 10:07 ` Eli Zaretskii
  2003-04-13  2:01   ` prefix line with number WAS: " John Kliff Jochens
       [not found]   ` <mailman.4499.1050199969.21513.help-gnu-emacs@gnu.org>
       [not found] ` <mailman.4474.1050138530.21513.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 15+ messages in thread
From: Eli Zaretskii @ 2003-04-12 10:07 UTC (permalink / raw)


> From: j_del_strother@hotmail.com (Jon)
> Newsgroups: gnu.emacs.help
> Date: 10 Apr 2003 02:10:07 -0700
> 
> I'm running Emacs 21.1.1 under Windows NT.  The scrollbar behaviour is
> horrible.

I'd say this is extreme.  It's not horrible, at least not in most
cases.  It's just a little bit irregular, although in some rare cases,
like very small files and/or lines whose length varies wildly, it
could indeed look horrible.

> It doesn't scroll all the way to the bottom, stopping a couple of
> lines before the end of the buffer.
> And the scrolling text jitters up & down while scrolling.

This is because Emacs sets the scroll-bar thumb size based on the
number of characters, not lines.  One reason is that Emacs doesn't
count lines in the buffer unless specifically required to do so by
some command.

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

* Re: Are Windows-Emacs' scrollbars broken?
       [not found] ` <mailman.4474.1050138530.21513.help-gnu-emacs@gnu.org>
@ 2003-04-12 18:05   ` Stefan Monnier
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 2003-04-12 18:05 UTC (permalink / raw)


>> It doesn't scroll all the way to the bottom, stopping a couple of
>> lines before the end of the buffer.
>> And the scrolling text jitters up & down while scrolling.
> This is because Emacs sets the scroll-bar thumb size based on the
> number of characters, not lines.  One reason is that Emacs doesn't
> count lines in the buffer unless specifically required to do so by
> some command.

Changing from char to lines wouldn't solve the problem.  You need to change
from char to pixels to get something that works.  Of course you
can also change other things such as the rule for the position/size
of the thumb.


        Stefan


PS: Of course the difference between counting lines-vs-pixels is less than
    for chars-vs-pixels, so it would help in many cases.

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

* prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
  2003-04-12 10:07 ` Eli Zaretskii
@ 2003-04-13  2:01   ` John Kliff Jochens
       [not found]   ` <mailman.4499.1050199969.21513.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 15+ messages in thread
From: John Kliff Jochens @ 2003-04-13  2:01 UTC (permalink / raw)


On Sat, 2003-04-12 at 07:07, Eli Zaretskii wrote:

> 
> > It doesn't scroll all the way to the bottom, stopping a couple of
> > lines before the end of the buffer.
> > And the scrolling text jitters up & down while scrolling.
> 
> This is because Emacs sets the scroll-bar thumb size based on the
> number of characters, not lines.  One reason is that Emacs doesn't
> count lines in the buffer unless specifically required to do so by
> some command.

Now that you mentioned it, how can I have each line of the buffer
prefixed with its number? All I managed to do was to show on the line
with the file name (and etc), as well as the column, but I'd preffer to
have the line shown at the begginig of line.

Anyone knows how to do that (GNU Emacs 21.2.1)?
-- 
John Kliff Jochens <jk-listas@bol.com.br>

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
       [not found]   ` <mailman.4499.1050199969.21513.help-gnu-emacs@gnu.org>
@ 2003-04-13  8:03     ` Kai Großjohann
  2003-04-13  9:16       ` John Kliff Jochens
       [not found]       ` <mailman.4515.1050226027.21513.help-gnu-emacs@gnu.org>
  2003-04-18  0:16     ` Pascal Bourguignon
  1 sibling, 2 replies; 15+ messages in thread
From: Kai Großjohann @ 2003-04-13  8:03 UTC (permalink / raw)


John Kliff Jochens <jk-listas@bol.com.br> writes:

> Now that you mentioned it, how can I have each line of the buffer
> prefixed with its number? All I managed to do was to show on the line
> with the file name (and etc), as well as the column, but I'd preffer to
> have the line shown at the begginig of line.

There is a file setnu.el (or set-nu.el) floating about on the Net
somewhere.
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
  2003-04-13  8:03     ` Kai Großjohann
@ 2003-04-13  9:16       ` John Kliff Jochens
       [not found]       ` <mailman.4515.1050226027.21513.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 15+ messages in thread
From: John Kliff Jochens @ 2003-04-13  9:16 UTC (permalink / raw)


On Sun, 2003-04-13 at 05:03, Kai Großjohann wrote:

> John Kliff Jochens <jk-listas@bol.com.br> writes:
> 
> > Now that you mentioned it, how can I have each line of the buffer
> > prefixed with its number? All I managed to do was to show on the line
> > with the file name (and etc), as well as the column, but I'd preffer to
> > have the line shown at the begginig of line.
> 
> There is a file setnu.el (or set-nu.el) floating about on the Net
> somewhere.

Thanks a lot.
It worked just fine but, as I tried to do as indicated to have it
working automatically (indicated on the .el file itself)

[added to .emacs]

(add-hook 'text-mode-hook 'turn-on-setnu-mode)

I got the following error on running emacs:
"Symbol's function definition is void: turn-on-setnu-mode"

M-x turn-on-setnu-mode doesn't work neither.
 
As I'm no lisp connaisseur, I am a little lost :) 
Can you help me find a workaround to get it working automatically?

thanks inadvance.


-- 
John Kliff Jochens <jk-listas@bol.com.br>

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
       [not found]       ` <mailman.4515.1050226027.21513.help-gnu-emacs@gnu.org>
@ 2003-04-13 11:57         ` Kai Großjohann
  2003-04-13 20:41           ` John Kliff Jochens
       [not found]           ` <mailman.4530.1050267377.21513.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 15+ messages in thread
From: Kai Großjohann @ 2003-04-13 11:57 UTC (permalink / raw)


John Kliff Jochens <jk-listas@bol.com.br> writes:

> Thanks a lot.
> It worked just fine but, as I tried to do as indicated to have it
> working automatically (indicated on the .el file itself)
>
> [added to .emacs]
>
> (add-hook 'text-mode-hook 'turn-on-setnu-mode)
>
> I got the following error on running emacs:
> "Symbol's function definition is void: turn-on-setnu-mode"
>
> M-x turn-on-setnu-mode doesn't work neither.

Does it help to put (require 'setnu) before the add-hook statement?

-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
  2003-04-13 11:57         ` Kai Großjohann
@ 2003-04-13 20:41           ` John Kliff Jochens
  2003-04-14  5:47             ` Kai Großjohann
       [not found]             ` <mailman.4543.1050304974.21513.help-gnu-emacs@gnu.org>
       [not found]           ` <mailman.4530.1050267377.21513.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 15+ messages in thread
From: John Kliff Jochens @ 2003-04-13 20:41 UTC (permalink / raw)
  Cc: help-gnu-emacs

On Sun, 2003-04-13 at 08:57, Kai Großjohann wrote:
> E-mail Premium BOL
> Antivírus, anti-spam e até 100 MB de espaço. Assine já!
> http://email.bol.com.br/
> John Kliff Jochens <jk-listas@bol.com.br> writes:
> 
> > Thanks a lot.
> > It worked just fine but, as I tried to do as indicated to have it
> > working automatically (indicated on the .el file itself)
> >
> > [added to .emacs]
> >
> > (add-hook 'text-mode-hook 'turn-on-setnu-mode)
> >
> > I got the following error on running emacs:
> > "Symbol's function definition is void: turn-on-setnu-mode"
> >
> > M-x turn-on-setnu-mode doesn't work neither.
> 
> Does it help to put (require 'setnu) before the add-hook statement?
No. It tells me that 'selected feature setnu was not provided'.
-- 
John Kliff Jochens <jk-listas@bol.com.br>

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
       [not found]           ` <mailman.4530.1050267377.21513.help-gnu-emacs@gnu.org>
@ 2003-04-13 21:36             ` Martin Stemplinger
  2003-04-14  2:11             ` Peter Lee
  1 sibling, 0 replies; 15+ messages in thread
From: Martin Stemplinger @ 2003-04-13 21:36 UTC (permalink / raw)


On So Apr 13 2003 at 22:41, John Kliff Jochens <jk-listas@bol.com.br> wrote:

>> Does it help to put (require 'setnu) before the add-hook statement?
> No. It tells me that 'selected feature setnu was not provided'.

You probably either need to use (load "setnu") or add (provide 'setnu)
and the very end of setnu.el. I'd prefer the former.

HTH
Martin

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
       [not found]           ` <mailman.4530.1050267377.21513.help-gnu-emacs@gnu.org>
  2003-04-13 21:36             ` Martin Stemplinger
@ 2003-04-14  2:11             ` Peter Lee
  2003-04-14  2:31               ` John Kliff Jochens
  2003-04-14  5:58               ` Kai Großjohann
  1 sibling, 2 replies; 15+ messages in thread
From: Peter Lee @ 2003-04-14  2:11 UTC (permalink / raw)


John Kliff Jochens <jk-listas@bol.com.br> writes:

> No. It tells me that 'selected feature setnu was not provided'.

You would also need to make sure that the setnu.el file is in your
load-path.

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
  2003-04-14  2:11             ` Peter Lee
@ 2003-04-14  2:31               ` John Kliff Jochens
  2003-04-14  5:58               ` Kai Großjohann
  1 sibling, 0 replies; 15+ messages in thread
From: John Kliff Jochens @ 2003-04-14  2:31 UTC (permalink / raw)


On Sun, 2003-04-13 at 23:11, Peter Lee wrote:
> E-mail Premium BOL
> Antivírus, anti-spam e até 100 MB de espaço. Assine já!
> http://email.bol.com.br/
> John Kliff Jochens <jk-listas@bol.com.br> writes:
> 
> > No. It tells me that 'selected feature setnu was not provided'.
> 
> You would also need to make sure that the setnu.el file is in your
> load-path.

The compiled setnu.elc is in $HOME/.elisp, and 
(setq load-path (append load-path (list
				   "~/.el"
				   )))

is in my ~/.emacs.

> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
  2003-04-13 20:41           ` John Kliff Jochens
@ 2003-04-14  5:47             ` Kai Großjohann
       [not found]             ` <mailman.4543.1050304974.21513.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 15+ messages in thread
From: Kai Großjohann @ 2003-04-14  5:47 UTC (permalink / raw)
  Cc: help-gnu-emacs

John Kliff Jochens <jk-listas@bol.com.br> writes:

> On Sun, 2003-04-13 at 08:57, Kai Großjohann wrote:
>
>> Does it help to put (require 'setnu) before the add-hook statement?
>
> No. It tells me that 'selected feature setnu was not provided'.

Ah.  This looks like a bug in setnu.el.  Add (provide 'setnu) near
the end of the file.  If that helps, report the bug to the author.
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
  2003-04-14  2:11             ` Peter Lee
  2003-04-14  2:31               ` John Kliff Jochens
@ 2003-04-14  5:58               ` Kai Großjohann
  1 sibling, 0 replies; 15+ messages in thread
From: Kai Großjohann @ 2003-04-14  5:58 UTC (permalink / raw)


Peter Lee <pete_lee/remove-for-email/@swbell.net> writes:

> John Kliff Jochens <jk-listas@bol.com.br> writes:
>
>> No. It tells me that 'selected feature setnu was not provided'.
>
> You would also need to make sure that the setnu.el file is in your
> load-path.

The error message occurs after the file has already been loaded.  So
load-path is probably not the problem.
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
       [not found]             ` <mailman.4543.1050304974.21513.help-gnu-emacs@gnu.org>
@ 2003-04-14 13:41               ` Johan Bockgård
  0 siblings, 0 replies; 15+ messages in thread
From: Johan Bockgård @ 2003-04-14 13:41 UTC (permalink / raw)


kai.grossjohann@gmx.net (Kai Großjohann) writes:

> Ah.  This looks like a bug in setnu.el.  Add (provide 'setnu) near
> the end of the file.  If that helps, report the bug to the author.

It is there in the version I use (1.06). There is also something
called setnu+, that "supposedly improves setnu's ability to deal with
faces and adding/removing newlines". See the Emacs Wiki for both of
these:

http://www.emacswiki.org/cgi-bin/wiki.pl?LineNumbers

-- 
Johan Bockgård

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

* Re: prefix line with number WAS: Are Windows-Emacs' scrollbars broken?
       [not found]   ` <mailman.4499.1050199969.21513.help-gnu-emacs@gnu.org>
  2003-04-13  8:03     ` Kai Großjohann
@ 2003-04-18  0:16     ` Pascal Bourguignon
  1 sibling, 0 replies; 15+ messages in thread
From: Pascal Bourguignon @ 2003-04-18  0:16 UTC (permalink / raw)


John Kliff Jochens <jk-listas@bol.com.br> writes:

> On Sat, 2003-04-12 at 07:07, Eli Zaretskii wrote:
> 
> > 
> > > It doesn't scroll all the way to the bottom, stopping a couple of
> > > lines before the end of the buffer.
> > > And the scrolling text jitters up & down while scrolling.
> > 
> > This is because Emacs sets the scroll-bar thumb size based on the
> > number of characters, not lines.  One reason is that Emacs doesn't
> > count lines in the buffer unless specifically required to do so by
> > some command.
> 
> Now that you mentioned it, how can I have each line of the buffer
> prefixed with its number? All I managed to do was to show on the line
> with the file name (and etc), as well as the column, but I'd preffer to
> have the line shown at the begginig of line.
> 
> Anyone knows how to do that (GNU Emacs 21.2.1)?

Perhaps  faster than  searching  anything  on the  web  and trying  to
install it inside emacs would be to write this in one's .emacs:

(defun insert-line-numbers ()
    "Insert a line number on all lines of the current buffer."
  (interactive)
  (save-excursion
    (save-restriction
      (widen)
      (let ((fmt (format "%%0%dd "
                         (1+ (truncate 
                              (log (count-lines (point-min) (point-max)) 
                                   10)))))
            (i 0))
        (goto-char (point-min))
        (while (< (point) (point-max))
          (setq i (1+ i))
          (insert (format fmt i))
          (forward-line)))))
  );;insert-line-numbers


Then you may want to have line numbers inserted on new lines:

(defun lse-newline ()
  "Insert newline and line number incremented with the same step 
   as previously."
  (interactive)
  (newline)
  (let ((nlpt (point))
        (line (progn
                (forward-line -1)
                (beginning-of-line)
                (if (looking-at "[0-9]+")
                    (let ((curr (string-to-number (match-string 0))))
                      (forward-line -1)
                      (beginning-of-line)
                      (if (looking-at "[0-9]+")
                          (let ((prev (string-to-number (match-string 0))))
                            (+ curr (abs (- curr prev))))
                        (+ 10 curr)))
                  10))))
    (goto-char nlpt)
    (beginning-of-line)
    (insert (format "%d " line))
    (when (looking-at " +")
      (delete-region (match-beginning 0) (match-end 0)))))

And activating with:

(setq line-num-map (make-sparse-keymap))
(define-key line-num-map "\n"  'lse-newline)
(define-key line-num-map "\r"  'lse-newline)

and:
M-x eval-expression RETURN (use-local-map line-num-map) RETURN 
in the buffer.
(or you can add these keys to the map of the mode of these buffers).


But then you have to renumber lines sometimes:

(defun delete-line-numbers ()
  (interactive)
  (save-excursion
    (save-restriction
      (widen)
        (goto-char (point-min))
        (while (< (point) (point-max))
          (if (looking-at "[0-9][0-9]* ")
            (delete-region (match-beginning 0) (match-end 0)))
          (forward-line))))
  );;delete-line-numbers


(defun renumber-lines ()
    (interactive)
    (delete-line-numbers)
    (insert-line-numbers))



-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------
Do not adjust your mind, there is a fault in reality.

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

end of thread, other threads:[~2003-04-18  0:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-10  9:10 Are Windows-Emacs' scrollbars broken? Jon
2003-04-12 10:07 ` Eli Zaretskii
2003-04-13  2:01   ` prefix line with number WAS: " John Kliff Jochens
     [not found]   ` <mailman.4499.1050199969.21513.help-gnu-emacs@gnu.org>
2003-04-13  8:03     ` Kai Großjohann
2003-04-13  9:16       ` John Kliff Jochens
     [not found]       ` <mailman.4515.1050226027.21513.help-gnu-emacs@gnu.org>
2003-04-13 11:57         ` Kai Großjohann
2003-04-13 20:41           ` John Kliff Jochens
2003-04-14  5:47             ` Kai Großjohann
     [not found]             ` <mailman.4543.1050304974.21513.help-gnu-emacs@gnu.org>
2003-04-14 13:41               ` Johan Bockgård
     [not found]           ` <mailman.4530.1050267377.21513.help-gnu-emacs@gnu.org>
2003-04-13 21:36             ` Martin Stemplinger
2003-04-14  2:11             ` Peter Lee
2003-04-14  2:31               ` John Kliff Jochens
2003-04-14  5:58               ` Kai Großjohann
2003-04-18  0:16     ` Pascal Bourguignon
     [not found] ` <mailman.4474.1050138530.21513.help-gnu-emacs@gnu.org>
2003-04-12 18:05   ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).