Commit e129aab
authored
fix: promote headline while refile to file-end (#641)
* fix: promote headline while refile to file-end
- promote headlines to first level when archiving (like Emacs)
- promote headlines to first level when refiling without targeting a
headline (Emacs only allows headlines as refiling targets)
Motivation:
Refiling to file-ends is only indirectly used in Emacs Org-Mode for
archiving. In this case Org-Mode promotes headlines to the first
level in the archive file.
This fix aligns the archiving-behavior with Emacs while also adapting
the normal refiling feature when no headline was given.
This has two advantages: It prevents the user from getting wrong and
unexpected structures in org-files and archive-files and it aligns
Nvim-Orgmode more with the original Emacs Org-Mode.
* chore: remove superfluous refile functions
Because the main logic is now consolidated in Capture:_refile_to,
the two functions Capture:refile_to_headline and Capture:_refile_to_end
are not needed anymore.
Adjust the tests accordingly.
Note:
A general refactoring of the Capture class would be helpful in the
future. The current Capture class mixes several concerns: Refiling,
capturing and archiving. Separating these into different classes might
help to make the code easier to understand and to adjust.
---------
Co-authored-by: Sebastian Flügge <[email protected]>1 parent 3a5148f commit e129aab
File tree
3 files changed
+53
-67
lines changed- lua/orgmode/capture
- tests/plenary
- capture
- ui/mappings
3 files changed
+53
-67
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
| 132 | + | |
137 | 133 | | |
138 | 134 | | |
139 | 135 | | |
| |||
202 | 198 | | |
203 | 199 | | |
204 | 200 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 201 | + | |
219 | 202 | | |
220 | 203 | | |
221 | 204 | | |
| |||
240 | 223 | | |
241 | 224 | | |
242 | 225 | | |
243 | | - | |
| 226 | + | |
244 | 227 | | |
245 | 228 | | |
246 | 229 | | |
247 | 230 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 231 | + | |
252 | 232 | | |
253 | 233 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
277 | 242 | | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 243 | + | |
| 244 | + | |
283 | 245 | | |
284 | | - | |
285 | | - | |
| 246 | + | |
286 | 247 | | |
287 | 248 | | |
288 | 249 | | |
| |||
343 | 304 | | |
344 | 305 | | |
345 | 306 | | |
346 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
347 | 321 | | |
348 | 322 | | |
349 | | - | |
350 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
351 | 334 | | |
352 | 335 | | |
353 | 336 | | |
354 | 337 | | |
355 | 338 | | |
| 339 | + | |
| 340 | + | |
356 | 341 | | |
357 | 342 | | |
358 | 343 | | |
| |||
375 | 360 | | |
376 | 361 | | |
377 | 362 | | |
| 363 | + | |
378 | 364 | | |
379 | 365 | | |
380 | 366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
| 275 | + | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
0 commit comments