From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: lee Newsgroups: gmane.emacs.help Subject: Re: prevent scroll-lock-mode from scrolling? Date: Mon, 20 Jun 2016 21:50:05 +0200 Organization: my virtual residence Message-ID: <877fdjej2q.fsf@heimdali.yagibdah.de> References: <871t3waaa8.fsf@heimdali.yagibdah.de> <83eg7wcnwj.fsf@gnu.org> <8760t7l8cg.fsf@heimdali.yagibdah.de> <834m8qc2nb.fsf@gnu.org> <87mvmgpwf9.fsf@heimdali.yagibdah.de> <87y4609nv5.fsf@gmail.com> <87twgnhohm.fsf@heimdali.yagibdah.de> <87a8ifalf9.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1466458851 18163 80.91.229.3 (20 Jun 2016 21:40:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2016 21:40:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 20 23:40:44 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bF6w0-0003yt-3f for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Jun 2016 23:40:44 +0200 Original-Received: from localhost ([::1]:46711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF6vz-0002K4-93 for geh-help-gnu-emacs@m.gmane.org; Mon, 20 Jun 2016 17:40:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF6vJ-0002Jd-Uo for help-gnu-emacs@gnu.org; Mon, 20 Jun 2016 17:40:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF6vF-0003SW-K5 for help-gnu-emacs@gnu.org; Mon, 20 Jun 2016 17:40:00 -0400 Original-Received: from acheron.yagibdah.de ([185.55.75.245]:52694) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF6vF-0003SQ-By for help-gnu-emacs@gnu.org; Mon, 20 Jun 2016 17:39:57 -0400 Original-Received: from heimdali.yagibdah.de ([192.168.3.20]) by acheron.yagibdah.de with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.85) (envelope-from ) id 1bF6vD-0001Ik-AH for help-gnu-emacs@gnu.org; Mon, 20 Jun 2016 23:39:55 +0200 Original-Received: from lee by heimdali.yagibdah.de with local (Exim 4.87) (envelope-from ) id 1bF6vD-0003fl-7e for help-gnu-emacs@gnu.org; Mon, 20 Jun 2016 23:39:55 +0200 In-Reply-To: <87a8ifalf9.fsf@gmail.com> (Dmitry Alexandrov's message of "Mon, 20 Jun 2016 19:12:58 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Mail-Followup-To: help-gnu-emacs@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.55.75.245 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110538 Archived-At: Dmitry Alexandrov <321942@gmail.com> writes: > lee writes: > >> Dmitry Alexandrov <321942@gmail.com> writes: >> >>> lee writes: >>>> Can you explain to me why the cursor remains at its position /on the >>>> screen/ while I'm scrolling with scroll-lock-mode enabled all the time >>>> like it should --- and then suddenly moves when the top or bottom of t= he >>>> buffer contents come into view? That doesn't make any sense to me; the >>>> cursor still shouldn't move. >>> >>> Given that there is no free space before the first line of a buffer, >>> this does make perfect sense with regard to scrolling backward (to the >>> top of a buffer). The other way we would just get stuck with the point >>> in the middle of a screen not being able to reach first lines. The >>> scrolling forward behaves the same way for sake of coherence, I guess. >> >> There is no free space beyond the last line of a buffer, either. > > Well, by default in GNU Emacs there *is* free space beyond the last > line, which is taken in account while scrolling. I have no idea how > could you disabled it. Err, yes, I shouldn't have said it this way. I mean there's no free space, only whatever emacs uses to fill parts of the display there are no buffer contents such parts could otherwise be filled with. Inconsistently, emacs fills only what it considers as "below" of buffer contents with non-buffer-contents. > Actually I would like to see some day an opposite option in GNU Emacs > =E2=80=94 to enable empty lines above the top of a buffer. I'd like that, too. It would make things consistent. >> It doesn't make sense, though, because scroll-lock means that the cursor >> does not move when scrolling. Why else would I use scroll-lock-mode? > > As far as I understand, minor modes for Emacs are generally designed to > be used on permanent basis, not to be toggled every several keystrokes. > Since the algorithm you described prevents user from accessing to first > N lines of buffer, this algorithm would be perceived as broken. Scroll-lock-mode shouldn't have been implemented as a minor mode then, or be given a different name. Not that I'd press the ScrollLock key every few keystrokes, though. > [...] > >>> Also, if you are regularily toggling the =E2=80=98scroll-lock-mode=E2= =80=99 on and off, >>> you might consider to use approach that, one might say, is more >>> =E2=80=98Emacsish=E2=80=99 =E2=80=94 another keychord instead of mode: >>> >>> (setq scroll-preserve-screen-position 'always) >>> (global-set-key (kbd "M-n") #'scroll-up-line) >>> (global-set-key (kbd "M-") #'scroll-up-line) >>> (global-set-key (kbd "M-p") #'scroll-down-line) >>> (global-set-key (kbd "M-") #'scroll-down-line) >> >> The idea was to make use of the ScrollLock key. So I did that and found >> that when scroll-lock-mode is enabled, the point does move when it >> shouldn't. >> >> Since what scroll-lock-mode does is achieved by setting >> scroll-preserve-screen-position to t, what is the point or purpose of >> scroll-lock-mode? That the cursor moves when it shouldn't? > > First of all, I would not say that there is something wrong even with > existence of a minor mode that only toggles single variable. However > you might notice that besides toggling =E2=80=98scroll-preserve-screen-po= sition=E2=80=99 > =E2=80=98scroll-lock-mode=E2=80=99 at least re-defines several moving key= s: =E2=80=98C-n=E2=80=99, =E2=80=98C-p=E2=80=99, etc. I'm wondering why a whole mode should be needed when what the mode does can be done by just changing a single variable instead. And why would it do more than doing just that? >> BTW, it seems that changing scroll-preserve-screen-position requires >> restarting emacs to take effect. > > No. You mean it does take effect without restarting when you try it? >> Maybe that's what scroll-lock-mode is >> for, being able to change the behaviour without restarting? > > As you already noticed, =E2=80=98scroll-lock-mode=E2=80=99 depends on sta= te of > =E2=80=98scroll-preserve-screen-position=E2=80=99. How then could it eva= de such a > limitation if it existed? Why would it do more than changing the variable if changing it would take effect without any further ado? --=20 GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, X toolkit) of 2016-03-18 on heimdali