From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: TIP: Opening selected files with ROX file manager Date: Wed, 07 Sep 2022 21:38:08 +0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11141"; mail-complaints-to="usenet@ciao.gmane.io" To: Help GNU Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 07 20:43:15 2022 Return-path: Envelope-to: geh-help-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 1oW015-0002jM-OG for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 07 Sep 2022 20:43:15 +0200 Original-Received: from localhost ([::1]:40128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oW014-0001np-QV for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 07 Sep 2022 14:43:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVzxS-0001Re-Tx for help-gnu-emacs@gnu.org; Wed, 07 Sep 2022 14:39:30 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:40347) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVzxQ-00068k-ON for help-gnu-emacs@gnu.org; Wed, 07 Sep 2022 14:39:30 -0400 Original-Received: from localhost ([::ffff:102.82.36.66]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 00000000000B5AC5.000000006318E53C.00007CFE; Wed, 07 Sep 2022 11:38:52 -0700 Received-SPF: pass client-ip=217.170.207.13; envelope-from=support1@rcdrun.com; helo=stw1.rcdrun.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:139312 Archived-At: I often have case where I locate files by using Emacs and Dired, and need to drag and drop those files to other application in X. For dragging and dropping I like to use ROX file manager. Problem is when files are many, or there are many images, then opening of files takes longer time and visually it is not possible to locate the same files which I wanted to drop or share into chat window of other application. Solution is to create temporary directory and make symbolic links from it. (defun rcd-temp-directory-name (&optional directory-name) "Return temporary directory name." (let ((name (concat (file-name-as-directory (or (getenv "TMPDIR") "/tmp/")) "temp-dirs/" (file-name-as-directory (or directory-name (format-time-string "%A-%B-%d-%Y-%H-%M-%S")))))) name)) (rcd-temp-directory-name) ⇒ "/home/data1/protected/tmp/temp-dirs/Wednesday-September-07-2022-21-35-24/" The following function opens ROX Filer. (defun rox (&optional file) "Start ROX Filer with optional FILE. FILE can be directory." (interactive) (if file (start-process "Rox" "Rox" "rox" "-n" "-s" file) (start-process "Rox" "Rox" "rox" "-n"))) And following function is the key function that creates temporary directory and opens it with graphical file manager containing only files selected within Dired. (defun rox-dired-files () "Generate temporary directory with selected files in Dired." (interactive) (let ((files (dired-get-marked-files))) (when filesn (let ((directory (rcd-temp-directory-name))) (mkdir directory t) (while files (let* ((target (pop files)) (linkname (concat (file-name-as-directory directory) (file-name-nondirectory target)))) (make-symbolic-link target linkname t))) (rox (expand-file-name directory)))))) It is very hand to assign key in dired to this function, so that marked files simply appear in new Rox file window. (keymap-set dired-mode-map "C-c r" #'rox-dired-files) One can replace Rox with other file managers. Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/