GithubHelp home page GithubHelp logo

Comments (5)

ag91 avatar ag91 commented on August 10, 2024

Hi! Thanks for trying it out. Uhm, could you (require 'cl-lib) and then try again? As far as I know incf comes from there and moldable-emacs.el requires that library.
If that does not change anything, I will look into how to setup straight.el to give a try on my system.

from moldable-emacs.

librarianmage avatar librarianmage commented on August 10, 2024

I tried that but it didn't seem to change anything
Here's the debug log when I call the stats mold:

Debugger entered--Lisp error: (void-function incf)
  incf(0)
  me-count-raw-word-list(("." "'" "." "'" "," "'" "," "." "." "," "," "." "." "'" "," "." "." "," "," "." "," "." "'" "," "'" "." "." "." "," "." "'" "," "." "\"" "," "\"" "\"" "." "\"" "\"" "." "\"" "'" "'" "\"" "\"" "\"" "." "." "\"" ...))
  me-word-stats("#+TITLE: My Emacsen (Emacs Configuration)\n#+AUTHOR...")
  (let ((list (me-word-stats contents)) (i 0) it it-index) (ignore it it-index) (while list (setq it (pop list) it-index i i (1+ i)) (when (> (length (car it)) 2) (push it result))))
  (--each (me-word-stats contents) (when (> (length (car it)) 2) (push it result)))
  (let (result) (--each (me-word-stats contents) (when (> (length (car it)) 2) (push it result))) (nreverse result))
  (--filter (> (length (car it)) 2) (me-word-stats contents))
  (let* ((old-buffer (buffer-name)) (buffer (get-buffer-create "Statistics")) (buffersize (buffer-size)) (self (me-mold-treesitter-to-parse-tree)) (contents (buffer-substring-no-properties (point-min) (point-max))) (lines (count-lines-page)) (words (call-interactively 'count-words)) (book-pages (me-get-book-pages contents)) (reading-time (me-get-reading-time contents)) (word-analysis (--filter (> (length (car it)) 2) (me-word-stats contents))) (word-analysis-stats (-concat (-take 3 word-analysis) (reverse (-take 3 (reverse word-analysis))))) (funs (when self (length (me-by-type 'function_definition self)))) (methods (when self (length (me-by-type 'method_declaration self)))) (ifs (when self (length (--filter (or (eq ... ...) (eq ... ...)) self)))) (classes (when self (length (--filter (or (eq ... ...) (eq ... ...)) self)))) (comments (when self (length (me-by-type 'comment self))))) (with-current-buffer buffername (erase-buffer) (org-mode) (insert "* Generic Stats\n\n") (insert (format "- Reading time: %s minutes \n" reading-time)) (insert (format "- %s\n" lines)) (insert (format "- %s\n" words)) (insert (format "- Average book pages for this text: %s\n\n" book-pages)) (insert (format "- Buffer size in KiloBytes: %s\n\n" buffersize)) (insert "- Up to three most and least used words:\n\n") (--each word-analysis-stats (insert (format "  %s | %s\n" (substring (concat (number-to-string ...) (s-repeat 5 " ")) 0 3) (car it)))) (insert "\n") (when funs (insert "* Programming Stats\n\n") (insert "\n") (insert "-- Code Stats --\n\n") (insert (format "#Functions: %s \n" funs)) (insert (format "#Methods: %s \n" methods)) (insert (format "#If-else: %s \n" ifs)) (insert (format "#Classes: %s \n" classes)) (insert (format "#Comments: %s \n" comments))) (insert "\n") (when self (insert "* Duplication Stats\n\n") (insert "-- Code Duplication By Token Type --\n\n") (let* ((nodes-with-duplication (me-nodes-with-duplication self)) (texts-by-type (--map (cons ... ...) (--group-by ... self)))) (me-require 'tree-sitter-query) (me-insert-treesitter-follow-overlay nodes-with-duplication (lambda (node) (let (... ...) (format "%s: %s/%s\n" type ... ...))))))))
  (progn (get-buffer-create buffername) (let* ((old-buffer (buffer-name)) (buffer (get-buffer-create "Statistics")) (buffersize (buffer-size)) (self (me-mold-treesitter-to-parse-tree)) (contents (buffer-substring-no-properties (point-min) (point-max))) (lines (count-lines-page)) (words (call-interactively 'count-words)) (book-pages (me-get-book-pages contents)) (reading-time (me-get-reading-time contents)) (word-analysis (--filter (> (length (car it)) 2) (me-word-stats contents))) (word-analysis-stats (-concat (-take 3 word-analysis) (reverse (-take 3 (reverse word-analysis))))) (funs (when self (length (me-by-type 'function_definition self)))) (methods (when self (length (me-by-type 'method_declaration self)))) (ifs (when self (length (--filter (or ... ...) self)))) (classes (when self (length (--filter (or ... ...) self)))) (comments (when self (length (me-by-type 'comment self))))) (with-current-buffer buffername (erase-buffer) (org-mode) (insert "* Generic Stats\n\n") (insert (format "- Reading time: %s minutes \n" reading-time)) (insert (format "- %s\n" lines)) (insert (format "- %s\n" words)) (insert (format "- Average book pages for this text: %s\n\n" book-pages)) (insert (format "- Buffer size in KiloBytes: %s\n\n" buffersize)) (insert "- Up to three most and least used words:\n\n") (--each word-analysis-stats (insert (format "  %s | %s\n" (substring (concat ... ...) 0 3) (car it)))) (insert "\n") (when funs (insert "* Programming Stats\n\n") (insert "\n") (insert "-- Code Stats --\n\n") (insert (format "#Functions: %s \n" funs)) (insert (format "#Methods: %s \n" methods)) (insert (format "#If-else: %s \n" ifs)) (insert (format "#Classes: %s \n" classes)) (insert (format "#Comments: %s \n" comments))) (insert "\n") (when self (insert "* Duplication Stats\n\n") (insert "-- Code Duplication By Token Type --\n\n") (let* ((nodes-with-duplication (me-nodes-with-duplication self)) (texts-by-type (--map ... ...))) (me-require 'tree-sitter-query) (me-insert-treesitter-follow-overlay nodes-with-duplication (lambda (node) (let ... ...))))))) (ignore-errors (switch-to-buffer-other-window (get-buffer buffername))))
  (cond ((equal '(:then) '(:given)) 't) ((equal '(:then) '(:then)) (progn (get-buffer-create buffername) (let* ((old-buffer (buffer-name)) (buffer (get-buffer-create "Statistics")) (buffersize (buffer-size)) (self (me-mold-treesitter-to-parse-tree)) (contents (buffer-substring-no-properties (point-min) (point-max))) (lines (count-lines-page)) (words (call-interactively 'count-words)) (book-pages (me-get-book-pages contents)) (reading-time (me-get-reading-time contents)) (word-analysis (--filter (> ... 2) (me-word-stats contents))) (word-analysis-stats (-concat (-take 3 word-analysis) (reverse ...))) (funs (when self (length ...))) (methods (when self (length ...))) (ifs (when self (length ...))) (classes (when self (length ...))) (comments (when self (length ...)))) (with-current-buffer buffername (erase-buffer) (org-mode) (insert "* Generic Stats\n\n") (insert (format "- Reading time: %s minutes \n" reading-time)) (insert (format "- %s\n" lines)) (insert (format "- %s\n" words)) (insert (format "- Average book pages for this text: %s\n\n" book-pages)) (insert (format "- Buffer size in KiloBytes: %s\n\n" buffersize)) (insert "- Up to three most and least used words:\n\n") (--each word-analysis-stats (insert (format "  %s | %s\n" ... ...))) (insert "\n") (when funs (insert "* Programming Stats\n\n") (insert "\n") (insert "-- Code Stats --\n\n") (insert (format "#Functions: %s \n" funs)) (insert (format "#Methods: %s \n" methods)) (insert (format "#If-else: %s \n" ifs)) (insert (format "#Classes: %s \n" classes)) (insert (format "#Comments: %s \n" comments))) (insert "\n") (when self (insert "* Duplication Stats\n\n") (insert "-- Code Duplication By Token Type --\n\n") (let* (... ...) (me-require ...) (me-insert-treesitter-follow-overlay nodes-with-duplication ...))))) (ignore-errors (switch-to-buffer-other-window (get-buffer buffername))))) (t :then))
  (pcase '(:then) ('(:given) 't) ('(:then) (progn (get-buffer-create buffername) (let* ((old-buffer (buffer-name)) (buffer (get-buffer-create "Statistics")) (buffersize (buffer-size)) (self (me-mold-treesitter-to-parse-tree)) (contents (buffer-substring-no-properties (point-min) (point-max))) (lines (count-lines-page)) (words (call-interactively 'count-words)) (book-pages (me-get-book-pages contents)) (reading-time (me-get-reading-time contents)) (word-analysis (--filter (> ... 2) (me-word-stats contents))) (word-analysis-stats (-concat (-take 3 word-analysis) (reverse ...))) (funs (when self (length ...))) (methods (when self (length ...))) (ifs (when self (length ...))) (classes (when self (length ...))) (comments (when self (length ...)))) (with-current-buffer buffername (erase-buffer) (org-mode) (insert "* Generic Stats\n\n") (insert (format "- Reading time: %s minutes \n" reading-time)) (insert (format "- %s\n" lines)) (insert (format "- %s\n" words)) (insert (format "- Average book pages for this text: %s\n\n" book-pages)) (insert (format "- Buffer size in KiloBytes: %s\n\n" buffersize)) (insert "- Up to three most and least used words:\n\n") (--each word-analysis-stats (insert (format "  %s | %s\n" ... ...))) (insert "\n") (when funs (insert "* Programming Stats\n\n") (insert "\n") (insert "-- Code Stats --\n\n") (insert (format "#Functions: %s \n" funs)) (insert (format "#Methods: %s \n" methods)) (insert (format "#If-else: %s \n" ifs)) (insert (format "#Classes: %s \n" classes)) (insert (format "#Comments: %s \n" comments))) (insert "\n") (when self (insert "* Duplication Stats\n\n") (insert "-- Code Duplication By Token Type --\n\n") (let* (... ...) (me-require ...) (me-insert-treesitter-follow-overlay nodes-with-duplication ...))))) (ignore-errors (switch-to-buffer-other-window (get-buffer buffername))))) (_ :then))
  (let* nil (pcase '(:then) ('(:given) 't) ('(:then) (progn (get-buffer-create buffername) (let* ((old-buffer (buffer-name)) (buffer (get-buffer-create "Statistics")) (buffersize (buffer-size)) (self (me-mold-treesitter-to-parse-tree)) (contents (buffer-substring-no-properties ... ...)) (lines (count-lines-page)) (words (call-interactively ...)) (book-pages (me-get-book-pages contents)) (reading-time (me-get-reading-time contents)) (word-analysis (--filter ... ...)) (word-analysis-stats (-concat ... ...)) (funs (when self ...)) (methods (when self ...)) (ifs (when self ...)) (classes (when self ...)) (comments (when self ...))) (with-current-buffer buffername (erase-buffer) (org-mode) (insert "* Generic Stats\n\n") (insert (format "- Reading time: %s minutes \n" reading-time)) (insert (format "- %s\n" lines)) (insert (format "- %s\n" words)) (insert (format "- Average book pages for this text: %s\n\n" book-pages)) (insert (format "- Buffer size in KiloBytes: %s\n\n" buffersize)) (insert "- Up to three most and least used words:\n\n") (--each word-analysis-stats (insert ...)) (insert "\n") (when funs (insert "* Programming Stats\n\n") (insert "\n") (insert "-- Code Stats --\n\n") (insert ...) (insert ...) (insert ...) (insert ...) (insert ...)) (insert "\n") (when self (insert "* Duplication Stats\n\n") (insert "-- Code Duplication By Token Type --\n\n") (let* ... ... ...)))) (ignore-errors (switch-to-buffer-other-window (get-buffer buffername))))) (_ :then)))
  (let ((buffername (concat "*moldable-emacs-" (or nil "Stats") "*"))) (let* nil (pcase '(:then) ('(:given) 't) ('(:then) (progn (get-buffer-create buffername) (let* ((old-buffer ...) (buffer ...) (buffersize ...) (self ...) (contents ...) (lines ...) (words ...) (book-pages ...) (reading-time ...) (word-analysis ...) (word-analysis-stats ...) (funs ...) (methods ...) (ifs ...) (classes ...) (comments ...)) (with-current-buffer buffername (erase-buffer) (org-mode) (insert "* Generic Stats\n\n") (insert ...) (insert ...) (insert ...) (insert ...) (insert ...) (insert "- Up to three most and least used words:\n\n") (--each word-analysis-stats ...) (insert "\n") (when funs ... ... ... ... ... ... ... ...) (insert "\n") (when self ... ... ...))) (ignore-errors (switch-to-buffer-other-window (get-buffer buffername))))) (_ :then))))
  (progn (let ((buffername (concat "*moldable-emacs-" (or nil "Stats") "*"))) (let* nil (pcase '(:then) ('(:given) 't) ('(:then) (progn (get-buffer-create buffername) (let* (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (with-current-buffer buffername ... ... ... ... ... ... ... ... ... ... ... ... ... ...)) (ignore-errors (switch-to-buffer-other-window ...)))) (_ :then)))))
  eval((progn (let ((buffername (concat "*moldable-emacs-" (or nil "Stats") "*"))) (let* nil (pcase '(:then) ('(:given) 't) ('(:then) (progn (get-buffer-create buffername) (let* ... ...) (ignore-errors ...))) (_ :then))))) t)
  me-mold-run-then((:key "Stats" :docs "View some generic buffer stats like reading time a..." :given (:fn 't) :then (:fn (let* ((old-buffer (buffer-name)) (buffer (get-buffer-create "Statistics")) (buffersize (buffer-size)) (self (me-mold-treesitter-to-parse-tree)) (contents (buffer-substring-no-properties (point-min) (point-max))) (lines (count-lines-page)) (words (call-interactively 'count-words)) (book-pages (me-get-book-pages contents)) (reading-time (me-get-reading-time contents)) (word-analysis (--filter (> ... 2) (me-word-stats contents))) (word-analysis-stats (-concat (-take 3 word-analysis) (reverse ...))) (funs (when self (length ...))) (methods (when self (length ...))) (ifs (when self (length ...))) (classes (when self (length ...))) (comments (when self (length ...)))) (with-current-buffer buffername (erase-buffer) (org-mode) (insert "* Generic Stats\n\n") (insert (format "- Reading time: %s minutes \n" reading-time)) (insert (format "- %s\n" lines)) (insert (format "- %s\n" words)) (insert (format "- Average book pages for this text: %s\n\n" book-pages)) (insert (format "- Buffer size in KiloBytes: %s\n\n" buffersize)) (insert "- Up to three most and least used words:\n\n") (--each word-analysis-stats (insert (format "  %s | %s\n" ... ...))) (insert "\n") (when funs (insert "* Programming Stats\n\n") (insert "\n") (insert "-- Code Stats --\n\n") (insert (format "#Functions: %s \n" funs)) (insert (format "#Methods: %s \n" methods)) (insert (format "#If-else: %s \n" ifs)) (insert (format "#Classes: %s \n" classes)) (insert (format "#Comments: %s \n" comments))) (insert "\n") (when self (insert "* Duplication Stats\n\n") (insert "-- Code Duplication By Token Type --\n\n") (let* (... ...) (me-require ...) (me-insert-treesitter-follow-overlay nodes-with-duplication ...)))))) :docs "You can extract information from the original buff..." :examples ((:name "Basic stats" :given (:type file :name "/tmp/test.txt" :mode text-mode :contents "This is a little test file. Test!\n") :then (:type buffer :name "Statistics" :mode org-mode :contents "* Generic Stats\n\n- Reading time: 0 minutes \n- Page..."))) :origin "/home/librarianmage/.config/emacs/straight/build/m..."))
  me-mold()
  funcall-interactively(me-mold)
  call-interactively(me-mold nil nil)
  command-execute(me-mold)

from moldable-emacs.

librarianmage avatar librarianmage commented on August 10, 2024

Figured it out! It was unrelated to straight.el. In

(defun me-count-raw-word-list (raw-word-list)
"Produce a dictionary of RAW-WORD-LIST with the number of occurrences for each word."
(--> raw-word-list
(--reduce-from
(progn
(incf (cdr (or (assoc it acc)
(car (push (cons it 0) acc)))))
acc)
nil
it)
(sort it (lambda (a b) (string< (car a) (car b))))))
you use incf but cl-lib uses cl-incf. The cl package aliases incf to that as well.

from moldable-emacs.

ag91 avatar ag91 commented on August 10, 2024

from moldable-emacs.

librarianmage avatar librarianmage commented on August 10, 2024

Yup! All's good now ^_^

from moldable-emacs.

Related Issues (19)

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.