Commit a283996f authored by Ulf Jasper's avatar Ulf Jasper
Browse files

Add command for customizing current newsticker feed

* lisp/net/newst-backend.el (newsticker-customize-feed): New.
  (newsticker--insert-bytes): Add documentation string.
  (newsticker--decode-iso8601-date): Fix documentation string.
* lisp/net/newst-treeview.el (newsticker-treeview-customize-current-feed):
  New.
  (newsticker-treeview-mode-map): Add key for new command
  'newsticker-treeview-customize-current-feed'. (Fixes second issue in
  Bug#41376.)
parent 57084098
Pipeline #9474 passed with stages
in 12 minutes and 15 seconds
...@@ -645,6 +645,17 @@ If URL is nil it is searched at point." ...@@ -645,6 +645,17 @@ If URL is nil it is searched at point."
(add-to-list 'newsticker-url-list (list name url nil nil nil) t) (add-to-list 'newsticker-url-list (list name url nil nil nil) t)
(customize-variable 'newsticker-url-list)) (customize-variable 'newsticker-url-list))
(defun newsticker-customize-feed (feed-name)
"Open customization buffer for `newsticker-url-list' and jump to FEED-NAME."
(interactive
(list (completing-read "Name of feed or group to edit: "
(append (mapcar #'car newsticker-url-list)
nil t feed-name))))
(customize-variable 'newsticker-url-list)
(delete-other-windows)
(when (re-search-forward (concat "Label: " feed-name) nil t)
(forward-line -1)))
(defun newsticker-customize () (defun newsticker-customize ()
"Open the newsticker customization group." "Open the newsticker customization group."
(interactive) (interactive)
...@@ -1548,6 +1559,7 @@ argument, which is one of the items in ITEMLIST." ...@@ -1548,6 +1559,7 @@ argument, which is one of the items in ITEMLIST."
;; ====================================================================== ;; ======================================================================
(defun newsticker--insert-bytes (bytes) (defun newsticker--insert-bytes (bytes)
"Decode BYTES and insert in current buffer."
(insert (decode-coding-string bytes 'binary))) (insert (decode-coding-string bytes 'binary)))
(defun newsticker--remove-whitespace (string) (defun newsticker--remove-whitespace (string)
...@@ -1587,7 +1599,7 @@ This function calls `message' with arguments STRING and ARGS, if ...@@ -1587,7 +1599,7 @@ This function calls `message' with arguments STRING and ARGS, if
(apply 'message string args))) (apply 'message string args)))
(defun newsticker--decode-iso8601-date (string) (defun newsticker--decode-iso8601-date (string)
"Return ISO8601-STRING in format like `encode-time'. "Return ISO8601-encoded STRING in format like `encode-time'.
Converts from ISO-8601 to Emacs representation. If no time zone Converts from ISO-8601 to Emacs representation. If no time zone
is present, this function defaults to universal time." is present, this function defaults to universal time."
(if string (if string
......
...@@ -1434,6 +1434,15 @@ Move to next item unless DONT-PROCEED is non-nil." ...@@ -1434,6 +1434,15 @@ Move to next item unless DONT-PROCEED is non-nil."
newsticker--treeview-current-vfeed) newsticker--treeview-current-vfeed)
(newsticker--treeview-get-selected-item))) (newsticker--treeview-get-selected-item)))
(defun newsticker-treeview-customize-current-feed ()
"Open customization buffer for `newsticker-url-list' and move to current feed."
(interactive)
(let ((cur-feed (or newsticker--treeview-current-feed
newsticker--treeview-current-vfeed)))
(if (newsticker--group-get-group cur-feed)
(message "Cannot customize groups. Please select a feed.")
(newsticker-customize-feed cur-feed))))
(defun newsticker--treeview-set-current-node (node) (defun newsticker--treeview-set-current-node (node)
"Make NODE the current node." "Make NODE the current node."
(with-current-buffer (newsticker--treeview-tree-buffer) (with-current-buffer (newsticker--treeview-tree-buffer)
...@@ -1995,6 +2004,7 @@ Return t if groups have changed, nil otherwise." ...@@ -1995,6 +2004,7 @@ Return t if groups have changed, nil otherwise."
(define-key map " " 'newsticker-treeview-next-page) (define-key map " " 'newsticker-treeview-next-page)
(define-key map "a" 'newsticker-add-url) (define-key map "a" 'newsticker-add-url)
(define-key map "b" 'newsticker-treeview-browse-url-item) (define-key map "b" 'newsticker-treeview-browse-url-item)
(define-key map "c" 'newsticker-treeview-customize-current-feed)
(define-key map "F" 'newsticker-treeview-prev-feed) (define-key map "F" 'newsticker-treeview-prev-feed)
(define-key map "f" 'newsticker-treeview-next-feed) (define-key map "f" 'newsticker-treeview-next-feed)
(define-key map "g" 'newsticker-treeview-get-news) (define-key map "g" 'newsticker-treeview-get-news)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment