{"id":13443234,"url":"https://github.com/rexim/simpc-mode","last_synced_at":"2026-05-01T20:30:20.939Z","repository":{"id":140937038,"uuid":"278953432","full_name":"rexim/simpc-mode","owner":"rexim","description":"Simple C mode for Emacs","archived":false,"fork":false,"pushed_at":"2022-10-11T16:32:21.000Z","size":23,"stargazers_count":26,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-17T08:35:51.345Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rexim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-07-11T22:45:40.000Z","updated_at":"2024-02-04T12:37:44.000Z","dependencies_parsed_at":"2024-01-13T17:10:12.635Z","dependency_job_id":"bad14be7-53da-49dc-a654-05d269d74b51","html_url":"https://github.com/rexim/simpc-mode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexim%2Fsimpc-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexim%2Fsimpc-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexim%2Fsimpc-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexim%2Fsimpc-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rexim","download_url":"https://codeload.github.com/rexim/simpc-mode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240079610,"owners_count":19744720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-07-31T03:01:57.899Z","updated_at":"2026-05-01T20:30:20.882Z","avatar_url":"https://github.com/rexim.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"# Simple C mode for Emacs\n\nBecause whatever comes with Emacs is too slow.\n\nThis mode does not try to be as featureful as `c-mode`, `c++-mode`,\n`cc-mode`, etc. Instead we are trying to implement a bare minimum\nsyntax highlighting and indentation to maintain high performance on\nbig files with long lines.\n\nThe goal is to be able to comfortably browse and modify the following files:\n- [imgui](https://raw.githubusercontent.com/ocornut/imgui/fb7f6cab8c322731da336e553915e944bf386e62/imgui.h)\n- [amalgamated sqlite3.c](https://raw.githubusercontent.com/IreneKnapp/direct-sqlite/a74cc50c735053c7c49c487a66e7756b524db883/cbits/sqlite3.c)\n- [miniaudio.h](https://raw.githubusercontent.com/mackron/miniaudio/refs/heads/master/miniaudio.h)\n- ...\n\nRight now the only way to work with these files in Emacs is to use\n`text-mode`. Which is actually a good evidence that Emacs itself can\nhandle such files! It's `c-mode` (and others) that cannot.\n\n## Installing locally\n\nPut [simpc-mode.el](./simpc-mode.el) to some folder `/path/to/simpc/`. Add this to your `.emacs`:\n\n```el\n;; Adding `/path/to/simpc` to load-path so `require` can find it\n(add-to-list 'load-path \"/path/to/simpc/\")\n;; Importing simpc-mode\n(require 'simpc-mode)\n;; Automatically enabling simpc-mode on files with extensions like .h, .c, .cpp, .hpp\n(add-to-list 'auto-mode-alist '(\"\\\\.[hc]\\\\(pp\\\\)?\\\\'\" . simpc-mode))\n```\n\n## Indentation\n\nRight now the mode supports only very simple indentations based on the\nanalysing the previous non-empty line and its surrounding curly\nbraces. Anything more complicated is outside of the scope of the\nproject.\n\nIt is recommended to use an external formatter such as\n[indent](https://www.gnu.org/software/indent/),\n[astyle](http://astyle.sourceforge.net/),\n[clang-format](https://clang.llvm.org/docs/ClangFormat.html), etc.\n\nHere is how I use [astyle](http://astyle.sourceforge.net/):\n\n```emacs-lisp\n(defun astyle-buffer ()\n  (interactive)\n  (let ((saved-line-number (line-number-at-pos)))\n    (shell-command-on-region\n     (point-min)\n     (point-max)\n     \"astyle --style=kr\"\n     nil\n     t)\n    (goto-line saved-line-number)))\n```\n\nThen I bind `astyle-buffer` to some key combination and invoke it\nperiodically to reformat the whole current buffer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexim%2Fsimpc-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frexim%2Fsimpc-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexim%2Fsimpc-mode/lists"}