Giter Club home page Giter Club logo

worf's Introduction

worf

GNU Emacs minor mode that provides vi-like bindings for org-mode

See the documentation in HTML or org.

worf's People

Contributors

abo-abo avatar bixuanzju avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

worf's Issues

worf-goto VERY slow compared to helm-org-headlines

Hi!

i find worf-goto far superior compared to helm-org-headlines in terms of the UI, ease of use etc. i would love to over to use it full time. yet it seems 10x slower than the helm-org-headlines option. on a 40000 line org file (my main note file) it takes around 15-20 seconds just to load...this makes it not very usable :)
is there a way to speed things up? or perhaps use the excellent ivy/swiper to search orgmode headlines only?

thx so much

Z

Enhancement: worf-delete-subtree to update the todo count

I found a solution to this emacs stackexchange question and then started to think that it could a good addition to worf-delete-subtree.

I am not too sure about the design philosophy behind worf and implications of adding this functionality, so rather than creating a pull request, I suggest here that this could be added to the end of the worf-delete-subtree function code:

(when org-provide-todo-statistics
      (org-update-parent-todo-statistics))

At least, there is very little overhead in adding it. At best, updating the stats automatically could be a pleasant surprise to the user. There might be other places where org todo stats could be taken into account, but not sure where.

worf-beginning-of-line in visual-line-mode

worf-beginning-of-line could behave nicer when visual-line mode is active. Here's two alternatives which makes it work. I am not sure which one is more desireable.

First one behaves as worf-beginning-of-line usually does:

(defun worf-beginning-of-line ()
  "Replaces `org-beginning-of-line'.
When already at beginning of line, move back to heading."
  (interactive)
  (let ((pt (point)))
    (org-beginning-of-line)
    (when (and (eq pt (point))
               (not (looking-at "^[*]")))
      (push-mark)
      (re-search-backward "^*"))))

Second one moves to beginning of visual line -> beginning of logical line -> back to heading.


  (defun worf-beginning-of-line ()
    "Replaces `org-beginning-of-line'.
When already at beginning of line, move back to heading.
When at beginning of visual line, move to beginning of logical line."
    (interactive)
    (let ((pt (point)))
      (org-beginning-of-line)
      (when (eq pt (point))
        (cond ((looking-at "^[^*]")
               (push-mark)
               (re-search-backward "^*"))
              ((not (looking-at "^[*]"))
               (push-mark)
               (re-search-backward "^")))))

`worf-change-shift-mode`: "hjkl" or "wasd"?

The docs say hjkl are used to move headings after activating worf-change-shift-mode, but I get this Hydra instead, which uses wasd for moving headings:

screenshot 2016-09-06 15 28 15

Are the docs not up do date or am I missing something?

(the docs say "While worf-change-shift-mode is active, hjkl act as S- and arrows in the default org".)

Anyway, to be honest, I would prefer using hjkl as it's consistent with the other keybindings. What do you think?

error: (invalid-function with-ivy-window) on latest worf mode

I just updated some of my package as well as worf-mode today, then I get this error, when run command (wspecial-worf-goto)

here is the error

Debugger entered--Lisp error: (invalid-function with-ivy-window)
  with-ivy-window(656 nil nil)
  worf-goto-action((#("2   Package Initialization" 0 1 (idx 3) 4 26 (face org-level-2)) . 656))
  ivy-call()
  ....

I google the related error abo-abo/swiper#185, then I re-install all the related package, such as swiper, ivy, but the issue is still not resolved.

Any other idea?

Thanks

Require hydra?

Is there no explicit (require 'hydra) because another required package requires it? After updating, I've found worf no longer works ((void-variable hydra-worf-change)) unless I add an explicit require.

I didn't have this issue before, so I'm not sure if it's because of my package manager (straight.el) or because another package that required hydra no longer does. If you think this is really unexpected, I will look into it further.

worf-todo increments number in heading

Hey,

I have spotted one pretty annoying bug that prevents me from using worf-todo. When it's used it increments first number in heading by 1. Some might not find it critical, but it's critical for me as it changed some important data in my headings without me noticing it. Note that calling C-c C-t doesn't change anything in heading except for TODO keyword.

  • Steps to reproduce

First three steps are options, I just show how exactly I've tested it.

  1. Open up Emacs with -Q option.
  2. Add org, hydra and worf package directories to load-path and load them in that exact order.
  3. Open org-mode file with following content.
* Heading 1
** TODO Sub-heading 1: say 2
** TODO Sub-heading 2
  1. Enable worf-mode (e. g. M-: (worf-mode)).
  2. Place cursor at the beginning of second line (** TODO Sub-heading 1: say 2).
  3. Press t and select d for DONE.
  • What happens

The second line changes from ** TODO Sub-heading 1: say 2 to ``** DONE Sub-heading 2: say 2`.

  • What is expected to happen

The second line changes from ** TODO Sub-heading 1: say 2 to ``** DONE Sub-heading 1: say 2` without changing any numbers in text.


Worf version is 20161206.201. If you need any more additional information, please let me know.

worf-back and worf-forward default key mappings

I find the default mapping of [ and ] in worf to worf-backward and worf-forward to be awkward, as this prevents me from manually typing in links with square brackets.

I can override the mappings with the following in my init file;

(define-key worf-mode-map "]" nil)
(define-key worf-mode-map (kbd "M-]") 'worf-forward)
(define-key worf-mode-map "[" nil)
(define-key worf-mode-map (kbd "M-[") 'worf-backward)

Am I missing something? Surely it isn't desirable to effectively prevent the use of the characters [ and [ in all org-mode files?

Would this be a better default?

About worf-summary

Dear abo-abo
Thank you very much, it is really a good accomplishment.

I tested the snippet, maybe there are some little bugs.

  1. When i call worf--summary-on, it hides all my subheadings. It would be best without doing any other things except re-display in my opinion.
  2. The results is below, which shows the align contents, which is not what I need. Addtionaly there are also two /.
    image
  3. If you can change the order of caption and label, it will be best for me.
  4. I want to make worf--summary-on automatically when i am in org-mode. Ok, i can add the hook by myself.

Thanks again, it is really a great help to me!

Best regard!

[SEVERE BUG] after latest ivy update worf gives error

Hi worf gives an error when trying to jump to selected header i think since the last ivy update. the error is:

ivy-call: Wrong type argument: integer-or-marker-p, (#("2   ivy" 4 7 (pabbrev-added t face org-level-2 org-category "settings" fontified t)) . 59106)

i did reintsall both worf and ivy but that didnt seem to help. any clue?

thx

z

void-function worf-change-name

Here is the debug info:

Debugger entered--Lisp error: (void-function worf-change-name)
documentation(worf-change-name)
(format "Call %s' when special, self-insert otherwise.\n\n%s" (symbol-name def) (documentation def)) (list (quote lambda) (help-function-arglist def) (format "Call%s' when special, self-insert otherwise.\n\n%s" (symbol-name def) (documentation def)) (interactive-form def) (list (quote let) (quote (cmd)) (cons (quote cond) (cons (list (quote (worf--special-p)) (if disable (progn (cons disable ...))) (cons def (delq (quote &rest) (delq ... ...))) (cons (quote unless) (cons (cons ... ...) (quote ...)))) (quote ((t (org-self-insert-command 1))))))))
(let ((disable (cdr (assoc :disable alist))) (break (cdr (assoc :break alist)))) (list (quote lambda) (help-function-arglist def) (format "Call %s' when special, self-insert otherwise.\n\n%s" (symbol-name def) (documentation def)) (interactive-form def) (list (quote let) (quote (cmd)) (cons (quote cond) (cons (list (quote (worf--special-p)) (if disable (progn ...)) (cons def (delq ... ...)) (cons (quote unless) (cons ... ...))) (quote ((t ...)))))))) worf--insert-or-call(worf-change-name ((:disable . worf-change-mode) (:break . t))) (defalias (intern (concat "wspecial-" (symbol-name def))) (worf--insert-or-call def (worf--flag-to-alist plist :break))) (let ((func (defalias (intern (concat "wspecial-" (symbol-name def))) (worf--insert-or-call def (worf--flag-to-alist plist :break))))) (if (member func ac-trigger-commands) nil (setq ac-trigger-commands (cons func ac-trigger-commands))) (if (member func company-begin-commands) nil (setq company-begin-commands (cons func company-begin-commands))) (define-key keymap (kbd key) func)) worf-define-key((keymap (116 . wspecial-org-set-tags) (108 . wspecial-org-metaright) (104 . wspecial-org-metaleft) (107 . wspecial-org-metaup) (106 . wspecial-org-metadown)) "n" worf-change-name (:disable . worf-change-mode) :break) apply(worf-define-key ((keymap (116 . wspecial-org-set-tags) (108 . wspecial-org-metaright) (104 . wspecial-org-metaleft) (107 . wspecial-org-metaup) (106 . wspecial-org-metadown)) "n" worf-change-name (:disable . worf-change-mode) :break)) (lambda (x) (let ((y (memq :disable x))) (if y (progn (setcar y (cons :disable (quote worf-change-mode)))))) (apply (quote worf-define-key) (cons worf-change-mode-map x)))(("n" worf-change-name (:disable . worf-change-mode) :break)) mapc((lambda (x) (let ((y (memq :disable x))) (if y (progn (setcar y (cons :disable (quote worf-change-mode)))))) (apply (quote worf-define-key) (cons worf-change-mode-map x))) (("j" org-metadown) ("k" org-metaup) ("h" org-metaleft) ("l" org-metaright) ("t" org-set-tags (:disable . worf-change-mode)) ("n" worf-change-name (:disable . worf-change-mode) :break))) (progn (defvar worf-change-mode-map (make-sparse-keymap)) (progn (progn :autoload-end (defvar worf-change-mode nil "Non-nil if Worf-Change mode is enabled.\nUse the commandworf-change-mode' to change this variable.") (make-variable-buffer-local (quote worf-change-mode))) (defalias (quote worf-change-mode) (function (lambda (&optional arg) "Change verb." (interactive (list (or current-prefix-arg ...))) (let ((last-message ...)) (setq worf-change-mode (if ... ... ...)) (cond (worf-change-mode ...) (t nil)) (run-hooks (quote worf-change-mode-hook) (if worf-change-mode ... ...)) (if (called-interactively-p ...) (progn nil ...))) (force-mode-line-update) worf-change-mode))) :autoload-end (defvar worf-change-mode-hook nil "Hook run after entering or leaving worf-change-mode'.\nNo problems result if this variable is not bound.\nadd-hook' automatically binds it. (This is true for all hook variables.)") nil (with-no-warnings (add-minor-mode (quote worf-change-mode) (quote " [change]") worf-change-mode-map nil nil))) (mapc (function (lambda (x) (let ((y (memq :disable x))) (if y (progn (setcar y ...)))) (apply (quote worf-define-key) (cons worf-change-mode-map x)))) (quote (("j" org-metadown) ("k" org-metaup) ("h" org-metaleft) ("l" org-metaright) ("t" org-set-tags (:disable . worf-change-mode)) ("n" worf-change-name (:disable . worf-change-mode) :break)))) (if (memq (quote worf-change-mode) worf-known-verbs) nil (setq worf-known-verbs (cons (quote worf-change-mode) worf-known-verbs))) worf-known-verbs)
eval-buffer(#<buffer load> nil "/Users/jeremybi/.emacs.d/packages/worf.el" nil t) ; Reading at buffer position 9488
load-with-code-conversion("/Users/jeremybi/.emacs.d/packages/worf.el" "/Users/jeremybi/.emacs.d/packages/worf.el" nil t)
require(worf)
eval((require (quote worf)) nil)
eval-last-sexp-1(nil)
eval-last-sexp(nil)
#(eval-last-sexp nil nil)
ad-Advice-call-interactively(# eval-last-sexp nil nil)
apply(ad-Advice-call-interactively # (eval-last-sexp nil nil))
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)

wspecial is active when the region is active

Apologies in advance if this is a feature rather than a bug.

Unlike with Lispy, where special mode is triggered if "the point is before/after paren or the region is active", Worf documentation makes no reference to enabling special mode when the region is active. Indeed, tree manipulation commands are useless beyond headers or Org markup.

However, on an emacs -q session, editing an org file with worf-mode enabled and region active outside of a header:

  • C-h k q reads:

q runs the command wspecial-worf-quit (found in worf-mode-map), which
is an interactive Lisp function in ‘worf.el’

  • just as C-h k j echoes:

j runs the command wspecial-worf-down (found in worf-mode-map), which
is an interactive Lisp function in ‘worf.el’.

Both suggesting that Worf is in special mode when the region is active.

Is this behaviour by design or a bug?

suggestion: add worf-goto global?

Hi

i have been using worf-goto every day as an integral part of my workflow and really love it.

An idea has come up today regarding perhaps having an additional worf-goto command that would act the same as worf-goto but on many files?

so either a user defined folder, list of files, agenda file etc..

that way when one launches worf-goto-global you get all the headers from your pre defined file/folder list of org files.

does that make any sense ;-) any thoughts on that?

best

Z

~wta~ will NOT add a new heading with *TODO* keyword

** a - added
:PROPERTIES:
:CUSTOM_ID: added
:END:
Represents /added/ heading. The behavior depends on the currently
active verb:
*** goto
Forward to =org-insert-heading-respect-content= (bound to C-RET in =org-mode=).

*** change
Forward to =org-meta-return= (bound to M-RET in =org-mode=).

*** keyword <--------------- HERE document is not true ---------------------------------->
Add a new heading with a corresponding keyword.

For example wta will add a new TODO, and wna will add a new
NEXT.

source: README.org

wta would NOT add new heading with TODO status, instead, it makes the current heading as TODO keyword and adds a new heading without any keywords.

Beginning of buffer is treated as special position

Hey,

Looks like worf-mode treats beginning of buffer as special position, so instead of inserting letters it executes underlying commands.

  1. Open any org file or create empty buffer with org-mode enabled.
  2. Go to beginning of buffer.
  3. Type H.
  4. Notice Nothing here, move along in the echo area.

Instead I would like H letter to be inserted.

To be honest it would not be such a pain if it's wasn't the same in org-campture-mode. In some templates capture buffer is empty and you have to escape via C-q first letter you type. I know that it's possible to disable worf-mode via org-capture-mode-hook, but I find worf-mode useful in that mode as well.

Is such behaviour a bug? Or is it by design? If so, is it possible to change it? 😸

Thanks in advance.

P. S. Many thanks for this wonderful package!

ace-jump-mode not needed

The line (require 'ace-jump-mode) is not needed anymore (because of ace-link and avy, I guess).

Change tags broken?

I do 'ct' on a headline and emacs complains that org-set-tags is not a command (as indeed it isn't). Maybe the hydra should call org-set-tags-command?

Emacs: 26.1
Org: 20190218 (melpa)

Add worf-flow and worf-back?

I think that the equivalents from lispy would work well in worf as well. I often traverse with worf-right deep into a tree, then want to continue to the next top level item.

A Suggestion for Ivyification

Due to the recent maturation of Ivy, I suggest dropping the Helm dependency and instead using Ivy for the goto function.

[BUG] 100% reproduicable, loading worf disables company-mode completions in orgmode

Hi

I discovered today that when i enable worf mode it kills/disables company-mode completions in an orgmode buffer.

this is my relevant company mode config

  (use-package company 
   :ensure t
   :config
  (add-hook 'after-init-hook 'global-company-mode)

  (setq company-idle-delay 0)
  (setq company-minimum-prefix-length 2) 
    
(add-to-list 'company-backends 'company-ispell)
(add-to-list 'company-backends 'company-dabbrev)
(add-to-list 'company-backends 'company-abbrev)

)

 (defun my-org-mode-hook ()
      (set (make-local-variable 'company-backends)
           '((company-capf company-files company-dabbrev))))


(add-hook 'org-mode-hook #'my-org-mode-hook)

any clue why this happens? can you confirm? can we try and debug this?

EDIT: if i move my worf config below company mode it seems to work..strange..any clue why?

thx alot in advance!

Z

Change motion keys according to xah fly keys

I like the key sheme of xah fly keys very much. In short:

j = left
l = right
i = above
k= below

worf works with vim like key sheme. My goal is one key sheme for all my work, so I tried to change some keys in worf mode:

(use-package worf
  :ensure t
  :init
  (add-hook 'org-mode-hook #'worf-mode)

  :bind
  (:map worf-mode-map
        ;; Navigation mode
        ("k" . wspecial-worf-down)
        ("i" . wspecial-worf-up)
        ("c" . wspecial-worf-tab)
        ("C" . wspecial-worf-shifttab)
        ("ö" . wspecial-worf-right)
        ("<" . wspecial-worf-change-mode)

        ;; Delete Mode
        :map worf-delete-mode-map
        ("k" . wspecial-worf-cut-subtree)
        ("i" . wspecial-worf-delete-k)
        ))

But this makes problems for example when I press a to add a new heading below the current one the structure of my org file get's corrupted. Without my personal keys it does work fine and of course c for change mode is not working anymore. Is there any way to change keys to xah fly keys sheme?

Wspecial-worf-add destroys nested org structure, bug?

I open a new issue because it has not much to do with my issue a a couple of days ago.. I do not have redefined any worf-mode keys ins this scenario.

Take this simple structure of a org file:

* Testing A
   ** Testing a
   ** Testing b
* Testing B

go to *** Testing A** headline press i to fold it and hit a (wspecial-worf-add) to insert a new heading below. The result looks like this:

bildschirmfoto_2017-09-30_17-04-03

The command inserts the heading after **Testing b, is this a bug?

When I hit c (change mode) + a it works without problems. This are my settings for blank lines in org-mode.

(setq org-blank-before-new-entry
        '((heading . auto)
          (plain-list-item . auto)))

I commented them out but it does not help.

Regards
Thorsten

worf-backward gets to bolded text instead of headline

Hi.

It seems that the regex for getting back to a headline fails when there's a line that contains only bolded text.

For example, consider the following text:

*** Headline
*Bolded text*
- Line 1
- Line 2.

When the point is on line 2 and worf-backward is executed, the point moves to the bolded text instead. The expected behaviour would be getting to the headline, I think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.