tpapp / julia-repl

Run an inferior Julia REPL in a terminal inside Emacs
Other
169 stars 35 forks source link

Does not skip empty line when julia-repl--send-string #119

Closed yashi closed 2 years ago

yashi commented 2 years ago

It'd be nice to skip empty lines or comment only lines like ESS does.

When reporting an issue, please provide

  1. the Emacs version (M-x emacs-version [RET], will also appear in the buffer *Messages*),

    GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.31, cairo version 1.16.0) of 2022-02-24
  2. the Julia version (VERSION)

    julia> versioninfo()
    Julia Version 1.7.2
    Commit bf53498635 (2022-02-06 15:21 UTC)
    Platform Info:
    OS: Linux (x86_64-pc-linux-gnu)
    CPU: AMD Ryzen 9 5900X 12-Core Processor
    WORD_SIZE: 64
    LIBM: libopenlibm
    LLVM: libLLVM-12.0.1 (ORCJIT, znver3)
  3. the version of julia-repl (something like “latest master” is fine). e90b1ed2cc806262b0ee772dcc88f8da693d9210

  4. self-contained steps to replicate the issue.

    
    $ cat /tmp/a.jl
    a = 1
    b = 2

a + b $ emacs /tmp/a.jl <<hit C-Enter 2 time and your cursor is at the empty line>>

tpapp commented 2 years ago

This is a reasonable request. I can skip blank lines and simple comment lines (spaces followed by a #), but to skip (#= ... =#) blocks I would need to look into syntax table navigation functions. julia-mode has those so this is possible, but if someone has a clever idea how to go about it, please share.

wentasah commented 2 years ago

Seems like forward-comment (or comment-forward) is what's needed.

hexaeder commented 2 years ago

Just to add another POV: For my workflow at least, this would not necessarily be beneficial. Long code blocks can be evaluated comfortably using the send-region command, ie to send the first 100 lines of a script.

During interactive development/testing I am working on specific lines (or regions for that matter) quite often. For example plot commands, where I change and reevaluate a specific line (or region) repeatedly. Long jumps of the point over empty lines and comments wouldn't be expected there... at least for me it is quite rare to step through a long script by evaluating each line individually.

tpapp commented 2 years ago

@wentasah: thanks, #120 is now available for testing.

@yashi, does this do what you want? Note that in contrast to ESS, I skip after sending, makes more sense to me. Please test.

@hexaeder: I understand, this is disabled by default. No behavior changes unless you explicitly enable this.

yashi commented 2 years ago

Works like a charm. Thanks.