unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Le" <l26wang@gmail.com>
Subject: Re: Emacs keyboard command
Date: 27 Jul 2006 22:29:17 -0700	[thread overview]
Message-ID: <1154064557.461481.69360@75g2000cwc.googlegroups.com> (raw)
In-Reply-To: <c08ed$44c6bf2e$49ede5e$623@DIALUPUSA.NET>

B. T. Raven wrote:
> C-<backspace> if Backspace is Del. Also hold Ctl down while typing a-k
> will delete everything back to the read-only prompt.

I'm late to the discussion, but this seems to be what the OP wanted?
Insert into your init file or autoload as you see fit.


(eval-when-compile (require 'cl))

(defvar le::directory-sep-chars "/\\\\")

(defmacro Init-emacs-load (emacs-form &rest xemacs-forms)
  "Expand to EMACS-FORM on Emacs, XEMACS-FORM on XEmacs."
  (if (featurep 'xemacs)
      (cons 'progn xemacs-forms)
    emacs-form))

(defmacro Init-cond (&rest args)
  "just like cond, except result of expansion is compiled."
  (dolist (arg args)
    (when (eval (car arg))
      (return (cons 'progn (cdr arg))))))

(defun _le::kill-path-element (arg)
  "kils arg number or path elements negative is backwards"
  (let ((old-point (point))
        skip-func
        limit)
    (if (< arg 0)
        (setq skip-func 'skip-chars-backward
              limit (Init-cond
                     ((fboundp 'minibuffer-prompt-end)
                      (minibuffer-prompt-end))
                     (t
                      (point-min))))
      (setq skip-func 'skip-chars-forward
            limit (point-max)))
    (setq arg (abs arg))
    (dotimes (i arg)
      (let ((old-point (point)))
        (eval (list skip-func le::directory-sep-chars limit))
        (eval (list skip-func (concat "^" le::directory-sep-chars)
limit))
        (when (eq (point) old-point)
          (return))))
    (unless (eq (point) old-point)
      (kill-region (point) old-point))))

;;;###autoload
(defun le::kill-path-element (arg)
  (interactive "*p")
  (_le::kill-path-element arg))

;;;###autoload
(defun le::backward-kill-path-element (arg)
  (interactive "*p")
  (_le::kill-path-element (- arg)))

(mapc
 #'(lambda (map)
;;      (define-key map [remap backward-kill-word]
'le::backward-kill-path-element)
;;      (define-key map [remap kill-word] 'le::kill-path-element)
     (substitute-key-definition 'backward-kill-word
'le::backward-kill-path-element map global-map)
     (substitute-key-definition 'kill-word 'le::kill-path-element map
global-map))
 (Init-xemacs-load
     (list read-file-name-map
           read-file-name-must-match-map)
   (list minibuffer-local-filename-completion-map
         minibuffer-local-must-match-filename-map
         )))

  parent reply	other threads:[~2006-07-28  5:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-25 22:57 Emacs keyboard command mailpitches
2006-07-25 23:42 ` Steve Allan
2006-07-26  0:58   ` B. T. Raven
2006-07-26  6:00     ` Dieter Wilhelm
2006-07-28  5:29     ` Le [this message]
2006-07-26 11:26 ` Tao Chen
2006-08-13  1:04   ` David Combs
2006-08-14 13:33 ` HASM
2006-08-15 15:10   ` B. T. Raven
2006-08-15 19:39     ` Eli Zaretskii
2006-08-15 20:39     ` HASM
     [not found]     ` <mailman.5195.1155670786.9609.help-gnu-emacs@gnu.org>
2006-08-17 23:42       ` B. T. Raven
2006-08-18 10:44         ` Eli Zaretskii
     [not found]         ` <mailman.5313.1155897936.9609.help-gnu-emacs@gnu.org>
2006-08-18 15:05           ` B. T. Raven
2006-08-18 15:49             ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1154064557.461481.69360@75g2000cwc.googlegroups.com \
    --to=l26wang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).