saf-dmitry/taskpaper-mode

"Fill" commands and settings don't work in *.taskpaper files

Closed this issue · 1 comments

It seems that fill-paragraphand auto-fill-mode don't work when editing *.taskpaper files, nor do the other manual fill- commands. While I can understand not wanting to constrain the overall width of a project-and-task outline, it would be nice to be able to at least hard-wrap notes at 70 - 80 characters to help keep things tidy. Is there a particular reasong for disabling these commands/variables?

Yes, the paragraph filling commands are disabled for reason. In TaskPaper syntax every item (project, task, or note) can occupy exactly one line.

TaskPaper's file format is fairly simple. Here's how TaskPaper reads a file:

  • Files are expected to use the UTF-8 encoding and use \n to separate lines.

  • A task is a line that begins with a hyphen followed by a space (- ) which can optionally be prefixed (i.e. indented) with tabs. A task can have zero or more tags anywhere on the line (not just trailing at the end).

  • A project is a line that isn't a task and ends with a colon (:) followed by a newline. Tags can exist after the colon, but if any non-tag text is present, then it won't be recognized as a project.

  • A note is any non-blank line that doesn't match the task or project rules.

Indentation level (with tabs, not spaces) defines ownership. For instance, if you indent one task under another task, then it is considered a subtask. Projects, tasks, and notes own all items that are indented underneath them. Empty lines are ignored when calculating ownership.

Filling paragraphs will break this syntax rules.

If you want a cleaner outline view like on the screencasts, where long-line items are wrapped according to the syntax rules using soft line breaks, I recommend using adaptive-wrap.el (included in this repository). The adaptive-wrap.el sets the wrap-prefix correctly for indenting and wrapping of long-line items. The version included in this repository provides the adaptive-wrap-prefix-mode minor mode, which sets the wrap-prefix property on the fly so that single-long-line paragraphs get word-wrapped in a way similar to what you'd get with M-q using adaptive-fill-mode, but without actually changing the buffer's text. The present version supports tabs, works on one-line paragraphs, and can be used in modes other than TaskPaper mode. In can be activated globally by putting adaptive-wrap-mode.el on the load path and adding to .emacs

(require 'adaptive-wrap)
(add-hook 'visual-line-mode-hook
          '(lambda () (adaptive-wrap-prefix-mode 1)))
(global-visual-line-mode 1)