hsitz / VimOrganizer

VimOrganizer is partly a clone of Emacs' Org-mode, and partly a front end to Org-mode itself. Do Org in Vim.
http://vimeo.com/31531308
518 stars 67 forks source link

Provide patch for vim 7.4 #63

Open vlcinsky opened 10 years ago

vlcinsky commented 10 years ago

Recently (by end of August 2013), vim version 7.4 was released and is included e.g. in Ubuntu 13.10.

Current contrib directory provides patches only for older versions 7.3 and 7.2.

Vím version 7.4 for sure does not highlight properly folded headers, so the patch is needed.

Please, provide patch for vim 7.4, so that I can use this excellent tool without swallowing a bullet and switching to emacs.

hsitz commented 10 years ago

On Mon, Oct 28, 2013 at 10:43 AM, Jan Vlčinský notifications@github.comwrote:

Vím version 7.4 for sure does not highlight properly folded headers, so the patch is needed.

Please, provide patch for vim 7.4, so that I can use this excellent tool without swallowing a bullet and switching to emacs.

Jan -- Okay, okay, your request will get me off my butt to get a fold highlighting patch for 7.4. Sorry I haven't gotten to it yet, haven't even loaded Vim7.4 on my machine and I'm not doing much work on VimOrganizer. But I'll get to it either today or tomorrow, or die trying. ;)

Regards,

Herb

vlcinsky commented 10 years ago

Hi Herb You are really quick. Meantime, I managed to get vim 7.3_390 (tagged v7-3-390 in repo), applied existing patch, compiled, installed - and now it highlights in gvim. The difference is really big one.

So - in case you would by dying trying - stop it, there are more important things to do today or tomorrow.

Patch for 7.4 is still welcome.

Spending couple of hours on vimorg I have to admit, this is real piece of work - awesome. Thanks for that.

Are you still using it for your task management and note taking? Getting excited about a new solution is one thing (articles about perfect GTD tools are countless, but they most often lack any sign of continuation), but using it (and maintaining) in long term is what really counts. I got feeling with vimorg it is the second way.

hsitz commented 10 years ago

On Mon, Oct 28, 2013 at 12:00 PM, Jan Vlčinský notifications@github.comwrote:

So - in case you would by dying trying - stop it, there are more important things to do today or tomorrow.

Yes, was just kidding about "dying trying". Main problem may just be getting instance of Vim compiled on my new machine; I use Windows and getting Vim compiling nicely on Windows is not always fun. . . . But I'll give it a go. -- Herb

vlcinsky commented 10 years ago

Hi Herb. My vim 7.3 gets freezing with existing patch applied. Vim without the patch works well. (64-bit Ubuntu 13.10 on Zenbook)

Use of vimorg without your nice highlighting addition is ... not very convenient.

Meantime I have checked emacs, installed it, studied org-mode - it is very well documented, all seems functioning, so I am currently using org-mode under emacs. But it really hurts. All my kung-fu trics and habits from vim are clashing with something in emacs - and this is not only about not being used to that, but unnecessary complexity of all the keystrokes - uaaaa.

I appreciate your heroism compiling Vim under Windows. If you succeed, you will get my appreciation.

hsitz commented 10 years ago

On Mon, Nov 4, 2013 at 5:48 AM, Jan Vlčinský notifications@github.comwrote:

Hi Herb. My vim 7.3 gets freezing with existing patch applied. Vim without the patch works well. (64-bit Ubuntu 13.10 on Zenbook)

Not sure what to say there, haven't had any reports of bugs with properly applied patch before and haven't experienced any myself. The patch itself is quite simple.

I thought you had previously reported that the patch for v7.3.390 was working for you. Do you have steps to reproduce the "freeze"? Also, a freeze sounds strange if there's an error with the patch, I would have expected a crash to desktop. I wonder whether you have some problem with the plugin code itself, in which case ctrl-C should break any infinite loop that's happening in Vimscript.

Meantime I have checked emacs, installed it, studied org-mode - it is very well documented, all seems functioning, so I am currently using org-mode under emacs. But it really hurts. All my kung-fu trics and habits from vim are clashing with something in emacs - and this is not only about not being used to that, but unnecessary complexity of all the keystrokes - uaaaa.

If you;re going to make major use of Org-mode then using Emacs is the best option. (I sometimes open .org files in Emacs and sometimes in Vim.) The EVIL vim-emulator in Emacs is not bad, won't quite feel like Vim but at least you can use many of Vim's keystrokes. If you're going to be using Org-mode you would want to extend EVIL with VimOrganizer-like key combinations for Org functions you use. See this post in org-mode newslist as well as the two later messages in the thread: http://thread.gmane.org/gmane.emacs.orgmode/52815

-- Herb

vlcinsky commented 10 years ago

Thanks Herb for your great tips. I found, that working a while in emacs is really spoiling my productivity in vim and other vim-like environments (vimperator in Firefox, shortucts in GMail...).

Regarding the patch: when I applied that, I was happy it works. But when I was using it a bit more, it occasionally got stuck and I was unable to do any Ctrl-C or so. I was happy to kill it by killall gvim.

I searched for some tool for organizing my (mostly GTD influenced) notes and during this search I got couple of dreams for best solution. org-mode is fulfilling more then I was dreaming of, so I am thinking, how to go on. I want to be productive.

Your VimOrganizer provides nice features, as you say, it is "pretty usable". But I got some problems with using agenda (generated agenda was not regenerating but being appended to the end repeatedly).

I shall properly describe and report these two bugs, but I am getting into hard period of my year, where I am lacking any reserves, so it has to go to my existing notes into Someday part and I shall hope to get back to that in foreseeable future.

vlcinsky commented 10 years ago

EVIL vim-emulator is great relief.

And keymappings for it from your link too. Thanks a lot.

hsitz commented 10 years ago

On Mon, Nov 4, 2013 at 8:36 PM, Jan Vlčinský notifications@github.comwrote:

EVIL vim-emulator is great relief.

Yes, EVIL is pretty good. I find myself getting stuck in the command-line window at bottom of screen sometimes and needing to press ctrl-G. Emacs still feels a little clunky, compared to silky smoothness of Vim, but EVIL makes it usable. (Emacs is pretty amazing, despite not having a good "feel".)

Still not sure what your issues could be with the fold-highlight patch. Have compiled on Windows and Ubuntu and not had any problem with crashing. I can't recall any reports of it having crashed, though not sure how many make use of the patch. Have tested much more heavily on Windows, but the same source files are used to compile Vim on both platforms, so I'm not seeing that as an issue either.

I wonder whether it's possible that patch is not getting properly applied. I believe the 7.3.390 patch was submitted by someone, not generated or test by me. You might check the 7.4 patch, which I included as attachment in an earlier message and which works fine for me. . . .

Regards,

Herb

vlcinsky commented 10 years ago

Hi Herb I cannot find the patch - not seeing it in this issue, not in my e-mails, not in the source code tree. Regards

Jan

hsitz commented 10 years ago

On Tue, Nov 5, 2013 at 11:44 AM, Jan Vlčinský notifications@github.comwrote:

Hi Herb I cannot find the patch - not seeing it in this issue, not in my e-mails, not in the source code tree. Regards

Hmm, shows up for me as having been included in October 29 email. Attached here again.

vlcinsky commented 10 years ago

It seems that GitHub does not allow attaching files to issues (only images are allowed to be pasted into report).

See: http://stackoverflow.com/questions/10963205/how-to-attach-file-to-a-github-issue

What about creating a branch and adding that patch into source tree?

Jan

hsitz commented 10 years ago

On Tue, Nov 5, 2013 at 12:51 PM, Jan Vlčinský notifications@github.comwrote:

It seems that GitHub does not allow attaching files to issues (only images are allowed to be pasted into report).

See: http://stackoverflow.com/questions/10963205/how-to-attach-file-to-a-github-issue

What about creating a branch and adding that patch into source tree?

Ahh, that explains it. Thanks.

I just pushed the file up to main repo on github. Hopefully it won't have the problem you experienced with 7.3.390, but let me know . . .

vlcinsky commented 10 years ago

Hi Herb I took the patch from source tree and tried to apply it. But I got into problems.

I do not have much skills with applying patches (the 7.3 patch was the first one I have ever applied).

Comparing the previous patches with existing one I found following differences:

I tried to modify the patch - changed "\" to "/" and changed directory names. Anyway, it was still asking for a file to patch::

$ patch < ../patch/vim74_foldhighlight.patch                           
can't find file to patch at input line 4
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -u src/eval.c src-changed/eval.c
|--- src/eval.c Fri Jul 05 09:23:42 2013
|+++ src-changed/eval.c Tue Oct 29 13:58:08 2013
--------------------------
File to patch: 

Then, I made new try:

  1. for vim I took tag v7-4 (no patches applied)
  2. I took the patch as it was found in your repo and applied it assigning files to change manually.

Result is not good, even though vim runs and does not seem crush (after short use, no extensive testing), but folds are not highlighted.

I would propose following steps:

  1. specify exact tag/commit, to which shall be the patch applied
  2. if possible, modify the patch to apply without asking what to modify (but this is not so big problem).

Jan

hsitz commented 10 years ago

On Wed, Nov 6, 2013 at 2:16 PM, Jan Vlčinský notifications@github.comwrote:

Hi Herb I took the patch from source tree and tried to apply it. But I got into problems.

Jan -- You should be able to apply the patch by putting it in the same directory as the files you want to apply it to, then issue command:

patch -p1 --verbose -i [name of patch file]

The verbose will result in information about how the patch worked.

The Vim74 patch is for the main downloadable version at vim.org ( http://www.vim.org/download.php ). I believe this version is 7.4.000 . There have been subsequent patches but as far as I know no official incorporation of them into a Vim release

The patch files will usually work with later versions of the Vim source code, but you would want to check verbose output of the patch command to verify this. I will change 7.4 patch to indicate it was made from 7.4.000 source, but it likely works with later revisions.

Hope that helps,

Herb

I do not have much skills with applying patches (the 7.3 patch was the first one I have ever applied).

Comparing the previous patches with existing one I found following differences:

  • unknown commit/version of vim to apply the patch to. This could be core of the problem
  • source and target directories do differ in patches - I had to enter files to be modified manually.
  • later patch (for 7.4) is using backslash as directory separator.

I tried to modify the patch - changed "\" to "/" and changed directory names. Anyway, it was still asking for a file to patch::

$ patch < ../patch/vim74_foldhighlight.patch can't find file to patch at input line 4 Perhaps you should have used the -p or --strip option?

The text leading up to this was:

|diff -u src/eval.c src-changed/eval.c |--- src/eval.c Fri Jul 05 09:23:42 2013

|+++ src-changed/eval.c Tue Oct 29 13:58:08 2013

File to patch:

Then, I made new try:

  1. for vim I took tag v7-4 (no patches applied)
  2. I took the patch as it was found in your repo and applied it assigning files to change manually.

Result is not good, even though vim runs and does not seem crush (after short use, no extensive testing), but folds are not highlighted.

I would propose following steps:

  1. specify exact tag/commit, to which shall be the patch applied
  2. if possible, modify the patch to apply without asking what to modify (but this is not so big problem).

Jan

— Reply to this email directly or view it on GitHubhttps://github.com/hsitz/VimOrganizer/issues/63#issuecomment-27919330 .

chrisbra commented 8 years ago

What exactly does the patch do? Can you show a screenshot please?

TheBigBear commented 8 years ago

@chrisbra, a patch is a text file, just read it. ;-) BTW this is an old and dead thread/issue from back in Nov 2013 ??? Herb you should probably close this issue as it worked for you (and others) at the time.

hsitz commented 8 years ago

On Mon, Jun 6, 2016 at 12:45 PM, Christian Brabandt < notifications@github.com> wrote:

What exactly does the patch do? Can you show a screenshot please?

Christian -- I don't have screenshot and don't actually have working version at the moment (switched to Emacs/Orgmode/Evil).

But the patch creates what I call "level dependent fold highlighting". With basic Vim the collapsed headings in an outline are the same highlight group, regardless of what level they are. So if you had an outline collapsed to show only headings, no text, it would all be the same color.

With the patch the collapsed headings will be the same color as the same color as the uncollapsed heading text, but bolded, to provide visual cue that it's folded. So if you had an outline collapsed to show only headings, no text, each of the headings would retain the original color to help provide visual cue of the heading level (instead of a mass of headings of different levels all being the same color).

Also, if a heading has a todo item in it (e.g., TODO, DONE, CLOSED, etc.) when folded that TODO item will have the proper highlight applied, instead of being same color as all the folded text. So you can collapse an outline structure to show only headings, and the TODO's, DONE's, etc., will still pop out at you.

hsitz commented 8 years ago

On Mon, Jun 6, 2016 at 1:13 PM, TheBigBear notifications@github.com wrote:

@chrisbra https://github.com/chrisbra, a patch is a text file, just read it. ;-) BTW this is an old and dead thread/issue from back in Nov 2013 ??? Herb you should probably close this issue as it worked for you (and others) at the time.

BigBear -- Christian's an accomplished programmer, not sure why he's looking at this now, but I'm sure knows what a patch is. I"m not really an accomplished programmer, in fact this patch is about the only thing I've ever done in C. I was surprised how easy it was, though, and thought it was a nice feature, but never made a push to get it adopted into main Vim codebase. I'm sure it would have needed a few tweaks for that, but I don't think it would have been that hard to do.

chrisbra commented 8 years ago

thanks. The reason I asked is, I am wondering whether it is worth submitting upstream. I wondered if I should update the patch and submit it, however I don't know, if it is considered generally useful.

It needs documentation however and a test would be good as well. But before I consider writing those, I asked here first.

TheBigBear commented 8 years ago

@chrisbra sorry had a rubbish day at work and took it out on you. sincere apologies, should have not responded, or taken time to first look you up.

chrisbra commented 8 years ago

@TheBigBear no problem and a great move to apologize!

hsitz commented 8 years ago

On Mon, Jun 6, 2016 at 1:21 PM, Christian Brabandt <notifications@github.com

wrote:

thanks. The reason I asked is, I am wondering whether it is worth submitting upstream. I wondered if I should update the patch and submit it, however I don't know, if it is considered generally useful.

It needs documentation however and a test would be good as well. But before I consider writing those, I asked here first.

Ah, well, although fairly simple it was a bit of a kludge, and the patch isn't really "self contained". That is, it requires the proper logic in OrgFoldText() function to (1) check if current Vim is a patched Vim (in which case v:foldhighlight and v:todohighlight variables exist), and if so, dynamically alter their values to change the highlighting for the current folded line that's being rendered. In other words, in the main Vim C code there is only a single variable for folded heading highlight (and for todo heading highlight), which is altered on the fly in the OrgFoldText() function as the folded lines are drawn. You can find this piece of code at the bottom of the OrgFoldText function in /ftplugin/org.vim.

hsitz commented 8 years ago

On Mon, Jun 6, 2016 at 1:16 PM, Herbert Sitz hesitz@gmail.com wrote:

With the patch the collapsed headings will be the same color as the same color as the uncollapsed heading text, but bolded, to provide visual cue that it's folded..

Actually, that didn't sound quite right to me, and taking a second look the case is a little different. In VimOrganizer there are nine highlight groups that set highlights for headings (OL1 .. OL9). For the folded headings there are nine corresponding highlight groups (OL1Folded .. OL9Folded). I think by default the script would automatically set the FOLDED set to be the same as the regular set, but with bold. But the user could set the FOLDED set to be something entirely different. In any case, it's the OLxFOLDED highlights that are used to render the folded heading text.