Make sure remote references will not switch the selected buffer
Karl Eichwalder writes: > Consider the following two files: > > * 2009 > #+TBLNAME: 2009 > :PROPERTIES: > :ID: ea32e5b5-31ba-468e-8e31-3e0d09696bb0 > :END: > |-----+-------| > | mm | km | > |-----+-------| > | all | 946.8 | > |-----+-------| > > * 2010 > #+TBLNAME: 2010 > :PROPERTIES: > :ID: e0df84c4-8abc-458f-a1ee-eb53eb71b4f0 > :END: > |-----+-------+-------+-------| > | mm | km | B km | G km | > |-----+-------+-------+-------| > | all | 249.4 | 429.2 | 678.6 | > |-----+-------+-------+-------| > > * all > :PROPERTIES: > :ID: 44751a7f-73a4-4c07-b3c2-e3edb9042acd > :END: > #+TBLNAME: all > |------+--------| > | yyyy | km | > |------+--------| > | 2009 | | > | 2010 | 678.6 | > |------+--------| > | all | 1625.4 | > |------+--------| > #+TBLFM: @2$2=remote(ea32e5b5-31ba-468e-8e31-3e0d09696bb0,$LR2);%.1f::@3$2=remote(2010,$LR4);%.1f::$LR2=vsum(@2$2..@-1);%.1f > > Then, in the 2010 file, eval the formula of the "all" table by pressing > C-c C-c. > ==> > > It takes the km value from the 2009 file, but also puts the cursor > (point) into the 2009 file in front of the ID: > > * 2009 > #+TBLNAME: 2009 > :PROPERTIES: > :ID: -!-ea32e5b5-31ba-468e-8e31-3e0d09696bb0 > :END: > |-----+-------| > | mm | km | > |-----+-------| > | all | 946.8 | > |-----+-------| > > -=-=-=-=-=-=-=-=-=-=-=-=-=- cut here -=-=-=-=-=-=-=-=-=-=-=-=-=- > > I'd prefer if the point would stay in the 2010 file.
This commit is contained in:
parent
33fba09ddb
commit
336456d0c3
|
@ -1,5 +1,8 @@
|
|||
2010-05-12 Carsten Dominik <carsten.dominik@gmail.com>
|
||||
|
||||
* org-table.el (org-table-get-remote-range): Return to
|
||||
original buffer when retrieving remote reference.
|
||||
|
||||
* org.el (org-display-inline-images): Do the entire buffer,
|
||||
not just the narrowed region. Clear the cache.
|
||||
(org-display-inline-images): Match mode file paths.
|
||||
|
|
|
@ -4343,23 +4343,23 @@ list of the fields in the rectangle ."
|
|||
(setq buffer (marker-buffer id-loc)
|
||||
loc (marker-position id-loc))
|
||||
(move-marker id-loc nil)))
|
||||
(switch-to-buffer buffer)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char loc)
|
||||
(forward-char 1)
|
||||
(unless (and (re-search-forward "^\\(\\*+ \\)\\|[ \t]*|" nil t)
|
||||
(not (match-beginning 1)))
|
||||
(error "Cannot find a table at NAME or ID %s" name-or-id))
|
||||
(setq tbeg (point-at-bol))
|
||||
(org-table-get-specials)
|
||||
(setq form (org-table-formula-substitute-names form))
|
||||
(if (and (string-match org-table-range-regexp form)
|
||||
(> (length (match-string 0 form)) 1))
|
||||
(save-match-data
|
||||
(org-table-get-range (match-string 0 form) tbeg 1))
|
||||
form))))))))
|
||||
(with-current-buffer buffer
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char loc)
|
||||
(forward-char 1)
|
||||
(unless (and (re-search-forward "^\\(\\*+ \\)\\|[ \t]*|" nil t)
|
||||
(not (match-beginning 1)))
|
||||
(error "Cannot find a table at NAME or ID %s" name-or-id))
|
||||
(setq tbeg (point-at-bol))
|
||||
(org-table-get-specials)
|
||||
(setq form (org-table-formula-substitute-names form))
|
||||
(if (and (string-match org-table-range-regexp form)
|
||||
(> (length (match-string 0 form)) 1))
|
||||
(save-match-data
|
||||
(org-table-get-range (match-string 0 form) tbeg 1))
|
||||
form)))))))))
|
||||
|
||||
(provide 'org-table)
|
||||
|
||||
|
|
Loading…
Reference in New Issue