From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Julien Danjou Newsgroups: gmane.emacs.orgmode,gmane.emacs.devel Subject: Re: Weird behaviour with org-yank and org-startup-indented Date: Mon, 18 Oct 2010 16:37:12 +0200 Message-ID: References: <87bp6vpks7.fsf@keller.adm.naquadah.org> <3B1391C6-72E9-4BAA-9197-7B27B26249BC@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1287413777 5481 80.91.229.12 (18 Oct 2010 14:56:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Oct 2010 14:56:17 +0000 (UTC) Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org To: Carsten Dominik Original-X-From: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Mon Oct 18 16:56:10 2010 Return-path: Envelope-to: geo-emacs-orgmode@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P7r8B-0000tH-5m for geo-emacs-orgmode@m.gmane.org; Mon, 18 Oct 2010 16:56:07 +0200 Original-Received: from localhost ([127.0.0.1]:56089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7qwi-00085M-Mq for geo-emacs-orgmode@m.gmane.org; Mon, 18 Oct 2010 10:44:16 -0400 Original-Received: from [140.186.70.92] (port=58746 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7qvY-0007hD-Im for emacs-orgmode@gnu.org; Mon, 18 Oct 2010 10:43:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7qq0-0000sN-Cg for emacs-orgmode@gnu.org; Mon, 18 Oct 2010 10:37:21 -0400 Original-Received: from coquelicot-s.easter-eggs.com ([213.215.37.94]:47076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7qpw-0000rM-4G; Mon, 18 Oct 2010 10:37:17 -0400 Original-Received: from cigue.easter-eggs.fr (cigue.easter-eggs.fr [10.0.0.33]) by rose.easter-eggs.fr (Postfix) with ESMTPS id 8B8C61429A; Mon, 18 Oct 2010 16:37:09 +0200 (CEST) Original-Received: from jdanjou by cigue.easter-eggs.fr with local (Exim 4.72) (envelope-from ) id 1P7qps-0006Q9-Sz; Mon, 18 Oct 2010 16:37:12 +0200 Mail-Followup-To: Carsten Dominik , emacs-orgmode@gnu.org, emacs-devel@gnu.org In-Reply-To: <3B1391C6-72E9-4BAA-9197-7B27B26249BC@gmail.com> (Carsten Dominik's message of "Sun, 17 Oct 2010 08:08:38 +0200") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.orgmode:32060 gmane.emacs.devel:131812 Archived-At: On Sun, Oct 17 2010, Carsten Dominik wrote: > This is bad. As this problem does not exist in Emacs 23 and I have not > changed anything in this part of the code, maybe a bug report to EMacs is > in order. Will you file one, with the remark that this works fine in Em= acs > 23? I'm not sure that will work fine. Well, I've started to debug this, any help appreciated. I'm adding emacs-devel in Cc since this is clearly a bug in Emacs 24. For people not reading orgmode list, the problem is that when org-startup-indented is set to t, the yanking does not yank the correct text. To test, this is what I've got: * TODO Blalaundo I copy "undo" with C-space on `u', C-e, M-w. Then I press C-y (org-yank). Everything is fine, except that as that moment: Debugger entered--returning value: "* TODO Blala" x-get-selection(PRIMARY UTF8_STRING) * byte-code("\303 @\"=12\303\207" [type request-type text x-get-selection]= 3) * x-selection-value-internal(PRIMARY) * x-selection-value() * current-kill(0) * (and kill-ring (current-kill 0)) * (or txt (and kill-ring (current-kill 0)) "") * (let* ((kill (or txt (and kill-ring (current-kill 0)) "")) (start-level (= and kill (string-match (concat "\\`\\([ \n=0D]*?\n\\)?\\(" org-outline-reg= exp "\\)") kill) (- (match-end 2) (match-beginning 2) 1))) (re (concat "^" = org-outline-regexp)) (start (1+ (or (match-beginning 2) -1)))) (if (not sta= rt-level) (progn nil) (catch (quote exit) (while (setq start (string-match = re kill (1+ start))) (when (< (- (match-end 0) (match-beginning 0) 1) start= -level) (throw (quote exit) nil))) t))) * org-kill-is-subtree-p() * (and (org-kill-is-subtree-p) (or (bolp) (and (looking-at "[ ]*$") (strin= g-match "\\`\\*+\\'" (buffer-substring (point-at-bol) (point)))))) * (let ((subtreep (and (org-kill-is-subtree-p) (or (bolp) (and (looking-at = "[ ]*$") (string-match "\\`\\*+\\'" (buffer-substring ... ...)))))) swallo= wp) (cond ((and subtreep org-yank-folded-subtrees) (let ((beg (point)) end)= (if (and subtreep org-yank-adjusted-subtrees) (org-paste-subtree nil nil (= quote for-yank)) (call-interactively command)) (setq end (point)) (goto-cha= r beg) (when (and (bolp) subtreep (not (setq swallowp ...))) (or (looking-a= t outline-regexp) (re-search-forward (concat "^" outline-regexp) end t)) (w= hile (and (< ... end) (looking-at outline-regexp)) (hide-subtree) (org-cycl= e-show-empty-lines (quote folded)) (condition-case nil (outline-forward-sam= e-level 1) (error ...)))) (when swallowp (message "Inserted text not folded= because that would swallow text")) (goto-char end) (skip-chars-forward " = \n=0D") (beginning-of-line 1) (push-mark beg (quote nomsg)))) ((and subtree= p org-yank-adjusted-subtrees) (let ((beg (point-at-bol))) (org-paste-subtre= e nil nil (quote for-yank)) (push-mark beg (quote nomsg)))) (t (call-intera= ctively command)))) * (if arg (call-interactively command) (let ((subtreep (and (org-kill-is-su= btree-p) (or (bolp) (and (looking-at "[ ]*$") (string-match "\\`\\*+\\'" .= ..))))) swallowp) (cond ((and subtreep org-yank-folded-subtrees) (let ((beg= (point)) end) (if (and subtreep org-yank-adjusted-subtrees) (org-paste-sub= tree nil nil (quote for-yank)) (call-interactively command)) (setq end (poi= nt)) (goto-char beg) (when (and (bolp) subtreep (not ...)) (or (looking-at = outline-regexp) (re-search-forward ... end t)) (while (and ... ...) (hide-s= ubtree) (org-cycle-show-empty-lines ...) (condition-case nil ... ...))) (wh= en swallowp (message "Inserted text not folded because that would swallow t= ext")) (goto-char end) (skip-chars-forward " \n=0D") (beginning-of-line 1)= (push-mark beg (quote nomsg)))) ((and subtreep org-yank-adjusted-subtrees)= (let ((beg (point-at-bol))) (org-paste-subtree nil nil (quote for-yank)) (= push-mark beg (quote nomsg)))) (t (call-interactively command))))) * org-yank-generic(yank nil) * org-yank(nil) call-interactively(org-yank nil nil) No clue why, but the PRIMARY selection seems to return the start of the line. I've done this then: * TODO Blalaundo I go on `u', press C-space, then C-e. The M-; and execute (x-selection-value), which returns: "undo". So far so good. But if I go on `u', press C-space, then C-e, then M-w, then M-; to execute (x-selection-value), it returns "* TODO Blala". So it seems that when the org-startup-indented is set to t, M-w goes crazy and set the primary selection wrongly. Hint? --=20 Julien Danjou // =E1=90=B0 http://julien.danjou.info _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Danjou Subject: Re: Weird behaviour with org-yank and org-startup-indented Date: Mon, 18 Oct 2010 16:37:12 +0200 Message-ID: References: <87bp6vpks7.fsf@keller.adm.naquadah.org> <3B1391C6-72E9-4BAA-9197-7B27B26249BC@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=58746 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7qvY-0007hD-Im for emacs-orgmode@gnu.org; Mon, 18 Oct 2010 10:43:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7qq0-0000sN-Cg for emacs-orgmode@gnu.org; Mon, 18 Oct 2010 10:37:21 -0400 In-Reply-To: <3B1391C6-72E9-4BAA-9197-7B27B26249BC@gmail.com> (Carsten Dominik's message of "Sun, 17 Oct 2010 08:08:38 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org On Sun, Oct 17 2010, Carsten Dominik wrote: > This is bad. As this problem does not exist in Emacs 23 and I have not > changed anything in this part of the code, maybe a bug report to EMacs is > in order. Will you file one, with the remark that this works fine in Em= acs > 23? I'm not sure that will work fine. Well, I've started to debug this, any help appreciated. I'm adding emacs-devel in Cc since this is clearly a bug in Emacs 24. For people not reading orgmode list, the problem is that when org-startup-indented is set to t, the yanking does not yank the correct text. To test, this is what I've got: * TODO Blalaundo I copy "undo" with C-space on `u', C-e, M-w. Then I press C-y (org-yank). Everything is fine, except that as that moment: Debugger entered--returning value: "* TODO Blala" x-get-selection(PRIMARY UTF8_STRING) * byte-code("\303 @\"=12\303\207" [type request-type text x-get-selection]= 3) * x-selection-value-internal(PRIMARY) * x-selection-value() * current-kill(0) * (and kill-ring (current-kill 0)) * (or txt (and kill-ring (current-kill 0)) "") * (let* ((kill (or txt (and kill-ring (current-kill 0)) "")) (start-level (= and kill (string-match (concat "\\`\\([ \n=0D]*?\n\\)?\\(" org-outline-reg= exp "\\)") kill) (- (match-end 2) (match-beginning 2) 1))) (re (concat "^" = org-outline-regexp)) (start (1+ (or (match-beginning 2) -1)))) (if (not sta= rt-level) (progn nil) (catch (quote exit) (while (setq start (string-match = re kill (1+ start))) (when (< (- (match-end 0) (match-beginning 0) 1) start= -level) (throw (quote exit) nil))) t))) * org-kill-is-subtree-p() * (and (org-kill-is-subtree-p) (or (bolp) (and (looking-at "[ ]*$") (strin= g-match "\\`\\*+\\'" (buffer-substring (point-at-bol) (point)))))) * (let ((subtreep (and (org-kill-is-subtree-p) (or (bolp) (and (looking-at = "[ ]*$") (string-match "\\`\\*+\\'" (buffer-substring ... ...)))))) swallo= wp) (cond ((and subtreep org-yank-folded-subtrees) (let ((beg (point)) end)= (if (and subtreep org-yank-adjusted-subtrees) (org-paste-subtree nil nil (= quote for-yank)) (call-interactively command)) (setq end (point)) (goto-cha= r beg) (when (and (bolp) subtreep (not (setq swallowp ...))) (or (looking-a= t outline-regexp) (re-search-forward (concat "^" outline-regexp) end t)) (w= hile (and (< ... end) (looking-at outline-regexp)) (hide-subtree) (org-cycl= e-show-empty-lines (quote folded)) (condition-case nil (outline-forward-sam= e-level 1) (error ...)))) (when swallowp (message "Inserted text not folded= because that would swallow text")) (goto-char end) (skip-chars-forward " = \n=0D") (beginning-of-line 1) (push-mark beg (quote nomsg)))) ((and subtree= p org-yank-adjusted-subtrees) (let ((beg (point-at-bol))) (org-paste-subtre= e nil nil (quote for-yank)) (push-mark beg (quote nomsg)))) (t (call-intera= ctively command)))) * (if arg (call-interactively command) (let ((subtreep (and (org-kill-is-su= btree-p) (or (bolp) (and (looking-at "[ ]*$") (string-match "\\`\\*+\\'" .= ..))))) swallowp) (cond ((and subtreep org-yank-folded-subtrees) (let ((beg= (point)) end) (if (and subtreep org-yank-adjusted-subtrees) (org-paste-sub= tree nil nil (quote for-yank)) (call-interactively command)) (setq end (poi= nt)) (goto-char beg) (when (and (bolp) subtreep (not ...)) (or (looking-at = outline-regexp) (re-search-forward ... end t)) (while (and ... ...) (hide-s= ubtree) (org-cycle-show-empty-lines ...) (condition-case nil ... ...))) (wh= en swallowp (message "Inserted text not folded because that would swallow t= ext")) (goto-char end) (skip-chars-forward " \n=0D") (beginning-of-line 1)= (push-mark beg (quote nomsg)))) ((and subtreep org-yank-adjusted-subtrees)= (let ((beg (point-at-bol))) (org-paste-subtree nil nil (quote for-yank)) (= push-mark beg (quote nomsg)))) (t (call-interactively command))))) * org-yank-generic(yank nil) * org-yank(nil) call-interactively(org-yank nil nil) No clue why, but the PRIMARY selection seems to return the start of the line. I've done this then: * TODO Blalaundo I go on `u', press C-space, then C-e. The M-; and execute (x-selection-value), which returns: "undo". So far so good. But if I go on `u', press C-space, then C-e, then M-w, then M-; to execute (x-selection-value), it returns "* TODO Blala". So it seems that when the org-startup-indented is set to t, M-w goes crazy and set the primary selection wrongly. Hint? --=20 Julien Danjou // =E1=90=B0 http://julien.danjou.info