• Using Emacs for keeping an eye on a logfile

    From Cecil Westerhof@Cecil@decebal.nl to gnu.emacs.help on Thu Mar 30 07:18:16 2023
    From Newsgroup: gnu.emacs.help

    I am using Emacs to keep an eye on a log-file. I can see what has
    changed and giving two times F9 I can later see what has changed
    again.
    I keep the cursor at the end of the file and have auto-revert-mode on.
    Works great with one slight problem. When the file grows often the
    last line is not at the bottom of the screen. I can solve this by
    giving three time C-l, but that is a little nuisance. Is there a way
    to have the last line always at the bottom of the screen?
    --
    Cecil Westerhof
    Senior Software Engineer
    LinkedIn: http://www.linkedin.com/in/cecilwesterhof
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From HASM@hasm@example.invalid to gnu.emacs.help on Thu Mar 30 04:47:23 2023
    From Newsgroup: gnu.emacs.help


    I can see what has changed and giving two times F9 I can later see
    what has changed again.

    I think we need to tell us what is your F9 key binding.

    It is not bound on my emacs and this section in the manual
    https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html
    says
    Function keys F5 through F9 without modifier keys are also reserved for users to define.

    I keep the cursor at the end of the file and have auto-revert-mode on.

    I believe auto-revert-tail-mode does what you want. And check
    https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Revert.html for a few variables that control the auto-revert modes.

    -- HASM


    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Cecil Westerhof@Cecil@decebal.nl to gnu.emacs.help on Thu Mar 30 17:49:17 2023
    From Newsgroup: gnu.emacs.help

    HASM <hasm@example.invalid> writes:

    I can see what has changed and giving two times F9 I can later see
    what has changed again.

    I think we need to tell us what is your F9 key binding.

    It is not bound on my emacs and this section in the manual
    https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html
    says
    Function keys F5 through F9 without modifier keys are also reserved for users to define.

    Oops, my bad. I defined that to be highlight-changes-mode so I can
    easily switch between highlight mode on and of.


    I keep the cursor at the end of the file and have auto-revert-mode on.

    I believe auto-revert-tail-mode does what you want. And check
    https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Revert.html for a few variables that control the auto-revert modes.

    I will try it out.
    --
    Cecil Westerhof
    Senior Software Engineer
    LinkedIn: http://www.linkedin.com/in/cecilwesterhof
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Cecil Westerhof@Cecil@decebal.nl to gnu.emacs.help on Thu Mar 30 18:44:24 2023
    From Newsgroup: gnu.emacs.help

    Cecil Westerhof <Cecil@decebal.nl> writes:

    I keep the cursor at the end of the file and have auto-revert-mode on.

    I believe auto-revert-tail-mode does what you want. And check
    https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Revert.html >> for a few variables that control the auto-revert modes.

    I will try it out.

    Nope. The same problem. I think it only say that the changes are
    always at the end of the file so things can be handled more efficient.
    :'-(
    --
    Cecil Westerhof
    Senior Software Engineer
    LinkedIn: http://www.linkedin.com/in/cecilwesterhof
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From HASM@hasm@example.invalid to gnu.emacs.help on Thu Mar 30 10:53:54 2023
    From Newsgroup: gnu.emacs.help

    Cecil Westerhof <Cecil@decebal.nl> writes:

    I believe auto-revert-tail-mode does what you want. And check
    https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Revert.html
    for a few variables that control the auto-revert modes.
    I will try it out.

    Nope. The same problem.

    Works on my emacs, linux, and a file on the local file system.
    Maybe only at the poll period, didn't check for that.

    -- HASM
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Cecil Westerhof@Cecil@decebal.nl to gnu.emacs.help on Fri Mar 31 08:57:11 2023
    From Newsgroup: gnu.emacs.help

    HASM <hasm@example.invalid> writes:

    Cecil Westerhof <Cecil@decebal.nl> writes:

    I believe auto-revert-tail-mode does what you want. And check
    https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Revert.html
    for a few variables that control the auto-revert modes.
    I will try it out.

    Nope. The same problem.

    Works on my emacs, linux, and a file on the local file system.
    Maybe only at the poll period, didn't check for that.

    Then I have to try it out again.
    Could it because I have a little older Emacs?
    I am on Debian:
    GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2021-03-28, modified by Debian
    --
    Cecil Westerhof
    Senior Software Engineer
    LinkedIn: http://www.linkedin.com/in/cecilwesterhof
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From W. Greenhouse@wgreenhouse@tilde.club to gnu.emacs.help on Sun Apr 2 15:17:44 2023
    From Newsgroup: gnu.emacs.help

    Cecil Westerhof <Cecil@decebal.nl> writes:


    [...]

    Nope. The same problem. I think it only say that the changes are
    always at the end of the file so things can be handled more efficient.
    :'-(

    auto-revert-tail-mode may be of interest.
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Cecil Westerhof@Cecil@decebal.nl to gnu.emacs.help on Sun Apr 2 20:59:01 2023
    From Newsgroup: gnu.emacs.help

    "W. Greenhouse" <wgreenhouse@tilde.club> writes:

    Cecil Westerhof <Cecil@decebal.nl> writes:


    [...]

    Nope. The same problem. I think it only say that the changes are
    always at the end of the file so things can be handled more efficient.
    :'-(

    auto-revert-tail-mode may be of interest.

    That was what HASM was referring to and it does not work for me.

    I believe auto-revert-tail-mode does what you want. And check
    https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Revert.html
    --
    Cecil Westerhof
    Senior Software Engineer
    LinkedIn: http://www.linkedin.com/in/cecilwesterhof
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Manuel Giraud@manuel@ledu-giraud.fr to gnu.emacs.help on Mon Apr 3 14:11:00 2023
    From Newsgroup: gnu.emacs.help

    Cecil Westerhof <Cecil@decebal.nl> writes:

    I am using Emacs to keep an eye on a log-file. I can see what has
    changed and giving two times F9 I can later see what has changed
    again.
    I keep the cursor at the end of the file and have auto-revert-mode on.
    Works great with one slight problem. When the file grows often the
    last line is not at the bottom of the screen. I can solve this by
    giving three time C-l, but that is a little nuisance. Is there a way
    to have the last line always at the bottom of the screen?

    Hi,

    I don't know if it would work for you but here is what I do:

    - if it is not already the case, I toggle the buffer to
    view-mode with 'C-x C-q'
    - Then I hit 'F' (View-revert-buffer-scroll-page-forward) to
    update the buffer and scroll forward.
    --
    Manuel Giraud
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Cecil Westerhof@Cecil@decebal.nl to gnu.emacs.help on Mon Apr 3 18:59:47 2023
    From Newsgroup: gnu.emacs.help

    Manuel Giraud <manuel@ledu-giraud.fr> writes:

    Cecil Westerhof <Cecil@decebal.nl> writes:

    I am using Emacs to keep an eye on a log-file. I can see what has
    changed and giving two times F9 I can later see what has changed
    again.
    I keep the cursor at the end of the file and have auto-revert-mode on.
    Works great with one slight problem. When the file grows often the
    last line is not at the bottom of the screen. I can solve this by
    giving three time C-l, but that is a little nuisance. Is there a way
    to have the last line always at the bottom of the screen?

    Hi,

    I don't know if it would work for you but here is what I do:

    - if it is not already the case, I toggle the buffer to
    view-mode with 'C-x C-q'

    No, that will not work, because then you go into read-only mode and in read-only mode you cannot change highlight-change mode. And that is
    what I am using.
    --
    Cecil Westerhof
    Senior Software Engineer
    LinkedIn: http://www.linkedin.com/in/cecilwesterhof
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Manuel Giraud@manuel@ledu-giraud.fr to gnu.emacs.help on Wed Apr 5 10:27:26 2023
    From Newsgroup: gnu.emacs.help

    Cecil Westerhof <Cecil@decebal.nl> writes:

    [...]

    No, that will not work, because then you go into read-only mode and in read-only mode you cannot change highlight-change mode. And that is
    what I am using.

    Ok. I did not know about highlight-change mode but here is what I tried
    and it seems to work for me:

    - Open a read only log
    - 'M-x highlight-changes-mode' on that buffer
    - Hit 'F': the buffer is updated (and scrolled) with the new content
    in a different face
    --
    Manuel Giraud
    --- Synchronet 3.21d-Linux NewsLink 1.2