auto-revert-tail-mode is great, but it has its limits. Therefore I prefer to use an asynchronous shell command. Open the remote directory in dired, position the cursor to the file you want to watch, and apply ! tail -f * &.
If you want to suppress Tramp messages, decrease the verbosity. (setq tramp-verbose 1) shall be sufficient.
I have the following snippet in my init.el, which was adapted from an original I found in the following Reddit thread:
(EDIT: modernised to advice-add and removed clumsy read-only buffer handling on advice of @blujay)
(defun sh/current-time-microseconds ()
The translation of @xinfatang's simple solution to the new advice-add syntax as a wrapper around the message function is:
(defun my-message-with-timestamp (old-func fmt-string &rest args)
"Prepend current timestamp (with microsecond precision) to a message"
(concat (format-time-string "[%F %T.%3N %Z] ")
This is what I use. It disables everything that might slow emacs down, makes the buffer read only, and sets up auto-revert-tail-mode:
;; automagically tail log files
(add-to-list 'auto-mode-alist '("\\.log\\'" . auto-revert-tail-mode))
(defun etc-log-tail-handler ()
You can't with message. Having looked at the internals of message, only the raw char* is given to the function that actually logs the text, all text properties are lost.
You can hack your way around this by writing a function that:
calls message with message-log-max let-bound to nil so that it won't log to *Messages*
manually inserts the propertized string ...
Each buffer has a point, and in addition each window also has a point. The manual explains the relationship:
The window point is established when a window is first created; it is initialized from the buffer's point, or from the window point of another window opened on the buffer if such a window exists.
Selecting a window sets the value of point in ...
Yes! This is command-log-mode which can be installed from Melpa.
You have to add the function to whatever modes you want to record, like
(add-hook 'python-mode-hook 'command-log-mode)
Then, to invoke the log window as shown in the video
Open a Python file (in my example) and start manipulating the code to see your ...
Library showkey.el (code) gives you what you request, I think.
It defines two global minor modes, which give you two ways to show keys you type:
showkey-tooltip-mode – Show only the last key used, in a tooltip. This is refreshed with each such event. By default, it uses large red characters, just as you request.
showkey-log-mode – Show a log of such events,...
I have an Org capture template that tracks weight. It is a sub-capture under "health". The relevant snippet for the capture template is:
table-line (id "ID-TBL-WEIGHT") "|%?|%u|" :unnarrowed t)
And then I have a table that collects the data:
| Weight (...
See the Emacs manual, node Checklist and the Elisp manual, node Recording Input.
Start writing all keyboard characters to a dribble file called FILE.
If FILE is nil, close any open dribble file.
The file will be closed when Emacs exits.
Be aware that this records ALL characters you type!
This may include sensitive ...
It is possible that that you're calling kill-region which is bound to C-w. This is what one would consider the cut command in other applications. If the region is not active it will kill from your point to where the last mark was, which could possibly be the beginning of the buffer.
The command view-lossage (bound to C-h l or <f1> l) displays the last ...
Refer from https://www.emacswiki.org/emacs/DebugMessages:
(defadvice message (before when-was-that activate)
"Add timestamps to `message' output."
(ad-set-arg 0 (concat (format-time-string "[%Y-%m-%d %T %Z] ")
(ad-get-arg 0)) ))
Finally i still like Stuart Hickinbottom 's answer, because it avoid show timestamp in minibuffer, ...
view-lossage (bound to C-h l by default) is limited to a fixed number of events, and doesn't keep time stamps, but it might be good enough for your use case. To store a longer log, you can try open-dribble-file.
See also https://stackoverflow.com/questions/9761401 for a similar question.
If you set variable debug-on-error to t then Emacs will show you a detailed backtrace of what function calls led to the error. (This affects only actual errors, not non-error messages, which are also logged to *Messages*.)
I've added [in my fork] the following setup steps to command-log-mode to stash recently typed text in a variable.
(defvar clm/log-text t
"A non-nil setting means text will be saved to the command log.")
(defvar clm/recent-history-string ""
"This string will hold recently typed text.")
(defun clm/recent-history ()
Set or customize the variable org-log-into-drawer to t.* The doc string of the variable (C-h v org-log-into-drawer RET) states:
Non-nil means insert state change notes and time stamps into a drawer.
When nil, state changes notes will be inserted after the headline and
any scheduling and clock lines, but not inside a drawer.
If you want to make this ...
Is there any package that does that, or a way to achieve it?
One such package is Show Key (code: showkey.el).
Global minor mode showkey-log-mode keeps a log of such events, in a separate frame. It's refreshed with each new event, and it's kept on top of other frames without stealing the input focus. Various user options control what events get logged, etc.
Not exactly what you want, but most of search related functions support similar behaviors. They list filtered result, and you can jump to any point you want from it. You don't really need a special mode to open your log file, just use these search function in your log file buffer.
Here are some I know:
occur: built-in search buffer function. (check multi-...
Noting that this is more or less along the lines of how run-mode-hooks and delay-mode-hooks interact, you could do something similar to that:
(defvar scoped-message-p nil)
(defvar scoped-messages nil)
(defmacro scoped-message (message &rest body)
(declare (indent 1))
(push ,message scoped-messages)
According to the documentation it should be determined with the TZ environment variable :
The default time zone is determined by the TZ environment variable.
[...] For example, you can tell Emacs to default to Universal Time
with (setenv "TZ" "UTC0"). If TZ is not in the environment, Emacs uses
system wall clock time, which is a platform-dependent ...
Not exactly the answer you are expecting, but:
If you are running on GNU/Linux in a GNOME environment, you could try the upcoming Emacs 26.1. Tramp offers a new method there, gdrive, which allows you to edit the file remotely on the Google drive. Something like
C-x C-f /gdrive:email@example.com:/dir/to/file
Replace the account name with yours.
My solution expands on Stuart Hickinbottom 's and xinfa tang 's answers by NOT printing the timestamp of repeated messages:
(defvar my-package--last-message nil
"Last message with timestamp appended to it.")
(defun my-package-ad-timestamp-message (format-string &rest args)
"Prepend timestamp to each message in message buffer.
See this question and answer, you can do this same thing when opening a log file with ansi colors.
If this is a running log, I would suggest just opening a shell buffer and tail -fing the file which will handle colors.
what is causing this?
The problem here is that you seem to consider that the point is associated to a buffer, but this is not exactly the case.
Consider for example the case where the same buffer is displayed in two different windows. You'll notice that the buffer contents is the same (i.e. modifying the buffer contents in one window modifies it in the ...