From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Le" Newsgroups: gmane.emacs.help Subject: Re: Emacs keyboard command Date: 27 Jul 2006 22:29:17 -0700 Organization: http://groups.google.com Message-ID: <1154064557.461481.69360@75g2000cwc.googlegroups.com> References: <1153868272.150837.298300@b28g2000cwb.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1154065232 21634 80.91.229.2 (28 Jul 2006 05:40:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 28 Jul 2006 05:40:32 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 28 07:40:31 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G6L5J-00077g-88 for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Jul 2006 07:40:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G6L5I-0006sm-RA for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Jul 2006 01:40:28 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!75g2000cwc.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs,comp.emacs.xemacs Original-Lines: 75 Original-NNTP-Posting-Host: 131.107.0.102 Original-X-Trace: posting.google.com 1154064561 26408 127.0.0.1 (28 Jul 2006 05:29:21 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 28 Jul 2006 05:29:21 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; WOW64; SV1; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 RED-PRXY-26 Complaints-To: groups-abuse@google.com Injection-Info: 75g2000cwc.googlegroups.com; posting-host=131.107.0.102; posting-account=j4OimgwAAAALo-2szSZvOyX5OE1uyIeS Original-Xref: shelby.stanford.edu gnu.emacs.help:140696 comp.emacs:92674 comp.emacs.xemacs:80467 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:36321 Archived-At: B. T. Raven wrote: > C- 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 )))