emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-kill-line


From: Jisang Yoo
Subject: Re: [O] org-kill-line
Date: Sun, 28 Apr 2013 11:56:43 +0900

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")
  (cond
   ((or (not org-special-ctrl-k)
        (bolp)
        (not (org-at-heading-p)))
    (if (and (get-char-property (min (point-max) (point-at-eol)) 'invisible)
             org-ctrl-k-protect-subtree)
        (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")))
    (call-interactively
     'kill-line))
   ((looking-at (org-re ".*?\\S-\\([ \t]+\\(:[[:alnum:address@hidden:]+:\\)\\)[ 
\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 via email to

[Prev in Thread] Current Thread [Next in Thread]