{"id":50872174,"url":"https://github.com/epfl-systemf/dvar-track","last_synced_at":"2026-06-15T06:06:14.092Z","repository":{"id":363599837,"uuid":"1079844809","full_name":"epfl-systemf/dvar-track","owner":"epfl-systemf","description":"An Emacs Lisp dynamic variable reference tracker","archived":false,"fork":false,"pushed_at":"2026-06-09T14:38:44.000Z","size":289,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T16:22:52.472Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/epfl-systemf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-20T13:26:42.000Z","updated_at":"2026-06-09T14:48:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/epfl-systemf/dvar-track","commit_stats":null,"previous_names":["epfl-systemf/dvar-track"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/epfl-systemf/dvar-track","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epfl-systemf%2Fdvar-track","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epfl-systemf%2Fdvar-track/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epfl-systemf%2Fdvar-track/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epfl-systemf%2Fdvar-track/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epfl-systemf","download_url":"https://codeload.github.com/epfl-systemf/dvar-track/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epfl-systemf%2Fdvar-track/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34349976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-15T06:06:08.649Z","updated_at":"2026-06-15T06:06:14.087Z","avatar_url":"https://github.com/epfl-systemf.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dvar-track: A dynvar reference tracker\nAUTHOR: Basil L. Contovounesios and Tsung-Han Liu\n\n## File Organization\n\n* `*.el`\n  - `dvar-track.el`\n    The core of _dvar-track_, provides dependency analysis, basic report, and inheritance traversal.\n  - `dvar-eldoc.el`\n    An _eldoc_ backend analyzes missing bindings on the fly. \n  - `dvar-docstring.el`\n    Docstrings and _Help_ annotations.\n* `dvar-tests/`\n  Logging facilities in ELisp dump and aggregate C analysis result after running the testsuite of Emacs.\n* `treesit/`\n  - `global_parser.cpp` \n    The preprocessor for C analysis. It generates indirect access functions for every Lisp global variable defined in C, and patches rewriting every `\u0026Vvarname` literal to `\u0026globals.f_Vvarname`.\n  - `applyupdate.sh`\n    A script applying the referencing global variables patches.\n  - `tree-sitter-c/`\n    A submodule of C grammar for _tree-sitter_.\n* `emacs-builder/Containerfile`\n  An container includes dependencies for building Emacs.\n* `emacs`\n  a submodule contains the source code of Emacs-30.2.\n* `emacs-patch/`\n  C analysis facilities for Emacs-30.2.\n  - `src/Makefile.in`\n    A patched Makefile template includes _dvar-track_ related source code. \n  - `src/emacs.c`\n    A patched initialization procedure registers the global variables for _dvar-track_.\n  - `src/dvar-track.c` and `src/dvar-track.h`\n    The core of C analysis.\n  - `test/Makefile.in`\n    A patched Makefile template enables C analysis, and dumps results with `dvar-tests/dump-result.el` for the testsuite.\n\n\n## Installation\n\n_dvar-track_ Lisp analysis depends on Emacs 30+ and [dash](https://github.com/magnars/dash.el).\nDash can be installed with the build-in package manager of Emacs.\n\n    M-x package-install RET dash RET\n\nAdd the directory containing *dvar-track* source code to the load path of Emacs.\n\n``` emacs-lisp\n(add-to-list 'load-path \"\u003cPATH_TO_DVAR_TRACK\u003e\")\n(require 'dvar-track)\n```\n\n\u003e Testing _dvar-track_ does not requires C analysis.\n\u003e For the procedure to do C analysis, please check the [C analysis](#c-analysis) section.\n\n## Usage\n\nSet up variables with `dvar-track--clear-all-cache` before the first\ntime running analysis or when you don't want the previous result\nincluded in the report.\n\n    M-x dvar-track--clear-all-cache\n    M-x dvar-track-report\n    \n`dvar-track-report` scans on Emacs Lisp file and generates a report\nincluding the list of functions and their dependencies.\n\nYou might want to know how a variable became the dependency of a function. \n\n    M-x dvar-track--traverse-path RET \u003cfunction-name\u003e RET \u003cvariable-name\u003e\n\n`dvar-track--traverse-path` constructs a tree telling which function\naccesses the target variable and how did the dependency inherited to\nthe target function.\n\n\n### dvar-eldoc\n\n*dvar-eldoc* is a on-the-fly missing binding checking [eldoc](https://www.gnu.org/software/emacs/manual/html_node/emacs/Programming-Language-Doc.html) backend.\n\n``` emacs-lisp\n(require 'dvar-eldoc)\n```\n\n\nTo have the dependency information of the function the library you use, scan it beforehand.\n\n    M-x dvar-track--scan-files-directory \u003cpath-to-ELPA or path-to-library\u003e\n    M-x dvar-track--toggle-eldoc\n\nWith the *dvar-eldoc*, in the echo buffer, you can see the list of dependencies that are not yet bound in the current lexical-scope when the cursor is on an explicit function call.\n\n![dvar-eldoc](./images/eldoc.png \"dvar-eldoc\")\n\n### dvar-docstring\n\n``` emacs-lisp\n(require 'dvar-docstring`)\n```\n\nIn a Emacs Lisp source code buffer, enabling `dvar-docstring-mode` annotates the existing docstrings with the dependency list of the corresponding functions.\nEnabling help annotation append dependencies information after the documentation in the help buffer.\n\n    M-x dvar-docstring-mode\n    M-x dvar-doc-toggle-help-annotation\n    \nSet `dvar-doc-automatically-parse` to non-nil, force _dvar-track_ to parse the function if it is not in cache when we use `describe-function`.\n``` emacs-lisp\n(setq dvar-doc-automatically-parse t)\n```\n\n![docstring](./images/docstring-overlay.png \"Docstring Annotation\")\n![helpbuffer](./images/help-annotation.png \"Help Annotation\")\n\n# C Analysis\n\n## Preparation\n\nClone submodules, use `--depth=1` to save time.\n\n``` shell\ngit submodule update --depth=1 --init\n```\n\nPrepare for a Emacs compilation environment, we tested the patch with `emacs-builder/Containerfile`.\n\n## Apply Patches\n\nInstall the patches\n\n``` shell\ncd emacs-patch\nfind . -type f -exec cp {} ../emacs/{} \\;\ncd ..\n```\n\nConfigure Emacs and generate `globals.h` for the second phase patches.\n\n``` shell\ncd emacs\n./autogen.sh\n./configure --with-native-compilation=no\ncd src\ntouch dvar-func.c # create a dummy file, so that make does not block the compilation\nmake globals.h\ncd ../../\n```\n\n## Generate Indirect Access Functions \u0026 Compile Patched Emacs\n\nCompile C grammar module and the global variable parser.\n\n``` shell\ncd treesit/tree-sitter-c\nmake\ncd ..\nmake\ncd ..\n```\n\nGenerate indirect access functions and compile patched Emacs.\n\n``` shell\ncd emacs\n../treesit/global_parser -t $(pwd)\ncd src\n../../treesit/applyupdate.sh # rewrite all \u0026Vvarname literals\nmake # compile Emacs\n```\n\n## Test Variable Access Interception\n\nLaunch Emacs and open a scratch buffer.\n\n``` emacs-lisp\n(let ((dvar-log-variable-access t))\n  (prin1 '(a b c)))\n  \n(gethash #'prin1 dvar-function-dependency)\n```\n\nEvaluate the code you can see something like:\n\n```\n#s(hash-table test equal data (\"f_debug_on_next_call\" t \"f_symbols_with_pos_enabled\" t \"f_Vquit_flag\" t \"f_max_lisp_eval_depth\" t \"f_Vinternal_interpreter_environment\" t \"f_Vstandard_output\" t \"f_unibyte_display_via_language_environment\" t \"f_minibuffer_auto_raise\" t \"f_Vprint_continuous_numbering\" t \"f_Vprint_number_table\" t \"f_Vprint_circle\" t \"f_Vprint_level\" t ...))\n```\n\nThe strings are the C name of the intercepted dependencies of `prin1`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepfl-systemf%2Fdvar-track","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepfl-systemf%2Fdvar-track","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepfl-systemf%2Fdvar-track/lists"}