Is there any way to combine local and global marks together? what I am trying to do is just to have a common keybinding to pop-global-mark and set-mark-command. Something like; "try to pop the local mark, if there are no remaining ones, then try pop the global mark".
This is needed to move back around the code, and not thinking if i should press C-u C-SPC
or C-x C-SPC
, depending if the jump between functions was inside or outside the same file.
First of all, you cannot really use
set-mark-command
in code because it checksthis-command
andlast-command
so it will not work as intended.However, examining its code, I came up with (untested!):