org-fix-bullet-type is now org-list-repair. Created aliases for compatibility.

This commit is contained in:
Nicolas Goaziou 2010-08-17 21:29:49 +02:00
parent dea5050dbc
commit dae1ec63a9
3 changed files with 21 additions and 31 deletions

View File

@ -973,7 +973,7 @@ Point will remain at the first line after the inserted text."
(insert template) (insert template)
(org-capture-empty-lines-after) (org-capture-empty-lines-after)
(goto-char beg) (goto-char beg)
(org-maybe-renumber-ordered-list) (org-list-repair)
(org-end-of-item) (org-end-of-item)
(setq end (point))) (setq end (point)))
(t (insert template))) (t (insert template)))

View File

@ -439,7 +439,7 @@ function ends."
(before-p (funcall insert-fun nil) (before-p (funcall insert-fun nil)
;; Not taking advantage of renumbering while moving ;; Not taking advantage of renumbering while moving
;; down. Need to call it directly. ;; down. Need to call it directly.
(org-maybe-renumber-ordered-list) t) (org-list-repair) t)
;; Can't split item: insert bullet at the end of item. ;; Can't split item: insert bullet at the end of item.
((not (org-get-alist-option org-M-RET-may-split-line 'item)) ((not (org-get-alist-option org-M-RET-may-split-line 'item))
(funcall insert-fun nil) t) (funcall insert-fun nil) t)
@ -685,7 +685,7 @@ so this really moves item trees."
(goto-char pos) (goto-char pos)
(error "Cannot move this item further down")) (error "Cannot move this item further down"))
(org-list-exchange-items actual-item next-item) (org-list-exchange-items actual-item next-item)
(org-maybe-renumber-ordered-list) (org-list-repair)
(org-next-item) (org-next-item)
(move-to-column col)))) (move-to-column col))))
@ -703,7 +703,7 @@ so this really moves item trees."
(goto-char pos) (goto-char pos)
(error "Cannot move this item further up")) (error "Cannot move this item further up"))
(org-list-exchange-items prev-item actual-item) (org-list-exchange-items prev-item actual-item)
(org-maybe-renumber-ordered-list) (org-list-repair)
(move-to-column col)))) (move-to-column col))))
(defun org-insert-item (&optional checkbox) (defun org-insert-item (&optional checkbox)
@ -1152,7 +1152,7 @@ children. Return t if successful."
(t (back-to-indentation) (t (back-to-indentation)
(indent-to-column (car org-tab-ind-state)) (indent-to-column (car org-tab-ind-state))
(end-of-line) (end-of-line)
(org-fix-bullet-type (cdr org-tab-ind-state)) (org-list-repair (cdr org-tab-ind-state))
;; Break cycle ;; Break cycle
(setq this-command 'identity))) (setq this-command 'identity)))
;; If a cycle is starting, remember indentation and bullet, ;; If a cycle is starting, remember indentation and bullet,
@ -1195,9 +1195,14 @@ It determines the number of whitespaces to append by looking at
(number-to-string (1+ (string-to-number (match-string 0 bullet)))) nil nil bullet) (number-to-string (1+ (string-to-number (match-string 0 bullet)))) nil nil bullet)
bullet)) bullet))
(defun org-fix-bullet-type (&optional force-bullet) (defun org-list-repair (&optional force-bullet)
"Make sure all items in this list have the same bullet as the first item. "Make sure all items are correctly indented, with the right bullet.
Also, fix the indentation." This function scans the list at point, along with any sublist.
If the string FORCE-BULLET is provided, ensure all items in list
share this bullet, or a logical successor in an ordered list.
Item's body is not indented, only shifted with the bullet."
(interactive) (interactive)
(unless (org-at-item-p) (error "This is not a list")) (unless (org-at-item-p) (error "This is not a list"))
(let* ((struct (org-list-struct (point-at-bol) (point-at-eol))) (let* ((struct (org-list-struct (point-at-bol) (point-at-eol)))
@ -1210,25 +1215,10 @@ Also, fix the indentation."
(setq fixed-struct (org-list-struct-fix-struct struct origins))) (setq fixed-struct (org-list-struct-fix-struct struct origins)))
(org-list-struct-apply-struct fixed-struct))) (org-list-struct-apply-struct fixed-struct)))
(defun org-renumber-ordered-list () ;; For backward compatibility
"Renumber an ordered plain list. (defalias 'org-fix-bullet-type 'org-list-repair)
Cursor needs to be in the first line of an item." (defalias 'org-renumber-ordered-list 'org-list-repair)
(interactive) (defalias 'org-maybe-renumber-ordered-list 'org-list-repair)
(unless (and (org-at-item-p)
(match-beginning 3))
(error "This is not an ordered list"))
(let* ((struct (org-list-struct (point-at-bol) (point-at-eol)))
(origins (org-list-struct-origins struct)))
(org-list-struct-apply-struct (org-list-struct-fix-struct struct origins))))
(defun org-maybe-renumber-ordered-list ()
"Renumber the ordered list at point if setup allows it.
This tests the if 'renumber rule is set in
`org-list-automatic-rules' before doing the renumbering.
Do not throw error on failure."
(interactive)
(when (cdr (assq 'renumber org-list-automatic-rules))
(ignore-errors (org-renumber-ordered-list))))
(defun org-cycle-list-bullet (&optional which) (defun org-cycle-list-bullet (&optional which)
"Cycle through the different itemize/enumerate bullets. "Cycle through the different itemize/enumerate bullets.
@ -1267,7 +1257,7 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is
((numberp which) (funcall get-value which)) ((numberp which) (funcall get-value which))
((eq 'previous which) (funcall get-value (1- item-index))) ((eq 'previous which) (funcall get-value (1- item-index)))
(t (funcall get-value (1+ item-index)))))) (t (funcall get-value (1+ item-index))))))
(org-fix-bullet-type new)))) (org-list-repair new))))
;;; Checkboxes ;;; Checkboxes
@ -1601,7 +1591,7 @@ optional argument WITH-CASE, the sorting considers case as well."
(error "Invalid key function `%s'" getkey-func))) (error "Invalid key function `%s'" getkey-func)))
(t (error "Invalid sorting type `%c'" sorting-type))))))) (t (error "Invalid sorting type `%c'" sorting-type)))))))
(sort-subr (/= dcst sorting-type) begin-record end-record value-to-sort nil sort-func) (sort-subr (/= dcst sorting-type) begin-record end-record value-to-sort nil sort-func)
(org-maybe-renumber-ordered-list) (org-list-repair)
(run-hooks 'org-after-sorting-entries-or-items-hook) (run-hooks 'org-after-sorting-entries-or-items-hook)
(message "Sorting items...done"))))) (message "Sorting items...done")))))

View File

@ -17207,11 +17207,11 @@ This command does many different things, depending on context:
(org-footnote-at-definition-p)) (org-footnote-at-definition-p))
(call-interactively 'org-footnote-action)) (call-interactively 'org-footnote-action))
((org-at-item-checkbox-p) ((org-at-item-checkbox-p)
(call-interactively 'org-fix-bullet-type) (call-interactively 'org-list-repair)
(call-interactively 'org-toggle-checkbox) (call-interactively 'org-toggle-checkbox)
(org-list-send-list 'maybe)) (org-list-send-list 'maybe))
((org-at-item-p) ((org-at-item-p)
(call-interactively 'org-fix-bullet-type) (call-interactively 'org-list-repair)
(when arg (call-interactively 'org-toggle-checkbox)) (when arg (call-interactively 'org-toggle-checkbox))
(org-list-send-list 'maybe)) (org-list-send-list 'maybe))
((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re))