all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* newline at start of buffer
@ 2009-10-03  3:33 Dan Davison
  2009-10-03  7:24 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Davison @ 2009-10-03  3:33 UTC (permalink / raw)
  To: emacs org-mode mailing list

In a completely empty buffer, org-insert-heading inserts a newline
before the first heading. However, if there is (e.g.) a single space
character in the buffer (after point), the heading goes on the first
line. I admit it's trivial, but that doesn't seem right -- there
presumably isn't a reason for the newline in the first case and not in
the second, right? (My preference would be no automatic blank line.)

Dan

diff --git a/lisp/org.el b/lisp/org.el
index 73ef6c5..4883a2f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5754,7 +5754,7 @@ current headline.  If point is not at the beginning, do not split the line,
 but create the new headline after the current line."
   (interactive "P")
   (if (= (buffer-size) 0)
-      (insert "\n* ")
+      (insert "* ")
     (when (or force-heading (not (org-insert-item)))
       (let* ((empty-line-p nil)
             (head (save-excursion

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: newline at start of buffer
  2009-10-03  3:33 newline at start of buffer Dan Davison
@ 2009-10-03  7:24 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-10-03  7:24 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs org-mode mailing list

Hi Dan,

this was a stupid hack to get the headline away from the first
buffer line which can cause problems in Org under some circumstances
which are hard to consistently remove.  It looks a the empty buffer
case because this is what will happen when people open a new buffer
and immediately create a headline in this way.  When there is already
something in the buffer, even a space, I am assuming the user wants
to be in control.

If it is not bothering you a lot, I'd like to keep it this way.

- Carsten

On Oct 3, 2009, at 5:33 AM, Dan Davison wrote:

> In a completely empty buffer, org-insert-heading inserts a newline
> before the first heading. However, if there is (e.g.) a single space
> character in the buffer (after point), the heading goes on the first
> line. I admit it's trivial, but that doesn't seem right -- there
> presumably isn't a reason for the newline in the first case and not in
> the second, right? (My preference would be no automatic blank line.)
>
> Dan
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 73ef6c5..4883a2f 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -5754,7 +5754,7 @@ current headline.  If point is not at the  
> beginning, do not split the line,
> but create the new headline after the current line."
>   (interactive "P")
>   (if (= (buffer-size) 0)
> -      (insert "\n* ")
> +      (insert "* ")
>     (when (or force-heading (not (org-insert-item)))
>       (let* ((empty-line-p nil)
>             (head (save-excursion
>
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-03  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-03  3:33 newline at start of buffer Dan Davison
2009-10-03  7:24 ` Carsten Dominik

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.