From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Xavier Capaldi Newsgroups: gmane.emacs.bugs Subject: bug#53638: [PATCH] newsticker better path handling and data Date: Sun, 15 May 2022 23:50:22 -0400 Message-ID: <87y1z287b5.fsf@corydoras.i-did-not-set--mail-host-address--so-tickle-me> References: <87h79lgg5n.fsf@protonmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30656"; mail-complaints-to="usenet@ciao.gmane.io" To: 53638@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 16 06:37:56 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqSUT-0007lP-Gy for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 May 2022 06:37:55 +0200 Original-Received: from localhost ([::1]:47586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqSUS-0001tz-2z for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 May 2022 00:37:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqSTf-0001se-EC for bug-gnu-emacs@gnu.org; Mon, 16 May 2022 00:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57452) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqSTf-0005dw-3d for bug-gnu-emacs@gnu.org; Mon, 16 May 2022 00:37:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nqSTf-0003AG-1M for bug-gnu-emacs@gnu.org; Mon, 16 May 2022 00:37:03 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87h79lgg5n.fsf@protonmail.com> Resent-From: Xavier Capaldi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 May 2022 04:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53638 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 53638-submit@debbugs.gnu.org id=B53638.165267579112093 (code B ref 53638); Mon, 16 May 2022 04:37:02 +0000 Original-Received: (at 53638) by debbugs.gnu.org; 16 May 2022 04:36:31 +0000 Original-Received: from localhost ([127.0.0.1]:51342 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqST8-00038t-7h for submit@debbugs.gnu.org; Mon, 16 May 2022 00:36:30 -0400 Original-Received: from mx2-c2.supremebox.com ([198.23.53.235]:37659 helo=mx1.supremebox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqRkX-0001xH-ND for 53638@debbugs.gnu.org; Sun, 15 May 2022 23:50:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=scribo.biz; s=default; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=FnWMHxIFS0nq+ccQaGcVetaZhjTUYst3TOAfaXVtMYc=; b=SATTc478O+TBid1R/Xf4b4+tsO 8mmvPpBMo7eSKzcs0sl9ucYdATm6ZJ+bsNTNaSJGWrLB+yYHXzMrVGqSg14Lr7NzmPwKyiw9VCmZU T6jaTsSK+RBW49WTI5XsikPuGdXpzIR53YxsYWBAxZ7XF8tMpXLzVgSENRtmGKHhMPtI=; Original-Received: from modemcable070.248-202-24.mc.videotron.ca ([24.202.248.70] helo=localhost) by mx1.supremebox.com with esmtpa (Exim 4.92) (envelope-from ) id 1nqRkV-0005TR-H4 for 53638@debbugs.gnu.org; Mon, 16 May 2022 03:50:24 +0000 X-Sender-Ident-agJab5osgicCis: xcapaldi@scribo.biz X-Mailman-Approved-At: Mon, 16 May 2022 00:36:27 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:232352 Archived-At: --=-=-= Content-Type: text/plain Not sure if this bug report/patch is blocked but I faced the `prin1-to-string` issue which is fixed by the patch here. I've attached an updated patch that uses chained calls to `expand-file-name` instead of `file-name-concat` since that was the last issue mentioned with the patch. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=newsticker-patch-3.diff diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index a62a7bd8b7..d3610a2130 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -1697,11 +1697,13 @@ newsticker--update-process-ids ;; ====================================================================== (defun newsticker--images-dir () "Return directory where feed images are saved." - (concat newsticker-dir "/images/")) + (file-name-as-directory + (expand-file-name "images" newsticker-dir))) (defun newsticker--icons-dir () "Return directory where feed icons are saved." - (concat newsticker-dir "/icons/")) + (file-name-as-directory + (expand-file-name "icons" newsticker-dir))) (defun newsticker--image-get (feed-name filename directory url) "Get image for FEED-NAME by returning FILENAME from DIRECTORY. @@ -2114,7 +2116,8 @@ newsticker--cache-get-feed (defun newsticker--cache-dir () "Return directory for saving cache data." - (concat newsticker-dir "/feeds")) + (file-name-as-directory + (expand-file-name "feeds" newsticker-dir))) (defun newsticker--cache-save () "Save cache data for all feeds." @@ -2125,11 +2128,15 @@ newsticker--cache-save (defun newsticker--cache-save-feed (feed) "Save cache data for FEED." - (let ((dir (concat (newsticker--cache-dir) "/" (symbol-name (car feed))))) + (let ((dir (file-name-as-directory + (expand-file-name (symbol-name (car feed)) + (newsticker--cache-dir)))) + (print-level nil) + (print-length nil)) (unless (file-directory-p dir) (make-directory dir t)) (let ((coding-system-for-write 'utf-8)) - (with-temp-file (concat dir "/data") + (with-temp-file (expand-file-name "data" dir) (insert ";; -*- coding: utf-8 -*-\n") (insert (prin1-to-string (cdr feed))))))) @@ -2141,7 +2148,7 @@ newsticker--cache-read (defun newsticker--cache-read-feed (feed-name) "Read cache data for feed named FEED-NAME." - (let ((file-name (concat (newsticker--cache-dir) "/" feed-name "/data")) + (let ((file-name (expand-file-name "data" (expand-file-name feed-name (newsticker--cache-dir))) (coding-system-for-read 'utf-8)) (when (file-exists-p file-name) (with-temp-buffer @@ -2334,14 +2343,15 @@ newsticker-download-images "Download the first image. If FEEDNAME equals \"imagefeed\" download the first image URL found in the description=contents of ITEM to the directory -\"~/tmp/newsticker/FEEDNAME/TITLE\" where TITLE is the title of +`temporary-file-directory'/newsticker/FEEDNAME/TITLE where TITLE is the title of the item." (when (string= feedname "imagefeed") (let ((title (newsticker--title item)) (desc (newsticker--desc item))) (when (string-match "