alphapapa / org-rifle

Rifle through your Org-mode buffers and acquire your target
GNU General Public License v3.0
499 stars 30 forks source link

Strange characters in buffer after find-files-raw #24

Open adam52 opened 6 years ago

adam52 commented 6 years ago

The Find-files-raw branch is lightning fast, which I absolutely love! Unfortunately, once a selection is made, the resulting buffer forgets about the UTF-8 coding system.

alphapapa commented 6 years ago

Hi,

I'm glad you discovered that experimental branch and are finding it useful. As you can see, I haven't touched it in about a year.

Looking at the code, when a search result is selected, the buffer should be reverted, which should reload the file from disk and activate org-mode. There shouldn't be any artifacts of fundamental-mode left over.

If this is not in fact happening, then it would seem to be a bug. I'm not sure how much support I can offer for this branch at this time, but if you want to help debug it, please provide some more info, like:

Thanks.

adam52 commented 6 years ago

Sure, here you go!

Emacs version 25.3.3 Org-mode 9.1.9

Here are the settings in my init.el file:

(add-to-list 'load-path "~/.emacs.d/lisp/helm-org-rifle")

(require 'helm-org-rifle) (global-set-key (kbd "C-c h r") 'helm-org-rifle-org-directory)

And then I just hit C-c h r (helm-org-rifle-org-directory) and select the desired entry. Once the org buffer loads, I see the artifacts...

Best, -Adam

On 16 Apr 2018, at 19:55, alphapapa notifications@github.com wrote:

Hi,

I'm glad you discovered that experimental branch and are finding it useful. As you can see, I haven't touched it in about a year.

Looking at the code, when a search result is selected, the buffer should be reverted, which should reload the file from disk and activate org-mode. There shouldn't be any artifacts of fundamental-mode left over.

If this is not in fact happening, then it would seem to be a bug. I'm not sure how much support I can offer for this branch at this time, but if you want to help debug it, please provide some more info, like:

Emacs version Org version Exact, command-by-command, keypress-by-keypress reproduction steps Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alphapapa/helm-org-rifle/issues/24#issuecomment-381711402, or mute the thread https://github.com/notifications/unsubscribe-auth/ABONSTQjlRDu4SVB7-TnnenvA_BvKPRTks5tpOkUgaJpZM4TB5EQ.

alphapapa commented 6 years ago

What happens if you eval (revert-buffer nil t) in the Org buffer that has the artifacts (using M-:) ?

adam52 commented 6 years ago

Nope, same issue.

If it helps, here is a screenshot of some R code in a Babel block (what it normally looks like)

And here is the same code block after navigating to the document with rifle:

On 16 Apr 2018, at 23:59, alphapapa notifications@github.com wrote:

What happens if you eval (revert-buffer nil t) in the Org buffer that has the artifacts (using M-:) ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alphapapa/helm-org-rifle/issues/24#issuecomment-381776169, or mute the thread https://github.com/notifications/unsubscribe-auth/ABONScSknOyOl-CbcaDe34MhICwHuVc0ks5tpSJLgaJpZM4TB5EQ.

alphapapa commented 6 years ago

I don't think the pictures came through the email.

adam52 commented 6 years ago

Ah, sorry. Let's try that again. Here it is if I navigate to the file through Emacs:

with-utf8

and here it is if I navigate using helm-org-rifle (raw version).

without-utf8

alphapapa commented 6 years ago

Okay, so if you are looking at the second screenshot and run revert-buffer, what does it look like after that?

adam52 commented 6 years ago

revert-buffer had no effect. But I found that running toggle-enable-multibyte-characters worked...

alphapapa commented 6 years ago

Ok, please try this: in one of the raw buffers, eval (revert-buffer-with-coding-system nil t). It looks like that might correctly reset the coding system.

adam52 commented 6 years ago

Nope. No effect.

adam52 commented 6 years ago

Running M-: (set-buffer-multibyte t) works for me...

alphapapa commented 6 years ago

Hmm, I'm not sure what's going on here. According to the manual, revert-buffer-with-coding-system should work. And I'm not sure that set-buffer-multibyte is the correct or safe thing to do in all cases. I'll have to look into it when I have more time. Thanks.