Skip to content

Commit

Permalink
Merge pull request 'Switch back to non-literate pile-of-files project…
Browse files Browse the repository at this point in the history
… structure' (legoscia#27) from illiterate into production

Reviewed-on: https://codeberg.org/emacs-jabber/emacs-jabber/pulls/27
  • Loading branch information
contrapunctus committed Jun 15, 2023
2 parents af0315e + 5a0073c commit bccb9d9
Show file tree
Hide file tree
Showing 82 changed files with 16,209 additions and 14,652 deletions.
21 changes: 1 addition & 20 deletions .dir-locals.el
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
;; `nameless-current-name' cannot be detected in Org mode buffers,
;; IIRC, and thus has to be defined explicitly. To make use of this,
;; install `nameless' and enable `nameless-mode' in Org mode buffers.
((nil . ((nameless-current-name . "jabber")
(nameless-aliases . (("jaa" . "jabber-autoaway")
("ja" . "jabber-avatar")
("jac" . "jabber-activity")
("jc" . "jabber-chat")
("jco" . "jabber-console")
("jcs" . "jabber-chatstates")
("je" . "jabber-events")
("jh" . "jabber-history")
("jk" . "jabber-keepalive")
("jm" . "jabber-muc")
("jml" . "jabber-mode-line")
("jr" . "jabber-roster")
("jp" . "jabber-private")
("jrt" . "jabber-rtt")
("js" . "jabber-socks5")
("jv" . "jabber-vcard")
("jw" . "jabber-whitespace")
("jx" . "jabber-xml")))))
(org-mode . ((org-tags-column . -60)
((org-mode . ((org-tags-column . -60)
(eval . (progn
(make-local-variable 'before-save-hook)
(add-hook 'before-save-hook #'org-align-all-tags nil t))))))
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ elc-stamp
*.tar*
*.zip
jabber-autoloads.el
jabber-ourversion.el
jabber.info
emacs-jabber.schemas
69 changes: 25 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,62 +1,43 @@
.phony: all tangle autoload compile lint clean

build: tangle autoload compile

dev: tangle autoload compile lint

# No -q or -Q without ORG_PATH - if the user has a newer version of
# Org, we want to use it.
jabber.el:
if [ -z "${ORG_PATH}" ]; then \
echo ; \
echo "[WARNING] ORG_PATH is unset. Org versions older than 9.3.8 have a bug" ; \
echo "which result in them always using absolute paths in comment links in" ; \
echo "tangled source files. If your Org version is older than 9.3.8, please" ; \
echo "upgrade it before tangling." ; \
echo ; \
emacs --batch \
emacs --batch \
--eval="(progn (package-initialize) (require 'ob-tangle))" \
--eval='(org-babel-tangle-file "jabber.org")' ; \
else \
emacs -q -Q --batch \
--eval="(add-to-list 'load-path \"${ORG_PATH}\")" \
--eval="(require 'ob-tangle)" \
--eval='(org-babel-tangle-file "jabber.org")' ; \
fi

tangle: jabber.el
.phony: all autoload compile lint clean

build: autoload compile

dev: autoload compile lint

autoload:
emacs -q --batch --eval="(require 'package)" \
--eval="(package-generate-autoloads \"jabber\" default-directory)"

compile: tangle
compile:
emacs -q -Q --batch \
--eval="(setq print-length nil)" \
--eval="(add-to-list 'load-path \"$(pwd)\")" \
--eval="(add-to-list 'load-path \"jabber-fallback-lib\")" \
--eval='(byte-compile-file "jabber.el")' ; \
-f batch-byte-compile elisp/

lint-check-declare: tangle
emacs -q -Q --batch --eval='(check-declare-file "jabber.el")'
lint-check-declare:
for file in elisp/*.el ; do \
emacs -q -Q --batch --eval="(check-declare-file \"$$file\")" ; \
done

lint-checkdoc: tangle
emacs -q -Q --batch --eval='(checkdoc-file "jabber.el")'
lint-checkdoc:
for file in elisp/*.el ; do \
emacs -q -Q --batch --eval="(checkdoc-file \"$$file\")" ; \
done

lint-package-lint: tangle
emacs -Q --batch --eval='(package-initialize)' \
--eval="(require 'package-lint)" \
-f 'package-lint-batch-and-exit' jabber.el
lint-package-lint:
emacs -Q --batch \
--eval='(package-initialize)' --eval="(require 'package-lint)" \
-f 'package-lint-batch-and-exit' $(wildcard elisp/*.el)

lint-relint: tangle
emacs -q -Q --batch --eval="(progn (package-initialize) (relint-file \"jabber.el\"))"
lint-relint:
emacs -Q --batch \
--eval='(package-initialize)' --eval="(require 'relint)" \
-f 'relint-batch' "elisp"

lint: lint-check-declare lint-checkdoc lint-package-lint lint-relint

clean-tangle:
-rm jabber.el

clean-elc:
-rm *.elc
-rm elisp/*.elc

clean: clean-elc
40 changes: 11 additions & 29 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Old resources
3. Use of the deprecated =cl= library is almost completely replaced with =cl-lib=
4. Build system changed from Autotools to a =Makefile=
5. Lots of cleanup by addressing =checkdoc= and byte-compiler warnings - addition/improvement of docstrings, function/variable declarations, etc
6. Converted to [[#literate-program][an Org literate program]]

** Requirements
:PROPERTIES:
Expand Down Expand Up @@ -100,30 +99,6 @@ This release of jabber.el contains support for file transfer. You may need to c
:END:
It is possible to make various web browsers pass links starting with "xmpp:" to jabber.el. In the ideal case, this works right after running "make install". Otherwise, see the manual, section "XMPP URIs".

** Literate program
:PROPERTIES:
:CUSTOM_ID: literate-program
:END:
jabber.el is a literate program made using Org. Thanks to [[https://github.com/melpa/melpa/issues/7408][package.el limitations]], we check in the tangled sources to Git. The tangled sources are what Emacs knows how to load.

Alternatively, it is possible to use =literate-elisp-load-file= from [[https://github.com/jingtaozf/literate-elisp][literate-elisp]] to directly load this Org literate program. This way, links to the source (e.g. =xref=, =describe-*= buffers, byte-compilation messages) take the user directly to the Org file rather than to the tangled source.

If a source block does not have syntax highlighting, press =M-o M-o= (=font-lock-fontify-block=) in it.

*** TODO literate/organizational tasks [37%]
:PROPERTIES:
:CUSTOM_ID: literate-organizational-tasks
:END:
1. [ ] (maybe) make dependencies optional and tangle them to separate files, reducing load time for users.
2. [ ] contemplate [[https://github.com/melpa/melpa/issues/7408][distribution strategies]]
3. [X] make headings for remaining definitions - some FSM-related definitions remain.
4. [ ] move tests to this file (probably migrate them to =ert= or =buttercup= first), in sub-headings of their concerned components.
5. [ ] move dependencies to the Dependencies heading; also make library headers for them
6. [X] move per-file author information and copyright notice here, and delete the empty .el files
* But it will cease to remain applicable as soon as we move anything around...
7. [ ] "Code" has a lot of direct sub-headings, making it somewhat cumbersome to navigate; someone with a better understanding of the program could organize these better
8. [X] The tangled file currently does not list all the other authors (currently listed in =:COPYRIGHT:= drawers). We could add them all at once in the library headers section...or something else. 🤔

** Debugging tips
:PROPERTIES:
:CUSTOM_ID: debugging-tips
Expand Down Expand Up @@ -225,6 +200,16 @@ The following is a brief summary about the stanza processing.
5. Call all of their functions with the jabber connection and XML data as parameters .
6. Continue in the same state.

** HTTP Upload
[[file:elisp/jabber-httpupload.el][elisp/jabber-httpupload.el]] implements the HTTP Upload [[https://xmpp.org/extensions/xep-0363.html][XEP-0363]] extension, providing a way to send files (images, audio, etc) through XMPP clients by using server space and the HTTP protocol to upload and download from it. The advantage is that the sender user does not need to be connected after sharing the file, and the receiver may be disconnected while the sender is uploading.

The procedure to send a file is as follows -

1. Use Disco queries to discover if the server supports the HTTP Upload (~urn:xmpp:http:upload~ namespace).
2. Request a slot to the upload Disco item. The server will answer with a GET and PUT URL.
3. Upload the file to the HTTP server by using the PUT URL.
4. Usually, send the GET URL to the other XMPP clients to allow them to access the uploaded file.

* Tutorials
:PROPERTIES:
:CUSTOM_ID: tutorials
Expand Down Expand Up @@ -290,7 +275,7 @@ To install the Info documentation, copy =jabber.info= to =/usr/local/info= and r
2. Optionally, evaluate the following to install additional development tools (requires MELPA to be set up as package source) -
#+BEGIN_SRC emacs-lisp :tangle no
(mapcar #'package-install
'(indent-lint package-lint relint nameless literate-elisp))
'(indent-lint package-lint relint nameless))
#+END_SRC

3. Make your edits to =jabber.org= (not =jabber.el=), and save. Then, tangle the file -
Expand All @@ -301,14 +286,11 @@ To install the Info documentation, copy =jabber.info= to =/usr/local/info= and r
#+BEGIN_SRC
M-x compile RET ORG_PATH=/path/to/org/source/lisp/ make -Bk RET
#+END_SRC
+ If you don't like working with literate programs, just edit =jabber.el= and we'll incorporate your PR into =jabber.org=.

This tangles the literate program and byte compiles the tangled sources. Try to address any byte compilation errors.

You can also run =make dev= to tangle, compile, and run linters in one go, and address their output.

Stage the changes you made to =jabber.org=, as well as any changes the tangling process made to =jabber.el=.

Try to follow [[https://cbea.ms/git-commit/#seven-rules][the seven rules of a great Git commit message]] in your commits.

4. Update the documentation.
Expand Down
Loading

0 comments on commit bccb9d9

Please sign in to comment.