[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Harking back to some old 8-bits
From: |
Phil Carmody |
Subject: |
Harking back to some old 8-bits |
Date: |
Thu, 04 Dec 2008 12:50:26 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
I remember the wonderful feature of being able to move a read-cursor
somewhere on the screen, press the 'copy' key, and whatever character
was at the read-cursor would be duplicated under the write-cursor,
and both cursors would move forward. I'd really like that feature
again (presumably 'mark' would be the read-cursor).
e.g. http://en.wikipedia.org/wiki/Image:BBC_Micro.jpeg
However, with what I'm hacking at currently (lots of closely-related
lines of code), just the very simple function of being able to
grab whatever character is on the line above and duplicate it on
the current line would be great.
I'm more than a little rusty at elisp, but here's what I threw
together in a few minutes this morning in order to achieve the
latter:
---- 8< ----
(defun pc-dupchar-above ()
"Duplicate character on line above cursor"
(interactive)
(insert (save-excursion
(next-line -1)
(buffer-substring-no-properties
(point)
(1+ (point))))))
(local-set-key (kbd "C-^") 'pc-dupchar-above)
---- 8< ----
It has at least one problem, namely it doesn't properly
extend short lines if you've just come from a longer line.
(E.g. cursor down from right -->here<-- , and try to copy
the 'r' of 'from'.)
If anyone could turn the above into something more robust,
I'd be grateful, maybe things like having a prefix count
would be good too?
And if someone could give some advice on how to have the
ability to treat the mark as a read cursor, and copy forwards
from there (preferably without moving the mark, which requires
maintaining some state about how many characters have been
copied), that would be fantastic. Maybe there's already an
emulation mode that has this functionality, I don't know.
Cheers,
Phil
--
I tried the Vista speech recognition by running the tutorial. I was
amazed, it was awesome, recognised every word I said. Then I said the
wrong word ... and it typed the right one. It was actually just
detecting a sound and printing the expected word! -- pbhj on /.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Harking back to some old 8-bits,
Phil Carmody <=