I am looking for a solution that is already possible in Org mode with headers, for example:
* HL1
* HL2 {press: Meta+arrowup}
=>
* HL2
* HL1
(1) I want to change the paragraphs. The idea basically is that I move the point somewhere {example: here []} in the middle of the paragraph, press {key + arrowdown}, and the paragraph will switch from the next one below.
(2) This will simplify the restructuring of the text when editing documents.
=> Paragraph (2) must be presented before paragraph (1). I am not sure if this is a trivial issue. This would be more appropriate if it were nβt just for a function like:
- Mark item P1
- Copy
- P2 move point
- insert P1
Actual switching between P1 and P2 would not hinder the spacing around paragraphs.
Thank,
Edit: solution found:
1.easy:
(global-set-key (kbd "M-ΓΌ") 'transpose-paragraphs) ;; forward
(global-set-key (kbd "C-M-ΓΌ")
(lambda () (interactive) (transpose-paragraphs -1)
(backward-paragraph)
)) ;; backwards
2.laborated( ergoemacs-functions.el - org-mode):
(defmacro ergoemacs-define-org-meta (direction &optional disable)
"Defines org-mode meta-direction keys.
DIRECTION defines the `org-mode' and `ergoemacs-mode' direction.
DISABLE defines if the option should be disabled by default."
`(progn
(defcustom ,(intern (format "ergoemacs-use-ergoemacs-meta%s" direction)) ,(not disable)
,(format "Use ergoemacs-mode defined <M-%s>." direction)
:type 'boolean
:group 'ergoemacs-mode)
(defun ,(intern (format "ergoemacs-org-meta%s" direction)) ()
,(format "Run `org-meta%s' in the proper context.
When `ergoemacs-use-ergoemacs-meta%s' is non-nil use what ergoemacs-mode defines for <M-%s>.
ARG is the prefix argument for either command." direction direction direction)
(interactive)
(cond
((or
(not ,(intern (format "ergoemacs-use-ergoemacs-meta%s" direction)))
(org-at-heading-p)
(org-at-item-p)
(org-at-table-p)
(and (org-region-active-p)
(save-excursion
(goto-char (region-beginning))
(org-at-item-p)))
(org-with-limited-levels
(or (org-at-heading-p)
(and (org-region-active-p)
(save-excursion
(goto-char (region-beginning))
(org-at-heading-p))))))
;; (setq prefix-arg current-prefix-arg)
;; Send prefix to next function
(call-interactively ',(intern (format "org-meta%s" direction))))
(t
;; (setq prefix-arg current-prefix-arg)
;; Send prefix to next function
(ergoemacs-lookup-key-and-run ,(format "<M-%s>" direction)))))))
(ergoemacs-define-org-meta "left")
(ergoemacs-define-org-meta "right")
(ergoemacs-define-org-meta "up" t)
(ergoemacs-define-org-meta "down" t)
, !