3 Turn on syntax highlighting.
source | link
(defun org-back-to-item ()
  (re-search-backward "^ *[-+*]\\|^ *[1-9]+[)\.] " nil nil 1))

(defun org-fill-paragraph-handle-lists (&optional num-paragraphs)
  (interactive "p")
  (save-excursion
    (let ((bound (if mark-active
                     (- (region-end) 2)
                   (progn
                     (org-back-to-item)
                     (while (>= num-paragraphs 0)
                       (call-interactively 'org-mark-element)
                       (setq num-paragraphs (1- num-paragraphs)))
                     (- (region-end) 2)))))
      (while (search-forward "\n" bound t)
        (replace-match " ")))
    (org-fill-paragraph)))

(define-key org-mode-map (kbd "C-M-q") 'org-fill-paragraph-handle-lists)
(defun org-back-to-item ()
  (re-search-backward "^ *[-+*]\\|^ *[1-9]+[)\.] " nil nil 1))

(defun org-fill-paragraph-handle-lists (&optional num-paragraphs)
  (interactive "p")
  (save-excursion
    (let ((bound (if mark-active
                     (- (region-end) 2)
                   (progn
                     (org-back-to-item)
                     (while (>= num-paragraphs 0)
                       (call-interactively 'org-mark-element)
                       (setq num-paragraphs (1- num-paragraphs)))
                     (- (region-end) 2)))))
      (while (search-forward "\n" bound t)
        (replace-match " ")))
    (org-fill-paragraph)))

(define-key org-mode-map (kbd "C-M-q") 'org-fill-paragraph-handle-lists)
(defun org-back-to-item ()
  (re-search-backward "^ *[-+*]\\|^ *[1-9]+[)\.] " nil nil 1))

(defun org-fill-paragraph-handle-lists (&optional num-paragraphs)
  (interactive "p")
  (save-excursion
    (let ((bound (if mark-active
                     (- (region-end) 2)
                   (progn
                     (org-back-to-item)
                     (while (>= num-paragraphs 0)
                       (call-interactively 'org-mark-element)
                       (setq num-paragraphs (1- num-paragraphs)))
                     (- (region-end) 2)))))
      (while (search-forward "\n" bound t)
        (replace-match " ")))
    (org-fill-paragraph)))

(define-key org-mode-map (kbd "C-M-q") 'org-fill-paragraph-handle-lists)
(defun org-back-to-item ()
  (re-search-backward "^ *[-+*]\\|^ *[1-9]+[)\.] " nil nil 1))

(defun org-fill-paragraph-handle-lists (&optional num-paragraphs)
  (interactive "p")
  (save-excursion
    (let ((bound (if mark-active
                     (- (region-end) 2)
                   (progn
                     (org-back-to-item)
                     (while (>= num-paragraphs 0)
                       (call-interactively 'org-mark-element)
                       (setq num-paragraphs (1- num-paragraphs)))
                     (- (region-end) 2)))))
      (while (search-forward "\n" bound t)
        (replace-match " ")))
    (org-fill-paragraph)))

(define-key org-mode-map (kbd "C-M-q") 'org-fill-paragraph-handle-lists)
2 Make command more robust.
source | link

As @KyleMeyer explains in his answer, org-mode does not consider text to be part of a list item if it is not indented past the level of the corresponding bullet. So essentially, we need a way to absorb paragraphs into list items.

With point positioned inside a list item, the following command lets you do that without having to take care of indentation manually:

(defun org-back-to-item ()
  (re-search-backward "^ *[-+*]\\|^ *[1-9]+[)\.] " nil nil 1))

(defun org-fill-paragraph-handle-lists (&optional num-paragraphs)
  (interactive "p")
  (save-excursion
    (let ((bound (if mark-active
                     (- (region-end) 2)
                   (progn
                     (org-back-to-item)
                     (while (>= num-paragraphs 0)
                       (call-interactively 'org-mark-element)
                       (setq num-paragraphs (1- num-paragraphs)))
                     (- (region-end) 2)))))
      (while (search-forward "\n" bound t)
        (replace-match " ")))
    (org-fill-paragraph)))

(define-key org-mode-map (kbd "C-M-q") 'org-fill-paragraph-handle-lists)

The main idea is to replace occurrences of \n with SPC in the list item to fill before calling org-fill-paragraph on it.

Note that if you have more than one paragraph inside a list item:

  ...
  4) a bullet that does
  NOT respond to fill-paragraph
  because the "N" in "NOT" is in the same column
  as the start of the bullet

  Some more text
  5) ...

you can make Some more text (the second paragraph) become part of the list item by calling the command like this:

M-2 C-M-q

More specifically, org-fill-paragraph-handle-lists will absorb a single paragraph below a list item by default, but can be instructed to absorb any number of paragraphs by calling it with a numeric prefix arg.

As @KyleMeyer explains in his answer, org-mode does not consider text to be part of a list item if it is not indented past the level of the corresponding bullet. So essentially, we need a way to absorb paragraphs into list items.

With point positioned inside a list item, the following command lets you do that without having to take care of indentation manually:

(defun org-fill-paragraph-handle-lists (&optional num-paragraphs)
  (interactive "p")
  (save-excursion
    (let ((bound (if mark-active
                     (- (region-end) 2)
                   (progn
                     (while (>= num-paragraphs 0)
                       (call-interactively 'org-mark-element)
                       (setq num-paragraphs (1- num-paragraphs)))
                     (- (region-end) 2)))))
      (while (search-forward "\n" bound t)
        (replace-match " ")))
    (org-fill-paragraph)))

(define-key org-mode-map (kbd "C-M-q") 'org-fill-paragraph-handle-lists)

The main idea is to replace occurrences of \n with SPC in the list item to fill before calling org-fill-paragraph on it.

Note that if you have more than one paragraph inside a list item:

  ...
  4) a bullet that does
  NOT respond to fill-paragraph
  because the "N" in "NOT" is in the same column
  as the start of the bullet

  Some more text
  5) ...

you can make Some more text (the second paragraph) become part of the list item by calling the command like this:

M-2 C-M-q

More specifically, org-fill-paragraph-handle-lists will absorb a single paragraph below a list item by default, but can be instructed to absorb any number of paragraphs by calling it with a numeric prefix arg.

As @KyleMeyer explains in his answer, org-mode does not consider text to be part of a list item if it is not indented past the level of the corresponding bullet. So essentially, we need a way to absorb paragraphs into list items.

With point positioned inside a list item, the following command lets you do that without having to take care of indentation manually:

(defun org-back-to-item ()
  (re-search-backward "^ *[-+*]\\|^ *[1-9]+[)\.] " nil nil 1))

(defun org-fill-paragraph-handle-lists (&optional num-paragraphs)
  (interactive "p")
  (save-excursion
    (let ((bound (if mark-active
                     (- (region-end) 2)
                   (progn
                     (org-back-to-item)
                     (while (>= num-paragraphs 0)
                       (call-interactively 'org-mark-element)
                       (setq num-paragraphs (1- num-paragraphs)))
                     (- (region-end) 2)))))
      (while (search-forward "\n" bound t)
        (replace-match " ")))
    (org-fill-paragraph)))

(define-key org-mode-map (kbd "C-M-q") 'org-fill-paragraph-handle-lists)

The main idea is to replace occurrences of \n with SPC in the list item to fill before calling org-fill-paragraph on it.

Note that if you have more than one paragraph inside a list item:

  ...
  4) a bullet that does
  NOT respond to fill-paragraph
  because the "N" in "NOT" is in the same column
  as the start of the bullet

  Some more text
  5) ...

you can make Some more text (the second paragraph) become part of the list item by calling the command like this:

M-2 C-M-q

More specifically, org-fill-paragraph-handle-lists will absorb a single paragraph below a list item by default, but can be instructed to absorb any number of paragraphs by calling it with a numeric prefix arg.

1
source | link

As @KyleMeyer explains in his answer, org-mode does not consider text to be part of a list item if it is not indented past the level of the corresponding bullet. So essentially, we need a way to absorb paragraphs into list items.

With point positioned inside a list item, the following command lets you do that without having to take care of indentation manually:

(defun org-fill-paragraph-handle-lists (&optional num-paragraphs)
  (interactive "p")
  (save-excursion
    (let ((bound (if mark-active
                     (- (region-end) 2)
                   (progn
                     (while (>= num-paragraphs 0)
                       (call-interactively 'org-mark-element)
                       (setq num-paragraphs (1- num-paragraphs)))
                     (- (region-end) 2)))))
      (while (search-forward "\n" bound t)
        (replace-match " ")))
    (org-fill-paragraph)))

(define-key org-mode-map (kbd "C-M-q") 'org-fill-paragraph-handle-lists)

The main idea is to replace occurrences of \n with SPC in the list item to fill before calling org-fill-paragraph on it.

Note that if you have more than one paragraph inside a list item:

  ...
  4) a bullet that does
  NOT respond to fill-paragraph
  because the "N" in "NOT" is in the same column
  as the start of the bullet

  Some more text
  5) ...

you can make Some more text (the second paragraph) become part of the list item by calling the command like this:

M-2 C-M-q

More specifically, org-fill-paragraph-handle-lists will absorb a single paragraph below a list item by default, but can be instructed to absorb any number of paragraphs by calling it with a numeric prefix arg.