Project Status

This page tracks the progress of this project. It may not be up-to-date.

1. Emacs Subroutines

Emacs approximately has ~1800 built-in subroutines in C:

grep -r '^DEFUN ("' ../elisp/emacs/src/*.c | wc --lines

These subroutines are implemented by (at least) ~100 C files:

grep -lr '^DEFUN ("' ../elisp/emacs/src/*.c | sed -E 's#.+/([^/]+\.c)$#\1#'

2. Juicemacs Subroutines

Subroutines in Juicemacs were generated by emacs-extractor with placehholder code like throw new UnsupportedOperationException(). The following code tracks how many subroutines has been generated and how many are actually implemented and filled with actual code:

(defvar juicemacs-elisp-src-path
  "../elisp/src/main/java/party/iroiro/juicemacs/elisp/")
(defvar juicemacs-builtin-forms-wildcard
  "forms/BuiltIn*.java")

(defvar juicemacs-builtin-annotation-regexp
  "^    @ELispBuiltIn(name = \"\\(.+?\\)\"")
(defun next-annotation ()
  (when (re-search-forward juicemacs-builtin-annotation-regexp nil t)
    (match-string 1)))
(defun try-search-in-range (pattern start end)
  (save-excursion
    (goto-char start)
    (re-search-forward pattern end t)))

(defun extract-subroutine-stats ()
  (let ((case-fold-search nil)
        (files (file-expand-wildcards
                (file-name-concat
                 juicemacs-elisp-src-path
                 juicemacs-builtin-forms-wildcard)))
        start end prev next implemented todos)
    (dolist (file files)
      (with-temp-buffer
        (setq start nil)
        (insert-file-contents file)
        (goto-char (point-min))
        (setq prev (next-annotation)
              start (point))
        (while prev
          (setq next (next-annotation))
          (setq end (point))
          (if (or (try-search-in-range "UnsupportedOperationException"
                                       start end)
                  (try-search-in-range "TODO"
                                       start end))
              (push prev todos)
            (push prev implemented))
          (setq start end
                prev next))))
    (list implemented todos files)))
extract-subroutine-stats
(pcase-let* ((`(,impls ,todos ,files) (extract-subroutine-stats))
             (impl-count (length impls))
             (todo-count (length todos))
             (file-count (length files)))
  (setq java-files files)
  `(("" "Implemented" "Remaining" "Total" "Files")
    ("GNU Emacs" ,total 0 ,total ,(length c-files))
    ("Juicemacs" ,impl-count ,todo-count ,(+ impl-count todo-count) ,file-count)))
  Implemented Remaining Total Files
GNU Emacs 1798 0 1798 105
Juicemacs 452 835 1287 49

3. Remaining C Files

(let* ((extracted-files
        (mapcar (lambda (f) (and (string-match "/BuiltIn\\(.+\\)\\.java$" f)
                                 (downcase (match-string 1 f))))
                java-files))
       (remaining (seq-filter
                   (lambda (f)
                     (not (member (with-temp-buffer
                                    (insert (car f))
                                    (replace-string "-" "" nil 1 (point-max))
                                    (replace-string ".c" "" nil 1 (point-max))
                                    (buffer-string))
                                  extracted-files)))
                   c-files)))
  (sort remaining))
androidfns.c
androidmenu.c
androidselect.c
androidvfs.c
atimer.c
cygw32.c
dbusbind.c
dosfns.c
emacs-module.c
font.c
fontset.c
fringe.c
gfilenotify.c
gnutls.c
haikufns.c
haikufont.c
haikumenu.c
haikuselect.c
image.c
inotify.c
insdel.c
json.c
kqueue.c
lcms.c
menu.c
msdos.c
pgtkfns.c
pgtkim.c
pgtkmenu.c
pgtkselect.c
profiler.c
sfntfont-android.c
sound.c
sqlite.c
sysdep.c
textconv.c
thread.c
undo.c
w16select.c
w32console.c
w32cygwinx.c
w32dwrite.c
w32fns.c
w32font.c
w32image.c
w32menu.c
w32notify.c
w32proc.c
w32select.c
xfns.c
xmenu.c
xml.c
xselect.c
xsettings.c
xsmfns.c
xwidget.c

Emacs 31.0.50 (Org mode 9.7.11)