Commit a283996f authored by Ulf Jasper's avatar Ulf Jasper

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):
  (newsticker-treeview-mode-map): Add key for new command
  'newsticker-treeview-customize-current-feed'. (Fixes second issue in
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."
(add-to-list 'newsticker-url-list (list name url nil nil nil) t)
(customize-variable 'newsticker-url-list))
(defun newsticker-customize-feed (feed-name)
"Open customization buffer for `newsticker-url-list' and jump to FEED-NAME."
(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)
(when (re-search-forward (concat "Label: " feed-name) nil t)
(forward-line -1)))
(defun newsticker-customize ()
"Open the newsticker customization group."
......@@ -1548,6 +1559,7 @@ argument, which is one of the items in ITEMLIST."
;; ======================================================================
(defun newsticker--insert-bytes (bytes)
"Decode BYTES and insert in current buffer."
(insert (decode-coding-string bytes 'binary)))
(defun newsticker--remove-whitespace (string)
......@@ -1587,7 +1599,7 @@ This function calls `message' with arguments STRING and ARGS, if
(apply 'message string args)))
(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
is present, this function defaults to universal time."
(if string
......@@ -1434,6 +1434,15 @@ Move to next item unless DONT-PROCEED is non-nil."
(defun newsticker-treeview-customize-current-feed ()
"Open customization buffer for `newsticker-url-list' and move to current feed."
(let ((cur-feed (or newsticker--treeview-current-feed
(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)
"Make NODE the current node."
(with-current-buffer (newsticker--treeview-tree-buffer)
......@@ -1995,6 +2004,7 @@ Return t if groups have changed, nil otherwise."
(define-key map " " 'newsticker-treeview-next-page)
(define-key map "a" 'newsticker-add-url)
(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-next-feed)
(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