emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-element-drag-* broken
@ 2012-07-04 10:36 suvayu ali
  2012-07-04 15:56 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: suvayu ali @ 2012-07-04 10:36 UTC (permalink / raw)
  To: org-mode mailing list; +Cc: Nicolas Goaziou

Hi Nicolas,

I have been trying out the `org-element-drag-backward' and
`org-element-drag-forward' navigation commands. I believe they stopped
working yesterday when I updated my org-mode (Git: dab2505 -> a69f4b8).

When I try to move list items, I get the backtrace shown below. FWIW,
promotion and demotion works.

I hope this helps.


Debugger entered--Lisp error: (error "Cannot swap elements")
  signal(error ("Cannot swap elements"))
  error("Cannot swap elements")
  (if (and specialp (or (not (eq (org-element-type elem-B) (quote
paragraph))) (/= (org-element-property :begin elem-B)
(org-element-property :contents-begin elem-B)))) (error "Cannot swap
elements"))
  (let ((specialp (not (bolp)))) (if (and specialp (or (not (eq
(org-element-type elem-B) (quote paragraph))) (/=
(org-element-property :begin elem-B) (org-element-property
:contents-begin elem-B)))) (error "Cannot swap elements")) (let*
((ind-B (when specialp (goto-char (org-element-property :begin
elem-B)) (org-get-indentation))) (beg-A (org-element-property :begin
elem-A)) (end-A (save-excursion (goto-char (org-element-property :end
elem-A)) (skip-chars-backward "
	\n") (point-at-eol))) (beg-B (org-element-property :begin elem-B))
(end-B (save-excursion (goto-char (org-element-property :end elem-B))
(skip-chars-backward "
	\n") (point-at-eol))) (overlays (cons (mapcar (lambda (ov) (list ov
... ...)) (overlays-in beg-A end-A)) (mapcar (lambda (ov) (list ov ...
...)) (overlays-in beg-B end-B)))) (body-A (buffer-substring beg-A
end-A)) (body-B (delete-and-extract-region beg-B end-B))) (goto-char
beg-B) (when specialp (setq body-B (replace-regexp-in-string "\\`[
	]*" "" body-B)) (org-indent-to-column ind-B)) (insert body-A) (mapc
(lambda (ov) (move-overlay (car ov) (+ (nth 1 ov) (- beg-B beg-A)) (+
(nth 2 ov) (- beg-B beg-A)))) (car overlays)) (goto-char beg-A)
(delete-region beg-A end-A) (insert body-B) (mapc (lambda (ov)
(move-overlay (car ov) (+ (nth 1 ov) (- beg-A beg-B)) (+ (nth 2 ov) (-
beg-A beg-B)))) (cdr overlays)) (goto-char (org-element-property :end
elem-B))))
  org-element-swap-A-B((paragraph (:begin 1258 :end 1268
:contents-begin 1258 :contents-end 1267 :post-blank 0)) (item (:bullet
"- " :begin 1268 :end 1298 :contents-begin 1270 :contents-end 1298
:checkbox nil :counter nil :tag nil :hiddenp nil :structure ((1256 0
"- " nil nil nil 1268) (1268 0 "- " nil nil nil 1298) (1298 0 "- " nil
nil nil 1307) (1307 0 "- " nil nil nil 1335) (1335 0 "- " nil nil nil
1344)) :post-blank 0)))
  (let ((size-next (- (save-excursion (goto-char (org-element-property
:end next-elem)) (skip-chars-backward "
	\n") (forward-line) (if (and (eolp) (not ...)) (1+ (point)) (point)))
(org-element-property :begin next-elem))) (size-blank (-
(org-element-property :end elem) (save-excursion (goto-char
(org-element-property :end elem)) (skip-chars-backward "
	\n") (forward-line) (point))))) (org-element-swap-A-B elem next-elem)
(goto-char (+ pos size-next size-blank)))
  (let ((next-elem (org-element-at-point))) (when (or
(org-element-nested-p elem next-elem) (and (eq (org-element-type
next-elem) (quote headline)) (not (eq (org-element-type elem) (quote
headline))))) (goto-char pos) (error "Cannot drag element forward"))
(let ((size-next (- (save-excursion (goto-char (org-element-property
:end next-elem)) (skip-chars-backward "
	\n") (forward-line) (if (and ... ...) (1+ ...) (point)))
(org-element-property :begin next-elem))) (size-blank (-
(org-element-property :end elem) (save-excursion (goto-char
(org-element-property :end elem)) (skip-chars-backward "
	\n") (forward-line) (point))))) (org-element-swap-A-B elem next-elem)
(goto-char (+ pos size-next size-blank))))
  (let* ((pos (point)) (elem (org-element-at-point))) (when (=
(point-max) (org-element-property :end elem)) (error "Cannot drag
element forward")) (goto-char (org-element-property :end elem)) (let
((next-elem (org-element-at-point))) (when (or (org-element-nested-p
elem next-elem) (and (eq (org-element-type next-elem) (quote
headline)) (not (eq (org-element-type elem) (quote headline)))))
(goto-char pos) (error "Cannot drag element forward")) (let
((size-next (- (save-excursion (goto-char ...) (skip-chars-backward "
	\n") (forward-line) (if ... ... ...)) (org-element-property :begin
next-elem))) (size-blank (- (org-element-property :end elem)
(save-excursion (goto-char ...) (skip-chars-backward "
	\n") (forward-line) (point))))) (org-element-swap-A-B elem next-elem)
(goto-char (+ pos size-next size-blank)))))
  org-metadown()
  call-interactively(org-metadown nil nil)


-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-04 16:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-04 10:36 org-element-drag-* broken suvayu ali
2012-07-04 15:56 ` Nicolas Goaziou
2012-07-04 16:13   ` suvayu ali
2012-07-04 16:22     ` Nicolas Goaziou
2012-07-04 16:28       ` suvayu ali

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).