emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Yank "normal" text as item in list
@ 2014-10-23 10:02 Igor Sosa Mayor
  2014-10-23 15:18 ` Rasmus
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Igor Sosa Mayor @ 2014-10-23 10:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

often I have to yank 'normal' text, that means, text which is not
indented into a item of a list. In other words, maybe, to convert it
into a list item.

I have always the problem that, when the text over one line goes, it
does not get the correct indentation.

Is there maybe a magical function to get this?

Many thanks in advance!


-- 
:: Igor Sosa Mayor     :: joseleopoldo1792@gmail.com ::
:: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/      ::
:: jabberid: rogorido  ::                            ::

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

* Re: Yank "normal" text as item in list
  2014-10-23 10:02 Yank "normal" text as item in list Igor Sosa Mayor
@ 2014-10-23 15:18 ` Rasmus
  2014-10-23 15:26   ` Igor Sosa Mayor
  2014-10-23 15:29 ` Alexander Baier
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Rasmus @ 2014-10-23 15:18 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Igor Sosa Mayor <joseleopoldo1792@gmail.com> writes:

> often I have to yank 'normal' text, that means, text which is not
> indented into a item of a list. In other words, maybe, to convert it
[+]
> into a list item.
>
> I have always the problem that, when the text over one line goes, it
> does not get the correct indentation.
>
> Is there maybe a magical function to get this?
>
> Many thanks in advance!

I usually just do M-^, `delete-indentation' and then M-q, but maybe
there's a better way.

-- 
C is for Cookie

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

* Re: Yank "normal" text as item in list
  2014-10-23 15:18 ` Rasmus
@ 2014-10-23 15:26   ` Igor Sosa Mayor
  0 siblings, 0 replies; 9+ messages in thread
From: Igor Sosa Mayor @ 2014-10-23 15:26 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> I usually just do M-^, `delete-indentation' and then M-q, but maybe
> there's a better way.

thanks! I will give it a try!

-- 
:: Igor Sosa Mayor     :: joseleopoldo1792@gmail.com ::
:: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/      ::
:: jabberid: rogorido  ::                            ::

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

* Re: Yank "normal" text as item in list
  2014-10-23 10:02 Yank "normal" text as item in list Igor Sosa Mayor
  2014-10-23 15:18 ` Rasmus
@ 2014-10-23 15:29 ` Alexander Baier
  2014-10-23 16:01   ` Igor Sosa Mayor
  2014-10-24  3:53 ` Eric Abrahamsen
  2014-10-25  1:05 ` Teika Kazura
  3 siblings, 1 reply; 9+ messages in thread
From: Alexander Baier @ 2014-10-23 15:29 UTC (permalink / raw)
  To: Igor Sosa Mayor; +Cc: emacs-orgmode

On 2014-10-23 12:02 Igor Sosa Mayor wrote:
> Hi,
>
> often I have to yank 'normal' text, that means, text which is not
> indented into a item of a list. In other words, maybe, to convert it
> into a list item.
>
> I have always the problem that, when the text over one line goes, it
> does not get the correct indentation.
>
> Is there maybe a magical function to get this?
>
> Many thanks in advance!

What is wrong with fill-paragraph (bound to M-q by default)?

HTH,
-- 
Alexander Baier

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

* Re: Yank "normal" text as item in list
  2014-10-23 15:29 ` Alexander Baier
@ 2014-10-23 16:01   ` Igor Sosa Mayor
  0 siblings, 0 replies; 9+ messages in thread
From: Igor Sosa Mayor @ 2014-10-23 16:01 UTC (permalink / raw)
  To: emacs-orgmode

Alexander Baier <alexander.baier@mailbox.org> writes:

> What is wrong with fill-paragraph (bound to M-q by default)?

nothing, just that it does not do with I want. It works if a yank/paste
something which is pasted as a long line. But if I copy/yank text which
is already wrapped, the list identation is not kept and the item is not
really an item (only maybe the first line).

thanks in any case for your answer!


-- 
:: Igor Sosa Mayor     :: joseleopoldo1792@gmail.com ::
:: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/      ::
:: jabberid: rogorido  ::                            ::

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

* Re: Yank "normal" text as item in list
  2014-10-23 10:02 Yank "normal" text as item in list Igor Sosa Mayor
  2014-10-23 15:18 ` Rasmus
  2014-10-23 15:29 ` Alexander Baier
@ 2014-10-24  3:53 ` Eric Abrahamsen
  2014-10-24 20:08   ` Igor Sosa Mayor
  2014-10-25  1:05 ` Teika Kazura
  3 siblings, 1 reply; 9+ messages in thread
From: Eric Abrahamsen @ 2014-10-24  3:53 UTC (permalink / raw)
  To: emacs-orgmode

Igor Sosa Mayor <joseleopoldo1792@gmail.com> writes:

> Hi,
>
> often I have to yank 'normal' text, that means, text which is not
> indented into a item of a list. In other words, maybe, to convert it
> into a list item.
>
> I have always the problem that, when the text over one line goes, it
> does not get the correct indentation.
>
> Is there maybe a magical function to get this?
>
> Many thanks in advance!

I don't know what situation in particular you've got, but what often
works for me is going to the line of the yanked text that I want to be
the first line of a new list item, and using "C-c -" to explicitly
convert it to an item. That command includes some indentation heuristics
that, for me anyway, often creates the result I was looking for.

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

* Re: Yank "normal" text as item in list
  2014-10-24  3:53 ` Eric Abrahamsen
@ 2014-10-24 20:08   ` Igor Sosa Mayor
  0 siblings, 0 replies; 9+ messages in thread
From: Igor Sosa Mayor @ 2014-10-24 20:08 UTC (permalink / raw)
  To: emacs-orgmode

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> I don't know what situation in particular you've got, but what often
> works for me is going to the line of the yanked text that I want to be
> the first line of a new list item, and using "C-c -" to explicitly
> convert it to an item. That command includes some indentation heuristics
> that, for me anyway, often creates the result I was looking for.

thanks, but I'm to able to get the behaviour I'd like to have...

-- 
:: Igor Sosa Mayor     :: joseleopoldo1792@gmail.com ::
:: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/      ::
:: jabberid: rogorido  ::                            ::

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

* Re: Yank "normal" text as item in list
  2014-10-23 10:02 Yank "normal" text as item in list Igor Sosa Mayor
                   ` (2 preceding siblings ...)
  2014-10-24  3:53 ` Eric Abrahamsen
@ 2014-10-25  1:05 ` Teika Kazura
  2014-10-29 14:53   ` Igor Sosa Mayor
  3 siblings, 1 reply; 9+ messages in thread
From: Teika Kazura @ 2014-10-25  1:05 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: joseleopoldo1792

Hi, Igor. Below is mine. It's rudimentary, but it may help you.

------------------------------------------------------------------------
(defun teika-org-yank (&optional arg)
  "Wrapper of `org-yank', taking care of indenting."
  (interactive)
  (let (p0 p1)
    (when
	(and kill-ring
	     (bolp)
	     (not (equal (substring-no-properties (car kill-ring) 0 1) "*"))
	     (not (equal (buffer-substring-no-properties (point) (1+ (point))) "*" )))
      (setq p0 (point))
      (org-cycle))
    (call-interactively 'org-yank)
    (when p0
      (indent-region p0 (point))
      (unless (eolp)
	(org-cycle)))))

(define-key org-mode-map "\C-y" 'teika-org-yank)
;; Obviously `p1' inside of `let' is not used. Sorry for bad lisp. =P

;; By the way, I have this:
(global-set-key [(shift ?\s )] 'just-one-space)
(global-set-key [(meta ?\s )] 'delete-horizontal-space)
;; You can easily press S-space and M-space with thumbs with my hack in Linux:
;; https://forums.gentoo.org/viewtopic-t-865313.html
;; (if you have a Japanese keyboard.)

;; I also bind to a key the following, a code fragment of a bigger function.
(progn
  (exchange-point-and-mark)
  (when (or (eq last-command 'yank)
	    (eq last-command 'yank-pop))
    (just-one-space)
    ))
;; I.e., right after yanking, it calls `just-one-space'. Adjust to your use.
------------------------------------------------------------------------
In fact, it was a surprise for me that none has answered with a nice implementation. Indent problem irritated me a lot.

Cheers,
Teika (Teika kazura)

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

* Re: Yank "normal" text as item in list
  2014-10-25  1:05 ` Teika Kazura
@ 2014-10-29 14:53   ` Igor Sosa Mayor
  0 siblings, 0 replies; 9+ messages in thread
From: Igor Sosa Mayor @ 2014-10-29 14:53 UTC (permalink / raw)
  To: emacs-orgmode

Teika Kazura <teika@gmx.com> writes:

> Hi, Igor. Below is mine. It's rudimentary, but it may help you.

thanks! I will give it a try and I let you know whether it worked for
me!

-- 
:: Igor Sosa Mayor     :: joseleopoldo1792@gmail.com ::
:: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/      ::
:: jabberid: rogorido  ::                            ::

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

end of thread, other threads:[~2014-10-29 14:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 10:02 Yank "normal" text as item in list Igor Sosa Mayor
2014-10-23 15:18 ` Rasmus
2014-10-23 15:26   ` Igor Sosa Mayor
2014-10-23 15:29 ` Alexander Baier
2014-10-23 16:01   ` Igor Sosa Mayor
2014-10-24  3:53 ` Eric Abrahamsen
2014-10-24 20:08   ` Igor Sosa Mayor
2014-10-25  1:05 ` Teika Kazura
2014-10-29 14:53   ` Igor Sosa Mayor

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