How can I speed up Emacs DocView mode? - emacs

I'm using a fairly standard install:
Ubuntu 12.04 LTS (installed less than a week ago)
GNU Emacs 24.1
And when I open a PDF file in Emacs, it's terribly slow. There's a 2-3 second delay when simply scrolling with the mouse, 1-2 second delay when using n, p, C-p, C-n, etc.
This is with a 20-page doc. With a 50-page doc like this one, Emacs becomes unusable (constant freezing), so the problem gets worse with document size.
How would I go about fixing this?

When I ran emacs -Q, the problem went a way. I isolated it to this line in my .emacs.d/init.el file:
(global-linum-mode 1)
If I comment that out and restart Emacs, I can scroll on PDFs and I get no UI delay whatsoever. If I turn it back on with M-x global-linum-mode, the long lag between mouse scroll and UI update comes back.

To disable linum-mode when you are in DocView mode, you can use the following setup file:
setup-linum.el
You can customize by editing line number 5

Related

cursor size emacs installed through guix

I have an Arch-linux system and I just installed guix. Using Guix, I installed emacs. When I use the pacman-installed emacs all is well but when I use the guix-installed emacs, the mouse cursor gets really small every time the mouse hover over the emacs window.
I have an hidpi screen which should be the cause but I don't know why the mouse does not recognize the dpi of the system when using guix-installed emacs.
emacs version is 28.1 (same as the system-wide version of emacs)
I use i3 wm
EDIT: I did the test and the problem does not happen when I use sway (Wayland wm) instead of i3. I guess this is a problem between Xorg and guix.
I'm on Debian and I have the same issue as you. I've tried the regular ways to increase cursor size like setting Xcursor.size in ~/.Xresources, but to no avail. Then, I realized that Guix set a XCURSOR_PATH. My fix was to set XCURSOR_PATH manuall in .xinitrc to both the path from Debian and Guix:
export XCURSOR_PATH=/usr/share/icons/:/home/munen/.guix-profile/share/icons

emacs 24 c++ auto-indentation broken

I'm running Emacs 24 on Ubuntu 10.04, coding c++ in the default c++ environment. Periodically after a while coding, my indentation engine seems to break -- pressing "tab" to indent places places any line at the beginning of the line. Selecting the entire buffer result in the entire buffer being un-indented. This problem effects all buffers, current or later opened. So far the only way I have found to repair it is the (highly inconvenient) step of restarting emacs. Is there another way to reboot my indentation engine? Attempting to load different indentation styles does not fix the problem.
Have you read this thread?
http://lists.gnu.org/archive/html/help-gnu-emacs/2012-09/msg00216.html
It sounds like you can fix your problem by updating cc-mode.
I see the same with 24.3 but I found that closing and re-opening the affected buffer also solves the issue.
This is a recurring issue on my system (Emacs 24.3 x86_64 Red Hat Linux) and could possibly be a bug introduced in Emacs 24 judging from the link posted by event_jr.
I encounter the issue fairly often and usually resolve it by reloading whatever buffer I'm working in:
M-x revert-buffer RET yes RET
This way you don't have to close neither buffer nor Emacs.
I found unbalanced preprocessor directives (#ifdef etc) can throw it into this sort of behaviour

How to Save all edited-situations and resume all the situations from the last time when opening Emacs again

I learned that to add those codes in .emacs can make Emacs saves automatically all situations before quitting and start it next time, Emacs can show the last situation and go on editing it.
(load "desktop")
(desktop-load-default)
(desktop-read)
(add-hook 'kill-emacs-hook
'(lambda()(desktop-save "~/")))
but this codes makes a problem that you only can open one Emacs, when you want to start another Emacs at the same time, only the previous one can run.
I want the function saving all situations for the next use, but I also need to start one more Emacs, How can I get the two sides work simultaneously?
Thank you for your help. I am waiting......
Use different desktop files; or use emacsclient instead of emacs to start new editing buffers once you have your main Emacs up and running. There are multiple examples in Google of an emacs alias / function / whatever to start Emacs if it is not running, and otherwise run emacsclient.

Emacs 23 on Ubuntu - menus between Tools and Help are broken

I have used succesfully used for some time
GNU Emacs 23.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.0)
on Ubuntu 9.10. With all kinds of plugins and additions.
Now I have installed a completely new Ubuntu, that's 11.04, and I installed most of the emacs and related emacs plugins with apt-get.
This is what I have installed.
i A emacs23 - The GNU Emacs editor (with GTK+ user interface)
i A emacs23-bin-common - The GNU Emacs editor's shared, architecture dependent files
i A emacs23-common - The GNU Emacs editor's shared, architecture independent infrastructure
v emacs23-gtk -
i A emacsen-common
And my version now is:
GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4)
of 2011-04-04 on crested, modified by Debian
The problem is, that on when I enter any mode (css, sgml, org, sql, c, text, etc), whatever menus I have between Tools and Help do not show. So the main menu item shows (like SQL in sql mode), but when I mouseover it, it does not contain any items.
First, I thought is one of the *.el files I have in my .emacs.d or I blame it on pymacs rope ropemode ropemacs etc. But then I deleted all from my .emacs file and my .emacs.d folder and I have the same strange thing.
What is extremely weird, is that sometimes, I don't know how, when I start emacs, the problem is gone. This is like one in 50 tries. I first thought I did something (like when I uninstalled magit), and blame it on that. But then I closed and opened my emacs again, without modifying anything and the menus were broken again.
No that I installed back my .emacs .emacs.d and my plugins, since it's not their fault, I have for example on scratch buffer a Lisp-Interaction menu beginning with "Complete Lisp symbol" and then a YASnippet empty menu.
If I switch to a .py file, the first menu after the Tools menu is IM-Python, which in fact has the sub-menu items that Lisp-Interaction menu has. So when I hover on IM-Python I get "Complete Lisp Symbol", "Indent-or-Pretty print", etc. and then the rest of menus Python, Yasnippet, Rope are empty. And the last menu, Help, is good again.
I really don't know what should I try more, or how to go further and debug, I've been fighting with it for hours.
PS: oh yeah, so now I discovered an answer on stackoverflow for a similar issue, so when I hit F10 (menu-bar-open) the menu fixes, the submenu items appear correctly.
But when I open a new file and want to use the menu again, it's broken and have to hit F10 again and it works. So it's not so bad after all :) but anyway, if you have a clue please let me know.
Thanks,
Stefan
Try and duplicate the issue with a plain-vanilla emacs. To do that, startup emacs like this:
$ emacs -q --no-site-init
It should work as expected. If it does, then make a copy of your .emacs file and in the copy, delete half of it, then restart emacs normally. If the problem is there, then cut down your .emacs by half again; if it's not there, startup with the other half of the original .emacs file. Lather, rinse, repeat until you find the offending code that mucks everything up.
If it does not work when emacs -q --no-site-init is called, then there's something wonky going on in the interaction between your emacs binary and the window manager, which will be a lot tougher to track down.

Emacs mouse focus stuck in one frame

Twice in the past two days, I've had a problem with my emacs sessions. Somehow emacs is keeping the focus within one frame. So, if I mouse over another frame and click in it, the cursor in the new frame stays put and the cursor in frame 1 moves as if I clicked in the corresponding position in it. Same happens with mouse-wheel scrolling. But not keyboard input.
Killing the hogging frame just causes another frame to become the hoarder.
My solution yesterday was to quit and restart emacs.
Some googling pointed me towards the variable focus-follows-mouse, but that appears to be set correctly (i.e. "t").
Any ideas what caused it and how to reset it?
(I'm using Ubuntu intrepid's package of emacs 22.2-0ubuntu2.)
I have
(setq focus-follows-mouse t)
(setq mouse-autoselect-window t)
in my .emacs file, and find that this makes focus follow mouse work correctly. Maybe there's something else in your config that's changing emacs' behaviour, do you have your elisp in version control? Can you identify when this started happening, and look at changes to your elisp around then ?
Try starting emacs with --no-init-file and seeing if the undesired behaviour persists.
I have discovered that switching to another tty (eg crtl-alt-1) then back to whatever tty you were on before will reset your focus.
Not a general solution, but at least you don't have to kill X (which is what I've been doing until now).