Emacs Tpu-edt emulation scrolling margins startup - emacs

Can anyone help me get scrolling margins enabled automatically when I start emacs with tpu-edt emulation?
Currently, my _emacs file (WinXP) contains the line:
(setq term-setup-hook 'tpu-edt-on)
I find TPU works great, and I can manually supply the command
M-x tpu-set-scroll-margin
It then prompts me for the top and bottom parameters, and works fine when I supply them.
I tried adding the example line from the tpu-extras.el file into the _emacs file:
(tpu-set-scroll-margins "10%" "15%")
but I get the message:
Symbol's function definition is void: tpu-set-scroll-margin
Help! Scrolling margins are the best feature of all time, and I want them always on!

Aside from the typo question raised by #sanityinc (still open --- you cite the name without s twice and with s once), it's likely that you need to invoke that code when you are in the proper mode. For example, if the mode in question is named tpu-edt-mode, then you do do something like this:
(add-hook 'tpu-edt-mode (lambda () (tpu-set-scroll-margins "10%" "15%")))

Related

emacs and dictionary.el

I installed emacs 24.1 and dictionary.el, which is a dictd client plugin for emacs. I am able to look up dictionary within command "dict xxx", it works just fine.
However, dictionary.el doesn't work correctly, whenever I use "M-x dictionary-search" to find something, minibuffer displays "dictionary-mode: Symbol's function definition is void: make-local-hook".
Here is what I have in dot-emacs:
(setq dictionary-server "localhost")
Any ideas?
If you're referring to http://me.in-berlin.de/~myrkr/dictionary/
Then the issue would be here:
(make-local-hook 'kill-buffer-hook)
(add-hook 'kill-buffer-hook 'dictionary-close t t)
Because the add-hook call supplies the local argument, you can resolve this issue by deleting (or commenting out) the first line with the call to make-local-hook. That line was only left in the code to provide backward-compatibility with very old versions of Emacs, and is otherwise redundant.
Make sure you send them a bug report.
Edit: tripleee has pointed out that this problem has already been fixed in the current version of the library, which now lives at the following URL:
https://github.com/myrkr/dictionary-el
"localhost" is defined in /etc/dictd/dict.conf. It should be OK to remove or comment out the setq. By default, dictionary-el points to dict.org.

How do I encourage emacs to follow the compilation buffer

Occasionally when I'm compiling, I have to scroll up my compilation buffer to see the details of an error. At this point, emacs stops "following" my compilation buffer, i.e., scrolling to automatically display new output.
I'm using Aqumacs on OS X. Any idea how I can "reattach" or re encourage the compilation buffer to follow again?
Regards,
Chris
Put in your ~/.emacs file
;; Compilation output
(setq compilation-scroll-output t)
or even
(setq compilation-scroll-output 'first-error)
to make it scroll to the first error.
Try using M-x auto-revert-tail-mode or M-x auto-revert-mode. Taken from official documentation:
One use of Auto-Revert mode is to
“tail” a file such as a system log, so
that changes made to that file by
other programs are continuously
displayed. To do this, just move the
point to the end of the buffer, and it
will stay there as the file contents
change. However, if you are sure that
the file will only change by growing
at the end, use Auto-Revert Tail mode
instead (auto-revert-tail-mode). It is
more efficient for this. Auto-Revert
Tail mode works also for remote files.
So, as Chmouel already noted, just moving point to end of buffer will also work.
I am not sure about aquamacs but for me (Emacs 23/Debian) I just go in the compilation window and place my cursor at the end of the window which will attach and follow (you can go to another window and it will still follow).

Emacs 23.2 opens a new window for each compile error/warning navigated to

I've recently upgraded from Carbon Emacs (v22.3) to vanilla Emacs 23.2 (from http://www.emacsformacosx.com). On Carbon Emacs when compiling a project, The frame is split in two with the current source file/SConscript in the top window, and the compile output in the bottom window. I'd hit C-x ` to navigate to the first warning or error in the compile output and it would replace whatever was in the top window with the source file the error or warning is in.
In Emacs 23.2, however, a 3rd window is opened causing two windows open in the top half of the frame (split vertically) and the compile output in the window of the bottom half of the frame. How do I tell Emacs to not open a new window and instead open the code in the the existing non-compiler output window in the frame?
A little further clarification on the behavior that I just noticed. If I hit C-x ` while the buffer containing the source file or SConscript file is active, no new window is opened. It's only if I'm manually navigating through the *compilation* buffer and hitting enter on an error or warning, or mouse clicking on a warning when a third buffer window appears.
The function which is used in next-error functionality is pop-to-buffer which in turn uses split-window-sensibly. You can control the behavior of split-window-sensibly by adjusting the variables split-width-threshold and split-height-threshold.
In your case it is split-width-threshold which is too small. In my emacs 23.1 it is set to 160. Just set it to a larger number and the problem should be solved:
(setq split-width-threshold 200)
I can't reproduce this problem myself, but you might try the following:
(setq split-width-threshold nil)
This tells display-buffer never to split windows horizontally, even if they are quite wide. There is also a split-height-threshold variable which is handled similarly. Checking these variables' current values might suggest whether they could be relevant to the behavior you're seeing.
One last thing to check: if you have defined your own display-buffer-function, that could be making these decisions for you.

Windows and Minibuffer floating over the frame

When I start Emacs, its windows and its minibuffer start up floating on the main frame, leaving a lot of empty space (see: here and here). Any idea of what is going on and how to fix it?
I'm using emacs version 23.1.1 on Xmonad
Thanks!
I get the same thing occasionally when doing a TAB expand in shell mode. I don't end up with an empty mini-buf, it usually has all the contents from the shell expand. The only solution I've found so far is to kill the current shell buffer
You might try C-l (recenter-top-bottom). I've used this over the years as a pretty reliable "repaint" operation that will clear up various detritus that occurs on the frame. It is even more helpful when you do not have a window system.
It looks like an odd interaction between Emacs and your window manager. It's as if Emacs is configuring itself to have a certain number of lines and columns in its active window, but the frame the window manager has allocated it is larger.
Can you try running X without Xmonad (ie. just run startX) and then run Emacs? You won't get frame decorations, but you can still use xterm to start it and see what 'natural' size it gets allocated. With the same Emacs configuration, that would narrow it down to some issue with Xmonad.
It's not obvious from the screenshots, as one is definitely in GUI mode, but the other (green on black) looks like it is in text mode. If you force it to run in text mode (emacs -nw), does it take up the same size? Within the shell, do normal commands take up the entire size of the allocated window?
Are the shell variables COLUMNS or LINES set correctly? Do they match the window dimensions? Assuming you are running bash, is shopt checkwinsize turned on? Do regular commands such as ls wrap at the expected margins and scroll to use the entire window?
It is worth ensuring that text mode is being configured correctly before getting GUI mode to work. I have a hunch the way that Xmonad is managing its window sizing may be the culprit, if it is 'forcing' windows to tile in certain arrangements, and the correct X hints aren't being sent. But - that's all just supposition for now...
This partially works (taken from here):
(defun fullscreen ()
(interactive)
(set-frame-parameter nil 'fullscreen
(if (frame-parameter nil 'fullscreen) nil 'fullboth)))
(add-hook 'emacs-startup-hook 'fullscreen)
The windows get corrected, although the mini-buffer is still larger than the usual.
Sounds like a bug, to me. Consider reporting it: M-x report-emacs-bug. Try to provide a recipe starting from emacs -Q.

Display same file successive pages on Emacs split screen

I've done this before, years ago, so I know the answer is out there. However the google-space is heavily polluted with namespace collisions, especially new user guides.
This is what I'd like to do in Emacs 21:
Split the screen on a given file buffer (C-x 3).
As I page through the first screen (C-v), the next page of the file is automatically displayed on the second.
To be clear, the next line in the file after the last line on the left screen should be the first line on the right screen, always.
Any help?
You might be looking for follow-mode
It is minor mode that combines windows into one tall virtual window.
You want scroll-all-mode
scroll-all-mode is an interactive compiled Lisp function in `scroll-all.el'.
(scroll-all-mode &optional arg)
Toggle Scroll-All minor mode.
With arg, turn Scroll-All minor mode on if arg is positive, off otherwise.
When Scroll-All mode is on, scrolling commands entered in one window
apply to all visible windows in the same frame.
Set up the windows appropriately, and then turn on scroll-all-mode, and from then on all windows scroll together
If follow-mode doesn't work, you could define your own macro, something like
(defun align-windows ()
(set-window-start (other-window) (window-start))
(scroll-other-window))
Then either use this (along with scroll-down) instead of C-v, or rebind C-v to that, or add
advice to scroll-down.
You can start Follow mode and setting up a basic two-window layout using
M-x follow-delete-other-windows-and-split RET.
it is from http://www.emacswiki.org/emacs/FollowMode