Posts

Emacs: Binary File Viewer

Image
  Quick visualization tool for Binary data using C header definition. Semantic parses the C header file and generates a type definition. The type definition is passed to bindat-unpack along with the binary data. The result is displayed using speedbar . ;; Note: The command works on the binary data in the current buffer.   M-x hexl-form   (hexl-form)      The image shows the example included in the commentary section of bindat.el .   Conversions (format "%02X" 255) ;; => "FF" (string-to-number "FF" 16) ;; => 255   ;; Little endian unpacking (let* ((bindat-raw [1 2 3 4 5 6 7 8])           (bindat-idx 0))   (bindat--unpack-u64r))   ;; Little endian packing (let* ((bindat-raw [0 0 0 0 0 0 0 0])           (bindat-idx 0))   (bindat--pack-u64r #x0102030405060708)   bindat-raw)      Insert Binary Data Emacs creates a multibyte buffer ...

CEDET: Across the Language Barrier

Image
Emacs at its core is a Lisp interpreter written in C. If you are an Emacs developer, this means you often need to jump between C and Lisp programming languages. CEDET is capable of maintaining project-wide tag database and hence allows the user to seamlessly jump across the definitions in either C or Lisp.    Demo: Jump to definition across Lisp and C (including pre-processor) using CEDET . Note: Emacs provides necessary tools to make development easier.  find-function will also do the job. However, this article is about CEDET. Another useful application is when you are editing an HTML which usually entails editing HTML, CSS and JS. Setup instructions are here: https://lifeofpenguin.blogspot.com/2021/04/gnu-emacs-as-lightweight-ide.html

Emacs Font is wider

Emacs Font is wider than other applications. Most people don't notice the difference. If you can perceive it, you are not hallucinating. This can be attributed to the following: Points per inch #ifndef HAVE_ANDROID /* Number of pt per inch (from the TeXbook).  */ #define PT_PER_INCH 72.27 #else /* Android uses this value instead to compensate for different device    dimensions.  */ #define PT_PER_INCH 160.00 #endif    Emacs definition is larger than the standard definition . The DTP point is defined as 1⁄72 of an inch.  Round-off error Emacs definition : /* Return a pixel size (integer) corresponding to POINT size (double)    on resolution DPI.  */ #define POINT_TO_PIXEL(POINT, DPI) ((POINT) * (DPI) / PT_PER_INCH + 0.5) /* Return a point size corresponding to POINT size (integer)    on resolution DPI.  Note that though point size is a double, we expect    it to be rounded to an int, so we add 0.5 here.  If ...

Emacs: A non-intrusive browser

Image
  Web is simple. Browser can be simpler.     Features No pop-up ads Content first (CSS and images are loaded asynchronously) No beacon or marketing pixel ( zero pixel) image tracking Split panes Fully customizable (custom theme using CSS) Fully extensible (write your plugins/extensions) Easy cookie mangement   The technical details are here .  

HTML Renderer (Emacs)

Image
  Emacs: A non-intrusive browser An Elisp implementation of HTML rendering using SVG. The browser functionality is an extension of eww . For Javascript, you can use either NodeJS or QuickJS as a JS interpreter . Developer Note: The entry point is shr-render.   Table Colspan example Rowspan example Sample Table <html>   <body>     <table border="1">       <tr bgcolor="#9acd32">         <th style="text-align:left">Title</th>         <th style="text-align:left">Artist</th>       </tr>       <tr>         <td>Empire Burlesque</td>         <td>Bob Dylan</td>       </tr>     </table>   </body> </html...

The Oval Editor (Emacs)

Image
   The Oval Editor is a feature which allows the user to combine text with advanced formatting and drawings seamlessly in Emacs. This is an amalgamation of several disparate features developed over a period of time . It is also available as a single package in my Emacs fork . Draw and Scribble Notes in GNU Emacs   Text inside a shape (uses librsvg fork ) Context menu   Variable fonts Faux Bold and Italics   Annotate Completion Candidates   Text wrap at fixed pixel width in edit mode (only available in my Emacs fork) Symbol selector     (require 'formula)    Use M-x formula-draw to start drawing in a buffer. Select rectangle shape by pressing r. You can use the grid lines to align the shapes. You may exit the drawing mode by pressing q. Double-click on the shape to start editing the text inside a shape. The editing area is restricted to the width of the enclosing shape. Use right-click context menu to apply formatting. The demo use...

Variable Font in Emacs

Image
Variable fonts are an evolution of the OpenType font specification that enables many different variations of a typeface to be incorporated into a single file, rather than having a separate font file for every width, weight, or style. Please note that the fonts are designed for readability. These are not simple geometric transformations. Hence, the fonts may or may not support full range of variations specified by the standards. Font weight ranges from 100 to 900 for variable fonts. For static fonts, this range is between 0 to 215. You can use FcWeightToOpenTypeDouble() for converting static font weight to variable font weight. Font width ranges from 50 to 200. This is a percentage value. For example, ultra-expanded is 200% of normal width. This is same for static font. In Emacs, use :weight and :width face attributes for setting the values. cairo_font_options_set_variations() Cairo API can be used to render these variations in Emacs. Please note that the sequence of axes - wght...