all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Word wrap and horizontal scrolling
@ 2011-03-13 15:53 Alexander Stepanov
  2011-03-14  4:48 ` Yuri Khan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexander Stepanov @ 2011-03-13 15:53 UTC (permalink / raw)
  To: help-gnu-emacs

I am still trying to make emacs work as usual Windows text editor such
as Notepad++ and MS Visual Studio. I can turn off word wrap in Notepad+
+ and it will show horizontal scrollbar. To do such in emacs i must
input M-x toggle-truncate-lines and scroll to the left and to the
right using C-PgDn and C-PgUp. But this method scrolls code with too
big offset. For example my current task at work is to make some
changes in such code:
if(...){
	if(...){
		if(...){
			...
		}
		else{
			if(...){
				if(...){
					if(...){
						else{
							if(...){
							}
							else{
I can edit this code in Notepad++. But Emacs wrap lines. When i turn
of line wrapping C-PgDn moves me to the last if and C-PgUp moves me to
the first if. If I want to edit center part of code I move using left
and write arrows at the keyboard. This Emacs behaviour is shameful. Is
there some way to emulate horizontal scrollbar?


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

* Re: Word wrap and horizontal scrolling
  2011-03-13 15:53 Word wrap and horizontal scrolling Alexander Stepanov
@ 2011-03-14  4:48 ` Yuri Khan
  2011-03-14  5:58 ` Le Wang
       [not found] ` <mailman.3.1300082295.2602.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Yuri Khan @ 2011-03-14  4:48 UTC (permalink / raw)
  To: Alexander Stepanov

On Sun, Mar 13, 2011 at 21:53, Alexander Stepanov <darkdrip@gmail.com> wrote:
> I am still trying to make emacs work as usual Windows text editor such
> as Notepad++ and MS Visual Studio. I can turn off word wrap in Notepad+
> + and it will show horizontal scrollbar. To do such in emacs i must
> input M-x toggle-truncate-lines and scroll to the left and to the
> right using C-PgDn and C-PgUp. But this method scrolls code with too
> big offset.

You can press C-h k C-PgDn and learn that scroll-left accepts an
optional argument that specifies how much to scroll, and that the
default is window width minus two. Then, you have options.

Firstly, you can specify this argument each time you use scroll-left:
C-u 20 C-PgDn will scroll by 20 columns.

Alternatively, you can write your own version with a different default
and bind it to C-PgDn:

(defun my-scroll-left (&optional arg set-minimum)
    (interactive "P")
    (scroll-left (or arg 4) set-minimum))
(global-set-key (kbd "C-<next>") 'my-scroll-left)



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

* Re: Word wrap and horizontal scrolling
  2011-03-13 15:53 Word wrap and horizontal scrolling Alexander Stepanov
  2011-03-14  4:48 ` Yuri Khan
@ 2011-03-14  5:58 ` Le Wang
       [not found] ` <mailman.3.1300082295.2602.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Le Wang @ 2011-03-14  5:58 UTC (permalink / raw)
  To: Alexander Stepanov; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2350 bytes --]

On Sun, Mar 13, 2011 at 11:53 PM, Alexander Stepanov <darkdrip@gmail.com>wrote:

> I am still trying to make emacs work as usual Windows text editor such
> as Notepad++ and MS Visual Studio. I can turn off word wrap in Notepad+
> + and it will show horizontal scrollbar. To do such in emacs i must
> input M-x toggle-truncate-lines and scroll to the left and to the
> right using C-PgDn and C-PgUp. But this method scrolls code with too
> big offset. For example my current task at work is to make some
> changes in such code:
> if(...){
>        if(...){
>                if(...){
>                        ...
>                }
>                else{
>                        if(...){
>                                if(...){
>                                        if(...){
>                                                else{
>                                                        if(...){
>                                                        }
>                                                        else{
> I can edit this code in Notepad++. But Emacs wrap lines. When i turn
> of line wrapping C-PgDn moves me to the last if and C-PgUp moves me to
> the first if. If I want to edit center part of code I move using left
> and write arrows at the keyboard. This Emacs behaviour is shameful. Is
> there some way to emulate horizontal scrollbar?
>

I agree that the lack of horizontal scroll-bar is _ridiculous_, perhaps even
shameful :).  When I switched from XEmacs to GNU Emacs, this worried me.
However, having used GNU Emacs for a few years now, I just don't find myself
missing it.

I stay away from scroll-left and scroll-right as they confuse the hell out
of me -- how is the cursor being off the screen helpful to anyone?  Which is
why it's disabled by default, I presume.

Just move the point(cursor) across the long line and let
auto-horizontal-scroll take care of the scrolling.  It's not a big deal.
Maybe you're hesitant because you want to leave the point at an interesting
location?  You can save the location of the point in Emacs by pressing
C-SPC.  When want to go back just press C-u C-SPC.

If you don't want to "plan ahead" by saving interesting points to the
mark-ring, I strongly suggest you take a look at the C-xC-/ feature of
"session.el" that I discussed in the "_under publicized_ features thread.

-- 
Le

[-- Attachment #2: Type: text/html, Size: 2756 bytes --]

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

* Re: Word wrap and horizontal scrolling
       [not found] ` <mailman.3.1300082295.2602.help-gnu-emacs@gnu.org>
@ 2011-03-31  5:54   ` Alexander Stepanov
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Stepanov @ 2011-03-31  5:54 UTC (permalink / raw)
  To: help-gnu-emacs

thanks


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

end of thread, other threads:[~2011-03-31  5:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-13 15:53 Word wrap and horizontal scrolling Alexander Stepanov
2011-03-14  4:48 ` Yuri Khan
2011-03-14  5:58 ` Le Wang
     [not found] ` <mailman.3.1300082295.2602.help-gnu-emacs@gnu.org>
2011-03-31  5:54   ` Alexander Stepanov

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.