diff options
author | Ulrich Müller <ulm@gentoo.org> | 2024-08-10 19:53:36 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2024-08-10 19:53:36 +0200 |
commit | ab8dd19e115bbc43e5a6aaa90e0b524976eb50fe (patch) | |
tree | 6385b7b092c7971562e0aea24b0debc578612867 | |
parent | Move binding of format-time-string to a macro (diff) | |
download | ebuild-mode-ab8dd19e115bbc43e5a6aaa90e0b524976eb50fe.tar.gz ebuild-mode-ab8dd19e115bbc43e5a6aaa90e0b524976eb50fe.tar.bz2 ebuild-mode-ab8dd19e115bbc43e5a6aaa90e0b524976eb50fe.zip |
New function ebuild-mode-find-build-log
* ebuild-mode.el (ebuild-mode-find-build-log): New function.
(ebuild-mode-map, ebuild-mode-menu): Keybinding and menu entry.
* ebuild-mode.texi (ebuild-mode): Document it.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ebuild-mode.el | 20 | ||||
-rw-r--r-- | ebuild-mode.texi | 8 |
3 files changed, 32 insertions, 0 deletions
@@ -1,5 +1,9 @@ 2024-08-10 Ulrich Müller <ulm@gentoo.org> + * ebuild-mode.el (ebuild-mode-find-build-log): New function. + (ebuild-mode-map, ebuild-mode-menu): Keybinding and menu entry. + * ebuild-mode.texi (ebuild-mode): Document it. + * test/ebuild-mode-tests.el (ebuild-mode-test-run-with-fixed-time): New macro. (ebuild-mode-test-update-copyright) diff --git a/ebuild-mode.el b/ebuild-mode.el index 06a30a9..46af991 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -674,6 +674,23 @@ With prefix argument OTHER-WINDOW, visit the directory in another window." (find-file-other-window s) (find-file s))))) +(defun ebuild-mode-find-build-log (&optional other-window) + "Visit the build log for the ebuild in this buffer. +With prefix argument OTHER-WINDOW, visit the directory in another window." + (interactive "P") + (let ((build-log (concat (ebuild-mode-get-builddir) "/temp/build.log"))) + (unless (file-readable-p build-log) + (error "Cannot read file \"%s\"" build-log)) + (if other-window + (find-file-other-window build-log) + (find-file build-log)) + ;; decode ANSI SGR control sequences if possible (tty-format.el) + (and (assq 'ansi-colors format-alist) + (save-excursion + (goto-char (point-min)) + (re-search-forward "\e\\[[0-9;]*m" nil t)) + (format-decode-buffer 'ansi-colors)))) + ;;; Modify package keywords. ;; This is basically a reimplementation of "ekeyword" in Emacs Lisp. @@ -988,6 +1005,7 @@ in a Gentoo profile." ("\C-c\C-e\C-c" ebuild-mode-run-pkgcheck) ("\C-c\C-e\C-w" ebuild-mode-find-workdir) ("\C-c\C-e\C-s" ebuild-mode-find-s) + ("\C-c\C-e\C-l" ebuild-mode-find-build-log) ("\C-c\C-e\C-k" ebuild-mode-keyword) ("\C-c\C-e\C-y" ebuild-mode-ekeyword) ("\C-c\C-e\C-u" ebuild-mode-all-keywords-unstable) @@ -1011,6 +1029,8 @@ in a Gentoo profile." :active (eq major-mode 'ebuild-mode)] ["Find build directory (S)" ebuild-mode-find-s :active (eq major-mode 'ebuild-mode)] + ["Find build log" ebuild-mode-find-build-log + :active (eq major-mode 'ebuild-mode)] ["Insert ebuild skeleton" ebuild-mode-insert-skeleton :active (eq major-mode 'ebuild-mode)] ["Set/unset keyword" ebuild-mode-keyword] diff --git a/ebuild-mode.texi b/ebuild-mode.texi index 07138a6..773c2ef 100644 --- a/ebuild-mode.texi +++ b/ebuild-mode.texi @@ -165,6 +165,12 @@ build directory (@code{$@{S@}}) that belong to the ebuild in the current buffer. With a prefix argument, the directory will be visited in another window. +The command @code{ebuild-mode-find-build-log} (@kbd{C-c C-e C-l}) visits +the @code{build.log} of the ebuild in the current buffer. With a prefix +argument, it visits the file in another window. Decoding of ANSI color +escape sequences is also supported when the @file{tty-format} library is +loaded. + @section Running @command{pkgdev} and @command{pkgcheck} @kbd{C-c C-e C-p} calls the command @code{ebuild-mode-run-pkgdev} @@ -192,6 +198,8 @@ Run Portage's ebuild command, you are prompted for the phase you want. Visit the working directory (@code{WORKDIR}) that belongs to the ebuild. @item C-c C-e C-s Visit temporary build directory (@code{S}) that belongs to the ebuild. +@item C-c C-e C-l +Visit the @code{build.log} file that belongs to the ebuild. @item C-c C-e C-p Run a @command{pkgdev} command. @item C-c C-e C-c |