unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Shifting a column left or right using key
@ 2006-04-14 23:08 Abbott, Kevin-p98710
  2006-04-15  8:45 ` Peter Dyballa
       [not found] ` <mailman.435.1145090737.9609.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Abbott, Kevin-p98710 @ 2006-04-14 23:08 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 522 bytes --]

Years ago I used IBM PERSONAL EDITOR  (PE) to edit text files. 
 One nice option that PE had was that one could mark a rectangle in
front of a column of text or data and use the ctrl --> or ctrl <-- to
shift the column/ text left or right.  Actually, the function deleted
the whitespace or added whitespace to the left of the column.  Once the
text or column reached the marked rectangle area the text/data would be
deleted a column of characters at a time.

Does anyone have a ELISP function that does this?



[-- Attachment #1.2: Type: text/html, Size: 1039 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: Shifting a column left or right using key
       [not found] <mailman.423.1145058292.9609.help-gnu-emacs@gnu.org>
@ 2006-04-15  1:59 ` Pascal Bourguignon
  0 siblings, 0 replies; 8+ messages in thread
From: Pascal Bourguignon @ 2006-04-15  1:59 UTC (permalink / raw)


"Abbott, Kevin-p98710" <Kevin.Abbott@gdc4s.com> writes:
> Years ago I used IBM PERSONAL EDITOR  (PE) to edit text files.
>  One nice option that PE had was that one could mark a rectangle in front of a
> column of text or data and use the ctrl --> or ctrl <-- to shift the column/
> text left or right.  Actually, the function deleted the whitespace or added
> whitespace to the left of the column.  Once the text or column reached the
> marked rectangle area the text/data would be deleted a column of characters at
> a time.
>
> Does anyone have a ELISP function that does this?

Just write it!  It's funny, really!

(defun force-indent-region-left (start end)
  (interactive "r")
  (setf mark-even-if-inactive t)
  (let* ((start (progn (goto-char start)
                       (beginning-of-line)
                       (point)))
         (end   (progn (goto-char end)
                       (forward-line)
                       (beginning-of-line)
                       (point)))
         (lnum  (count-lines start end)))
    (goto-char start)
    (dotimes (i (1- lnum))
      (beginning-of-line)
      (unless (looking-at "$")
        (delete-char 1))
      (forward-line))
    (set-mark start)))

(defun indent-region-right (start end)
  (interactive "r")
  (setf mark-even-if-inactive t)
  (let* ((start (progn (goto-char start)b
                       (beginning-of-line)
                       (point)))
         (end   (progn (goto-char end)
                       (forward-line)
                       (beginning-of-line)
                       (point)))
         (lnum  (count-lines start end)))
    (indent-rigidly start end 1)
    (goto-char start)
    (forward-line (1- lnum))
    (set-mark start)))

(global-set-key (kbd "<f7>") (function force-indent-region-left))
(global-set-key (kbd "<f8>") (function indent-region-right))

Then you can use F7 and F8 to do what you want.  The region
disappears, but you can still press F7/F8 to indent.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Kitty like plastic.
Confuses for litter box.
Don't leave tarp around.

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

* Re: Shifting a column left or right using key
  2006-04-14 23:08 Abbott, Kevin-p98710
@ 2006-04-15  8:45 ` Peter Dyballa
       [not found] ` <mailman.435.1145090737.9609.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2006-04-15  8:45 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 15.04.2006 um 01:08 schrieb Abbott, Kevin-p98710:

> One nice option that PE had was that one could mark a rectangle in  
> front of a column of text or data and use the ctrl --> or ctrl <--  
> to shift the column/ text left or right

C-x r o or C-x r t shift to the right, the latter by inserting a text  
you specify.
C-x r k kills a rectangle that the remainder is left shifted.

C-h d rectangle RET mentions some more.

--
Greetings

   Pete

If you're not confused, you're not paying attention

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

* Re: Shifting a column left or right using key
       [not found] ` <mailman.435.1145090737.9609.help-gnu-emacs@gnu.org>
@ 2006-04-15 16:53   ` B. T. Raven
  2006-04-15 17:59     ` Peter Dyballa
  2006-04-15 18:05     ` Drew Adams
  0 siblings, 2 replies; 8+ messages in thread
From: B. T. Raven @ 2006-04-15 16:53 UTC (permalink / raw)



"Peter Dyballa" <Peter_Dyballa@Web.DE> wrote in message
news:mailman.435.1145090737.9609.help-gnu-emacs@gnu.org...
>
> Am 15.04.2006 um 01:08 schrieb Abbott, Kevin-p98710:
>
> > One nice option that PE had was that one could mark a rectangle in
> > front of a column of text or data and use the ctrl --> or ctrl <--
> > to shift the column/ text left or right
>
> C-x r o or C-x r t shift to the right, the latter by inserting a text
> you specify.
> C-x r k kills a rectangle that the remainder is left shifted.
>
> C-h d rectangle RET mentions some more.
>

It might be useful to the rest of us tyros to see something like this in
these cases:

>(In v22 or cvs) C-h d rectangle RET mentions some more.

In half of the things I try (after reading about them here) I find that
they are just roundabout ways of running the ding function. If I knew only
as much as I did six months ago this would have been a complete mystery to
me. Now that I have 22.0.50, I can quickly run that too and retry the the
example in that version. With the version note included, those without the
cvs loaded in their systems would not have bothered to try the exampe.
(More efficient, no?)

Ed

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

* Re: Shifting a column left or right using key
  2006-04-15 16:53   ` B. T. Raven
@ 2006-04-15 17:59     ` Peter Dyballa
  2006-04-15 18:05     ` Drew Adams
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2006-04-15 17:59 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 15.04.2006 um 16:53 schrieb B. T. Raven:

>> (In v22 or cvs) C-h d rectangle RET mentions some more.

Sorry! I seem to have forgotten that GNU Emacs 21.4 is the "official"  
version ... (since I almost never use it)

Elder Emacsen have a similiar function, that works only on function  
names: apropos (GNU Emacs 22 knows also apropos-variable, apropos- 
value). It accepts regular expressions, but it works too to just  
type: C-h a rectangle RET. Could be apropos is even the better  
function: although the explanations are very terse, the key bindings  
are mentioned!

--
Greetings

   Pete

When you meet a master swordsman,
show him your sword.
When you meet a man who is not a poet,
do not show him your poem.
                 -- Rinzai, ninth century Zen master

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

* RE: Shifting a column left or right using key
  2006-04-15 16:53   ` B. T. Raven
  2006-04-15 17:59     ` Peter Dyballa
@ 2006-04-15 18:05     ` Drew Adams
  1 sibling, 0 replies; 8+ messages in thread
From: Drew Adams @ 2006-04-15 18:05 UTC (permalink / raw)


    It might be useful to the rest of us tyros to see something like this in
    these cases:

    >(In v22 or cvs) C-h d rectangle RET mentions some more.

    In half of the things I try (after reading about them here) I find
    that they are just roundabout ways of running the ding function. If
    I knew only as much as I did six months ago this would have been a
    complete mystery to me. Now that I have 22.0.50, I can quickly run
    that too and retry the example in that version. With the version
    note included, those without the cvs loaded in their systems would
    not have bothered to try the exampe. (More efficient, no?)

Speaking of "complete mystery", I had to read your post a couple times to
figure out what you were saying (maybe I was low on coffee).  I do agree
with your point, however, which, for any others who had trouble parsing your
message, is just this: It helps to mention the version of Emacs you're
talking about.

BTW, if the OP had referenced the command name (`apropos-documentation'),
instead of only the new keybinding (`C-h d'), there would have been no need
to know the Emacs version. The command itself is not new; it is as old as
the hills.

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

* Re: Shifting a column left or right using key
       [not found] <mailman.447.1145124370.9609.help-gnu-emacs@gnu.org>
@ 2006-04-15 22:10 ` B. T. Raven
  2006-04-15 23:04   ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: B. T. Raven @ 2006-04-15 22:10 UTC (permalink / raw)



"Drew Adams" <drew.adams@oracle.com> wrote in message
news:mailman.447.1145124370.9609.help-gnu-emacs@gnu.org...
>     It might be useful to the rest of us tyros to see something like
this in
>     these cases:
>
>     >(In v22 or cvs) C-h d rectangle RET mentions some more.
>
>     In half of the things I try (after reading about them here) I find
>     that they are just roundabout ways of running the ding function. If
>     I knew only as much as I did six months ago this would have been a
>     complete mystery to me. Now that I have 22.0.50, I can quickly run
>     that too and retry the example in that version. With the version
>     note included, those without the cvs loaded in their systems would
>     not have bothered to try the exampe. (More efficient, no?)
>
> Speaking of "complete mystery", I had to read your post a couple times
to
> figure out what you were saying (maybe I was low on coffee).  I do agree
> with your point, however, which, for any others who had trouble parsing
your
> message, is just this: It helps to mention the version of Emacs you're
> talking about.
>
> BTW, if the OP had referenced the command name
(`apropos-documentation'),
> instead of only the new keybinding (`C-h d'), there would have been no
need
> to know the Emacs version. The command itself is not new; it is as old
as
> the hills.

Or "instead of only the keybinding" since there does not appear to have
been an *old* keybinding.  (At least in 21.3 where "C-h w
apropos-documentation" doesn't find one. (Here interpreting "new" as "new
and improved" (i.e. different) rather than ex nihilo exstans (i.e. now
bound to a key for the first time). But context is everything.

Slight expansion of a telegraphic style maybe too compressed for
non-native speakers/readers of English:

 [With] half of the things I try (after reading about them here) I find
that they [,the aforesaid things,] are just roundabout ways of running the
ding function. If I knew only as much as [no more than] I did six months
ago this [example] would have been a complete mystery to me. Now that I
have [version] 22.0.50 [installed], I can quickly run that [version] too
and retry [your] example in that version. With the version note included
[if you had included a note anent the version], those without the cvs
[version] loaded in their systems would not have bothered to try the
examp[l]e. (More efficient, no?)

Sorry to sound so querulous. It may be nitpicking but I was just trying to
make a suggestion that would help us newbies to learn Emacs faster. The
default interpretation of the term Emacs (except in forums dedicated to
the bleeding edge) should refer to the latest stable release, imho.

Ed.

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

* RE: Shifting a column left or right using key
  2006-04-15 22:10 ` Shifting a column left or right using key B. T. Raven
@ 2006-04-15 23:04   ` Drew Adams
  0 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2006-04-15 23:04 UTC (permalink / raw)


    > BTW, if the OP had referenced the command name
    > (`apropos-documentation'),
    > instead of only the new keybinding (`C-h d'), there
    > would have been no need to know the Emacs version.

    Or "instead of only the keybinding" since there does not
    appear to have been an *old* keybinding.

Correct. I wrote "new keybinding" because `C-h d' was previously bound to
`describe-function', not because `apropos-documentation' had a different
keybinding previously. I could have been clearer.

    Sorry to sound so querulous.

No need to apologize. I enjoyed the style, actually. I thought "they are
just roundabout ways of running the ding function" was an interesting way to
say that they were undefined in your Emacs version. There is room on the
list for both clarity and inventiveness (combined or separately). I just
wanted to make sure others didn't miss your point - especially those who
might also have been thrown off by the implicit reference to the development
Emacs version.

    The default interpretation of the term Emacs (except in forums
    dedicated to the bleeding edge) should refer to the latest stable
    release, imho.

Agreed 100%. And it's good to not rely on any default interpretation but to
be explicit about the version.

It's perhaps unfortunate that we feel the need to refer to the CVS
development version at all in a mailing list aimed at helping each other
with Emacs. That's probably a reflection of two things: 1) there is
sometimes an easier way to do something in the development version (and
people feel like advertising it), and 2) the release cycle is so long now
(and we are so late in the current cycle) that many people now treat the
development version as a released version - they use it full-time every day.

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

end of thread, other threads:[~2006-04-15 23:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.447.1145124370.9609.help-gnu-emacs@gnu.org>
2006-04-15 22:10 ` Shifting a column left or right using key B. T. Raven
2006-04-15 23:04   ` Drew Adams
     [not found] <mailman.423.1145058292.9609.help-gnu-emacs@gnu.org>
2006-04-15  1:59 ` Pascal Bourguignon
2006-04-14 23:08 Abbott, Kevin-p98710
2006-04-15  8:45 ` Peter Dyballa
     [not found] ` <mailman.435.1145090737.9609.help-gnu-emacs@gnu.org>
2006-04-15 16:53   ` B. T. Raven
2006-04-15 17:59     ` Peter Dyballa
2006-04-15 18:05     ` Drew Adams

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).