From mboxrd@z Thu Jan 1 00:00:00 1970 From: Teika Kazura Subject: Re: Yank "normal" text as item in list Date: Sat, 25 Oct 2014 10:05:34 +0900 (JST) Message-ID: <20141025.100534.1353119178504294949.teika@gmx.com> References: <87h9yv85oq.fsf@pedroche.home> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xhpoa-0007xf-IG for emacs-orgmode@gnu.org; Fri, 24 Oct 2014 21:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XhpoT-0004YF-2E for emacs-orgmode@gnu.org; Fri, 24 Oct 2014 21:06:44 -0400 Received: from mout.gmx.com ([74.208.4.201]:50287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhpoS-0004Xq-S7 for emacs-orgmode@gnu.org; Fri, 24 Oct 2014 21:06:36 -0400 In-Reply-To: <87h9yv85oq.fsf@pedroche.home> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: joseleopoldo1792@gmail.com Hi, Igor. Below is mine. It's rudimentary, but it may help you. ------------------------------------------------------------------------ (defun teika-org-yank (&optional arg) "Wrapper of `org-yank', taking care of indenting." (interactive) (let (p0 p1) (when (and kill-ring (bolp) (not (equal (substring-no-properties (car kill-ring) 0 1) "*")) (not (equal (buffer-substring-no-properties (point) (1+ (point))) "*" ))) (setq p0 (point)) (org-cycle)) (call-interactively 'org-yank) (when p0 (indent-region p0 (point)) (unless (eolp) (org-cycle))))) (define-key org-mode-map "\C-y" 'teika-org-yank) ;; Obviously `p1' inside of `let' is not used. Sorry for bad lisp. =P ;; By the way, I have this: (global-set-key [(shift ?\s )] 'just-one-space) (global-set-key [(meta ?\s )] 'delete-horizontal-space) ;; You can easily press S-space and M-space with thumbs with my hack in Linux: ;; https://forums.gentoo.org/viewtopic-t-865313.html ;; (if you have a Japanese keyboard.) ;; I also bind to a key the following, a code fragment of a bigger function. (progn (exchange-point-and-mark) (when (or (eq last-command 'yank) (eq last-command 'yank-pop)) (just-one-space) )) ;; I.e., right after yanking, it calls `just-one-space'. Adjust to your use. ------------------------------------------------------------------------ In fact, it was a surprise for me that none has answered with a nice implementation. Indent problem irritated me a lot. Cheers, Teika (Teika kazura)