nibrahim / Hyde

An Emacs mode to manage Jekyll blogs
http://nibrahim.net.in/2010/11/11/hyde_%3A_an_emacs_mode_for_jekyll_blogs.html
GNU General Public License v3.0
117 stars 28 forks source link

Replacing cd command with cd elisp function #5

Closed copyninja closed 12 years ago

copyninja commented 12 years ago

Command was failing in zsh which is my default shell with following error

*zsh:cd blog path no such directory*

If patch looks ok to you please consider pulling it :-)

nibrahim commented 12 years ago

Can you describe your setup where the error you've mentioned occurred? I'd like to reproduce it and to validate that your fix solves the problem.

copyninja commented 12 years ago

On 00:34 Sun 24 Jun , Noufal Ibrahim wrote:

Can you describe your setup where the error you've mentioned occurred? I'd like to reproduce it and to validate that your fix solves the problem.

I've my blog setup in ~/Public/blog whenever I launch hyde and give the path even though it changes to the directory I see some message like "zsh: blog path no such directory" and git command doesn't work properly I assume because I see always my directory as uncommited even though executing git status in shell shows directory as git clean

Seeing the cd error in Messages buffer I replaced it with cd function and every thing is back to normal

Note that I use zsh and I never tried this with bash. Hope that helps

Vasudev Kamath http://copyninja.info Connect on ~friendica: copyninja@{frndk.de | vasudev.homelinux.net} IRC nick: copyninja | vasudev {irc.oftc.net | irc.freenode.net} GPG Key: C517 C25D E408 759D 98A4 C96B 6C8F 74AE 8770 0B7E

nibrahim commented 12 years ago

Interesting. Do you have a .hyde.el file? Can you send me the contents?

copyninja commented 12 years ago

On 05:44 Sun 24 Jun , Noufal Ibrahim wrote:

Interesting. Do you have a .hyde.el file? Can you send me the contents?

Here it comes but I guess its modified afterwards. In the begining it had only deploy variable

Vasudev Kamath http://copyninja.info Connect on ~friendica: copyninja@{frndk.de | vasudev.homelinux.net} IRC nick: copyninja | vasudev {irc.oftc.net | irc.freenode.net} GPG Key: C517 C25D E408 759D 98A4 C96B 6C8F 74AE 8770 0B7E (setq hyde/deploy-command "git push" ; Command to deploy hyde-posts-dir "_posts" hyde/git/remote "origin" hyde/git/remote-branch "master" )

nibrahim commented 12 years ago

Let me try this out. I'll try to reproduce the failure before I apply the patch.

If you can use edebug to figure out the exact command that is executed before the failure, I'd like to know what it is.

copyninja commented 12 years ago

On 05:57 Sun 24 Jun , Noufal Ibrahim wrote:

Let me try this out. I'll try to reproduce the failure before I apply the patch.

Sure thank you :-)

If you can use edebug to figure out the exact command that is executed before the failure, I'd like to know what it is.

Currently I'm using my fixed version of hyde also I'm noob in elisp, this was just a hack to solve my problem :-). If you can give me pointers on edebug I will try to do this in my free time

Regards

Vasudev Kamath http://copyninja.info Connect on ~friendica: copyninja@{frndk.de | vasudev.homelinux.net} IRC nick: copyninja | vasudev {irc.oftc.net | irc.freenode.net} GPG Key: C517 C25D E408 759D 98A4 C96B 6C8F 74AE 8770 0B7E

nibrahim commented 12 years ago

You open up the sources and then find the function which is printing that line. Once you do that, go into the function and do C-u C-M-x. This will (re)evaluate the function but instrument it for debugging. When you launch hyde again, it will enter a debugger when that function is invoked and you can inspect variables as you step through.[1]. Once you get the exact command line that's executed, please let me know and I might be able to get to the root of the problem. Thanks for the bug report!

Footnotes: [1] http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/edebug.html

copyninja commented 12 years ago

On 06:05 Sun 24 Jun , Noufal Ibrahim wrote:

You open up the sources and then find the function which is printing that line. Once you do that, go into the function and do C-u C-M-x. This will (re)evaluate the function but instrument it for debugging. When you launch hyde again, it will enter a debugger when that function is invoked and you can inspect variables as you step through.[1]. Once you get the exact command line that's executed, please let me know and I might be able to get to the root of the problem.

Ok that seems to be easier :-). I'm trying it out now but here is exact message what I get

zsh:cd:1: no such file or directory: ~/Public/blog//_posts [84 times] zsh:cd:1: no such file or directory: ~/Public/blog//_drafts

Not sure which function but since its coming after hyde asks me for my blog directory path I will take it as a clue.

And one more thing which came to my mind is shell-command doesn't expand ~ this is what I read in emacs docs so I guess this should be root problem?

Thanks for the bug report! Welcome :-)

Footnotes: [1] http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/edebug.html

Vasudev Kamath http://copyninja.info Connect on ~friendica: copyninja@{frndk.de | vasudev.homelinux.net} IRC nick: copyninja | vasudev {irc.oftc.net | irc.freenode.net} GPG Key: C517 C25D E408 759D 98A4 C96B 6C8F 74AE 8770 0B7E

nibrahim commented 12 years ago

And one more thing which came to my mind is shell-command doesn't expand ~ this is what I read in emacs docs so I guess this should be root problem?

nibrahim commented 12 years ago

And one more thing which came to my mind is shell-command doesn't expand ~ this is what I read in emacs docs so I guess this should be root problem?

Yes. I was about to say the same thing. Does it work if you use the full path to your blog directory instead of using the ~? Can you verify it?

copyninja commented 12 years ago

On 06:26 Sun 24 Jun , Noufal Ibrahim wrote:

And one more thing which came to my mind is shell-command doesn't expand ~ this is what I read in emacs docs so I guess this should be root problem?

Yes. I was about to say the same thing. Does it work if you use the full path to your blog directory instead of using the ~? Can you verify it?

Yes it works! I had tried it before but I forgot to mention this. Only after trying it before I thought of using cd command instead.

Vasudev Kamath http://copyninja.info Connect on ~friendica: copyninja@{frndk.de | vasudev.homelinux.net} IRC nick: copyninja | vasudev {irc.oftc.net | irc.freenode.net} GPG Key: C517 C25D E408 759D 98A4 C96B 6C8F 74AE 8770 0B7E

nibrahim commented 12 years ago

Alls well that ends well. I'll apply the patch. Thanks for your time. :)

copyninja commented 12 years ago

On 06:35 Sun 24 Jun , Noufal Ibrahim wrote:

Alls well that ends well. I'll apply the patch. Thanks for your time. :)

No problem. Its my pleasure :-).. Looking forward to meet you during Pycon

Vasudev Kamath http://copyninja.info Connect on ~friendica: copyninja@{frndk.de | vasudev.homelinux.net} IRC nick: copyninja | vasudev {irc.oftc.net | irc.freenode.net} GPG Key: C517 C25D E408 759D 98A4 C96B 6C8F 74AE 8770 0B7E

nibrahim commented 12 years ago

I've incorporated the date front matter patch but used expand-file-path instead of the native cd since I wanted to keep everything in a single transient subprocess. The merge commit is 32063d9710c20262f3d202cbd927f322288a4c4d.

copyninja commented 12 years ago

In a way that is good to use cd command. Because some time I noticed that after using Hyde and closing it emacs still refers to my blog directory as I used native cd command :-)

nibrahim commented 12 years ago

You prefer that the default directory change? I'd rather that that didn't happen. It's disorienting.

copyninja commented 12 years ago

No I didn't notice it first but later I came to know side affects of using native cd. I'm with your way may be If you had not done the change I would have raised another pull request ;-)