[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/09: emacs: Make 'guix-find-location' interactive.
From: |
Alex Kost |
Subject: |
05/09: emacs: Make 'guix-find-location' interactive. |
Date: |
Mon, 18 Apr 2016 07:13:37 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit e81a89d176a7330c22e263a000754cfa2b62476d
Author: Alex Kost <address@hidden>
Date: Fri Apr 1 21:52:21 2016 +0300
emacs: Make 'guix-find-location' interactive.
* emacs/guix-location.el (guix-find-location): Make interactive. Adjust
to handle "reduced" locations (without line and column numbers).
---
emacs/guix-location.el | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/emacs/guix-location.el b/emacs/guix-location.el
index 4b23293..81396b4 100644
--- a/emacs/guix-location.el
+++ b/emacs/guix-location.el
@@ -34,24 +34,31 @@ For the meaning of location, see `guix-find-location'."
(guix-eval-read (guix-make-guile-expression
'package-location-string id-or-name)))
+;;;###autoload
(defun guix-find-location (location &optional directory)
"Go to LOCATION of a package.
LOCATION is a string of the form:
- \"PATH:LINE:COLUMN\"
+ \"FILE:LINE:COLUMN\"
+
+If FILE is relative, it is considered to be relative to
+DIRECTORY (`guix-directory' by default).
-If PATH is relative, it is considered to be relative to
-DIRECTORY (`guix-directory' by default)."
- (cl-multiple-value-bind (path line col)
+Interactively, prompt for LOCATION. With prefix argument, prompt
+for DIRECTORY as well."
+ (interactive
+ (list (guix-read-package-location)
+ (guix-read-directory)))
+ (cl-multiple-value-bind (file line column)
(split-string location ":")
- (let ((file (expand-file-name path (or directory guix-directory)))
- (line (string-to-number line))
- (col (string-to-number col)))
- (find-file file)
- (goto-char (point-min))
- (forward-line (- line 1))
- (move-to-column col)
- (recenter 1))))
+ (find-file (expand-file-name file (or directory guix-directory)))
+ (when (and line column)
+ (let ((line (string-to-number line))
+ (column (string-to-number column)))
+ (goto-char (point-min))
+ (forward-line (- line 1))
+ (move-to-column column)
+ (recenter 1)))))
;;;###autoload
(defun guix-edit (id-or-name &optional directory)
- branch master updated (9bb46c1 -> a7c6178), Alex Kost, 2016/04/18
- 05/09: emacs: Make 'guix-find-location' interactive.,
Alex Kost <=
- 03/09: emacs: Separate package license code., Alex Kost, 2016/04/18
- 09/09: emacs: Display license info on button press in Package Info buffer., Alex Kost, 2016/04/18
- 01/09: emacs: Add 'guix-packages-by-location' command., Alex Kost, 2016/04/18
- 06/09: doc: emacs: Add "Package Source Locations" section., Alex Kost, 2016/04/18
- 08/09: emacs: Add location "Packages" button to Package Info buffer., Alex Kost, 2016/04/18
- 07/09: emacs: Add interface for package locations., Alex Kost, 2016/04/18
- 02/09: emacs: Separate package location code., Alex Kost, 2016/04/18
- 04/09: emacs: Display message if license not found., Alex Kost, 2016/04/18