emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-fill-paragraph invoked on column 0


From: Michael Brand
Subject: Re: [O] org-fill-paragraph invoked on column 0
Date: Tue, 31 Jul 2012 17:35:31 +0200

Hi Nicolas

On Mon, Jul 30, 2012 at 11:49 PM, Nicolas Goaziou <address@hidden> wrote:
> Yes. It's all about document's structure. First paragraph starts after
> bullet. Before, it's the item. Since you want to fill the first
> paragraph, you have to move into it.

Thank you for the explanations. I appreciate your improvements in
correctness of parsing and interpreting the Org structure.

Oh, and only now I see that, as your improvements exclude the item
bullet from filling, C-c and M-q (org-fill-paragraph) now leave the
manual alignment of the description in description lists untouched.
This is nice, it helps me as shown in my new post here:

"alignment of description list in Org and export old and new"
http://thread.gmane.org/gmane.emacs.orgmode/56631/focus=58222

> You can use navigation functions, move to the end of line, which is
> quicker, or to the beginning of the next line, even at column 0.

Because I need to fill list items so often and when I am on column 0
of the bullet line, I start to override M-q at least until maybe the
community decides that this old behaviour of M-q should be restored:

#+BEGIN_SRC emacs-lisp
  (add-hook 'org-mode-hook 'my-org-bind-M-q)
  (defun my-org-bind-M-q ()
    (define-key org-mode-map "\M-q" 'my-org-fill-paragraph))
  (defun my-org-fill-paragraph ()
    (interactive)
    (if (and (org-in-item-p) (not mark-active))
        (save-excursion
          ;; must deal also with:
          ;;   - cmd --log-level=wrn -o DST SRC ::
          ;;                               description
          ;;        for long term
          ;; or:
          ;;   - cmd --log-level=wrn -o DST SRC
          ;;                            :: description
          ;;        for long term
          (org-end-of-item)
          (backward-char)
          (org-fill-paragraph))
      (org-fill-paragraph)))
#+END_SRC

Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]