Git Product home page Git Product logo

Comments (6)

rdrg109 avatar rdrg109 commented on June 10, 2024

This problem seems to be the cause of the problem for this behavior in Guix

$ guix package -i emacs-ess
The following package will be installed:
   emacs-ess 18.10.2-0.24da603

The following derivations will be built:
  /gnu/store/fr1fp22rpdjc7k4my8b5bdvqpvf14s8y-emacs-julia-mode-0.4.drv
  /gnu/store/y6gn2gkvnawzkf5n79ryswqcx6r809rn-emacs-ess-18.10.2-0.24da603.drv

building /gnu/store/fr1fp22rpdjc7k4my8b5bdvqpvf14s8y-emacs-julia-mode-0.4.drv...
| 'check' phasebuilder for `/gnu/store/fr1fp22rpdjc7k4my8b5bdvqpvf14s8y-emacs-julia-mode-0.4.drv' failed with exit code 1
build of /gnu/store/fr1fp22rpdjc7k4my8b5bdvqpvf14s8y-emacs-julia-mode-0.4.drv failed
View build log at '/var/log/guix/drvs/fr/1fp22rpdjc7k4my8b5bdvqpvf14s8y-emacs-julia-mode-0.4.drv.gz'.
guix package: error: build of `/gnu/store/fr1fp22rpdjc7k4my8b5bdvqpvf14s8y-emacs-julia-mode-0.4.drv' failed
$ echo $?
1

Here's the relevant part of the file /var/log/guix/drvs/fr/1fp22rpdjc7k4my8b5bdvqpvf14s8y-emacs-julia-mode-0.4.drv.gz' (complete file here)

Indenting region... 
Indenting region...done
Test julia--test-end-of-defun-nested-2 backtrace:
  signal(ert-test-failed (((should (eq (point) (if (stringp "return fa
  ert-fail(((should (eq (point) (if (stringp "return fact(x)[ \n]+end"
  (if (unwind-protect (setq value-247 (apply fn-245 args-246)) (setq f
  (let (form-description-249) (if (unwind-protect (setq value-247 (app
  (let ((value-247 'ert-form-evaluation-aborted-248)) (let (form-descr
  (let* ((fn-245 #'eq) (args-246 (condition-case err (let ((signal-hoo
  (progn (julia-mode) (insert "function f(x)\nfunction fact(n)\nif n =
  (unwind-protect (progn (julia-mode) (insert "function f(x)\nfunction
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current
  (lambda nil (let ((temp-buffer (generate-new-buffer " *temp*" t))) (
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name julia--test-end-of-defun-nested-2 :do
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests ... :test-map
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-l" "julia-mode-tests.el" "-f" "ert-run-tests-batch
  command-line()
  normal-top-level()
Test julia--test-end-of-defun-nested-2 condition:
    (ert-test-failed
     ((should
       (eq
	(point)
	(if ... ... "return fact(x)[ \n]+end")))
      :form
      (eq 141 163)
      :value nil))
   FAILED  14/43  julia--test-end-of-defun-nested-2 (0.000723 sec) at julia-mode-tests.el:584
   passed  15/43  julia--test-escaped-strings-dont-terminate-string (0.000403 sec)
   passed  16/43  julia--test-function-assignment-font-locking (0.000419 sec)
Indenting region... 
Indenting region...done

from julia-emacs.

zimoun avatar zimoun commented on June 10, 2024

@simonlegrand I confim the bug appears with Emacs 29.1 and not with 28.2. What happens? Consider the Julia code used by the test:

function f(x)
    function fact(n)
        if n == 0
            return 1
        else
            return n * fact(n-1)
        end
    end
    return fact(x)
end

Now, I use the symbol [X] to mark where the current point is.

function f(x)
    function fact(n)
        if n == 0[X]
            return 1
        else
            return n * fact(n-1)
        end
    end
    return fact(x)
end

The test julia--test-end-of-defun-nested-2 applies C-u 2 C-M-e, it results:

function f(x)
    function fact(n)
        if n == 0
            return 1
        else
            return n * fact(n-1)
        end
    end
[x]    return fact(x)
end

which is incorrect. It should be at the end. Therefore, julia-end-of-defun is buggy.

I guess the bug comes from this new snippet in 29.1, lisp/emacs-lisp/lisp.el from core:

        ;; At this point, point either didn't move (because we started
        ;; in between two defun's), or is at the end of a defun
        ;; (because we started in the middle of a defun).
        (unless (zerop arg)
          (when (setq success (beginning-of-defun-raw (- arg)))
            (funcall end-of-defun-function))))

that replaced this old snippet in 28.x:

        (unless (zerop arg)
          (beginning-of-defun-raw (- arg))
	  (setq beg (point))
          (funcall end-of-defun-function))))

from julia-emacs.

zimoun avatar zimoun commented on June 10, 2024

The test julia--test-end-of-defun-nested-2 applies C-u 2 C-M-e, it results:
[...]
which is incorrect. It should be at the end. Therefore, julia-end-of-defun is buggy.

Hum, I do not know... I observe the same behavior with an equivalent Python code using python-mode.

from julia-emacs.

simonlegrand avatar simonlegrand commented on June 10, 2024

Thanks for the explanations!

Hum, I do not know... I observe the same behavior with an equivalent Python code using python-mode.

Doesn't it make sens since python-mode is also using end-of-defun-function?

from julia-emacs.

zimoun avatar zimoun commented on June 10, 2024

Reported to upstream Emacs: #66763.

from julia-emacs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.