2
* Heading  
** Sub-heading  
*** Sub-sub-heading  
- plain text
- more plain text
- even more plain text

I want to select - more plain text and archive it with C-c, C-x, C-a.

I only want - more plain text to be archived. I want the headings and the rest of the plain text to stay in place.

When I try this, it archives everything.

  • 4
    Where in your archive file should - more plain text be placed -- at the very bottom of the archive file (at flush left) without any heading/subheading? – lawlist Nov 16 '16 at 15:19
1

I recommend following the answer from @Tyler because it encourages using org-mode as designed.

However, if you're absolutely determined to archive a list item then:

Try this

  1. Place point on list item
  2. Move list item to bottom of the list using M-down.
  3. Convert list item to heading using C-c *.
  4. Archive header using C-cC-xC-a

This should leave the original file that appears similar to this:

* Heading

** Sub-heading

*** Sub-sub-heading

- plain text
- even more plain text

and create an entry in archive file that is similar to this:

* more plain text
  :PROPERTIES:
  :ARCHIVE_TIME: 2016-11-16 Wed 11:27
  :ARCHIVE_FILE: /tmp/sx/emacs/how-to-archive-selected-text-in-org.org
  :ARCHIVE_OLPATH: Heading/Sub-heading/Sub-sub-heading
  :ARCHIVE_CATEGORY: how-to-archive-selected-text-in-org
  :END:

Note: If you have any content under the header after your list do not archive or you'll archive more than you want too. This method only works on very simple use cases such as your example.

Hope that helped!


This answer was tested using

GNU Emacs 24.5.1 (x86_64-unknown-cygwin, GTK+ Version 3.14.13)
org-mode version: 9.0

4

Archiving is designed to work on trees or subtrees. i.e., the basic unit to be archived is a heading with all the nested content under that heading. You can't archive arbitrary text without the heading it belongs to. Otherwise, as @lawlist suggests in his question, there's no clearly defined place to archive the text. (and after you've archived one bit of text, where does the next bit go relative to the first bit you archived?)

You could probably code something yourself that would automatically transfer selected text to a particular location you specify, to 'archive' it. However, you'd be working against the expected workflow for org-mode. Using subheadings (which can be archived) or checkboxes (i.e., - [ ]) to indicate items that have been dealt with, might be more straightforward.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.