Hi Daniel, Daniel Pittman <[EMAIL PROTECTED]> writes:
> G'day. I am a fan of `newline-and-indent', and turn it on for most of > the modes I routinely use, since it is almost always what I want done. > > org-mode rebinds the "return" key to `org-return', which acts > intelligently in the face of tables -- and calls `newline' hard-coded in > other cases. > > I would like to preserve that intelligence, but also to use > `newline-and-indent', so generated this patch to implement my desired > behaviour. I think having a new option is not the best solution. I would prefer to preserve the distinction between the two commands (RET and C-j). The patch below does this: define org-return-indent and bind it to C-j. Whether you want to bind it to RET is up to you.
diff -u /home/guerry/elisp/testing/org/ /home/guerry/elisp/testing/temp4/org.el --- /home/guerry/elisp/testing/org/org.el 2007-12-10 19:35:09.000000000 +0100 +++ /home/guerry/elisp/testing/temp4/org.el 2007-12-11 01:33:04.000000000 +0100 @@ -25815,6 +25815,7 @@ (org-defkey org-mode-map "\C-c\C-k" 'org-kill-note-or-show-branches) (org-defkey org-mode-map "\C-c#" 'org-update-checkbox-count) (org-defkey org-mode-map "\C-m" 'org-return) +(org-defkey org-mode-map "\C-j" 'org-return-indent) (org-defkey org-mode-map "\C-c?" 'org-table-field-info) (org-defkey org-mode-map "\C-c " 'org-table-blank-field) (org-defkey org-mode-map "\C-c+" 'org-table-sum) @@ -26283,18 +26284,24 @@ (let ((org-note-abort t)) (funcall org-finish-function)))) -(defun org-return () +(defun org-return (&optional indent) "Goto next table row or insert a newline. Calls `org-table-next-row' or `newline', depending on context. See the individual commands for more information." (interactive) (cond - ((bobp) (newline)) + ((bobp) (if indent (newline-and-indent) (newline))) ((org-at-table-p) (org-table-justify-field-maybe) (call-interactively 'org-table-next-row)) - (t (newline)))) + (t (if indent (newline-and-indent) (newline))))) +(defun org-return-indent () + (interactive) + "Goto next table row or insert a newline and indent. +Calls `org-table-next-row' or `newline-and-indent', depending on +context. See the individual commands for more information." + (org-return t)) (defun org-ctrl-c-minus () "Insert separator line in table or modify bullet type in list. Diff finished. Tue Dec 11 01:33:29 2007
> If this isn't the right approach I am happy to rework the patch to > better match the rest of the software. Thanks for pointing out this issue and for the patch! I don't know what Carsten will do with this, but having two solutions is certainly good :) Best, -- Bastien
_______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode