Age | Commit message (Collapse) | Author |
|
|
|
|
|
Upon running `'w3m-session-backup`, this error message would be printed:
Symbol's function definition is void: string-join
I learned that Emacs doesn't load all functions at load. In particular
for this case, the `string-join` function was in a file not loaded by
default.
Thanks to the following resources:
https://emacs.stackexchange.com/questions/22142/cannot-open-load-file-subr-x
https://github.com/ralesi/ranger.el/blob/9db73d61/ranger.el#L84
I discovered I could require the `subr-x.el` file that contains the
`string-join` function needed. Decided to keep using `string-join`
instead of `(mapconcat 'identity ...` as it reads better in my mind.
|
|
|
|
|
|
Instead of printing a generic success message, include the filename and
path of the newly saved backup file.
Extract the code that generates the file path from
`w3m-session-backup--save-backup` to a new function so it can be reused.
|
|
Provide some user confirmation of the backup action. Otherwise, you're
left in doubt about whether the command actually ran.
|
|
|
|
Now that the package is published on GitHub, use that as the URL.
|
|
|
|
|
|
|
|
|
|
Incomplete, but includes a description, and sections for usage,
customisation options, dependencies, installation instructions, and
license information.
|
|
These were reference comments I took during development and are no
longer needed.
|
|
|
|
When I renamed my functions to prepend the `w3m-session-backup` prefix,
I forgot to add it to this variable's default value. Update it to use
the correct function name.
|
|
|
|
Follow the Coding Conventions and call `provide` at the end of the
package file. This allows our code to be `require`d if so desired.
References:
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html#Coding-Conventions
- https://www.gnu.org/software/emacs/manual/html_node/elisp/Named-Features.html#Named-Features
|
|
This is the only one from `finder-by-keyword` that even remotely seemed
to relate to this package.
|
|
This is the version I currently have installed, so I'm going to use that
as the dependency. The Melpa version is apparently "20180116.135", but I
guess I'll go with this (taken from my `~/.w3m/.sessions` file).
Presumably my package also works with earlier versions, but this is just
easier than making sure myself.
|
|
Since this is a user command, autoload it to ensure it's recognised.
|
|
|
|
Fill in our TODO-ed doc strings with real descriptions.
|
|
Still need to figure out the values for the "Package-Requires",
"Keywords", and "URL" sections.
|
|
|
|
Since these are global Lisp-style functions, they need to be prefixed
for namespacing. Looks like I'm going to call this package
"w3m-session-backup" as I can't think of anything more concise and
similarly descriptive.
As per the Coding Conventions document, use a two-hyphen separator for
private functions.
> Use two hyphens to separate prefix and name if the symbol is not meant
> to be used by other packages.
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html#Coding-Conventions)
|
|
The Emacs "Coding Conventions" documentation
(https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html#Coding-Conventions)
recommends that variables that store functions be named ending in
"-function".
|
|
Allow users to customise the name of the file that gets generated and
saved with a custom function.
|
|
It's apparently recommended that packages define groups for their custom
variables. Do this, and put the `save-directory` custom variable we
defined earlier in it.
|
|
This allows us to document the variable and designate it as a
user-customisable variable.
|
|
|
|
Helps to allow us to create multiple files. If multiple sessions are
saved in the span of a minute, only the last session file for the minute
is really persisted. This extends the chances of saving separate backup
files.
|
|
Put the save directory in a variable to make it configurable. Default it
to the current directory.
Thanks to Trey Jackson for the `FILE-NAME-AS-DIRECTORY` function:
https://stackoverflow.com/questions/3964715/what-is-the-correct-way-to-join-multiple-path-components-into-a-single-complete/3964815#3964815
|
|
Generate a filename using the current date and time. Still saves to the
home directory. That's the next step, we'll need to find a way to
customise the save directory.
|
|
Ensure that special characters don't cause the YAML to be invalid by
wrapping the URL and page title in quotes to force them to be strings.
Escape any literal single quotes in the page title by doubling them.
Didn't escape single quotes in the URL because I'm assuming any present
will be URL encoded.
|
|
* Change the temp file's extension to ".yml"
* Remove blank line between pages
* Output a YAML array of hashes containing the page titles and URLs in
Copy URLs From All Tabs format
|
|
Turns out `(last page 1)` didn't actually extract the page title string
from the list previously created by `LAST`. To extract the title string
from the list, just use `FIRST` and get rid of the now seemingly
unnecessary third argument.
|
|
Ended up not using this. Wrote that when I started writing the function,
but I ended up needed something a bit more complicated with maps and
joins etc.
|
|
* Use a real path for the temporary file because otherwise it either
doesn't get saved, or I have no idea where it gets saved to.
* Use the `INSERT` function to actually write the string to the
temporary file buffer.
* Use `(last page 1)` with the `1` argument at the end now as a way to
try to get it to return us the string instead of a single-element list
containing the page title. Not sure if this works though.
|
|
Use a temporary hard-coded file.
Construct a string with each page turning into a URL and page title on
separate lines, and a blank line between pages.
Doesn't quite work just yet, but the general idea is there.
|
|
* Extract the list of crash recovery session buffers to a function to
give it a name. I'll come up with a better name later.
* Grab the first and last elements of each buffer sub-list and create
tuples from them. This gives us a list of two-element lists containing
the URL and title of the pages.
|
|
Grab the buffers saved to the "Crash recovery session" in "emacs-w3m"'s
session file. Just list them for now. We'll be using this to create a
backup file.
|