組織モードで見出し付きで既に可能な解決策を探しています。例:
* HL1
* HL2 {press: Meta+arrowup}
=>
* HL2
* HL1
(1)そんな段落を切り替えたい。アイデアは基本的に、段落の途中でポイントを {example: here []} のどこかに移動し、{key+arrowdown} を押すと、段落が次の段落に切り替わります。
(2) これにより、論文の編集中にテキストを再構成することが容易になります。
=> 段落 (2) は段落 (1) の前にあるはずです。これが些細な問題かどうかはわかりません。次のような単なる関数ではない場合、より適しています。
- 段落 P1 をマーク
- コピー
- ポイントを P2 の下に移動
- P1を貼り付けます
P1 と P2 を実際に切り替えても、段落の周りのスペースが台無しになることはありません。
ありがとう、
編集:解決策が見つかりました:
1.簡単:
(global-set-key (kbd "M-ü") 'transpose-paragraphs) ;; forward
(global-set-key (kbd "C-M-ü")
(lambda () (interactive) (transpose-paragraphs -1)
(backward-paragraph)
)) ;; backwards
2.精緻化 (にある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)
動作を確認してください!