From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Lander Subject: Re: org-metaup / org-metadown nerfed in 7.9.1 Date: Wed, 19 Sep 2012 10:50:33 -0400 Message-ID: <1B3F071B-9000-46B1-9896-3BA11A885100@landerfamily.ca> References: <5059DA33.3030109@codepuzzles.org> Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TELc1-00052E-FH for emacs-orgmode@gnu.org; Wed, 19 Sep 2012 10:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TELbt-0007yJ-Dr for emacs-orgmode@gnu.org; Wed, 19 Sep 2012 10:50:49 -0400 Received: from mail-gh0-f169.google.com ([209.85.160.169]:54395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TELbt-0007xi-6x for emacs-orgmode@gnu.org; Wed, 19 Sep 2012 10:50:41 -0400 Received: by ghrr1 with SMTP id r1so299178ghr.0 for ; Wed, 19 Sep 2012 07:50:40 -0700 (PDT) In-Reply-To: <5059DA33.3030109@codepuzzles.org> 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: Trevor Vartanoff Cc: emacs-orgmode Mode Hi Trevor, On 12-Sep-19, at 10:44 AM, Trevor Vartanoff wrote: > And so, example 2, I was receiving "cannot drag element = forward/backward" when I was in a heading with no line breaks. That is, = a heading where paragraphs are separated with return + indent rather = than a full line break of return + return. I use the M-up/dn behaviour a lot to move property lines up and down. I = added some hooks to restore that functionality since property lines = aren't recognized as elements. Here's the code. You might be able to = adapt it to do what you want. Hope it helps, -Anthony ; Fix M- and M- to move individual lines inside a property = drawer (add-hook 'org-metaup-hook 'my-org-metaup-hook) (defun my-org-metaup-hook () "When on a property line, use M- to move the line up" (when (org-region-active-p) (return nil)) (let ((element (car (org-element-at-point)))) (if (eq element 'property-drawer) (let* ((position (- (point) (line-beginning-position))) (a (save-excursion (move-beginning-of-line 1) (point))) (b (save-excursion (move-end-of-line 1) (point))) (c (save-excursion (goto-char a) (move-beginning-of-line 0))) (d (save-excursion (goto-char a) (move-end-of-line 0) (point)))) (transpose-regions a b c d) (goto-char c) (forward-char position) t) nil))) (add-hook 'org-metadown-hook 'my-org-metadown-hook) (defun my-org-metadown-hook () "When on a property line, use M- to move the line down" (when (org-region-active-p) (return nil)) (let ((element (car (org-element-at-point)))) (if (eq element 'property-drawer) (let* ((position (- (point) (line-beginning-position))) (at-end-of-line (eq (point) (line-end-position))) (a (save-excursion (move-beginning-of-line 1))) (b (save-excursion (move-end-of-line 1) (point))) (c (save-excursion (next-line) (move-beginning-of-line 1))) (d (save-excursion (next-line) (move-end-of-line 1) (point)))) (transpose-regions a b c d) (move-beginning-of-line 1) (if at-end-of-line ; Strange boundary condition at = end of line (progn=20 (next-line) ; Goes to wrong place. So = instead just (move-end-of-line 1)) ; go to end of line. (forward-char position)) t) nil)))