emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jisang Yoo <jisang.yoo.ac+org@gmail.com>
To: Dov Grobgeld <dov.grobgeld@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: org-kill-line
Date: Sun, 28 Apr 2013 11:56:43 +0900	[thread overview]
Message-ID: <CADtzDwaSrrKmzhU2E_Pt+7m+6Pckmx9c1Cu6f9t_rxzG50E_=w@mail.gmail.com> (raw)
In-Reply-To: <CA++fsGFG8iuvks76Uj9HJe4heE_m5thCqSMmpFoxzwAAr1uFcQ@mail.gmail.com>

If you are referring to org-kill-line, it is indeed odd that C-k in
org mode kills screen lines in visual line mode while C-k in text mode
always kills logical lines.

It seems temporarily turning off visual-line-mode while running the
macro involving org-kill-line is a workaround.

Or define a version of org-kill-line which only uses kill-line:

(defun my-org-kill-logical-line (&optional arg)
  "Kill line, to tags or end of line."
  (interactive "P")
   ((or (not org-special-ctrl-k)
	(not (org-at-heading-p)))
    (if (and (get-char-property (min (point-max) (point-at-eol)) 'invisible)
	(if (or (eq org-ctrl-k-protect-subtree 'error)
		(not (y-or-n-p "Kill hidden subtree along with headline? ")))
	    (user-error "C-k aborted as it would kill a hidden subtree")))
   ((looking-at (org-re ".*?\\S-\\([ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)[ \t]*$"))
    (kill-region (point) (match-beginning 1))
    (org-set-tags nil t))
   (t (kill-region (point) (point-at-eol)))))

That has just one line of difference from org-kill-line. You can then put

(define-key org-mode-map (kbd "C-S-k") 'my-org-kill-logical-line)

and use C-S-k in macros.

> I don't like the use of kill-visual-line in org-kill-mode as it creates
> non-predictable behavior when recording keyboard macros, as the display
> width will influence the result of running the macro. Does anyone have a
> suggestion of how to get around this? Right now I redefined kill-visual-line
> to kill-line, as I didn't want to touch the org-mode sources, but it seems
> to be an overkill (pun intended :-).

      reply	other threads:[~2013-04-28  2:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26  7:39 org-kill-line Dov Grobgeld
2013-04-28  2:56 ` Jisang Yoo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADtzDwaSrrKmzhU2E_Pt+7m+6Pckmx9c1Cu6f9t_rxzG50E_=w@mail.gmail.com' \
    --to=jisang.yoo.ac+org@gmail.com \
    --cc=dov.grobgeld@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: org-kill-line' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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


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).