[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rcirc-sqlite 349aabcbb6 2/2: Browse URL in the message
From: |
ELPA Syncer |
Subject: |
[elpa] externals/rcirc-sqlite 349aabcbb6 2/2: Browse URL in the message |
Date: |
Fri, 8 Nov 2024 12:58:44 -0500 (EST) |
branch: externals/rcirc-sqlite
commit 349aabcbb6bd10b007f431d180e870a5918b9e21
Author: Matto Fransen <matto@matto.nl>
Commit: Matto Fransen <matto@matto.nl>
Browse URL in the message
---
README.org | 2 +-
rcirc-sqlite.el | 36 +++++++++++++++++++++++++++++++++---
rcirc-sqlite.texi | 18 ++++++++++++++++++
3 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/README.org b/README.org
index 48400f05ba..f8f60f6c80 100644
--- a/README.org
+++ b/README.org
@@ -51,7 +51,6 @@ Re-evaluate your init file or restart Emacs, whatever you
prefer.
The command ~rcirc-sqlite-log-mode~ toggles between activation
and deactivation of ~rcirc-sqlite~.
-
To start ~rcirc-sqlite~ automatically when ~rcirc~ is started, add the
following to your init file:
@@ -160,6 +159,7 @@ following keys.
| ~>~ | Same, but also include the next day |
| ~^~ | Same, but also include the previous day |
| ~a~ | Same, but also include all following days |
+| ~b~ | Browse URL in the message |
| ~<~ | Show logs of the channel,date, and nick of the selected message |
| ~c~ | Copy the selected message, nicely formatted, to the kill-ring |
| ~R~ | Insert the selected message, nicely formatted, into a register |
diff --git a/rcirc-sqlite.el b/rcirc-sqlite.el
index 872951c00e..a159969bd9 100644
--- a/rcirc-sqlite.el
+++ b/rcirc-sqlite.el
@@ -5,7 +5,7 @@
;; Author: Matto Fransen <matto@matto.nl>
;; Maintainer: Matto Fransen <matto@matto.nl>
;; Url: https://codeberg.org/mattof/rcirc-sqlite
-;; Version: 1.0.3
+;; Version: 1.0.4
;; Keywords: comm
;; Package-Requires: ((emacs "30.0"))
@@ -56,6 +56,12 @@
;;; News:
+;; Version 1.0.4 - 2024-11-08
+
+;; * Browse URL in the message
+;; Select a message in the logs and browse to the first URL
+;; in the message with the key 'b'.
+
;; Version 1.0.3 - 2024-09-26
;; * New command: rcirc-sqlite-stats-per-month
@@ -77,7 +83,8 @@
;; * Quickly change the view of the logs
;; When exploring your logs, change the view with just one key:
;; - Show all the logs of a channel for a single day or two days.
-;; - Show all the logs of a channel from a specific nick for a single day.
+;; - Show all the logs of a channel from a specific nick for a
+;; single day.
;;
;; * Collect individual messages with just one key:
;; - Select and copy a message nicely formatted to the `kill-ring'.
@@ -99,6 +106,7 @@
(defvar rcirc-log-alist)
(defvar rcirc-log-time-format)
+(defvar rcirc-url-regexp)
(defgroup rcirc-sqlite nil
"Rcirc logging in SQLite."
@@ -491,6 +499,7 @@ This function should be called from the two column
tabulated list."
(kbd ">") #'rcirc-sqlite-next-day
(kbd "^") #'rcirc-sqlite-previous-day
(kbd "a") #'rcirc-sqlite-all-next-days
+ (kbd "b") #'rcirc-sqlite-browse-url-from-message
(kbd "c") #'rcirc-sqlite-kill-insert
(kbd "r") #'rcirc-sqlite-register-append
(kbd "R") #'rcirc-sqlite-register-insert
@@ -642,7 +651,7 @@ When ALL-NEXT-DAYS is true, select everything after the
start-time."
(cons (nth 4 rowdata)
(+ (* extra-days 86400)
(nth 4 rowdata))))))
-
+
(defun rcirc-sqlite-query-single-day
(with-nick extra-days all-next-days)
"Select logs from a single day.
@@ -725,6 +734,27 @@ Called from `rcirc-sqlite-list-mode'."
(kill-new (rcirc-sqlite-format-message))
(message "Added message to kill-ring"))
+(defun rcirc-sqlite-browse-url-in-string (message)
+ "Fetch URL from MESSAGE and open it."
+ (let ((this-url
+ (and
+ (string-match
+ (concat "\\(" rcirc-url-regexp "\\)\\(.*$\\)")
+ message)
+ (match-string 1 message))))
+ (when (not this-url)
+ (error "No URL found"))
+ (browse-url this-url)))
+
+(defun rcirc-sqlite-browse-url-from-message ()
+ "Fetch URL from the selected message and open it."
+ (interactive nil rcirc-sqlite-list-mode)
+ (let ((rowid (tabulated-list-get-id)))
+ (when (not rowid)
+ (error "No row selected"))
+ (rcirc-sqlite-browse-url-in-string
+ (nth 3 (car (rcirc-sqlite-db-row-data rowid))))))
+
(defun rcirc-sqlite-register-add (method)
"Insert a chatmessage into the register `rcirc-sqlite-register'.
METHOD is eiter insert or append."
diff --git a/rcirc-sqlite.texi b/rcirc-sqlite.texi
index 3ebe54f76e..969b4b1b20 100644
--- a/rcirc-sqlite.texi
+++ b/rcirc-sqlite.texi
@@ -276,10 +276,12 @@ a different use.
* Summery of the commands::
* View the logs::
* Full text search and load the result in a buffer::
+* Toggle display of the server in the channel name::
* Change the selected logs in the log-buffer::
* Copy a message to the kill-ring::
* Collect one or more messages in a register::
* Logs from a specific nick::
+* Browse URL in the message::
* Stats::
@end menu
@@ -306,6 +308,7 @@ These actions are described in the sections:
@item @ref{Change the selected logs in the log-buffer}
@item @ref{Copy a message to the kill-ring}
@item @ref{Collect one or more messages in a register}
+@item @ref{Browse URL in the message}
@end itemize
The stats view offer some drill-down options and can be a good
@@ -604,6 +607,18 @@ The option @code{manually select range} prompts the user
to select a
start and a end of a time range, using the org date picker. Use the
org calendar commands to select a date and time.
+
+@node Browse URL in the message
+@section Browse URL in the message
+@findex rcirc-sqlite-browse-url-from-message
+@kindex b
+
+Move the point in the buffer @code{*rcirc log*} up or down to select a
+chat message.
+
+Activate the command `rcirc-sqlite-browse-url-from-message' with the key
+@key{b} to browse to the first URL in the selected message.
+
@node Stats
@section Stats
@findex rcirc-sqlite-stats
@@ -683,6 +698,7 @@ some commands.
@item @kbd{>} @code{rcirc-sqlite-next-day}
@item @kbd{^} @code{rcirc-sqlite-previous-day}
@item @kbd{a} @code{rcirc-sqlite-all-next-days}
+@item @kbd{b} @code{rcirc-sqlite-browse-url-from-message}
@item @kbd{<} @code{rcirc-sqlite-single-nick}
@item @kbd{c} @code{rcirc-sqlite-kill-insert}
@item @kbd{R} @code{rcirc-sqlite-register-insert}
@@ -697,6 +713,8 @@ For a description of these commands, see the following
chapters.
@ref{Collect one or more messages in a register}
+@ref{Browse URL in the message}
+
The default key bindings of the
@code{tabulated-list-mode} are also available in this buffer.