doublep/logview

Manually set submode

Closed this issue · 6 comments

The log files I use with logview do not have the message logview is looking for in the first line. Is it possible to manually set the mode? I thought about calling logview--initialize-submode, but I don't know what format the function arguments take.

I currently get round this by killing the text up to the first log message and save this as a separate file, however, I loose the auto-revert feature.

Any help is much appreciated, thanks,

Derek

There is no exposed way currently, logview--initialize-submode is only a part of guessing algorithm.

However, this should not be that difficult to add, e.g C-c C-c to manually pick a submode from the list of registered ones. However, it still has to somehow guess the timestamp format, unless you specify just one in submode definition. Does your log have an entry starting line somewhere near the beginning, say, in the first 50 lines?

Hi Paul,

Thanks for your quick response.

In my log file, the first parse-able message could be 100s of lines from the start of file and it won't be at the same line.

In my sub-mode definition I have ignored the timestamp. The log file is from a simulation so the time doesn't represent real time. I had thought of telling logview that is was UNIX time, but I don't have much need to filter by time as of yet.

Instead of manually picking the sub-mode, could I instead set it based on a file name? The log files always have the same name, so I thought of setting auto-mode-alist based on the file name and a function to tell logview which sub-mode it is.

Thanks!

Please test if the added command does what you want. You can invoke it with C-c C-c or from Lisp like

(logview-choose-submode "my-submode-name")

assuming you don't use any timestamps.

The command is not yet fully documented.

I can confirm that works. Brilliant, thanks very much!

I installed the new version though the Emacs package system (and deleted the old one), but couldn't get it to "reload" the new version so the above function was not recognised. Is there a way to do this without starting an new emacs process?

Cheers.

Elisp generally sucks for reloading on-the-fly. You can try visiting logview.el and manually evaluating all variable declarations with C-M-x.