[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/hyperbole-merge-7.0.2b 2e878cb 16/23: Initial commit of W
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/hyperbole-merge-7.0.2b 2e878cb 16/23: Initial commit of Windows path handling |
Date: |
Tue, 5 Feb 2019 16:11:21 -0500 (EST) |
branch: scratch/hyperbole-merge-7.0.2b
commit 2e878cbf1993485fba3b2581e84ce77d22b4e56a
Author: Bob Weiner <address@hidden>
Commit: Bob Weiner <address@hidden>
Initial commit of Windows path handling
---
hibtypes.el | 11 ++++++++---
hpath.el | 33 +++++++++++++++++++++++++++++++--
2 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/hibtypes.el b/hibtypes.el
old mode 100644
new mode 100755
index 47af123..f4dd991
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -177,6 +177,12 @@ See `hpath:find' function documentation for special file
display options."
;;; Displays files at specific lines and optional column number locations.
;;; ========================================================================
+(defconst hibtypes-path-line-and-col-regexp
+ (if (eq system-type 'windows-nt)
+ ;; Allow for 'c:' single letter drive prefixes on Windows
+ "\\([^ \t\n\r:][^ \t\n\r]+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?"
+ "\\([^ \t\n\r:]+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?"))
+
(defib pathname-line-and-column ()
"Makes a valid pathname:line-num[:column-num] pattern display the path at
line-num and optional column-num.
Also works for remote pathnames.
@@ -187,8 +193,7 @@ removed from pathname when searching for a valid match.
See `hpath:find' function documentation for special file display options."
(let ((path-line-and-col (hpath:delimited-possible-path)))
(if (and (stringp path-line-and-col)
- (string-match "\\([^ \t\n\r:]+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?"
- path-line-and-col))
+ (string-match hibtypes-path-line-and-col-regexp path-line-and-col))
(let ((file (expand-file-name (match-string-no-properties 1
path-line-and-col)))
(line-num (string-to-number (match-string-no-properties 2
path-line-and-col)))
(col-num (if (match-end 3) (string-to-number
(match-string-no-properties
@@ -740,7 +745,7 @@ This works with JavaScript and Python tracebacks, gdb, dbx,
and xdb. Such lines
(save-excursion
(beginning-of-line)
(cond
- ;; Python pdb
+ ;; Python pdb or traceback
((looking-at ".+ File \"\\([^\"\n\r]+\\)\", line \\([0-9]+\\)")
(let* ((file (match-string-no-properties 1))
(line-num (match-string-no-properties 2))
diff --git a/hpath.el b/hpath.el
old mode 100644
new mode 100755
index d26678d..a391447
--- a/hpath.el
+++ b/hpath.el
@@ -40,6 +40,35 @@ Default is `nil' since this can slow down normal file
finding."
:group 'hyperbole-buttons)
;;; ************************************************************************
+;;; MS WINDOWS PATH CONVERSIONS
+;;; ************************************************************************
+
+(defvar hpath:windows-mount-prefix "/mnt"
+ "Unix-style path prefix to add when converting MS Windows drive paths.")
+
+(defvar hpath:windows-system-type-list '(cygwin windows-nt ms-dos)
+ "List of 'system-type' values for which Windows paths are not converted to
UNIX-style.")
+
+(defun hpath:windows-to-unix-path(path)
+ "Convert a recognizable Windows path to a UNIX-style path.
+If path begins with a Windows drive letter, prefix the converted path with the
value of 'windows-mount-prefix'."
+ (if (not (memq system-type hpath:windows-system-type-list))
+ ;; Convert Windows disk drive paths to UNIX-style with a mount prefix.
+ (cond ((and (stringp path) (string-match "\\`\\([a-zA-Z]\\):" path))
+ (expand-file-name
+ (concat (match-string 1 path) "/" (substring path (match-end 0)))
+ hpath:windows-mount-prefix))
+ ;; !! Finish handling Windows network paths with forward
+ ;; or backward slashes
+ ((and (stringp path) (string-match "\\`\\(//\\|\\\\\\\\\\)[^/\\]"
path))
+ path)
+ (t path))))
+
+;; Replace all backslashes with forward slashes in path
+;;(defun a (path)
+;; (regexp-re
+
+;;; ************************************************************************
;;; FILE VIEWER COMMAND SETTINGS
;;; ************************************************************************
@@ -854,7 +883,7 @@ nonexistent local paths are allowed."
(not (string-match "[\t\n\r\"`'|{}\\]" path))
(or (not (hpath:www-p path))
(string-match "\\`ftp[:.]" path))
- (let ((remote-path (string-match "@.+:\\|^/.+:\\|.+:/" path)))
+ (let ((remote-path (string-match "@.+:\\|^/.+:\\|..+:/" path)))
(if (cond (remote-path
(cond ((eq type 'file)
(not (string-equal "/" (substring path -1))))
@@ -1271,7 +1300,7 @@ Returns \"anonymous\" if no default user is set."
string)))
(defun hpath:exists-p (path &optional suffix-flag)
- "Return PATH if it exists. (This does not mean you can read it.)
+ "Return PATH if it exists. (This does not mean you can read it).
If PATH exists with or without a suffix from hpath:suffixes, then that
pathname is returned.
- [elpa] scratch/hyperbole-merge-7.0.2b 7efe2f2 03/23: Removed Koutliner use of filladapt mode; it can cause filling errors, (continued)
- [elpa] scratch/hyperbole-merge-7.0.2b 7efe2f2 03/23: Removed Koutliner use of filladapt mode; it can cause filling errors, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 30600eb 04/23: Added extensive gitlab-reference ibtype; improved github-reference, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 1568adb 07/23: Merge Mats TEXINFO_SRC Makefile changes, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b ad584fd 11/23: Use implicit button org-mode also for org derived modes, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b f446ee0 22/23: Fixed README.md typo that referred to HY-ABOUT instead of HY-NEWS., Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 45a0841 12/23: Add default search term for web searches, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b d4653c5 10/23: Require 2.0 of treemacs and use bury-buffer, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b c0bd503 05/23: Rebuild doc when doc sources have changed, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 5892083 09/23: Use new treemacs 1.18 function treemacs-toggle-node, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 450489e 13/23: Adjust tramp-file-name-regexp to work with looking-at, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 2e878cb 16/23: Initial commit of Windows path handling,
Stefan Monnier <=
- [elpa] scratch/hyperbole-merge-7.0.2b d729726 21/23: Merge branch 'master' of github.com:rswgnu/hyperbole, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 66106d3 08/23: Fixed issue with inhibit-hyperbole-messaging not be set properly, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b afe3db8 06/23: Added 'k' to klink ids exported to html;, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 09e646e 17/23: Add implicit path button support for MSWindows paths, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b b02bf71 19/23: Merge branch 'master' of git.sv.gnu.org:/srv/git/hyperbole with changes, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 6139ba6 20/23: Set theme jekyll-theme-cayman, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b bda4f2d 15/23: Merge remote-tracking branch 'hyperbole/master' into externals/hyperbole, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b f3d59c4 18/23: Large set of BW changes for V7.0.2b pre-release., Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b c75213b 23/23: Merge remote-tracking branch 'hyperbole/master' into externals/hyperbole, Stefan Monnier, 2019/02/05
- [elpa] scratch/hyperbole-merge-7.0.2b 29b1b76 14/23: Merge tag 'hyperbole-7.0.2a' into externals/hyperbole, Stefan Monnier, 2019/02/05