labrat 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9638d07db35a3698225529915d79d2075fb2ec912d6fb5a476d4863508c64cb
4
- data.tar.gz: fab7d0b7feaa529f3b76bef4bade636635985c9c5ac1a7f9bd045ec347f73565
3
+ metadata.gz: 8ce9676af6fe2c1155bd75cdae1dc61e6b0a8875408340a53ab0b8cbef18b6b3
4
+ data.tar.gz: 313c7fc8caaac101a427e2e8f8f707e12dd2355fef59445c8f133eeba3caa834
5
5
  SHA512:
6
- metadata.gz: 17ee2b23c97e134bc5eb74926684fa8025b902a09cc1fbb33e8943b9ede3a8b037b39bea7c5d3d7527c40a833ea259a4c66a9cf74eea90efdf211ff266cf2767
7
- data.tar.gz: 0d81a841a46408a1448fcb34ca6ad8f899493ecbcc1581cbf4cfb74d4990e4234c4c43b9c7c55346ae82e253bddc24051848f3aea057607476d921acc95727d3
6
+ metadata.gz: 36b1daaa10a3bd14688ad0eaecdcee97afdc9e5bc2511a33a43346b63f3335e0d4c2111ec96144055fca72a84d5ce83e51fc6c9ae2347c360e13f74966f6e0ce
7
+ data.tar.gz: f24a79df4d77e682be68c1fecf709214250b050665eddd85353026b4358cdaa6aa8e771bed16f4ee6eb901ac7ff54e815bdf1f9fa52c6310ea913993b816d4e8
data/CHANGELOG.md CHANGED
@@ -1,22 +1,33 @@
1
- - [Version 1.4.1 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-28 Sun]</span></span>](#orgd8249d2)
2
- - [Version 1.3.0 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-26 Fri]</span></span>](#org107aabd)
3
- - [Version 1.2.3 <span class="timestamp-wrapper"><span class="timestamp">[2025-03-20 Thu]</span></span>](#org99dae2d)
4
- - [Version 1.2.2 <span class="timestamp-wrapper"><span class="timestamp">[2024-11-29 Fri]</span></span>](#org9958d5d)
5
- - [Version 1.2.1 <span class="timestamp-wrapper"><span class="timestamp">[2024-09-20 Fri]</span></span>](#org69020a9)
6
- - [Version 1.2.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-19 Thu]</span></span>](#org8b0bc88)
7
- - [Version 1.1.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-06 Fri]</span></span>](#orgccb7d5f)
8
- - [Version 0.1.14 <span class="timestamp-wrapper"><span class="timestamp">[2022-02-03 Thu]</span></span>](#org1ddf800)
9
- - [Version 0.1.13 <span class="timestamp-wrapper"><span class="timestamp">[2021-11-04 Thu]</span></span>](#org3b34d02)
1
+ - [Version 1.6.0 <span class="timestamp-wrapper"><span class="timestamp">[2026-03-06 Fri]</span></span>](#org0072ea7)
2
+ - [Version 1.4.1 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-28 Sun]</span></span>](#org309b509)
3
+ - [Version 1.3.0 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-26 Fri]</span></span>](#orgcd48f5d)
4
+ - [Version 1.2.3 <span class="timestamp-wrapper"><span class="timestamp">[2025-03-20 Thu]</span></span>](#orgd671ebe)
5
+ - [Version 1.2.2 <span class="timestamp-wrapper"><span class="timestamp">[2024-11-29 Fri]</span></span>](#org55a1d4d)
6
+ - [Version 1.2.1 <span class="timestamp-wrapper"><span class="timestamp">[2024-09-20 Fri]</span></span>](#org89e5245)
7
+ - [Version 1.2.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-19 Thu]</span></span>](#orgeed739d)
8
+ - [Version 1.1.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-06 Fri]</span></span>](#orgadd5092)
9
+ - [Version 0.1.14 <span class="timestamp-wrapper"><span class="timestamp">[2022-02-03 Thu]</span></span>](#org25c7986)
10
+ - [Version 0.1.13 <span class="timestamp-wrapper"><span class="timestamp">[2021-11-04 Thu]</span></span>](#org2d49d11)
10
11
 
11
12
 
12
- <a id="orgd8249d2"></a>
13
+ <a id="org0072ea7"></a>
14
+
15
+ # Version 1.6.0 <span class="timestamp-wrapper"><span class="timestamp">[2026-03-06 Fri]</span></span>
16
+
17
+ - Improved labrat.el to ensure that the **labrat** buffer gets created and logs the command used along with a timestamp and any errors.
18
+ - Echo the output file name after creation.
19
+ - Add the process number to file name to prevent name collisions.
20
+ - Fix use of XDG\_DATA\_HOME environment variable.
21
+
22
+
23
+ <a id="org309b509"></a>
13
24
 
14
25
  # Version 1.4.1 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-28 Sun]</span></span>
15
26
 
16
27
  - Added a `vim` plugin to allow printing or viewing labels from within a vim buffer as was possible in Emacs with `labrat.el`.
17
28
 
18
29
 
19
- <a id="org107aabd"></a>
30
+ <a id="orgcd48f5d"></a>
20
31
 
21
32
  # Version 1.3.0 <span class="timestamp-wrapper"><span class="timestamp">[2025-12-26 Fri]</span></span>
22
33
 
@@ -24,28 +35,28 @@
24
35
  - Output file can still be overridden with the `-o` or `--out-file` option
25
36
 
26
37
 
27
- <a id="org99dae2d"></a>
38
+ <a id="orgd671ebe"></a>
28
39
 
29
40
  # Version 1.2.3 <span class="timestamp-wrapper"><span class="timestamp">[2025-03-20 Thu]</span></span>
30
41
 
31
42
  - No user-visible changes
32
43
 
33
44
 
34
- <a id="org9958d5d"></a>
45
+ <a id="org55a1d4d"></a>
35
46
 
36
47
  # Version 1.2.2 <span class="timestamp-wrapper"><span class="timestamp">[2024-11-29 Fri]</span></span>
37
48
 
38
49
  - Used `fat_config` gem to read config files
39
50
 
40
51
 
41
- <a id="org69020a9"></a>
52
+ <a id="org89e5245"></a>
42
53
 
43
54
  # Version 1.2.1 <span class="timestamp-wrapper"><span class="timestamp">[2024-09-20 Fri]</span></span>
44
55
 
45
56
  - Fixed `labrat.el` view command
46
57
 
47
58
 
48
- <a id="org8b0bc88"></a>
59
+ <a id="orgeed739d"></a>
49
60
 
50
61
  # Version 1.2.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-19 Thu]</span></span>
51
62
 
@@ -54,7 +65,7 @@
54
65
  - Minor bug fixes
55
66
 
56
67
 
57
- <a id="orgccb7d5f"></a>
68
+ <a id="orgadd5092"></a>
58
69
 
59
70
  # Version 1.1.0 <span class="timestamp-wrapper"><span class="timestamp">[2023-01-06 Fri]</span></span>
60
71
 
@@ -63,14 +74,14 @@
63
74
  - Added label name to template output
64
75
 
65
76
 
66
- <a id="org1ddf800"></a>
77
+ <a id="org25c7986"></a>
67
78
 
68
79
  # Version 0.1.14 <span class="timestamp-wrapper"><span class="timestamp">[2022-02-03 Thu]</span></span>
69
80
 
70
81
  - Nothing important
71
82
 
72
83
 
73
- <a id="org3b34d02"></a>
84
+ <a id="org2d49d11"></a>
74
85
 
75
86
  # Version 0.1.13 <span class="timestamp-wrapper"><span class="timestamp">[2021-11-04 Thu]</span></span>
76
87
 
data/CHANGELOG.org CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ * Version 1.6.0 [2026-03-06 Fri]
3
+ - Improved labrat.el to ensure that the *labrat* buffer gets created and logs
4
+ the command used along with a timestamp and any errors.
5
+ - Echo the output file name after creation.
6
+ - Add the process number to file name to prevent name collisions.
7
+ - Fix use of XDG_DATA_HOME environment variable.
8
+
2
9
  * Version 1.4.1 [2025-12-28 Sun]
3
10
  - Added a ~vim~ plugin to allow printing or viewing labels from within a vim
4
11
  buffer as was possible in Emacs with ~labrat.el~.
data/Gemfile.lock CHANGED
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- labrat (1.5.1)
15
+ labrat (1.6.0)
16
16
  activesupport
17
17
  fat_config (>= 0.4.2)
18
18
  matrix
@@ -220,7 +220,7 @@ CHECKSUMS
220
220
  irb (1.17.0) sha256=168c4ddb93d8a361a045c41d92b2952c7a118fa73f23fe14e55609eb7a863aae
221
221
  json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
222
222
  json-schema (6.1.0) sha256=6bf70a2cfb6dfd5a06da28093fa8190f324c88eabd36a7f47097f227321dc702
223
- labrat (1.5.1)
223
+ labrat (1.6.0)
224
224
  language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
225
225
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
226
226
  logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
data/lib/labrat/label.rb CHANGED
@@ -119,6 +119,7 @@ module Labrat
119
119
  end
120
120
  end
121
121
  end
122
+ puts ops.out_file
122
123
  self
123
124
  end
124
125
 
@@ -117,11 +117,11 @@ module Labrat
117
117
  end
118
118
 
119
119
  def self.default_out_file
120
- dir = ENV['XDG_DATA_HOME'] || "~/.local/share/labrat"
121
- dir = File.expand_path(dir)
120
+ base = ENV["XDG_DATA_HOME"] || "~/.local/share"
121
+ dir = File.expand_path(File.join(base, "labrat"))
122
122
  FileUtils.mkdir_p(dir)
123
123
  stamp = Time.now.strftime("%Y-%m-%dT%H:%M:%S.%3N")
124
- File.join(dir, stamp + '.pdf')
124
+ File.join(dir, "#{stamp}-#{$$}.pdf")
125
125
  end
126
126
 
127
127
  # Return any string in msg, e.g., the usage help or error.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Labrat
4
- VERSION = "1.5.1"
4
+ VERSION = "1.6.0"
5
5
  end
data/lib/lisp/labrat.el CHANGED
@@ -38,6 +38,9 @@ labrat configuration at ~/.config/labrat/config.yml."
38
38
  :type 'string
39
39
  :group 'labrat)
40
40
 
41
+ (defconst labrat-buffer-name "*labrat*"
42
+ "Name of the labrat process output buffer.")
43
+
41
44
  (defun labrat/pars-in-region ()
42
45
  "Return a string of paragraphs in region, separated by `labrat-label-sep'.
43
46
 
@@ -82,6 +85,57 @@ that start with '#' are removed, and the remaining lines
82
85
  returned"
83
86
  (s-join "\n" (--remove (string-match "^#" it) (s-split "\n" str))))
84
87
 
88
+ (defun labrat/run (&rest args)
89
+ "Run labrat with ARGS, always reusing and displaying `*labrat*'.
90
+
91
+ Stdout and stderr are both written to the `*labrat*' buffer.
92
+ Return the labrat exit status."
93
+ (let* ((buf (get-buffer-create labrat-buffer-name))
94
+ (stderr-file (make-temp-file "labrat-stderr-"))
95
+ (status nil))
96
+ (unwind-protect
97
+ (progn
98
+ (with-current-buffer buf
99
+ (let ((inhibit-read-only t)
100
+ (ts (format-time-string "%Y-%m-%d %H:%M:%S")))
101
+ (goto-char (point-max))
102
+ (unless (bolp)
103
+ (insert "\n"))
104
+ (insert (format "\n===== %s =====\n" ts))
105
+ (insert (format "$ %s %s\n\n"
106
+ labrat-executable
107
+ (mapconcat #'identity args " ")))))
108
+ (setq status
109
+ (apply #'call-process
110
+ labrat-executable
111
+ nil
112
+ (list buf stderr-file)
113
+ nil
114
+ args))
115
+ (with-current-buffer buf
116
+ (let ((inhibit-read-only t))
117
+ (when (file-exists-p stderr-file)
118
+ (let ((stderr-text
119
+ (with-temp-buffer
120
+ (insert-file-contents stderr-file)
121
+ (buffer-string))))
122
+ (unless (string-empty-p stderr-text)
123
+ (goto-char (point-max))
124
+ (unless (bolp)
125
+ (insert "\n"))
126
+ (insert "===== stderr =====\n")
127
+ (insert stderr-text)
128
+ (unless (bolp)
129
+ (insert "\n")))))
130
+ (goto-char (point-max))
131
+ (insert (format "\n[labrat exited with status %s]\n" status))))
132
+ (unless (equal status 0)
133
+ (display-buffer buf)
134
+ (message "labrat failed with status %s; see %s" status labrat-buffer-name))
135
+ status)
136
+ (when (file-exists-p stderr-file)
137
+ (delete-file stderr-file)))))
138
+
85
139
  (defun labrat-view ()
86
140
  "View the paragraph at or before point as a label with labrat.
87
141
 
@@ -90,19 +144,17 @@ paragraph at or before point inserted in the <label> position,
90
144
  but with each new-line replaced with the value of the variable
91
145
  labrat-nl-sep, '~~' by default."
92
146
  (interactive)
93
- (call-process labrat-executable nil (get-buffer-create "*labrat*") nil
94
- "-V" "-o ~/labrat.pdf" (labrat/pars-in-region)))
147
+ (labrat/run "-V" (labrat/pars-in-region)))
95
148
 
96
149
  (defun labrat-print ()
97
150
  "Print the paragraph at or before point as a label with labrat.
98
151
 
99
- This invokes the \"labrat -P <label>\" command with the paragraph
152
+ This invokes the \"labrat <label>\" command with the paragraph
100
153
  at or before point inserted in the <label> position, but with
101
154
  each new-line replaced with the value of the variable
102
155
  labrat-nl-sep, '~~' by default."
103
156
  (interactive)
104
- (call-process labrat-executable nil (buffer-name (get-buffer-create "*labrat*")) nil
105
- "-o ~/labrat.pdf" (labrat/pars-in-region)))
157
+ (labrat/run (labrat/pars-in-region)))
106
158
 
107
159
  (provide 'labrat)
108
160
  ;;; labrat.el ends here
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: labrat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel E. Doherty