Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • by spur (4197) on 2004.08.03 10:29 (#33042) Homepage
    ain't nothing as good as some elisp hacking :-)

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;
    ; Selecting text with Shift+arrows, like in Windoze
    ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    (defun previous-line-and-select (&optional arg)
      (interactive "_p")
      (if (null (region-active-p))
          (set-mark-command nil))
      (previous-line arg))

    (defun next-line-and-select (&optional arg)
      (interactive "_p")
      (if (null (region-active-p))
          (set-mark-command nil))
      (next-line arg))

    (defun forward-char-and-select (&optional arg)
      (interactive "_p")
      (if (null (region-active-p))
          (set-mark-command nil))
      (forward-char arg))

    (defun backward-char-and-select (&optional arg)
      (interactive "_p")
      (if (null (region-active-p))
          (set-mark-command nil))
      (backward-char arg))

    (global-set-key '(shift up) 'previous-line-and-select)
    (global-set-key '(shift down) 'next-line-and-select)
    (global-set-key '(shift right) 'forward-char-and-select)
    (global-set-key '(shift left) 'backward-char-and-select)