emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-insert-heading wrongly adding checklist [8.0.7 (8.0.7-6-g13cb28-elpaplus @ /Users/ctanis/.emacs.d/elpa/org-plus-contrib-20130812/)]
@ 2013-08-12 13:07 Craig Tanis
  0 siblings, 0 replies; only message in thread
From: Craig Tanis @ 2013-08-12 13:07 UTC (permalink / raw)
  To: emacs-orgmode


When writing a numbered list, under certain conditions using Meta-return
(triggering org-insert-heading) causes a checkbox to incorrectly appear.

Specifically, a list like so:
1. foo
2. bar
<-----  with the cursor here, at the start of the next line

Meta-return adds a checkbox.  Normally this behaviour is only expected
when Meta-shift-return is entered.

I've traced it to the following code.  (Indeed, I even submitted a patch
a while ago, but I must have done something wrong.)

In org-insert-heading:

   ((or arg
	(and (not (org-in-item-p)) org-insert-heading-respect-content)
	(not (org-insert-item
	      (save-excursion
		(beginning-of-line)
		(looking-at org-list-full-item-re)
		(match-string 3)))))

In the situation described above, the (looking-at org-list-full-item-re)
does not match anything, but match-string is still called.  The results
do not correspond to the expected regexp pattern.  The following code
seems to remedy the problem I've described:

   ((or arg
	(and (not (org-in-item-p)) org-insert-heading-respect-content)
	(not (org-insert-item
	      (save-excursion
		(beginning-of-line)
		(and (looking-at org-list-full-item-re)
		     (match-string 3))))))

Obviously this only returns (match-string 3) when the regexp is
appropriate.

thanks,
Craig Tanis






Emacs  : GNU Emacs 24.3.1 (x86_64-apple-darwin12.3.0, NS apple-appkit-1187.37)
of 2013-03-18 on nincompoop.emcs3w.utc.edu
Package: Org-mode version 8.0.7 (8.0.7-6-g13cb28-elpaplus @ /Users/ctanis/.emacs.d/elpa/org-plus-contrib-20130812/)

current state:
==============
(setq
org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe
                      org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
org-goto-interface 'outline-path-completion
org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook)
org-mac-grab-Chrome-app-p nil
org-occur-hook '(org-first-headline-recenter)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-log-done 'time
org-confirm-shell-link-function 'yes-or-no-p
org-image-actual-width nil
org-mac-grab-Firefox-app-p nil
org-list-allow-alphabetical t
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-pre-tangle-hook '(save-buffer)
org-mode-hook '((lambda nil (define-key org-mode-map (kbd "C-c g") (quote omlg-grab-link)))
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
                 #[nil "\300\301\302\303\304$\207"
                   [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes
                 (lambda nil (make-variable-buffer-local (quote yas/trigger-key))
                  (setq yas/trigger-key [tab])
                  (add-to-list (quote org-tab-first-hook) (quote yas/org-very-safe-expand))
                  (define-key yas/keymap [tab] (quote yas/next-field)))
                 (lambda nil (local-set-key "\220" (quote org-backward-element))
                  (local-set-key "\216" (quote org-forward-element))
                  (local-set-key "\373" (quote backward-paragraph))
                  (local-set-key "\375" (quote forward-paragraph))
                  (local-set-key "\225" (quote org-up-list-or-element))
                  (local-set-key "\204" (quote org-down-element))
                  (local-set-key "\367" (quote org-refile-fullpath))
                  (local-set-key "\342" (quote org-mark-ring-goto))
                  (local-set-key "\356" (quote org-next-block))
                  (local-set-key "\360" (quote org-previous-block)) (toggle-truncate-lines 0)
                  (auto-fill-mode 1))
                 )
org-refile-targets '((nil :maxlevel . 9))
org-outline-path-complete-in-steps nil
org-use-speed-commands t
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe)
org-refile-use-outline-path t
org-directory "~/Dropbox/org"
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-hide-inline-tasks
                  org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
org-export-before-parsing-hook '(my-thesis-org-export-hook)
org-archive-default-command 'org-toggle-archive-tag
org-hide-emphasis-markers t
org-catch-invisible-edits 'smart
org-babel-tangle-lang-exts '(("python" . "py") ("java" . "java") ("C++" . "cpp") ("perl" . "pl")
                              ("emacs-lisp" . "el"))
org-confirm-elisp-link-function 'yes-or-no-p
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-log-into-drawer t
org-completion-use-ido t
org-babel-load-languages '((emacs-lisp . t) (perl . t) (C . t) (java . t) (python . t) (ditaa . t)
                            (dot . t) (gnuplot . t) (octave . t) (calc . t) (sh . t))
org-cycle-global-at-bob t
org-agenda-files '("~/Dropbox/org/tasks.org" "~/Dropbox/thesis/tex/chapters/splatter.org"
                    "~/Dropbox/org/notes.org")
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
)


----
Craig Tanis
UTC Computer Science
craig-tanis@utc.edu

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-08-12 13:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-12 13:07 Bug: org-insert-heading wrongly adding checklist [8.0.7 (8.0.7-6-g13cb28-elpaplus @ /Users/ctanis/.emacs.d/elpa/org-plus-contrib-20130812/)] Craig Tanis

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).