From unknown Sat Aug 16 10:42:49 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#13442 <13442@debbugs.gnu.org> To: bug#13442 <13442@debbugs.gnu.org> Subject: Status: 24.1; Please add a function to hexify paths to url-util, e.g. the attached Reply-To: bug#13442 <13442@debbugs.gnu.org> Date: Sat, 16 Aug 2025 17:42:49 +0000 retitle 13442 24.1; Please add a function to hexify paths to url-util, e.g.= the attached reassign 13442 emacs submitter 13442 Reuben Thomas severity 13442 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 14 17:30:04 2013 Received: (at submit) by debbugs.gnu.org; 14 Jan 2013 22:30:04 +0000 Received: from localhost ([127.0.0.1]:60399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TusXb-0007GQ-Co for submit@debbugs.gnu.org; Mon, 14 Jan 2013 17:30:04 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35098) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TusXY-0007FV-6I for submit@debbugs.gnu.org; Mon, 14 Jan 2013 17:30:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TusX6-0002c9-1Q for submit@debbugs.gnu.org; Mon, 14 Jan 2013 17:29:33 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-104.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:37291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TusX5-0002c5-UU for submit@debbugs.gnu.org; Mon, 14 Jan 2013 17:29:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TusX3-0001WP-3T for bug-gnu-emacs@gnu.org; Mon, 14 Jan 2013 17:29:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TusX0-0002bK-Pq for bug-gnu-emacs@gnu.org; Mon, 14 Jan 2013 17:29:29 -0500 Received: from exprod7og108.obsmtp.com ([64.18.2.169]:59901) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TusX0-0002bA-Cj for bug-gnu-emacs@gnu.org; Mon, 14 Jan 2013 17:29:26 -0500 Received: from mail-la0-f72.google.com ([209.85.215.72]) (using TLSv1) by exprod7ob108.postini.com ([64.18.6.12]) with SMTP ID DSNKUPSGw+cM1GqrUXy2Msh9ztkEK4kRIZ3x@postini.com; Mon, 14 Jan 2013 14:29:25 PST Received: by mail-la0-f72.google.com with SMTP id fp12so4595248lab.11 for ; Mon, 14 Jan 2013 14:29:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-received:from:to:subject:date:message-id:mime-version :content-type:x-gm-message-state; bh=FhnEtC0GimMg0fFX4So6NO+lU69i3zFEawssYU+XWNo=; b=h/jWU58RL5q0MEmOejcfRyK8hACcs9PxuQl/E65Y4233F3T354c3esbEXmM2v9KIrd aAfPBwPpILbulnYCFkad2nF3JxswXWzJ2wR6Pp14kTwci7pjr12Q4dj56wBIxQhl0Hzi TaH8KAevIovEJbsVjQnz4RJ/hSo97gAYX2TLt/1IUcpBm/wc8ZCKBQDyyBnJf0s4w+pO /NdH+xpNylQgdYA8Jqa3MU0n7CYhw1Vl1NXo6TpGMxRBrBxqr9GjHd33/ZUSaU/pFjkQ aJXnuOE5INrJTa2pOiTSlDiUEFdKFI8fOcMggkTDGo0fC4FgnfHpSz5gYMNFxIFUG912 oh9w== X-Received: by 10.180.82.41 with SMTP id f9mr93682wiy.25.1358202562829; Mon, 14 Jan 2013 14:29:22 -0800 (PST) X-Received: by 10.180.82.41 with SMTP id f9mr93676wiy.25.1358202562697; Mon, 14 Jan 2013 14:29:22 -0800 (PST) Received: from skwd ([149.241.115.91]) by mx.google.com with ESMTPS id bd6sm762599wib.10.2013.01.14.14.29.21 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Jan 2013 14:29:22 -0800 (PST) From: Reuben Thomas To: bug-gnu-emacs@gnu.org Subject: 24.1; Please add a function to hexify paths to url-util, e.g. the attached Date: Mon, 14 Jan 2013 22:29:20 +0000 Message-ID: <87fw23s8jj.fsf@sc3d.org> MIME-Version: 1.0 Content-Type: text/plain X-Gm-Message-State: ALoCoQkw2ZAmXAegmjK2dJh3P+MItxtsiLucPcFXx7cjzpOwzaUMTBqGcDNZnNsdjS3AYc/SRuR2YjYcq+Aqt9nEM8aj7+33mbORk6hb0R6hs4ANUmCp/3KQrcWdowUJwG/JI9Vc2Gj5xPs+KLdL0FFUVS2X7ORB+OxWEd4dKNvUBj/jSdEzRMg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) Sometimes, one needs to escape a path that will be made part of a URL. The code here: https://github.com/MassimoLauria/dotemacs/blob/master/init-latex.el shows a need for it, namely, escaping a filename to pass as part of a URL to DBus as part of the use of SyncTeX. As far as I can tell, there's no function that does this currently. Something like the code at the above-mentioned URL seems to work nicely, e.g.: (defun url-hexify-path (path) "Handle special characters for urlify. `/' is added temporarily to `url-unreserved-chars', so that `url-hexify-string' won't escape path separators." (let ((url-unreserved-chars (cons ?/ url-unreserved-chars))) (url-hexify-string path))) though I imagine this could be more neatly done. Since '/' is the only special character in paths that needs to be retained in URLs, the algorithm seems sound, at least. In GNU Emacs 24.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.12) of 2012-09-22 on batsu, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11300000 Configured using: `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.1/site-lisp:/usr/share/emacs/site-lisp' '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -O2' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: en_GB.UTF-8 value of $LC_NUMERIC: en_GB.UTF-8 value of $LC_TIME: en_GB.UTF-8 value of $LANG: en_GB.UTF-8 value of $XMODIFIERS: @im=none locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: shell-dirtrack-mode: t recentf-mode: t show-paren-mode: t server-mode: t savehist-mode: t minibuffer-electric-default-mode: t iswitchb-mode: t icomplete-mode: t global-auto-revert-mode: t desktop-save-mode: t TeX-PDF-mode: t TeX-source-correlate-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-a C-SPC C-n C-n C-n C-x b C-x b C-s C-a C-SPC C-n C-n C-n C-n C-n C-n M-x r e p o r t - e m a c s - b u g Recent messages: Wrote /home/rrt/.emacs.d/funs.el url-hexify-path byte-code: End of buffer [16 times] TeX-evince-sync-view Auto-saving...done Auto-saving...done Saving file /home/rrt/.emacs.d/funs.el... Wrote /home/rrt/.emacs.d/funs.el Making completion list... Mark set [3 times] Load-path shadows: /home/rrt/local/share/emacs/site-lisp/browse-kill-ring hides /usr/share/emacs24/site-lisp/emacs-goodies-el/browse-kill-ring /home/rrt/local/share/emacs/site-lisp/dict hides /usr/share/emacs24/site-lisp/emacs-goodies-el/dict /home/rrt/.emacs.d/elpa/dictionary-1.8.7/dictionary-init hides /usr/share/emacs24/site-lisp/dictionary-el/dictionary-init /home/rrt/.emacs.d/elpa/dictionary-1.8.7/dictionary hides /usr/share/emacs24/site-lisp/dictionary-el/dictionary /home/rrt/.emacs.d/elpa/dictionary-1.8.7/link hides /usr/share/emacs24/site-lisp/dictionary-el/link /home/rrt/.emacs.d/elpa/dictionary-1.8.7/connection hides /usr/share/emacs24/site-lisp/dictionary-el/connection /usr/share/emacs24/site-lisp/auctex/tex-style hides /usr/share/emacs/site-lisp/auctex/tex-style /usr/share/emacs24/site-lisp/auctex/tex-mik hides /usr/share/emacs/site-lisp/auctex/tex-mik /usr/share/emacs24/site-lisp/auctex/multi-prompt hides /usr/share/emacs/site-lisp/auctex/multi-prompt /usr/share/emacs24/site-lisp/auctex/tex-jp hides /usr/share/emacs/site-lisp/auctex/tex-jp /usr/share/emacs24/site-lisp/auctex/tex-info hides /usr/share/emacs/site-lisp/auctex/tex-info /usr/share/emacs24/site-lisp/auctex/plain-tex hides /usr/share/emacs/site-lisp/auctex/plain-tex /usr/share/emacs24/site-lisp/auctex/latex hides /usr/share/emacs/site-lisp/auctex/latex /usr/share/emacs24/site-lisp/auctex/preview hides /usr/share/emacs/site-lisp/auctex/preview /usr/share/emacs24/site-lisp/auctex/tex hides /usr/share/emacs/site-lisp/auctex/tex /usr/share/emacs24/site-lisp/auctex/texmathp hides /usr/share/emacs/site-lisp/auctex/texmathp /usr/share/emacs24/site-lisp/auctex/context-nl hides /usr/share/emacs/site-lisp/auctex/context-nl /usr/share/emacs24/site-lisp/auctex/tex-font hides /usr/share/emacs/site-lisp/auctex/tex-font /usr/share/emacs24/site-lisp/auctex/toolbar-x hides /usr/share/emacs/site-lisp/auctex/toolbar-x /usr/share/emacs24/site-lisp/auctex/tex-buf hides /usr/share/emacs/site-lisp/auctex/tex-buf /usr/share/emacs24/site-lisp/auctex/bib-cite hides /usr/share/emacs/site-lisp/auctex/bib-cite /usr/share/emacs24/site-lisp/auctex/context-en hides /usr/share/emacs/site-lisp/auctex/context-en /usr/share/emacs24/site-lisp/auctex/tex-fold hides /usr/share/emacs/site-lisp/auctex/tex-fold /usr/share/emacs24/site-lisp/auctex/tex-bar hides /usr/share/emacs/site-lisp/auctex/tex-bar /usr/share/emacs24/site-lisp/auctex/context hides /usr/share/emacs/site-lisp/auctex/context /usr/share/emacs24/site-lisp/auctex/prv-emacs hides /usr/share/emacs/site-lisp/auctex/prv-emacs /usr/share/emacs24/site-lisp/auctex/font-latex hides /usr/share/emacs/site-lisp/auctex/font-latex /usr/share/emacs/site-lisp/golang-mode/go-mode-load hides /usr/share/emacs/24.1/site-lisp/golang-mode/go-mode-load /usr/share/emacs/site-lisp/golang-mode/go-mode hides /usr/share/emacs/24.1/site-lisp/golang-mode/go-mode /usr/share/emacs/24.1/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode /usr/share/emacs/24.1/site-lisp/cdargs hides /usr/share/emacs/site-lisp/cdargs /usr/share/emacs/site-lisp/rst hides /usr/share/emacs/24.1/lisp/textmodes/rst /usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.1/lisp/textmodes/ispell /usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.1/lisp/textmodes/flyspell Features: (shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils newcomment url-util url-parse auth-source eieio gnus-util password-cache url-vars mm-util mail-prsvr shell pcomplete grep jka-compr find-func multi-isearch texmathp etags lua-mode cperl-mode vc-git python-21 python sh-script executable todoo help-mode view latexenc preview prv-emacs warnings noutline outline tex-buf font-latex byte-opt bytecomp byte-compile cconv macroexp latex tex-style flymake compile comint ansi-color ring face-remap flyspell ispell smart-quotes auto-dictionary-autoloads c-eldoc-autoloads dictionary-autoloads diff-git-autoloads dired-isearch-autoloads full-ack-autoloads guess-style-autoloads kill-ring-search-autoloads magit-autoloads mv-shell-autoloads tumble-autoloads http-post-simple-autoloads package tabulated-list completing-help recentf tree-widget wid-edit uniquify paren server savehist minibuf-eldef iswitchb icomplete autorevert desktop cus-start cus-load ropemacs pymacs tex dbus xml regexp-opt user-site-loaddefs advice advice-preload yasnippet help-fns derived edmacro kmacro easymenu assoc cl muse-autoloads go-mode-load emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs easy-mmode preview-latex tex-site auto-loads time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) -- http://rrt.sc3d.org/ From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 14 21:35:44 2013 Received: (at 13442) by debbugs.gnu.org; 15 Jan 2013 02:35:45 +0000 Received: from localhost ([127.0.0.1]:60557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TuwNM-0004b6-I3 for submit@debbugs.gnu.org; Mon, 14 Jan 2013 21:35:44 -0500 Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:55886) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TuwNJ-0004ar-Ci for 13442@debbugs.gnu.org; Mon, 14 Jan 2013 21:35:43 -0500 Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id CA121C0563; Tue, 15 Jan 2013 11:35:10 +0900 (JST) Date: Tue, 15 Jan 2013 11:35:10 +0900 Message-ID: From: YAMAMOTO Mitsuharu To: Reuben Thomas Subject: Re: bug#13442: 24.1; Please add a function to hexify paths to url-util, e.g. the attached In-Reply-To: <87fw23s8jj.fsf@sc3d.org> References: <87fw23s8jj.fsf@sc3d.org> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) Organization: Faculty of Science, Chiba University MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 13442 Cc: 13442@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) >>>>> On Mon, 14 Jan 2013 22:29:20 +0000, Reuben Thomas said: > Sometimes, one needs to escape a path that will be made part of a URL. The code here: > https://github.com/MassimoLauria/dotemacs/blob/master/init-latex.el > shows a need for it, namely, escaping a filename to pass as part of a > URL to DBus as part of the use of SyncTeX. > As far as I can tell, there's no function that does this currently. > Something like the code at the above-mentioned URL seems to work nicely, > e.g.: > (defun url-hexify-path (path) > "Handle special characters for urlify. `/' is added temporarily > to `url-unreserved-chars', so that `url-hexify-string' won't > escape path separators." > (let ((url-unreserved-chars (cons ?/ url-unreserved-chars))) > (url-hexify-string path))) > though I imagine this could be more neatly done. Since '/' is the only > special character in paths that needs to be retained in URLs, the > algorithm seems sound, at least. I usually do that like this: ;; Suppose we have an absolute file name in `file-name'. (let* ((coding (or file-name-coding-system default-file-name-coding-system)) (encoded-file-name (if coding (encode-coding-string file-name coding) file-name))) (concat "file://localhost" (mapconcat 'url-hexify-string (split-string encoded-file-name "/") "/"))) BTW, I think it is not a good idea to provide a function that simply "escapes" a file name string. Such a function should always return a well-formed URL. See also http://lists.gnu.org/archive/html/emacs-devel/2007-09/msg01168.html and http://lists.gnu.org/archive/html/emacs-devel/2006-05/msg01060.html . YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 25 16:14:54 2015 Received: (at control) by debbugs.gnu.org; 25 Dec 2015 21:14:54 +0000 Received: from localhost ([127.0.0.1]:35557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCZhO-000724-6a for submit@debbugs.gnu.org; Fri, 25 Dec 2015 16:14:54 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:43422) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCZhM-00071o-1Q for control@debbugs.gnu.org; Fri, 25 Dec 2015 16:14:52 -0500 Received: from 2.150.58.24.tmi.telenormobil.no ([2.150.58.24] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aCZh1-0004YA-5C for control@debbugs.gnu.org; Fri, 25 Dec 2015 22:14:31 +0100 Date: Fri, 25 Dec 2015 22:14:29 +0100 Message-Id: <8760zm1b9m.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #13442 X-MailScanner-ID: 1aCZh1-0004YA-5C X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1451682871.54695@JKRIa6xNzkpCJIfHKXTIdw X-Spam-Status: No X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) close 13442 From unknown Sat Aug 16 10:42:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 23 Jan 2016 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator