Closed DrWaleedAYousef closed 11 months ago
I'm also experiencing this problem, both on Ubuntu 20.04 using the Snap-installed Emacs 28 native comp. and MacOS Catalina using the Brew-installed Emacs 28 native comp.
Also, the PDF buffer tends to crash Emacs on MacOS when I try to interact with it once it is open, e.g. by attempting to scroll through it with the mouse, but I am unsure as to whether or not this is a separate issue.
Did run into the same issue this week, I will check this later.
I never had the problem that pdf-tools did not start, but I have run into the 'can not encode buffer pop-up' problem also. I have posted a solution already here. So, for me the solution is to deactivate git-gutter-mode
in the pdf-buffer. I guess we could add a fix by deactivating git-gutter-mode
by default in the pdf buffer.
Strange, I was not able to get this issue on my linux box. However I have now added some code to not activate git-gutter-mode
in pdf-view-mode
, can you double check whether this solves the encoding issues?
The auto start issue I cannot reproduce, on my side I am always getting pdf-view-mode
activated when I open a PDF file.
Can you post the value of pdf-view-mode-hook
without your fix? In my case I see the following:
pdf-view-mode-hook is a variable defined in pdf-view.el.
Value
(pdf-view-restore-mode
pdf-tools-enable-minor-modes)
View as literal Set
Documentation
Hook run after entering PDFView mode.
I only get this issue with a PDF that I created using the newest version of latex.
Anyway, unfortunately the problem is not yet completely fixed because I now get a message
Error running timer ‘git-gutter:live-update’: (wrong-type-argument arrayp nil)
And here is the backtrace produced by that error:
Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
substring(nil 0 1)
file-truename(nil)
git-gutter:live-update()
apply(git-gutter:live-update nil)
timer-event-handler([t 0 2 0 t git-gutter:live-update nil idle 0])
The error does not show up when I disable global-git-gutter-mode
first.
(Note, that this error only occurs in this particular PDF created with the newest latex version)
Now the message, although ugly, is not such a big deal, but somehow the global-git-gutter-mode
(or the timer) also causes pdf-view-mode
to open in emacs-state
, which of course is annoying.
So I guess, we should first try to disable that timer (which gets initialized in git-gutter-mode
), and then see if that prevents pdf-view-mode
to open in emacs-state
(for PDFs created with the newest latex).
For the mode-activation problem, why it only happens with the org mode enabled
For the encoding problem, it happens with any PDF file, whether created with latex or not
@DrWaleedAYousef Thanks for the feedback, but could you respond to @smile13241324 his questions. Also, did you try if deactivating git-gutter-mode
(manually) solves the 'encoding popup' problem? Otherwise, maybe you could gather more info about it by following the advice in this answer.
Both @smile13241324 and I could not reproduce the problem of the org layer preventing pdf-tools to start, so it is quite difficult to guess (what and) why it happens only with org mode.
Thanks @dalanicolai and @smile13241324 . Related to your questions, there are some updates:
(add-hook 'pdf-view-mode-hook 'pdf-tools-enable-minor-modes)
it seems that this problem is gone by itself as well!! Whether I keep this in the dotfile or not the pdf-tools starts. However, it starts in the emacs state. Even when I press Ctr z
, the evilified yellow color of the normal state appears but with no effect on the keybindings (e.g., j
and k
for navigation).I hope this helps.
The issue of pdf-view starting in emacs-state
seems to get triggered by the first form, i.e. (pdf-tools-install)
, in the :config
section of pdf/init-pdf-tools
, but this happens only when the version control layer is installed.
Additionally, there is the error message from the timer which is started by 'git-gutter-mode' (I guess git-gutter-mode
gets disabled 'locally' via a hook, but then the timer already got triggered by the initial activation of git-gutter-mode, I did not check this, it is just a hypothesis). This error is of minor priority, because it seems to do no harm other than triggering the error message. I don't know a straightforward way to deactivate the timer (e.g. via a hook), so I guess this should get fixed in git-gutter-mode
itself.
Anyway, there are two reasonable temporary workarounds:
(pdf-tools-install)
form in pdf/init-pdf-tools
@DrWaleedAYousef sounds like you have synced (git pull/reinstalled) Spacemacs, bugs generally don't fix themselves :) Thanks for the feedback of course!
I commented out the version-control layer; yet, the pdf starts in emacs-state.
Regarding the self-update, yes I have the following script to update the packages and spacemacs:
emacsclient -e '(kill-emacs)'
emacs --daemon -f configuration-layer/update-packages
emacsclient -e '(kill-emacs)'
cd .emacs.d
git pull --rebase
emacs &
Now, after weeks of working, I can confirm the following:
The inconsistency makes it hard to reproduce. I never reproduced it actually.
The inconsistency makes it hard to reproduce. I never reproduced it actually.
Ok, I will try to keep an eye and debug then report here. Please leave the issue open.
I know it is too early, because I need to experiment for a relatively long period to confirm my observation, but this is just to keep you in the loop:
Since I posted above (so, I am experimenting now for 4 days) I disabled the org
layer from the .spacemacs
. Everything is working great, with full pdf-view
functionality as expected!f
I have created a fix upstream for pdf-view
starting in normal-state
. The issue about the coding system message is due to git-gutter-mode
getting activated somehow. I am not sure if that should have been fixed, I can not find a commit about it, but on the other hand things seem to work fine here. I will probably create an upstream fix for that also anyway (just I have no time now). I guess you will automatically get notified when I create the upstream fix there also.
Then there is one error left which is Emacs erroring with Error running timer ‘git-gutter:live-update’: (wrong-type-argument arrayp nil)
(not reported here). It seems that that error is due to some misconfiguration in Spacemacs.
well just use diff-hl then.
Funny that it shows every push --force
here...
As you find in the links above, both upstream fixes have been merged so that the issues mentioned here should have been solved (and the issue can be closed).
The glitches that I mentioned are solved except launching the pdf-tools modes when opening a pdf. Every once and then it does not open.
On May 3, 2022, at 4:46 AM, Daniel Nicolai @.***> wrote:
As you find in the links above, both upstream fixes have been merged so that the issues mentioned here should have been solved (and the issue can be closed).
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
except launching the pdf-tools mods
what do you mean by mods?
Sorry: mode
On May 3, 2022, at 3:17 PM, Lucius Hu @.***> wrote:
except launching the pdf-tools mods
what do you mean by mods?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
This is a situation where the minor modes are not set correctly:
If the latex layer is setup with latex-view-pdf-in-split-window t
and there is no buffer yet that displays the PDF for a tex file, so that SPC m v
has to create a new buffer, then some minor modes appear to be missing and the leader key does not work.
Everything is fine if the PDF is open in some other buffer. In the first case find-file-noselect
creates a new buffer, in the second case some existing buffer is reused, see source.
It is also fixed by (add-hook 'pdf-view-mode-hook 'pdf-tools-enable-minor-modes)
in the user-config
.
@manuelbb-upb I read the linked upstream issue and it seems to be fixed there. Do you still see the same bug in Spacemacs (after updating pdf-tools)?
@manuelbb-upb I read the linked upstream issue and it seems to be fixed there. Do you still see the same bug in Spacemacs (after updating pdf-tools)?
For me, the only remaining bug is that the pdf-tools-enable-minor-modes
sometimes does not launch automatically. It requires calling it, then re-open the pdf!
@manuelbb-upb I read the linked upstream issue and it seems to be fixed there. Do you still see the same bug in Spacemacs (after updating pdf-tools)?
Yes, the leader key bug in that private layer appears to be fixed now.
However, the linking to this issue was rather by accident (as I wrongly thought the bugs to be related). Sorry!
I still use the add-hook
fix to enable all minor modes otherwise.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
Description :octocat:
pdf-tools
mode does not start when opening a pdf, unles there is this line in.spacemacs
:I traced the problem, it only happend when the
org
layer is loaded.When scrolling a pdf file, the following buffer always appears (also, attached as an image for clarity)
Reproduction guide :beetle:
Observed behaviour: :eyes: :broken_heart: explained upfront
Expected behaviour: :heart: :smile: <>
System Info :computer:
Backtrace :paw_prints: