Discussion:
[Geiser-users] Feature request: preserve point in geiser-set-scheme
Christopher Howard
2017-11-21 12:29:46 UTC
Permalink
Hi, I am running geiser 0.9 with emacs 24.5.1. When I run geiser-set-
scheme, point unnecessarily jumps to the beginning of the last function
in my file. Can that be adjusted to return point back to where I was
typing before running the command?

Also, could somebody please enter that as a feature request for me into
the issue tracker? I do not have a github account
<https://www.gnu.org/software/repo-criteria-evaluation.en.html>.
--
https://directory.fsf.org/wiki/Main_Page
Jose A. Ortega Ruiz
2017-11-21 20:23:13 UTC
Permalink
Hi Christopher,
Post by Christopher Howard
Hi, I am running geiser 0.9 with emacs 24.5.1. When I run geiser-set-
scheme, point unnecessarily jumps to the beginning of the last function
in my file. Can that be adjusted to return point back to where I was
typing before running the command?
I'm in geiser's "unstable" version (from melpa or directly the savannah
git repo) and cannot observe that behaviour: point remains where it is.
Any chance you could try with a newer geiser? Maybe it happens only
when switching to a particular scheme implementation?

Cheers,
jao
--
I took a speed reading course and read War and Peace in twenty
minutes. It involves Russia. -Woody Allen
Christopher Howard
2017-11-22 01:20:41 UTC
Permalink
Hi, I'm still getting the same behavior after trying a few different
things:

- I installed commit c3bc099.
- I tried other schemes when running geiser-set-scheme
- I tried running emacs with -nw -q and running (require 'geiser-
install) manually, to avoid complications from my .emacs file.
- I tried creating a new file and putting a few toy expressions in it,
but no actual define statements.

I all cases, running geiser-set-scheme jumps to just after the first
parenthesis of the last top-level expression.

I am quite curious what would happen if I switched to emacs-25, but I
wasn't sure if it was worth it to me to go to the trouble of compiling
and installing a whole new version of emacs. What emacs are you
running?
Post by Jose A. Ortega Ruiz
Hi Christopher,
Post by Christopher Howard
Hi, I am running geiser 0.9 with emacs 24.5.1. When I run geiser-
set-
scheme, point unnecessarily jumps to the beginning of the last function
in my file. Can that be adjusted to return point back to where I was
typing before running the command?
I'm in geiser's "unstable" version (from melpa or directly the
savannah
git repo) and cannot observe that behaviour: point remains where it is.
Any chance you could try with a newer geiser?  Maybe it happens only
when switching to a particular scheme implementation?
Cheers,
jao
--
https://u.fsf.org/user-liberation
Jose A. Ortega Ruiz
2017-11-22 01:44:35 UTC
Permalink
Hi, I'm still getting the same behavior after trying a few different
- I installed commit c3bc099.
- I tried other schemes when running geiser-set-scheme
- I tried running emacs with -nw -q and running (require 'geiser-
install) manually, to avoid complications from my .emacs file.
- I tried creating a new file and putting a few toy expressions in it,
but no actual define statements.
I all cases, running geiser-set-scheme jumps to just after the first
parenthesis of the last top-level expression.
I am quite curious what would happen if I switched to emacs-25, but I
wasn't sure if it was worth it to me to go to the trouble of compiling
and installing a whole new version of emacs. What emacs are you
running?
i've tried with emacs 25 and the current emacs 26 candidate... that
might be the cause (sorry, i had misread your emacs version in your
previous email)... i'm not really sure it'll fix the problem, but maybe
it does. for the record, telling geiser-set-scheme to preserve the
point no matter what should be just a matter of evaluating this
definition after you've loaded geiser:

(defun geiser-set-scheme ()
"Associates current buffer with a given Scheme implementation."
(save-excursion
(interactive)
(geiser-syntax--remove-kws)
(let ((impl (geiser-impl--read-impl)))
(geiser-impl--set-buffer-implementation impl)
(geiser-repl--set-up-repl impl)
(geiser-syntax--add-kws)
(geiser-syntax--fontify))))

the only thing i've changed is wrapping the function's body with
`save-excursion`... if that didn't work, i'd be kind of surprised!

cheers,
jao
--
Purely applicative languages are poorly applicable.
- Alan Perlis, Epigrams on Programming
Christopher Howard
2017-11-22 02:47:21 UTC
Permalink
  (defun geiser-set-scheme ()
    "Associates current buffer with a given Scheme implementation."
    (save-excursion
      (interactive)
      (geiser-syntax--remove-kws)
      (let ((impl (geiser-impl--read-impl)))
        (geiser-impl--set-buffer-implementation impl)
        (geiser-repl--set-up-repl impl)
        (geiser-syntax--add-kws)
        (geiser-syntax--fontify))))
the only thing i've changed is wrapping the function's body with
`save-excursion`... if that didn't work, i'd be kind of surprised!
cheers,
jao
Hi, that worked for me, except I first had to swap the save-excursion
line with the interactive line. Otherwise I get an error message when
trying to call the function. Thanks!

Is this patch something you'll put into geiser master branch, or should
I just patch my own tree? Right now I'm simply defining the new
function from geiser-mode-hook. I suspect it is due to some nuance of
emacs 24 vs 25 and 26.
--
https://worldenglishbible.org/
Jose A. Ortega Ruiz
2017-11-22 03:04:55 UTC
Permalink
Post by Christopher Howard
  (defun geiser-set-scheme ()
    "Associates current buffer with a given Scheme implementation."
    (save-excursion
      (interactive)
      (geiser-syntax--remove-kws)
      (let ((impl (geiser-impl--read-impl)))
        (geiser-impl--set-buffer-implementation impl)
        (geiser-repl--set-up-repl impl)
        (geiser-syntax--add-kws)
        (geiser-syntax--fontify))))
the only thing i've changed is wrapping the function's body with
`save-excursion`... if that didn't work, i'd be kind of surprised!
cheers,
jao
Hi, that worked for me, except I first had to swap the save-excursion
line with the interactive line. Otherwise I get an error message when
trying to call the function. Thanks!
Is this patch something you'll put into geiser master branch, or should
i just pushed it there... it's harmless for other versions... thanks!

cheers,
jao
--
A student came to the master and asked, for the master was one of them
who knew such things: "Does Emacs have the Buddha nature?" The master
contemplated this for some time, and answered: "I don't see why not,
it has about everything else."
Loading...