Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No error report for functions moved to another file. #149

Open
twlz0ne opened this issue Nov 22, 2019 · 5 comments
Open

No error report for functions moved to another file. #149

twlz0ne opened this issue Nov 22, 2019 · 5 comments

Comments

@twlz0ne
Copy link

twlz0ne commented Nov 22, 2019

For example, there is an error report for cl-caaar:

(with-temp-buffer
  (insert ";; Package-Requires: ((emacs \"24.1\"))"
          "\n(cl-caaar nil)")
  (let ((report (package-lint-buffer)))
    (and (= 5 (length report))
         (car (reverse report)))))
;; => (2 1 error "You should depend on (emacs \"24.3\") or the cl-lib package if you need `cl-caaar'.")

But no error report for caaar which moved from cl.el to subr.el:

(with-temp-buffer
  (insert ";; Package-Requires: ((emacs \"24.1\"))"
          "\n(caaar nil)")
  (let ((report (package-lint-buffer)))
    (and (= 5 (length report))
         (car (reverse report)))))
;; => nil

https://emba.gnu.org/emacs/emacs/commit/43eba4955350b787c5567a31e2980ae70b9fb52f

Move cXXXr and cXXXXr to subr.el

  • etc/NEWS: Mention new core Elisp.
  • doc/lispref/lists.texi (List Elements): Document and index the new
    functions.
  • doc/misc/cl.texi (List Functions): Change "defines" to "aliases".
  • lisp/subr.el (caaar, caadr, cadar, caddr, cdaar, cdadr, cddar)
    (cdddr, caaaar caaadr, caadar, caaddr, cadaar, cadadr, caddar):
    (cadddr, cdaaar, cdaadr, cdadar, cdaddr, cddaar, cddadr, cdddar):
    (cddddr): New functions.
  • lisp/emacs-lisp/cl-lib.el (cl-caaar, cl-caadr, cl-cadar, cl-caddr):
    (cl-cdaar, cl-cdadr, cl-cddar cl-cdddr, cl-caaaar cl-caaadr):
    (cl-caadar, cl-caaddr, cl-cadaar, cl-cadadr, cl-caddar, cl-cadddr):
    (cl-cdaaar, cl-cdaadr, cl-cdadar, cl-cdaddr, cl-cddaar, cl-cddadr):
    (cl-cdddar, cl-cddddr): Alias to new subr functions.
  • lisp/emacs-lisp/cl.el (cl-unload-function): Remove cXXXr and cXXXXr
    elements.
@purcell
Copy link
Owner

purcell commented Nov 24, 2019

Regarding detection of symbols that have moved from one file to another, this is very hard to do in the general case. See #109 for another example. In general package-lint doesn't check that you require the right files in order to obtain the specific symbols you want to use.

That said, the example behaviour you've pasted above look fine to me, since caaar was present in all Emacs >= 24.1. What am I missing?

@twlz0ne
Copy link
Author

twlz0ne commented Nov 24, 2019

That said, the example behaviour you've pasted above look fine to me

Check out this: https://repl.it/repls/CoolMediumblueDriverwrapper

since caaar was present in all Emacs >= 24.1.

caaar moved from cl.el to subr.el since 26.1.

@purcell
Copy link
Owner

purcell commented Nov 24, 2019

caaar moved from cl.el to subr.el since 26.1.

Yes, but it was present in older Emacsen too.

I'm having trouble understanding this issue, sorry. What error message are you expecting package-lint to produce?

@twlz0ne
Copy link
Author

twlz0ne commented Nov 25, 2019

I'm having trouble understanding this issue, sorry

If I use caaar (or other moved) function in code for older Emacs, I need to require the cl (or other) package. But I may not notice it, because I am using 26.3 or newer for editing. So, I wonder if pakcage-lint can detect the problem.

@purcell
Copy link
Owner

purcell commented Nov 25, 2019

Ah, right, thanks for the explanation. Yes, I can see the gap in warnings. That would be a hard case to detect. One thing we could do for such functions would be to consistently suggest cl-caaar etc. instead of caaar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants