(defvar pointstack-stack '() "Stack of bufferpoints") (defun pointstack-push (arg) (interactive "p") (let ((val (cons (point) (buffer-name)))) (setq pointstack-stack (list val pointstack-stack)))) (defun pointstack-pop (arg) (interactive "p") (if pointstack-stack (progn (switch-to-buffer (cdar pointstack-stack)) (goto-char (caar pointstack-stack)) (setq pointstack-stack (cadr pointstack-stack))) (message (format "Pointstack is empty" pointstack-stack)))) (defun pointstack-clear (arg) (interactive "p") (setq pointstack-stack '())) (defun pointstack-debug (arg) (interactive "p") (message (format "pointstack='%s'" pointstack-stack))) (global-set-key "\C-c\C-s\C-s" 'pointstack-push) (global-set-key "\C-c\C-s\C-r" 'pointstack-pop) (global-set-key "\C-c\C-s\C-d" 'pointstack-debug) (global-set-key "\C-c\C-s\C-c" 'pointstack-clear)