|
From: | Kevin Rodgers |
Subject: | Re: remove all the whitespace characters from the cursor to the next symbol |
Date: | Thu, 06 May 2010 21:34:21 -0600 |
User-agent: | Thunderbird 2.0.0.24 (Macintosh/20100228) |
alex_sv wrote:
Hi all! Could you please clarify - is it possible to remove all the whitespace characters including newline from the current cursor position to the next meaningful symbol using one command? I mean if our buffer's content is as follows: texttexttext{cursor}___ _ ___text where '_' means space character, is it possible to press some known key sequence to transform the given above to the following form: texttexttext{cursor}text
;; This is copied from delete-horizontal-space, with ;; skip-chars-forward/backward " \t" replaced by ;; skip-syntax-forward/forward " ": (defun delete-whitespace (&optional backward-only) "Delete all characters around point with whitespace syntax. If BACKWARD-ONLY is non-nil, only delete them before point." (interactive "*P") (let ((orig-pos (point))) (delete-region (if backward-only orig-pos (progn (skip-syntax-forward " ") (constrain-to-field nil orig-pos t))) (progn (skip-syntax-backward " ") (constrain-to-field nil orig-pos))))) ;; Now bind it to a convenient key: (global-set-key "\C-cw" 'delete-whitespace) -- Kevin Rodgers Denver, Colorado, USA
[Prev in Thread] | Current Thread | [Next in Thread] |