From: Jean Louis <bugs@gnu.support>
To: help-gnu-emacs@gnu.org
Subject: Re: [works on the comman line] (was: [a directory is also created])
Date: Sun, 20 Feb 2022 17:08:04 +0300 [thread overview]
Message-ID: <YhJLRGd0Z5kWnodI@protected.localdomain> (raw)
In-Reply-To: <87wnhpk62t.fsf_-_@mat.ucm.es>
* Uwe Brauer <oub@mat.ucm.es> [2022-02-20 16:44]:
> >>> "UB" == Uwe Brauer <oub@mat.ucm.es> writes:
>
> >> * Uwe Brauer <oub@mat.ucm.es> [2022-02-20 15:01]:
>
> >> Solution is Z.
>
> >> 1) Adapt `dired-compress-file-alist' for ZIP files;
> >> example:
>
> >> (setf (alist-get "\\.zip\\'" dired-compress-file-alist) "zip -9 %o %i")
>
> > It is a more complicated that I thought, but this is because of the
> > behavior of zip. If I use this setting zip creates a zip archive that
> > contains the file, but the whole absolute path, and that is crazy.
>
>
> > (setf (alist-get "\\.zip\\'" dired-compress-file-alist) "zip -9 --junk-paths %o %i")
>
> Very odd:
>
> On the command line
> zip -9 -j test.zip test.tex
>
> Works but emacs or dired adds a directory, who is here the culprit?
dired-compress-file-alist is a variable defined in ‘dired-aux.el’.
Where it says:
Within CMD, %i denotes the input file(s), and %o denotes the
output file. %i path(s) are relative, while %o is absolute.
Maybe that is limitation.
You can do it in single function here:
(defun rcd-zip-file ()
"ZIP single file within Dired."
(interactive)
(let* ((file (car (dired-get-marked-files t)))
(zip-file (concat file ".zip")))
(when file
(start-process "ZIP" "ZIP" "zip" "-9" zip-file file)
(revert-buffer))))
Then just bind to a key.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
next prev parent reply other threads:[~2022-02-20 14:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-20 9:22 how to generate a zip file (not a directory) within dired Uwe Brauer
2022-02-20 12:59 ` Jean Louis
2022-02-20 13:16 ` Uwe Brauer
2022-02-20 13:32 ` [a directory is also created] (was: how to generate a zip file (not a directory) within dired) Uwe Brauer
2022-02-20 13:42 ` [works on the comman line] (was: [a directory is also created]) Uwe Brauer
2022-02-20 14:08 ` Jean Louis [this message]
2022-02-20 15:41 ` [works on the comman line] Uwe Brauer
2022-02-20 15:46 ` Uwe Brauer
2022-02-21 4:28 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-21 19:38 ` Uwe Brauer
2022-02-26 0:47 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-21 4:18 ` [works on the comman line] (was: [a directory is also created]) Emanuel Berg via Users list for the GNU Emacs text editor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YhJLRGd0Z5kWnodI@protected.localdomain \
--to=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).